POST /sdk/v1/solana/build-tx
Build Solana Transaction
Build a transaction for Solana → EVM transfers. The transaction must be signed by the user's wallet and submitted via /sdk/v1/solana/submit.
Request
to string Required
Destination chain code: ETH, BASE, ARB, POLYGON
amount string Required
Amount in USDC
from_wallet string Required
Sender's Solana wallet address
recipient string Required
Recipient's EVM address
speed string
Transfer speed: fast or standard
Response
intent_id string
Transfer intent ID (use when submitting)
transaction string
Base64-encoded Solana transaction
fee object
Fee breakdown
expires_at string
Transaction expiration time (ISO 8601)
message string
Human-readable message
Example
bash · curl
curl -X POST https://api.sw4p.io/sdk/v1/solana/build-tx \
-H "Content-Type: application/json" \
-H "X-API-Key: sk_..." \
-d '{
"to": "BASE",
"amount": "100.00",
"from_wallet": "5abc123...",
"recipient": "0x..."
}'
json · Response
{
"intent_id": "int_xyz789",
"transaction": "AQAAAA...",
"fee": {
"total": "2.50",
"platform": "1.00",
"gas": "1.50"
},
"expires_at": "2024-01-01T00:05:00Z",
"message": "Transfer 100 USDC from Solana to Base"
}
Next Step
After building, sign the transaction and submit it:
typescript
// 1. Decode and sign
const tx = Transaction.from(Buffer.from(response.transaction, 'base64'))
const signed = await wallet.signTransaction(tx)
// 2. Submit
await fetch('https://api.sw4p.io/sdk/v1/solana/submit', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-API-Key': apiKey },
body: JSON.stringify({
intent_id: response.intent_id,
signed_transaction: Buffer.from(signed.serialize()).toString('base64')
})
})