Transactions

Gets transactions (rewards, deposits, withdrawals etc) events for a single, managed user

๐Ÿ“˜

Check out these recipes to learn more about transactions and the SDK

getTransactionsForUser(userId: string): Get transactions for a managed user- takes filters for start and end date and type/asset

const filters= {
  startDate: '2024-01-01',
  endDate: '2024-02-01',
  type: 'stake',
  asset: 'ETH',
  page: 1,
  limit: 100
};

const userId: 'managed_user_id

const { body: transactionsResponse } = await api.managedUsers.transactions.getTransactionsForUser(userId, filters);

console.log(`
  Total Transactions: ${transactionsResponse.total}
  Number of Pages: ${transactionsResponse.pages}
  Current Page: ${transactionsResponse.currentPage}
  Transactions: ${JSON.stringify(transactionsResponse.transactions)}
`);

for (const transaction of transactionsResponse.transactions) {
  console.log(`
    Transaction ID: ${transaction.eventId}
    Transaction Type: ${transaction.eventType}
    Transaction Asset: ${transaction.asset}
    Transaction Amount: ${transaction.assetAmount}
    Transaction Date: ${transaction.eventTime}
  `);
  }