Developer Docs
  • Getting Started
    • Xircus Web3 Protocol
    • Wallet & Authentication
    • Own Your Web3 Apps
    • Deploying Web3 Apps
    • Deploying NFT Collection
    • Minting and Importing NFTs
    • Listing and Selling NFTs
    • Supported Chains
  • Terminologies
    • DUST - Template System
      • The Presets
      • Dust
      • Dust React
      • Dust Chakra
      • Dust Radix
    • Carousel - Template Routers
    • Graphee
      • for TON Chain
  • Launching Your App
    • Quest Apps
    • NFT Marketplace Apps
    • eCommerce Apps
    • Launchpad Apps
  • TON Contracts
    • ⚡Quick Start
    • ⛏️Minter
      • Quick Start
      • Jetton
      • Jetton Non-Shard
      • NFT
      • SBT
      • Wallet
    • 🏪Marketplace
      • ⚡Quick Start
      • NFT Market
      • NFT Music Market
      • NFT Ticket Market
      • NFT Subscription Market
    • 🌱Launchpad
      • Getting Started
      • Auction Instant
      • Auction Pool
      • Auction Fair Launch
      • NFT Pre-Mint Auction Randomizer
      • NFT Allowlist Auction
    • 🛍️eCommerce
      • Checkout
      • Property Rentals
      • Fleet Courier
      • Delivery Pooling
      • Real World Assets
    • ⛰️Governance
      • Staking
      • Locker
      • Vesting Locker
      • Vesting Locker Simple
      • Proposals
    • ⛳Prediction
      • Getting Started
      • Optimistic Oracles
      • Prediction Market Factory
  • Platform Tools
    • 📃Smart Contracts
    • 🏅Open Quest & Leaderboard
    • ⚒️Web3 Minters
    • 🎨Generative NFT Creator
    • ✨NFT Auctioneer
  • App Templates
    • NFT Marketplace
    • Crowdfunding Launchpad
    • DeFi Exchange
    • Prediction Market
    • NFT Social
    • Token XP Campaigns
  • TON Blockchain
    • TON React
    • Telegram Mini dApps
  • React Reference
    • ⚡Quick Start
    • Hooks
      • useTonConnect
      • useUtils
      • useRegistry
      • useApp
      • useStorage
      • useTon
      • useTelegram
    • Recipes
      • Connect via Wallet Provider
      • Using Wallet Authentication
  • GraphQL Reference
    • ⚡Quick Start
    • Schemas
      • App
      • Currency
      • Account
      • Chain
      • Market
    • Methods
      • Get Apps
      • Get App
  • Core SDK Reference
    • ⚡Quick Start
    • Methods
  • Xircus CLI
    • ⚡Quick Start
    • Commands
      • Create
      • App
      • Contract
      • Skin
      • Module
  • DUST App Template Building
    • Getting Started
    • Dust Chakra Common
      • AppBrand / AppHeader
      • EditableFields
Powered by GitBook
On this page
  1. React Reference
  2. Hooks

useTonConnect

Allows you to connect to wallet providers to access wallet address and wallet balance and network information

// Import
import { useTonConnect } from "@xircus-web3/ton-react"

// Declare
const wallet = useTonConnect()
// or const { connectMetamask } = useWallet()

// Usage
return <button onClick={wallet.connect}>Connect</button>

Fields

Name
Description

ready

Returns true once SDK is initialized

status

Returns the status of the wallet connection

balance

Returns the balance of the wallet account

account

Returns the wallet address

network

Returns the info of the network

connector

Returns the info of the chain connector type e.g evm, solana, near

getBalance(account, token)

Returns the token balance of an account

getBalances (account, tokens = [])

Returns the token balances of wallet address e.g

getAccountBalance

Returns the native balance of wallet address

getBalanceFromChains (account, chains = [])

connectMetamask()

Connect via Metamask

connectWalletConnect()

Connect via WalletConnect

connectCoinbase()

Connect via Coinbase Wallet

connectPhantom

Connect via Solana Phantom

connectSender

Connect via Near Sender Wallet

connectRandom

Connect via Random Seed Key

connectSafe

Connect via Gnosis Safe

connect(chain)

Connect via RPC, chain can be short or network id e.g "bsc" or "56"

signMessage(message)

Returns the signed message after eth_personal_sign

switchNetwork(networkId)

Switch to another chain via wallet provider

getSigner

Returns the signer from wallet provider

PreviousHooksNextuseUtils

Last updated 11 months ago

Returns the native balances of wallet address from different , use the short e.g. chains = ["bsc", "polygon"]

chains