Chainworks
Documentation

SVM Transactions

Build unsigned transactions for token swaps.

Get Buy Transaction

Build an unsigned transaction for buying tokens.

Endpoint: /svm/buy/transaction

ParameterTypeRequiredDescription
chainstringYes

Always sol

tokenstringYesToken mint address
swapModestringYes

ExactIn or ExactOut

amountInstringYesAmount of SOL in lamports
walletstringYesWallet public key
slippageBpsnumberNoSlippage tolerance (default: 100 = 1%)
feeBpsnumberNoFee in basis points (0-175)
feeRecipientstringNoWallet to receive fees
sendRoutestringNo

Public, PublicWithNonce, Antimev, or AntimevWithNonce

prioFeesstringNoPriority fees (see below)
bribeFeesstringBased on sendRoutebribe fees (see below)
nonceAccountstringBased on sendRouteNonce account for transaction exclusivity
poolstringNo

When supplied, this parameter restricts quoting to the specified pool, subject to liquidity and compatibility requirements.

Example:

typescript
socket.emit("/svm/buy/transaction", {
  chain: "sol",
  token: "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
  swapMode: "ExactIn",
  amountIn: "1000000000",
  wallet: "YourSolanaWalletPublicKey",
  slippageBps: 100,
  prioFees: "100000",
  pool: "PoolAddress", // Optional: specific pool address
});

Get Sell Transaction

Endpoint: /svm/sell/transaction

Same parameters as buy transaction.