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.
property
description
required
type
network
specify which blockchain
optional
networkType
reference
specify which user
optional
string
address
specify which address
optional
string
the default behavior of Getting Transactions is to return the transactions for the whole organization unless you specify a reference or an address.
You only need to initialize the client once at the start of the application.
For Example,
Get Transactions by Reference
import { Oumla } from"@oumla/sdk";constclient=newOumla({ apiKey:process.env.API_KEY,// Additional options...});consttransactions=awaitclient.transactions.get({ 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
Get Transactions by address
import { Oumla } from"@oumla/sdk";constclient=newOumla({ apiKey:process.env.API_KEY,// Additional options...});consttransactions=awaitclient.transactions.get({ address:"tb1qmkg9mcvlt6atwp5gugvwmyc8kj3sffn728rnghcsa4jvtl2ea0ks03fwlw"});console.log(transactions); // will fetch all of the transactions for the organization // return type is Transactions[]
Get Transactions for the organization
import { Oumla } from"@oumla/sdk";constclient=newOumla({ apiKey:process.env.API_KEY,// Additional options...});consttransactions=awaitclient.transactions.get();console.log(transactions); // will fetch all of the transactions for the organization // return type is Transactions[]