Get Transactions

Once an application is connected to Martian wallet via connect method, an app can fetch a transactions using window.martian.getTransactions()and it will return a Promise that resolves when the request is successful and reject (throw when awaited) when the request is not valid/fails. It takes one optional parameter listed below

  • query?: {start?: number, limit?: number}

    • query.start The start transaction version of the page. Default is the latest ledger version

    • query.limit The max number of transactions should be returned for the page. Default is 25

Below is an example code describing the way to fetch a transaction.

// Fetch blockchain transactions
const transactions = await window.martian.getTransactions()
// above code output
// https://fullnode.devnet.aptoslabs.com/transactions
[
    {
        "type": "state_checkpoint_transaction",
        "version": "3801259",
        "hash": "0xe1b55d299a4925dc15cca45853c1c7ce69ad450006a1c0e183aaa6b227b3a3ab",
        "state_root_hash": "0x361b522c30b531419053ccf47049c3792f1a50b8e3fb6ad3f855c2b9289912c0",
        "event_root_hash": "0x414343554d554c41544f525f504c414345484f4c4445525f4841534800000000",
        "gas_used": "0",
        "success": true,
        "vm_status": "Executed successfully",
        "accumulator_root_hash": "0xac7e0e8abc93d9287ba2145f596f25a80b6a0daa78eeb2a201a5d30cc16c13d5",
        "changes": [],
        "timestamp": "1658817506725410"
    },
    ...
]

Last updated