πHistory
The History class from @holdstation/worldchain-sdk enables fetching transaction histories (such as sends, receives, swaps) associated with a wallet on WorldChain.
Installation
npm install @holdstation/worldchain-sdk ethersSetup
import * as sdk from "@holdstation/worldchain-sdk";
import { ethers } from "ethers";
const provider = new ethers.providers.JsonRpcProvider("<YOUR_RPC_URL>");
const managerHistory = new sdk.Manager(provider, 480); // 480 is WorldChain chainIdOverall Flow
Call
managerHistory.watch(address, callback).When new activity is detected, trigger refetch.
Call
walletHistory.find(offset, limit)to retrieve latest transactions.
π Full Example on GitHub
You can view a full working example here:
Watch Real-time Transaction Updates
π Parameters
address
string
β Yes
Wallet address to monitor.
callback
function
β Yes
Function triggered when new activity is detected.
βΉοΈ Notes:
watch(address, callback)returns a{ start, stop }object.You must call
start()to begin monitoring.Always call
stop()to properly clean up when the component unmounts.
π Usage Example
Fetch Stored Transaction History
π Parameters
offset
number
β Yes
Starting index for fetching transactions.
limit
number
β Yes
Maximum number of transactions to fetch.
π Usage Example
Last updated