@bwick-chain/sdk

The bwickchain SDK is a TypeScript library for building decentralized applications on bwickchain. It wraps CosmJS with BWICK-specific helpers for wallet connection, token operations, and contract interaction.

Installation

npm install @bwick-chain/sdk

Quick Start

Read-Only Client

Connect to bwickchain and query data without a wallet:
import { createClient, getBalance, formatBWICK } from "@bwick-chain/sdk";

const client = await createClient({
  rpcEndpoint: "https://rpc.bwick.fun",
});

// Get chain info
const chainId = await client.getChainId();  // "bwick-1"
const height = await client.getHeight();

// Query balance
const balance = await getBalance(client, "bwick1...");
console.log(formatBWICK(balance.amount), "BWICK");  // "1,000.50 BWICK"

Browser with Wallet

Connect a user’s wallet and send transactions:
import { showWalletModal, sendBWICK } from "@bwick-chain/sdk";

// Show wallet selection (Keplr, Leap, BWICK Wallet)
const wallet = await showWalletModal({
  rpcEndpoint: "https://rpc.bwick.fun",
});

if (wallet) {
  console.log("Connected:", wallet.address);
  // wallet.signer is ready for signing transactions
}

Node.js with Mnemonic

For scripts, bots, and backend services:
import { createSigningClient, sendBWICK } from "@bwick-chain/sdk";

const client = await createSigningClient(
  { rpcEndpoint: "https://rpc.bwick.fun" },
  "your mnemonic phrase here"
);

const result = await sendBWICK(client, "bwick1...recipient", "1000000");
console.log("TX:", result.transactionHash);

Key Modules

ModuleDescription
ClientcreateClient() for read-only, createSigningClient() for signing
QueriesBalance, token info, contract queries
TransactionsSend tokens, execute contracts
WalletKeplr, Leap, BWICK Wallet integration + modal
ContractsGeneric + CW20-specific contract operations
TypesCoin formatting, chain config, transaction types

Configuration

import { createClient } from "@bwick-chain/sdk";

const client = await createClient({
  rpcEndpoint: "https://rpc.bwick.fun",  // Required
  restEndpoint: "https://rest.bwick.fun",   // Optional (REST/LCD)
  chainId: "bwick-1",                              // Default: "bwick-1"
  prefix: "bwick",                                 // Default: "bwick"
});

Token Denominations

BWICK uses 6 decimals. The SDK provides helpers for conversion:
import { formatBWICK, parseBWICK, BWICK_DECIMALS, BWICK_DENOM } from "@bwick-chain/sdk";

formatBWICK("1000000");    // "1"          (ubwick → BWICK)
parseBWICK("1");           // "1000000"    (BWICK → ubwick)

BWICK_DECIMALS;  // 6
BWICK_DENOM;     // "ubwick"

Requirements

EnvironmentRequirements
BrowserKeplr, Leap, or BWICK Wallet extension for wallet features
Node.jsNode.js 18+
BothAccess to an bwickchain RPC node

Next Steps

Queries

Read balances, token info, and contract state

Transactions

Send tokens and execute contracts

Wallets

Connect Keplr, Leap, or BWICK Wallet