You generated an address for a user, Then that user received transactions and you want to show all of their transactions.
The getTransactions method returns the transactions for the organization, profile, or even an address.
The getTransactions function has the following properties.
the default behavior of getTransactions is to return the transactions for the whole organization unless you specify a reference or an address.
The following example is for getting the transactions for a user by providing the reference.
You only need to initialize the client once at the start of the application
import { Oumla } from"@oumla/sdk";constclient=newOumla({ apiKey:process.env.API_KEY,// Additional options...});consttransactions=awaitclient.getTransactions({ network:"BTC",// if not specified it brings all of the transactions from all chains reference:"dba1fea5-2004-4ea8-a06d-a7c7c5559b8f"});console.log(transactions); // will fetch the transactions for that user (profile)// return type is Transaction
Another example is if you want to get all of the transactions for the organization
// Some codeimport { Oumla } from"@oumla/sdk";constclient=newOumla({ apiKey:process.env.API_KEY,// Additional options...});consttransactions=awaitclient.getTransactions();console.log(transactions); // will fetch all of the transactions for the organization // return type is Transactions[]
Another example is if you want to get all of the transactions for an address
// Some codeimport { Oumla } from"@oumla/sdk";constclient=newOumla({ apiKey:process.env.API_KEY,// Additional options...});consttransactions=awaitclient.getTransactions({ address:"tb1qmkg9mcvlt6atwp5gugvwmyc8kj3sffn728rnghcsa4jvtl2ea0ks03fwlw"});console.log(transactions); // will fetch all of the transactions for the organization // return type is Transactions[]