Buy / Sell Quotes
Last updated
Last updated
We use the term clubs and tokens interchangeably. We will migrate to using tokens in the future.
If a user wishes to buy $100 (USDC) of a given token, the client can use this API to show the amountOut
of tokens the user will receive.
clubId
string
true
club.clubId
tokenAddress
0x${string}
true
club.tokenAddress
senderAddress
0x${string}
true
sender account
amountIn
string
true
USDC amount to spend (in decimals)
clientAddress
0x${string}
false
the client to receive a fee
referralAddress
0x${string}
false
the referrer to receive a fee
recipientAddress
0x${string}
false
the recipient of tokens (if not the senderAddress)
The response object contains the following params
to
The BonsaiLaunchpad contract address to send the buy transaction to
amountOut
The amount of tokens (in wei) the user will receive
maxAmountIn
The maximum amount of USDC the user will spend (with 5% slippage)
rawData
Prepared transaction data to send to the BonsaiLaunchpad
This param will be null
if the transaction would revert, which means the senderAddress
either has no funds or has not approved the swap beforehand.
If a user wishes to sell their tokens, the client can use this API to show the amountOut
of tokens the user will receive.
clubId
string
true
club.clubId
senderAddress
0x${string}
true
sender account
amountIn
string
true
token amount to spend (in decimals)
clientAddress
0x${string}
false
the client to receive a fee
The response object contains the following params
to
The BonsaiLaunchpad contract address to send the sell transaction to
amountOut
The amount of USDC (in wei) the user will receive
minAmountOut
The minimum amount of USDC the user will receive (with 5% slippage)
rawData
Prepared transaction data to send to the BonsaiLaunchpad
This param will be null
if the transaction would revert, which means the senderAddress
either has no tokens or has not approved the swap beforehand.