Payments
Sell a Specific Amount of Tokens
You can create a payment with either the input amount (sell) or output amount (buy) of a token. Most examples focus on buying a specific amount, but you can just as easily sell a specific amount of tokens.
To generate a sale, use the same inputs as Buy.prepare
, but with the Sell.prepare
function. The following function will sell 50 USDT on Arbitrum. The returned destinationAmount
will indicate how much USDC on Optimism you'll receive after fees.
You can execute this quote exactly like a buy. See the Send a Payment guide for more details on this process.
To connect with other auth strategies, use external wallets, or sponsor gas for users, check out the following guides: