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
  • Send Token
  • πŸ“‘ Parameters
  • πŸ“˜ Usage Examples
  • πŸ”Ή Send Native Token (e.g., ETH)
  • πŸ”Ή Send ERC20 Token
  • ⚠️ Typical Error Cases
  1. Integration
  2. Holdstation/Worldchain-SDK

Send

The Sender class from @holdstation/worldchain-sdk allows developers to send native tokens (e.g., ETH) or ERC20 tokens on WorldChain easily.


Installation

npm install @holdstation/worldchain-sdk ethers

Setup

import { ethers } from "ethers";
import { Sender } from "@holdstation/worldchain-sdk";

const provider = new ethers.providers.StaticJsonRpcProvider("<YOUR_RPC_URL>", {
  chainId: 480,
  name: "worldchain",
});
const sender = new Sender(provider);

Send Token

πŸ“‘ Parameters


Name
Type
Required
Description

to

string

βœ… Yes

Recipient wallet address.

amount

number

βœ… Yes

Amount to send (expressed in normal units, not wei).

token

string

❌ Optional

ERC20 token contract address. If omitted, sends native token (e.g., ETH).


ℹ️ Notes:

  • If token is omitted, the SDK will send native tokens like ETH.

  • If token is provided, the SDK will send ERC20 tokens.

  • amount should be entered as a human-readable number (e.g., 0.1 ETH, 10 Tokens).

  • The conversion to correct base units is handled internally.


πŸ“˜ Usage Examples


πŸ”Ή Send Native Token (e.g., ETH)

import { ethers } from "ethers";
import { Sender } from "@holdstation/worldchain-sdk";

const provider = new ethers.providers.StaticJsonRpcProvider("<YOUR_RPC_URL>", {
  chainId: 480,
  name: "worldchain",
});
const sender = new Sender(provider);
const amount = 0.1; // 0.1 ETH
const receiver = "0xAddress";
const result = await sender.send({ amount, to: receiver });
console.log("result:", result);

πŸ”Ή Send ERC20 Token

const tokenAddress = "0xTokenAddress";
const amount = 10; // 10 Tokens
const receiver = "0xAddress";
const result = await sender.send({ amount, token: tokenAddress, to: receiver });

⚠️ Typical Error Cases

Error
Possible Cause
How to Fix

insufficient funds

Wallet does not have enough native token to pay for gas or the transfer amount.

Ensure the sender wallet has enough native balance (e.g., ETH) to cover both gas fee and transfer amount.

insufficient allowance

Trying to send ERC20 token but no prior approve() call made or allowance is too small.

Make sure the sender has granted sufficient allowance to the token contract via approve() beforehand.

invalid address

The to address or token address is incorrectly formatted.

Verify that all addresses are valid Ethereum addresses (start with 0x and 42 characters long).

transaction underpriced

Gas fee settings are too low.

Retry with higher gas price or gas limit depending on network congestion.

execution reverted

Smart contract rejected the transfer (e.g., paused token, blocked address).

Check token smart contract status and address restrictions.

PreviousTokens and BalancesNextSwap

Last updated 29 days ago

πŸ“š
⏫