const snapId = `npm:@hashgraph/hedera-wallet-snap`
const getTransactionsAPI = async () => {
const externalAccountParams = {
externalAccount: {
accountIdOrEvmAddress: '0.0.12345',
curve: 'ED25519'
}
}
/*
If you want to retrieve all the transactions for your account,
transactionId can be empty
*/
const getTransactionsParams = {
transactionId: '[email protected]'
}
await window.ethereum.request({
method: 'wallet_invokeSnap',
params: {
snapId,
request: {
method: 'getTransactions',
params: {
network: 'testnet',
transactionId: getTransactionsParams.transactionId,
/*
Uncomment the below line if you want to connect
to a non-metamask account
*/
// ...externalAccountParams
}
}
}
})
}{
"currentAccount": {
"hederaAccountId": "0.0.4235873",
"hederaEvmAddress": "0x3ba201df50314e4702d4d92b52d304ee63bfca23",
"balance": {
"hbars": 0.75108133,
"timestamp": "Wed, 24 Jan 2024 21:58:32 GMT",
"tokens": {}
},
"network": "mainnet"
},
"transactions": [
{
"bytes": null,
"charged_tx_fee": 65919908,
"consensus_timestamp": "Wed, 24 Jan 2024 21:58:32 GMT",
"entity_id": null,
"max_fee": "100000000",
"memo_base64": "",
"name": "CRYPTOTRANSFER",
"nft_transfers": [],
"node": "0.0.8",
"nonce": 0,
"parent_consensus_timestamp": "",
"result": "SUCCESS",
"scheduled": false,
"staking_reward_transfers": [],
"token_transfers": [],
"transaction_hash": "lbF/gV2X5IDZBjRVdqiR+AAxKP0Kop8Z51Xt9DcNqGHgMI7PGSR1BoBCPR0aE2jz",
"transaction_id": "0.0.4235873-1706133501-928562334",
"transfers": [
{
"account": "0.0.8",
"amount": 5679,
"is_approval": false
},
{
"account": "0.0.98",
"amount": 59322807,
"is_approval": false
},
{
"account": "0.0.800",
"amount": 6591422,
"is_approval": false
},
{
"account": "0.0.4235873",
"amount": -65919918,
"is_approval": false
},
{
"account": "0.0.4551503",
"amount": 10,
"is_approval": false
}
],
"valid_duration_seconds": "120",
"valid_start_timestamp": "Wed, 24 Jan 2024 21:58:21 GMT"
}
]
}