useTransactions
Hook to get the transactions of an account
Import
import { useTransactions } from '@lawallet/react';
Usage
index.tsx
import { useTransactions } from '@lawallet/react';
function App() {
const transactions = useTransactions();
}
Parameters
import { type UseTransactionsParameters } from '@lawallet/react';
pubkey
String
- Public key of the account for which you want to consult the transactions
import { useTransactions } from '@lawallet/react';
function App() {
const transactions = useTransactions({
pubkey: '17efe7a5f1...53936f68b',
});
}
since
Number | undefined
- Since when do you start listening to transactions
import { useTransactions } from '@lawallet/react';
function App() {
const transactions = useTransactions({
pubkey: '17efe7a5f1...53936f68b',
since: Math.floor(Date.now() / 1000),
});
}
until
Number | undefined
- Until when to listen to transactions
import { useTransactions } from '@lawallet/react';
function App() {
const transactions = useTransactions({
pubkey: '17efe7a5f1...53936f68b',
until: Math.floor(Date.now() / 1000),
});
}
limit
Number | undefined
- Limit of transactions to listen
- The default parameter is 1000.
import { useTransactions } from '@lawallet/react';
function App() {
const transactions = useTransactions({
pubkey: '17efe7a5f1...53936f68b',
limit: 250,
});
}
storage
Boolean | undefined
- Defines whether listened transactions are saved in storage.
- The default parameter is false.
index.tsx
import { useTransactions } from '@lawallet/react';
function App() {
const transactions = useTransactions({
pubkey: '17efe7a5f1...53936f68b',
storage: true,
});
}
enabled
Boolean | undefined
- Set this to false to disable this query from automatically running.
- The default parameter is true.
import { useTransactions } from '@lawallet/react';
function App() {
const transactions = useTransactions({
pubkey: '17efe7a5f1...53936f68b',
enabled: false,
});
}
config
Config | undefined
Config
to use instead of retrieving from the from nearest LaWalletConfig
.
import { useTransactions } from '@lawallet/react';
import { config } from './config';
function App() {
const transactions = useTransactions({
pubkey: '17efe7a5f1...53936f68b',
config,
});
}
Return Type
import { type useTransactionsReturns } from '@lawallet/react';
transactions
Returns the requested transactions in Transaction format