Get the complete list of transactions involving an account.
// replace with account address
const rawAddress = 'TCHBDE-NCLKEB-ILBPWP-3JPB2X-NY64OE-7PYHHE-32I';
const address = Address.createFromRawAddress(rawAddress);
// replace with account address
const rawAddress = 'TCHBDE-NCLKEB-ILBPWP-3JPB2X-NY64OE-7PYHHE-32I';
const address = symbol_sdk_1.Address.createFromRawAddress(rawAddress);
2. Define a new TransactionHttp
repository and the search criteria.
In this example, we will retrieve all account-related transactions with at least one confirmation, but you could also query the unconfirmed and partial collections.
// replace with node endpoint
const nodeUrl = 'http://api-01.us-east-1.096x.symboldev.network:3000';
const repositoryFactory = new RepositoryFactoryHttp(nodeUrl);
const transactionHttp = repositoryFactory.createTransactionRepository();
const searchCriteria = {group: TransactionGroup.Confirmed, address, pageNumber: 1, pageSize: 100};
transactionHttp
.search(searchCriteria)
.subscribe((page) => console.log(page.data),
(err) => console.error(err));
// replace with node endpoint
const nodeUrl = 'http://api-01.us-east-1.096x.symboldev.network:3000';
const repositoryFactory = new symbol_sdk_1.RepositoryFactoryHttp(nodeUrl);
const transactionHttp = repositoryFactory.createTransactionRepository();
const searchCriteria = { group: symbol_sdk_1.TransactionGroup.Confirmed, address, pageNumber: 1, pageSize: 100 };
transactionHttp
.search(searchCriteria)
.subscribe((page) => console.log(page.data), (err) => console.error(err));
3. The API returns pages with up to 100 transactions. The page object contains meta information about the total amount of transactions and pages available.
To get additional transactions, you will have to make further requests iteratively.
For each additional call, increase the pageNumber
by one unit.
const searchCriteria = {group: TransactionGroup.Confirmed, address, pageNumber: 2, pageSize: 100};
4. Since the transaction collection might grow while paginating, it’s advised to set the first transaction you want to start pagination.
Set an offset
value with the first transaction internal identifier.
const searchCriteria = {group: TransactionGroup.Confirmed, address, pageNumber: 2, pageSize: 100, id:85BBEA6CC462B244};
Open a terminal window and run the following command to get the confirmed transactions involving an account.
symbol-cli transaction search --address TCHBDE-NCLKEB-ILBPWP-3JPB2X-NY64OE-7PYHHE-32I
Did you find what you were looking for? Give us your feedback.