Skip to main content

Transactions

Learn how to build, sign, and submit transactions through AxonVault.

Transaction Lifecycle


Step 1: Build Transaction

Create an unsigned transaction. For embedded wallets, the SDK handles this automatically. For server wallets, use the API:
Embedded Wallets: Use the SDK method wallet.sendTransaction() which handles building, signing, and submitting automatically. See the SDK documentation.
Server Wallet API:
POST /v1/transactions/build
{
  "fromAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f8fE8d",
  "toAddress": "0x1234567890123456789012345678901234567890",
  "amount": "1000000000000000000",
  "chainReference": "eip155:1"
}
Response:
{
  "txId": "tx_abc123",
  "unsignedTxHex": "0xf86c...",
  "signHashes": ["0xabc123..."],
  "metadata": {
    "nonce": "42",
    "gasLimit": "21000",
    "gasPrice": "20000000000"
  }
}

Server API Reference

See the complete build transaction API

Transaction Types

TypeDescriptionContract Address
Native TransferETH, SOL, etc.Not required
ERC-20 TransferToken transferRequired
Contract CallSmart contractRequired

Step 2: Policy Check (Automatic)

Transactions are automatically checked against policies. If approval is required:
{
  "allowed": true,
  "requiresApproval": true,
  "approvalRequestId": "apr_abc123"
}

Step 3: Sign Transaction

Sign the transaction hash. For embedded wallets, the SDK handles this automatically.
Embedded Wallets: The SDK automatically signs transactions when you call wallet.sendTransaction(). No manual signing needed.
Server Wallet API:
POST /v1/signature/sign
{
  "chainReference": "eip155:1",
  "unsignedTxHex": "0xf86c...",
  "keyId": "key_xyz789",
  "coinType": 60,
  "accountIndex": 0
}
Response:
{
  "signature": "0x1234...",
  "digest": "0xabc123...",
  "algorithm": "secp256k1"
}

Server Signing API

See the complete signing API

Step 4: Construct Signed Transaction

Combine unsigned transaction with signature:
POST /v1/transactions/construct-signed
{
  "txId": "tx_abc123",
  "signature": "0x1234..."
}
Response:
{
  "txId": "tx_abc123",
  "signedTxHex": "0xf86c..."
}

Step 5: Submit Transaction

Broadcast to the blockchain:
POST /v1/transactions/submit
{
  "txId": "tx_abc123",
  "signedTxHex": "0xf86c..."
}
Response:
{
  "txId": "tx_abc123",
  "txHash": "0x1234567890abcdef...",
  "status": 1
}

Transaction Status

StatusCodeDescription
Pending0Built, not signed
Submitted1Broadcast, awaiting confirmation
Confirmed2Included in block
Failed3Transaction failed

Checking Status

Embedded Wallet SDK:
const tx = await wallet.getTransaction('tx_abc123');
console.log('Status:', tx.status);
Server Wallet API:
GET /v1/transactions/{txId}

API Reference

See transaction status API

Complete Examples

For embedded wallets, use the SDK which handles all steps automatically:
import { AxonVaultEmbedded } from '@axonvault/embedded-wallet-sdk';

const axonVault = new AxonVaultEmbedded({
  projectId: 'proj_abc123'
});

const wallet = await axonVault.getDefaultWallet();

// SDK handles build, sign, and submit automatically
const txHash = await wallet.sendTransaction({
  to: '0x1234567890123456789012345678901234567890',
  amount: '1000000000000000000',
  chainId: 'eip155:8453'
});

console.log('Transaction sent:', txHash);

SDK Transaction Methods

See all SDK transaction methods

Gas Estimation

Gas is automatically estimated, but you can override:
{
  "fromAddress": "0x...",
  "toAddress": "0x...",
  "amount": "1000000000000000000",
  "chainReference": "eip155:1",
  "gasLimit": "50000",
  "gasPrice": "30000000000"
}

EIP-1559 Transactions

For EIP-1559 compatible chains:
{
  "maxFeePerGas": "50000000000",
  "maxPriorityFeePerGas": "2000000000"
}

Webhooks

Get notified when transactions complete:
{
  "event": "transaction.confirmed",
  "data": {
    "txId": "tx_abc123",
    "txHash": "0x1234...",
    "status": 2,
    "blockNumber": 12345678
  }
}

Configure Webhooks

Set up transaction notifications