Learn how to connect IBC-comptabile wallets to your application so that users
can interact with the Nibiru blockchain. This guide is designed for developers
who want to integrate Nibiru functionality into their apps.
Connect wallets to an application to interact with the Nibiru
blockchain.
Use a NibiruTxClient to perform basic operations like querying account balances and sending transactions
Invoke wasm smart contracts on the Nibiru blockchain.
Below is a step-by-step guide on how to connect to wallets using the set of
wallet adapters built into Cosmos-Kit, such as Leap Wallet, Keplr, and
Cosmostation. Alternatively, generate and use a newly created random wallet for
development purposes.
Copy
import{
NibiruTxClient,
Chain,
Testnet,}from"@nibiruchain/nibijs"/**
* A "Chain" object exposes all endpoints for Nibiru node such as the
* gRPC server, Tendermint RPC endpoint, and REST server.
*
* The most important one for nibijs is "Chain.endptTM", the Tendermint RPC.
**/constchain: Chain =Testnet()// Permanent testnet// ------------------// NibiruTxClient// // Signer: ⚠️ We' get this from the walletlet signer =awaitsignerFromWallet()const txClient =await NibiruTxClient.connectWithSigner(CHAIN.endptTm,
signer
)
With NibiJS, developers have access to a transaction client (NibiruTxClient),
which extends SigningStargateClient and functions as both a signing client and
a SigningCosmWasmClient.
This class enables interaction with smart contracts on the Nibiru blockchain,
including deployment, instantiation, querying, and execution.
Copy
const chainInfoMainnet ={chainId:"cataclysm-1",// Replace with "nibiru-testnet-1" for testnetchainName:"cataclysm-1",// Replace with "nibiru-testnet-1" for testnetrpc:"https://rpc.nibiru.fi",// Replace with testnet URL if neededrest:"https://lcd.nibiru.fi",// Replace with testnet URL if neededstakeCurrency:{coinDenom:"NIBI",coinMinimalDenom:"unibi",coinDecimals:6,},bip44:{coinType:118,},bech32Config:{bech32PrefixAccAddr:"nibi",bech32PrefixAccPub:"nibipub",bech32PrefixValAddr:"nibivaloper",bech32PrefixValPub:"nibivaloperpub",bech32PrefixConsAddr:"nibivalcons",bech32PrefixConsPub:"nibivalconspub",},currencies:[{coinDenom:"NIBI",coinMinimalDenom:"unibi",coinDecimals:6,},],feeCurrencies:[{coinDenom:"NIBI",coinMinimalDenom:"unibi",coinDecimals:6,gasPriceStep:{low:0.025,average:0.05,high:0.1,},},],};