Create Swap Transaction
Creates an unsigned transaction for the best possible swap through the specified tokens provided by Pump.fun.
This endpoint does not submit the transaction to the network.
The endpoint allows you to specify priority fees and tips to later control the transaction inclusion and propagation. Refer to the Transaction Submission & Front-Running Protection & Transaction Bundle page for additional information about these parameters.
Request
Method:
POST ./api/v2/pumpfun/swap
Parameters:
Parameter | Type | Description |
---|---|---|
| string | Solana address which is placing swap. |
| string | Bonding Curve program address. |
| string | Token address. |
| double | The amount of token users expected to swap. |
| double | The amount of SOL to determine if executing the transaction will be failed or not. When it is a buy token transaction, this is the maximum SOL users will spend. When it is a sell token transaction, this is the minimum SOL users will receive. |
| boolean | Specify if this is a buy or sell transaction. |
| uint64 | OPTIONAL. Specifies total compute limit to be allocated for all instructions within the created tx |
| uint64 | OPTIONAL. Specifies compute price in Lamport (0.000001 SOL = 1,000 Lamport) to be included as a part of instruction, known as priority fee. |
| unit64 |
Request example:
Response:
Fields:
Field | Type | Description |
---|---|---|
|
| See |
TransactionMessage
Parameter | Description | |
---|---|---|
| string | Raw bytes of signed transaction (should be in base64) |
Example:
Last updated