Skip to main content

Wallet Operations

This guide covers common workflows for managing wallets, accounts, and assets with the Paratro API.

Complete Setup Flow

A typical setup involves creating a wallet, adding accounts for each chain, and adding assets to each account.
ctx := context.Background()

// 1. Create wallet
wallet, err := client.Wallet.CreateWallet(ctx, &paratro.CreateWalletRequest{
    WalletName:  "Operations Wallet",
    Description: "Multi-chain operations",
})

// 2. Create accounts on different chains
ethAccount, _ := client.Account.CreateAccount(ctx, &paratro.CreateAccountRequest{
    WalletID: wallet.WalletID,
    Chain:    "ethereum",
    Label:    "ETH Deposits",
})

tronAccount, _ := client.Account.CreateAccount(ctx, &paratro.CreateAccountRequest{
    WalletID: wallet.WalletID,
    Chain:    "tron",
    Label:    "TRON Deposits",
})

// 3. Add assets
client.Asset.CreateAsset(ctx, &paratro.CreateAssetRequest{
    AccountID: ethAccount.AccountID,
    Symbol:    "ETH",
    Chain:     "ethereum",
})

client.Asset.CreateAsset(ctx, &paratro.CreateAssetRequest{
    AccountID: ethAccount.AccountID,
    Symbol:    "USDT",
    Chain:     "ethereum",
})

client.Asset.CreateAsset(ctx, &paratro.CreateAssetRequest{
    AccountID: tronAccount.AccountID,
    Symbol:    "USDT",
})

EVM Shared Addresses

EVM-compatible chains share the same key derivation, so creating an account on any EVM chain produces the same address. You can then add assets on different EVM chains to the same account:
// Create one EVM account
evmAccount, _ := client.Account.CreateAccount(ctx, &paratro.CreateAccountRequest{
    WalletID: wallet.WalletID,
    Chain:    "ethereum",
})

// Add USDT on different EVM chains
client.Asset.CreateAsset(ctx, &paratro.CreateAssetRequest{
    AccountID: evmAccount.AccountID,
    Symbol:    "USDT",
    Chain:     "ethereum",  // USDT on Ethereum
})

client.Asset.CreateAsset(ctx, &paratro.CreateAssetRequest{
    AccountID: evmAccount.AccountID,
    Symbol:    "USDT",
    Chain:     "bsc",       // USDT on BSC
})

Creating Transfers

Transfers use address + chain + token to automatically resolve the source asset:
transfer, err := client.Transaction.CreateTransfer(ctx, &paratro.CreateTransferRequest{
    FromAddress: evmAccount.Address,
    ToAddress:   "0xbbbb...",
    Chain:       "ethereum",
    TokenSymbol: "USDT",
    Amount:      "100.50",
    Memo:        "Vendor payment",
})

Monitoring Transactions

Check Single Transaction

tx, err := client.Transaction.GetTransaction(ctx, transfer.TxID)
fmt.Printf("Status: %s, Hash: %s\n", tx.Status, tx.TxHash)

List All Transactions

txList, err := client.Transaction.ListTransactions(ctx, &paratro.ListTransactionsRequest{
    WalletID: wallet.WalletID,
    Page:     1,
    PageSize: 50,
})

for _, tx := range txList.Items {
    fmt.Printf("%s | %s %s | %s | %s\n",
        tx.TxID, tx.Amount, tx.TokenSymbol, tx.Status, tx.Chain)
}

Checking Balances

assets, err := client.Asset.ListAssets(ctx, &paratro.ListAssetsRequest{
    AccountID: ethAccount.AccountID,
})

for _, asset := range assets.Items {
    fmt.Printf("%s: %s (locked: %s)\n",
        asset.Symbol, asset.Balance, asset.LockedBalance)
}