Holdstation Docs
  • πŸ‘‹Welcome
  • Overview
    • πŸ’‘Introduction
      • πŸ†Achievements
      • πŸ‘“Future Direction
      • πŸ’₯Product Suite
      • ⛓️Chain Support
      • 🀝Team
      • πŸ—ΊοΈRoadmap
      • πŸ”Audit
    • πŸ«‚Product Fit Community
      • Why Product Fit Community?
      • The Unique Cultures of Blockchain Communities
      • Holdstation’s Community Focus
      • Holdstation Across Ecosystems
    • πŸ‘₯Referral Program
      • πŸ’΅USDC Reward
    • πŸ”—Link
  • Holdstation on World Chain
    • πŸ‘οΈWhy World Chain?
    • πŸͺͺSmart Wallet for Real Users
    • πŸ’ΉAION
    • πŸ₯šEggs Vault: Gamified Rewards
  • 🐻Berachain's HONEY Hub
    • ❓Why Berachain
    • 🟑berAIs.land
    • πŸ’±Holdstation DEX Aggregator
      • How to Integrate?
      • Liquidity Sources
      • Fee Structures
    • πŸ’³DeFAI Smart Wallet
      • πŸ“¦Holdstation Chest
    • πŸ’ΉBeFutures Perp
      • πŸ—οΈArchitecture
        • πŸ’‘Dynamic Price Feed (DPF)
        • πŸ’ΉFlexible Market Making (FMM)
        • πŸ”ŒLeverage
        • 🧲Margin Requirement
        • 🀫Liquidation
        • πŸ’²BeFuture Fees
        • 🏧BeFuture Vault
    • πŸš€Berastarter
      • ❓How does the Fair Subscription model work?
      • 🎯Affiliate Reward
    • 🏨Holdstation Foundation
      • πŸ‘·DAO Structure
      • πŸ‘‰How to be qualified?
    • πŸ‘¨β€πŸ’»AI Communication
  • Holdstation on Solana
    • 🟣Why Solana?
    • πŸ€–Smart Wallet for AI Trading
  • Token
    • πŸ“ˆToken Overview
      • πŸš€Tokenomics
      • πŸ“ͺToken Utility
      • πŸ”Token Migration
      • πŸ’ͺSustainable Expansion
    • πŸ“”Contract Address
    • πŸ”‘Multisig Wallet
    • πŸ—“οΈHoldstation Public Sales (Ended)
  • User Guide
    • πŸ“ͺSpot Trading
    • πŸ“ŽMargin Trading
    • πŸŒ‰Bridging
    • ⚑Vault
    • 🟣HOLD Staking
  • Integration
    • πŸ“šHoldstation/Worldchain-SDK
      • πŸ‘οΈTokens and Balances
      • ⏫Send
      • πŸ’±Swap
      • πŸŒ‰Widget
      • πŸ“–History
  • Disclaimer
    • πŸ“•Disclaimer
Powered by GitBook
On this page
  • Installation
  • Setup
  • Overall Flow
  • πŸ”— Full Example on GitHub
  • Watch Real-time Transaction Updates
  • πŸ“‘ Parameters
  • πŸ“˜ Usage Example
  • Fetch Stored Transaction History
  • πŸ“‘ Parameters
  • πŸ“˜ Usage Example
  1. Integration
  2. Holdstation/Worldchain-SDK

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 ethers

Setup

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 chainId

Overall Flow

  1. Call managerHistory.watch(address, callback).

  2. When new activity is detected, trigger refetch.

  3. 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

Name
Type
Required
Description

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

const address = "0x138021392da7fdff698a453c94bf914b5045c3a0";

useEffect(() => {
  let stopRef: any = undefined;

  const fetchTransactionHistory = async () => {
    const { start, stop } = await managerHistory.watch(address, () => {});
    stopRef = stop;
    await start();
  };

  fetchTransactionHistory()
    .then(() => setRefetch((v) => !v))
    .catch((e) => console.error("Error fetching transaction history", e));

  return () => {
    if (stopRef) {
      stopRef();
    }
  };
}, [address]);

Fetch Stored Transaction History

πŸ“‘ Parameters

Name
Type
Required
Description

offset

number

βœ… Yes

Starting index for fetching transactions.

limit

number

βœ… Yes

Maximum number of transactions to fetch.


πŸ“˜ Usage Example

useEffect(() => {
  const fetchAllTransactions = async () => {
    try {
      const offset = 0;
      const limit = 100;
      const fetchedTransactions = await walletHistory.find(offset, limit);
      console.log("fetchedTransactions:", fetchedTransactions);
    } catch (error) {
      console.error("Error fetching transactions:", error);
    }
  };

  fetchAllTransactions();
}, [address, refetch]);
PreviousWidgetNextDisclaimer

Last updated 20 days ago

πŸ“š
πŸ“–
View history.tsx example