Jump to
Ctrl
+
/

Prepare An SPL Token Transfer From Address Solana

POST
/prepare-transactions/solana/{network}/spl-tokens

Prepare an unsigned SPL token transfer from an address. Derives the sender and recipient Associated Token Accounts (creating the recipient ATA in-transaction when it does not yet exist), and returns the unsigned transaction serialized to base64 together with the recent blockhash, compute-budget settings and the estimated fee. The amount is in the token's raw base units (scaled by the mint decimals).

Path Parameters

network string Required

Represents the name of the blockchain network used; "mainnet" is the live network with actual data while the others are test networks.

Query Parameters

context string Optional

In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. context is specified by the user.

Request Body Schema application/json

context string Optional

In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. context is specified by the user.

data object Required
item object Required
fromAddress string Required

Sender's Solana wallet address (base58). Owner of the source token account; also the fee payer.

toAddress string Required

Recipient's Solana wallet address (base58). Its Associated Token Account is derived (and created in-transaction if it does not yet exist).

tokenContract string Required

The SPL token mint address (base58).

amount string Required

Amount to send, in the token's raw base units (integer string, scaled by the mint decimals).

tokenStandard string Optional

Optional token program - "TOKEN" (classic SPL, default) or "TOKEN-2022" (Token Extensions).

feeOptions object Optional

Fee configuration.

priority string Optional

Fee priority - slow, standard or fast. Selects the priority fee tier.

Response Schema

apiVersion string Required

Specifies the version of the API that incorporates this endpoint.

2024-12-12
requestId string Required

Defines the ID of the request. The requestId is generated by Crypto APIs and it's unique for every request.

601c1710034ed6d407996b30
context string Optional

In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. context is specified by the user.

yourExampleString
data object Required
item object Required
sender string Required

The sender (fee payer) wallet address.

9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
recipient string Required

The recipient wallet address.

3Nxr6Wj5tK1abRxWzAf3VvJ2SsTf1cW9y5gEwYbNb6vA
amount string Required

The transferred amount in the token's raw base units.

1000000
recentBlockhash string Required

The recent blockhash the transaction is bound to (~60s TTL).

8HWLsJviKujXjg23sm7v5aiaU9gE1QpLAasEUpCuDUBN
lastValidBlockHeight string Required

The last block height at which the blockhash is still valid.

463187603
fee object Required

The estimated transaction fee.

amount string Required

The fee amount, in the base denomination.

7000
unit string Required

The fee denomination (lamports).

lamports
computeUnitLimit string Required

The compute unit limit set on the transaction (ComputeBudget).

25000
computeUnitPrice string Required

The compute unit price in micro-lamports per compute unit (ComputeBudget).

10000
serializedTransaction string Required

The unsigned transaction, serialized to base64, ready for the signer.

AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAIEfowIh2C/3h3dzzLBfyCbgkLuUqrxMfrNiNDqLG0LBvIjV7d1+yEItK+z/ZXUvIT1uq9WzenyybmZEAeqND/kXwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwZGb+UhFzL/7K26csOb57yM5bvF9xJrLEObOkAAAABsPEd2LGZ7+weJWXmkKYJUWGEjbNW7o2rEg/TnL/pyZQMDAAUCQA0DAAMACQMQJwAAAAAAAAICAAEMAgAAAKCGAQAAAAAA
tokenContract string Required

The SPL token mint address.

EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
senderTokenAccount string Required

The sender's derived Associated Token Account (source).

H8sMJSCQxfKiFTCfDR3DUMLPwcRbM61LGFJ8N4dK3WjS
recipientTokenAccount string Required

The recipient's derived Associated Token Account (destination).

Bqmac8kQe9dHwXFkJnv5KGjJDpvXfP6E1sTdKMv2yJqL
decimals integer Required

The token mint decimals used to scale the amount.

6
tokenStandard string Required

The token program used - "TOKEN" or "TOKEN-2022".

TOKEN
recipientTokenAccountCreated boolean Required

True when the recipient's ATA did not exist and a create-ATA instruction was prepended to the transaction.

false

Credits Cost

Blockchain protocol Credits for 1 Results
Default Cost 240
Solana 240
Was this page helpful?
Yes
No
Powered by
Language
URL

{
    "apiVersion": "2024-12-12",
    "requestId": "601c1710034ed6d407996b30",
    "context": "yourExampleString",
    "data": {
        "item": {
            "sender": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
            "recipient": "3Nxr6Wj5tK1abRxWzAf3VvJ2SsTf1cW9y5gEwYbNb6vA",
            "amount": "1000000",
            "recentBlockhash": "8HWLsJviKujXjg23sm7v5aiaU9gE1QpLAasEUpCuDUBN",
            "lastValidBlockHeight": "463187603",
            "fee": {
                "amount": "7000",
                "unit": "lamports"
            },
            "computeUnitLimit": "25000",
            "computeUnitPrice": "10000",
            "serializedTransaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAIEfowIh2C/3h3dzzLBfyCbgkLuUqrxMfrNiNDqLG0LBvIjV7d1+yEItK+z/ZXUvIT1uq9WzenyybmZEAeqND/kXwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwZGb+UhFzL/7K26csOb57yM5bvF9xJrLEObOkAAAABsPEd2LGZ7+weJWXmkKYJUWGEjbNW7o2rEg/TnL/pyZQMDAAUCQA0DAAMACQMQJwAAAAAAAAICAAEMAgAAAKCGAQAAAAAA",
            "tokenContract": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
            "senderTokenAccount": "H8sMJSCQxfKiFTCfDR3DUMLPwcRbM61LGFJ8N4dK3WjS",
            "recipientTokenAccount": "Bqmac8kQe9dHwXFkJnv5KGjJDpvXfP6E1sTdKMv2yJqL",
            "decimals": 6,
            "tokenStandard": "TOKEN",
            "recipientTokenAccountCreated": false
        }
    }
}