Skip to content

Transfers and swaps ​

Smart wallet operations use the Platform API and platform user authentication. Check the wallet's chain, available balance, and amount units before submitting a transaction.

Card partners use partner card funding.

Send a native token ​

Use smartWalletSendTransaction for a native token transfer:

graphql
mutation SendFromWallet($input: SmartWalletSendTransactionInput!) {
  smartWalletSendTransaction(input: $input) {
    success
    transactionHash
    error
    structuredError {
      code
      message
      details
    }
  }
}
json
{
  "input": {
    "digitalWalletId": "42",
    "recipient": "0x0000000000000000000000000000000000000001",
    "amount": "500000000000000000"
  }
}

Replace the wallet ID and recipient with your own values. amount is a string in native token base units: for ETH, 500000000000000000 means 0.5 ETH.

For an ERC-20 transfer, encode transfer(recipient, amount) as the data field, set the request's recipient to the token contract, and use "0" for the native token amount. Convert the ERC-20 amount using that token's decimals.

Check success and the returned error fields. Record the transaction hash and track the transaction through wallet data.

Request a swap quote ​

Request a quote before executing a swap:

graphql
mutation QuoteSwap($input: SmartWalletSwapInput!) {
  smartWalletSwapQuote(input: $input) {
    success
    quote {
      quoteId
      fromAmount
      minimumToAmount
      expiry
      priceImpactPct
      amountInUsd
      amountOutUsd
      networkFeeUsd
      estimatedFillSeconds
    }
    error
    structuredError {
      code
      message
    }
  }
}

The input requires digitalWalletId, fromToken, toToken, and amount. Swap amounts use the source token's base units: for USDC with six decimals, "100000000" means 100 USDC.

Optional toChainId selects the destination chain, and recipient sends the output to another address. Without a recipient, the output returns to the wallet. Check supported tokens and chains for your deployment.

Execute a quote ​

Show the returned amounts, fees, and expiry to the user before execution. Require a non-null quoteId and request a new quote when it expires.

graphql
mutation ExecuteSwap($input: SmartWalletExecuteSwapQuoteInput!) {
  smartWalletExecuteSwapQuote(input: $input) {
    success
    transactionHash
    quoteId
    status
    error
    structuredError {
      code
      message
    }
  }
}
json
{
  "input": {
    "quoteId": 456
  }
}

A submitted status means the swap is awaiting background confirmation; executed means it has confirmed on-chain. Track the transaction before treating the output as available.

BitGo transfers ​

BitGo wallets use their provider's signing, whitelist, and approval policies. Use the Platform schema browser to inspect bitgoSendTransaction and related approval operations for the wallet's configured type.