Chainworks
Documentation

EVM Transactions

Build unsigned transactions for token swaps.


Get Buy Transaction

Build an unsigned transaction for buying tokens.

Endpoint: /evm/buy/transaction

ParameterTypeRequiredDescription
chainstringYesChain identifier
tokenstringYesToken contract address
swapModestringYes

ExactIn or ExactOut

amountInstringYesAmount of native currency in wei
walletstringYesWallet address
slippageBpsnumberNoSlippage tolerance in basis points (default: 100 = 1%)
feeBpsnumberNoFee in basis points (0-175)
feeRecipientstringNoWallet to receive fees
sendRoutestringNo

Public, Private, or Both for MEV protection

Example:

typescript
socket.emit("/evm/buy/transaction", {
  chain: "eth",
  token: "0x6982508145454Ce325dDbE47a25d4ec3d2311933",
  swapMode: "ExactIn",
  amountIn: "1000000000000000000",
  wallet: "0x10a64c6d7f12c47b7c66c5b4e20e72bc1fcd5d9e",
  slippageBps: 100,
  sendRoute: "Private",
});

Get Sell Transaction

Endpoint: /evm/sell/transaction

Same parameters as buy transaction. May require a permit for V3 pools.


Get Approve Transaction

Build a transaction to approve token spending.

Endpoint: /evm/approve/transaction

ParameterTypeRequiredDescription
chainstringYesChain identifier
tokenstringYesToken contract address
walletstringYesWallet granting approval
spenderstringYesContract address to approve