Skip to main content

Embedded Wallet SDK

The AxonVault Embedded Wallet SDK enables you to integrate non-custodial wallets directly into your consumer-facing applications. Users authenticate via social login and get instant access to blockchain functionality without managing seed phrases.

Features

Social Login

Google, Apple, and Email authentication built-in

Multiple Wallet Types

Cloud HD, Self-Custody, Import, Observer

Multi-Chain

EVM and Solana support out of the box

Non-Custodial

Users control their keys, secured by TEE

Installation

npm install @axonvault/embedded-wallet-sdk

Quick Start

import { AxonVaultEmbedded } from '@axonvault/embedded-wallet-sdk';

// Initialize SDK
const axonVault = new AxonVaultEmbedded({
  projectId: 'proj_abc123',
  environment: 'production' // or 'development'
});

// Authenticate user with social login
const user = await axonVault.authenticate({
  provider: 'google',
  idToken: googleIdToken
});

// Get or create wallet
const wallet = await axonVault.getOrCreateWallet({
  walletName: 'My Wallet',
  walletType: 'cloud-hd'
});

// Get addresses for a chain
const addresses = await wallet.getAddresses('eip155:8453');

// Send a transaction
const txHash = await wallet.sendTransaction({
  to: '0x1234...',
  amount: '1000000000000000000', // 1 ETH in wei
  chainId: 'eip155:8453'
});

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

Architecture

The SDK handles all API communication, token management, and error handling automatically.

Core Concepts

Authentication

Users authenticate via social login (Google, Apple) or email. The SDK manages JWT tokens automatically:
// Authenticate with Google
const user = await axonVault.authenticate({
  provider: 'google',
  idToken: googleIdToken
});

// SDK automatically stores and refreshes tokens
// No manual token management needed

Wallets

The SDK supports multiple wallet types:
TypeDescriptionUse Case
Cloud HDAxonVault-managed HD walletDefault for new users
Self-Custody HDUser provides mnemonicPower users
Private Key ImportImport existing keyMigration
ExternalWalletConnect integrationExisting wallet users
ObserverWatch-only addressesPortfolio tracking

Transactions

The SDK simplifies transaction building, signing, and submission:
// Simple transfer
const txHash = await wallet.sendTransaction({
  to: recipientAddress,
  amount: amountInWei,
  chainId: 'eip155:8453'
});

// ERC-20 token transfer
const txHash = await wallet.sendToken({
  tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
  to: recipientAddress,
  amount: amountInSmallestUnit,
  chainId: 'eip155:1'
});

SDK Methods


Event Listeners

The SDK provides event listeners for real-time updates:
// Listen for wallet events
axonVault.on('wallet:created', (wallet) => {
  console.log('New wallet created:', wallet);
});

// Listen for transaction events
wallet.on('transaction:pending', (tx) => {
  console.log('Transaction pending:', tx.txHash);
});

wallet.on('transaction:confirmed', (tx) => {
  console.log('Transaction confirmed:', tx.txHash);
});

wallet.on('transaction:failed', (tx) => {
  console.log('Transaction failed:', tx.error);
});

Error Handling

The SDK throws typed errors that you can catch:
import { AxonVaultError, AuthenticationError, TransactionError } from '@axonvault/embedded-wallet-sdk';

try {
  await wallet.sendTransaction({ ... });
} catch (error) {
  if (error instanceof AuthenticationError) {
    // Handle auth issues
    await axonVault.refreshAuth();
  } else if (error instanceof TransactionError) {
    // Handle transaction errors
    console.error('Transaction failed:', error.message);
  } else {
    // Handle other errors
    console.error('Error:', error);
  }
}

Next Steps