Getting Transactions
getting transactions for a user
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.
For Example,
Get Transactions by Reference
import { Oumla } from "@oumla/sdk";
const client = new Oumla({
apiKey: process.env.API_KEY,
// Additional options...
});
const transactions = await client.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";
const client = new Oumla({
apiKey: process.env.API_KEY,
// Additional options...
});
const transactions = await client.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";
const client = new Oumla({
apiKey: process.env.API_KEY,
// Additional options...
});
const transactions = await client.transactions.get();
console.log(transactions); // will fetch all of the transactions for the organization
// return type is Transactions[]
The expected output
{
data: [
{
addressFrom: '0x42645cE4Dd0B766dT5Cee483cbf54bcEa670f9b2',
addressTo: '0x48E3D685b894369Ee26E27AA7bAA60Dd8dCde95b',
amount: '50000000000000000',
date: '2024-08-28T18:01:50.760Z',
isMempool: true,
isSpent: false,
status: 'Confirmed',
updatedAt: '2024-08-28T18:01:50.762Z',
createdAt: '2024-08-28T18:01:50.762Z',
type: 'Deposit',
network: 'ETH',
txid: '0xf85198eb2erp2c532bb7bc9143ea18f0cc812dc3b0605dc6c90afc486bd1bf8b'
},
// and the other transactions ...
],
pagination: { totalElements: 1, totalPages: 1, skip: 0, take: 10 },
}
{
data: [
{
addressFrom: '0x42645cE4Dd0B766dT5Cee483cbf54bcEa670f9b2',
addressTo: '0x48E3D685b894369Ee26E27AA7bAA60Dd8dCde95b',
amount: '50000000000000000',
date: '2024-08-28T18:01:50.760Z',
isMempool: true,
isSpent: false,
status: 'Pending',
updatedAt: '2024-08-28T18:01:50.762Z',
createdAt: '2024-08-28T18:01:50.762Z',
type: 'Deposit',
network: 'tETH',
txid: '0xf85198eb2erp2c532bb7bc9143ea18f0cc812dc3b0605dc6c90afc486bd1bf8b'
}
],
pagination: { totalElements: 1, totalPages: 1, skip: 0, take: 10 },
}
/** AFTER FEW MOMENT**/
{
data: [
{
addressFrom: '0x42645cE4Dd0B766dT5Cee483cbf54bcEa670f9b2',
addressTo: '0x48E3D685b894369Ee26E27AA7bAA60Dd8dCde95b',
amount: '50000000000000000',
date: '2024-08-28T18:01:50.760Z',
isMempool: true,
isSpent: false,
status: 'Confirmed',
updatedAt: '2024-08-28T18:01:50.762Z',
createdAt: '2024-08-28T18:01:50.762Z',
type: 'Deposit',
network: 'tETH',
txid: '0xf85198eb2erp2c532bb7bc9143ea18f0cc812dc3b0605dc6c90afc486bd1bf8b'
}
],
pagination: { totalElements: 1, totalPages: 1, skip: 0, take: 10 },
}
Last updated