Transactions Module
Track transaction history and status
Transactions Module
The transactions module provides functionality for querying transaction history and checking transaction status.
Import
import {
getWalletTransactions,
getTransactionStatus,
prepareTransaction,
submitTransaction,
transactionPreview,
feeEstimate,
networkFeeInfo,
exportTransactions,
sendRawPasskeyTransaction
} from 'cilantro-sdk/transactions';
Operations
getWalletTransactions(walletId, options?)
Get transaction history for a wallet.
pagenumberPage number (default: 1)
limitnumberNumber of transactions per page (default: 20)
typestringFilter by type (transfer, mint, burn, etc.)
statusstringFilter by status (pending, confirmed, failed)
const transactions = await getWalletTransactions('wallet-id', {
page: 1,
limit: 20,
type: 'transfer', // Optional
status: 'confirmed' // Optional
});
getTransactionStatus(signature)
Get transaction status by Solana signature.
signaturestringrequiredSolana transaction signature (base58 encoded)
const status = await getTransactionStatus('transaction-signature-here');
console.log('Transaction status:', status.data.status);
console.log('Confirmations:', status.data.confirmations);
prepareTransaction(walletId, options)
Prepare an unsigned transaction for client-side signing. Returns serialized transaction that can be signed by external wallet, passkey, or email/phone signer.
type'SEND_SOL' | 'SEND_SPL' | 'EXECUTE_INSTRUCTION'requiredTransaction type
signerPubkeystringrequiredPublic key of the signer (base64 encoded)
sendSolParamsobjectParameters for SOL transfer
sendSplParamsobjectParameters for SPL token transfer
executeInstructionParamsobjectParameters for custom instruction
const prepared = await prepareTransaction('wallet-id', {
type: 'SEND_SOL',
signerPubkey: 'base64-encoded-signer-public-key',
sendSolParams: {
recipientAddress: 'DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK',
amountLamports: 1000000000
}
});
// Returns: { serializedTransaction: "base64...", requiresSignature: true }
submitTransaction(walletId, options)
Submit a client-signed transaction to the Solana blockchain. Use after preparing transaction with prepareTransaction and signing it with your signer.
signedTransactionstringrequiredBase64 encoded signed transaction
const result = await submitTransaction('wallet-id', {
signedTransaction: 'base64-encoded-signed-transaction'
});
console.log('Transaction signature:', result.data.signature);
transactionPreview(walletId, options)
Get a detailed preview of a transaction including fee estimation, balance impact, and risk assessment before actually sending it.
type'SEND_SOL' | 'SEND_SPL' | 'EXECUTE_INSTRUCTION'requiredTransaction type
sendSolParamsobjectParameters for SOL transfer
sendSplParamsobjectParameters for SPL token transfer
executeInstructionParamsobjectParameters for custom instruction
const preview = await transactionPreview('wallet-id', {
type: 'SEND_SOL',
sendSolParams: {
recipientAddress: 'DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK',
amountLamports: 1000000000
}
});
console.log('Estimated fee:', preview.data.estimatedFee);
console.log('Balance after:', preview.data.balanceAfter);
console.log('Risk level:', preview.data.riskLevel);
feeEstimate(options)
Get fee estimation for different transaction types. Supports SOL transfers, SPL token transfers, and complex transactions. Includes priority fee recommendations and network status.
type'SOL_TRANSFER' | 'SPL_TOKEN_TRANSFER' | 'NFT_MINT' | 'TOKEN_MINT' | 'COMPLEX'Transaction type
fromAddressstringFrom address (required for SOL/SPL transfers)
toAddressstringTo address (required for SOL/SPL transfers)
amountnumberAmount in SOL (for SOL transfers)
mintAddressstringToken mint address (for SPL token transfers)
includePrioritybooleanInclude priority fee recommendation (default: true)
// Estimate SOL transfer fee
const estimate = await feeEstimate({
type: 'SOL_TRANSFER',
fromAddress: 'wallet-address',
toAddress: 'recipient-address',
amount: 1.0,
includePriority: true
});
console.log('Base fee:', estimate.data.baseFee);
console.log('Priority fee:', estimate.data.priorityFee);
console.log('Total fee:', estimate.data.totalFee);
networkFeeInfo()
Retrieve current network fee information including base fees, recent priority fees, and network congestion status.
const feeInfo = await networkFeeInfo();
console.log('Base fee:', feeInfo.data.baseFee);
console.log('Network congestion:', feeInfo.data.congestionLevel);
console.log('Recommended priority fee:', feeInfo.data.recommendedPriorityFee);
exportTransactions(walletId, options)
Export wallet transactions in CSV or JSON format. Supports filtering by date range, type, and status. Useful for accounting and tax reporting.
format'CSV' | 'JSON'requiredExport format
fromDatestringFilter transactions from this date (ISO 8601 format)
toDatestringFilter transactions until this date (ISO 8601 format)
typestringFilter by transaction type
statusstringFilter by transaction status
// Export transactions as CSV
const csvExport = await exportTransactions('wallet-id', {
format: 'CSV',
fromDate: '2024-01-01T00:00:00Z',
toDate: '2024-12-31T23:59:59Z',
type: 'transfer'
});
// Export transactions as JSON
const jsonExport = await exportTransactions('wallet-id', {
format: 'JSON',
status: 'confirmed'
});
sendRawPasskeyTransaction(options)
Send a transaction with passkey signature. Submit a base64-encoded transaction containing the instruction(s) to execute. Backend extracts the instruction(s), builds a smart wallet executeInstructionNonCustodial transaction with passkey signature verification, and submits to Solana.
walletIdstringrequiredWallet ID
transactionstringrequiredBase64 encoded transaction
passkeySignaturestringrequiredPasskey signature for authentication
const result = await sendRawPasskeyTransaction({
walletId: 'wallet-id',
transaction: 'base64-encoded-transaction',
passkeySignature: 'passkey-signature'
});
console.log('Transaction signature:', result.data.signature);
Advanced Filtering
Date Range Filtering
// Get transactions from last 30 days
const thirtyDaysAgo = new Date();
thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
const transactions = await getWalletTransactions('wallet-id', {
fromDate: thirtyDaysAgo.toISOString(),
toDate: new Date().toISOString(),
page: 1,
limit: 50
});
Transaction Type Filtering
// Get only SOL transfers
const solTransfers = await getWalletTransactions('wallet-id', {
type: 'SEND_SOL',
status: 'confirmed'
});
// Get only SPL token transfers
const tokenTransfers = await getWalletTransactions('wallet-id', {
type: 'SEND_SPL',
status: 'confirmed'
});