Jesse
April 23, 2022, 1:01pm
1
I’m wanting to add transaction history to users’ wallets and of course to do that, i need the wallet to have access to the relevant data (source of Tx, time stamp, etc…) how does the NNS canister go about retrieving that necessary data from the ledger canister? Specifically as it relates to canisters retrieving that data when they are the recipient of an income transfer.
A link to an example would be appreciated.
1 Like
Looking for something similar in case somebody has an example.
Jesse
May 3, 2022, 10:02am
3
@Dustin this thread offers a bit more insight:
query_blocks for the ICP ledger canister works. It even gives you an index for archive canisters if the record is too old.
Looks like this was added to the repo March 3rd. No idea when it went live on mainnet, but it is there now.
DFINITY folks, you’ve got to shout this kind of stuff from the rooftops. This feature drastically reduces complexity and basically enables all kinds of new functionality. THANK YOU!!!
If I missed the announcement for this please point me to it, I don’t want to mis…
1 Like
In case anyone is also looking for getting the transaction history in Typescript, here’s an example of how to do it using the Rosetta API.
/* eslint-disable camelcase */
/* eslint-disable @typescript-eslint/camelcase */
import fetch from 'cross-fetch';
import { TOKENS } from '../../../constants/tokens';
import { ERRORS } from '../../../errors';
import { NET_ID, ROSETTA_URL } from '../constants';
import { InferredTransaction, GetTransactionsResponse } from '../../../interfaces/transactions';
export const MILI_PER_SECOND = 1000000;
interface Operation {
account: {
address: string;
};
amount: {
value: string;
currency: {
symbol: string;
decimals: number;
This file has been truncated. show original
2 Likes