npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ts-xdbchain-sdk

v1.0.0

Published

A TypeScript SDK for interacting with XDBCHAIN - a Stellar-based blockchain network

Readme

XDBChain SDK - Exported Methods

Main Class: XDBChainSDK

Wallet Management

  • createWallet() - Create a new random wallet
  • loadWallet(secretKey: string) - Load an existing wallet from secret key
  • createWalletFromSeed(seed: string | Buffer) - Create wallet from seed
  • isValidAddress(address: string) - Validate a public address
  • isValidSecretKey(secretKey: string) - Validate a secret key

Keypair Management

  • generateKeypair() - Generate a new keypair
  • keypairFromSecret(secretKey: string) - Create keypair from secret key
  • keypairFromPublicKey(publicKey: string) - Create keypair from public key

Account Management

  • loadAccount(publicKey: string) - Load account information
  • createAccount(source: string, destination: string, startingBalance?: string) - Create new account
  • setAccountOptions(secretKey: string, options: XDBAccountOptions) - Set account options
  • mergeAccount(sourceSecret: string, destination: string) - Merge accounts
  • bumpSequence(secretKey: string, bumpTo: string) - Bump sequence number

Balance Management

  • getBalances(publicKey: string) - Get all balances
  • getXDBBalance(publicKey: string) - Get XDB balance only
  • watchBalances(publicKey: string, callback) - Monitor balance changes in real-time

Payments

  • sendPayment(senderSecret: string, options: XDBPaymentOptions) - Send simple payment
  • sendPathPaymentStrictReceive(senderSecret: string, options: XDBPathPaymentOptions) - Path payment (fixed receive amount)
  • sendPathPaymentStrictSend(senderSecret: string, options: XDBPathPaymentOptions) - Path payment (fixed send amount)
  • sendBatchPayments(senderSecret: string, payments: XDBPaymentOptions[]) - Multiple payments in batch

Trustline Management

  • addTrustline(walletSecret: string, options: XDBTrustlineOptions) - Add trustline
  • removeTrustline(walletSecret: string, options) - Remove trustline
  • getTrustlines(publicKey: string) - Get all trustlines
  • allowTrust(trustorSecret: string, trusteePublicKey: string, assetCode: string, authorize: boolean) - Authorize/revoke trust

Asset Management

  • createAssetObject(code: string, issuer?: string) - Create asset object
  • issueAsset(issuerSecret: string, distributorPublicKey: string, assetCode: string, amount: string, limit?: string) - Issue asset

Offer Management (DEX)

  • createSellOffer(secretKey: string, options: XDBOfferOptions) - Create sell offer
  • createBuyOffer(secretKey: string, options: XDBOfferOptions) - Create buy offer
  • createPassiveSellOffer(secretKey: string, options: XDBOfferOptions) - Create passive offer
  • cancelOffer(secretKey: string, offerId: string, selling: XDBAsset, buying: XDBAsset) - Cancel offer
  • getOffers(publicKey: string, options?: XDBStreamOptions) - Get account offers
  • getOrderbook(selling: XDBAsset, buying: XDBAsset, limit?: number) - Get orderbook

Data Management

  • manageData(secretKey: string, options: XDBDataOptions) - Manage account data

Transaction and Operation Queries

  • getTransactionHistory(publicKey: string, options?: XDBStreamOptions) - Transaction history
  • getTransactionsForLedger(ledgerSequence: number, options?: XDBStreamOptions) - Transactions for ledger
  • watchTransactions(publicKey: string, callback) - Monitor transactions in real-time
  • getOperations(publicKey: string, options?: XDBStreamOptions) - Get operations
  • getOperationsForLedger(ledgerSequence: number, options?: XDBStreamOptions) - Operations for ledger
  • getOperationsForTransaction(transactionHash: string, options?: XDBStreamOptions) - Operations for transaction
  • getPayments(publicKey: string, options?: XDBStreamOptions) - Get payments
  • watchPayments(publicKey: string, callback) - Monitor payments in real-time

Effects and Trade Queries

  • getEffects(publicKey: string, options?: XDBStreamOptions) - Get effects
  • getEffectsForOperation(operationId: string, options?: XDBStreamOptions) - Effects for operation
  • getTrades(publicKey: string, options?: XDBStreamOptions) - Get trades
  • getTradesForAssetPair(baseAsset: XDBAsset, counterAsset: XDBAsset, options?: XDBStreamOptions) - Trades for asset pair

Ledger Management

  • getLedger(sequence: number) - Get specific ledger information
  • getLedgers(options?: XDBStreamOptions) - Get ledger list

Claimable Balance

  • createClaimableBalance(senderSecret: string, claimantPublicKey: string, amount: string, asset?: XDBAsset) - Create claimable balance
  • claimBalance(claimantSecret: string, balanceId: string) - Claim balance
  • getClaimableBalances(publicKey: string) - Get claimable balances

Network and Fees

  • getNetworkInfo() - Network information
  • getBaseFee() - Base fee
  • getFeeStats() - Fee statistics
  • fundTestnetAccount(publicKey: string) - Fund testnet account
  • estimateFee(operationCount?: number) - Estimate fee

Path Finding

  • getPaymentPaths(sourcePublicKey: string, destination: XDBAsset, amount: string) - Find payment paths
  • getStrictReceivePaths(sourceAccount: string, destination: XDBAsset, amount: string) - Strict receive paths
  • getStrictSendPaths(sourceAsset: XDBAsset, destinationAssets: XDBAsset[], amount: string) - Strict send paths

Multi-Signature Transactions

  • signTransaction(transaction: Transaction, signers: Keypair[]) - Sign transaction
  • createMultiSigTransaction(sourceAccount: Account, operations: any[], signers: Keypair[]) - Create multi-sig transaction

SDK Utilities

  • getServer() - Get Horizon server instance
  • getNetworkPassphrase() - Get network passphrase
  • getConfig() - Get SDK configuration
  • submitTransaction(transaction: Transaction) - Submit transaction
  • fromXDR(xdr: string) - Parse from XDR

Exported Utility Functions

  • createXDBChainSDK(config: XDBChainConfig) - SDK factory
  • createMainnetSDK() - Mainnet SDK
  • createFuturenetSDK() - Futurenet SDK (testnet)
  • xdbToStroops(amount: number | string) - Convert XDB to stroops
  • stroopsToXdb(stroops: number | string) - Convert stroops to XDB
  • isValidAmount(amount: string) - Validate amount
  • formatAmount(amount: string, decimals?: number) - Format amount
  • generateNonce() - Generate random nonce
  • isValidMemo(memo: string, type?: string) - Validate memo
  • calculateFee(operationCount: number, baseFee: number) - Calculate fee
  • accountExists(server: Horizon.Server, publicKey: string) - Check account existence

Exported TypeScript Interfaces

Configuration

  • XDBChainConfig - SDK configuration
  • XDBWallet - Wallet representation
  • XDBAsset - Asset representation

Operation Options

  • XDBPaymentOptions - Payment options
  • XDBPathPaymentOptions - Path payment options
  • XDBTrustlineOptions - Trustline options
  • XDBAccountOptions - Account options
  • XDBOfferOptions - Offer options
  • XDBDataOptions - Data management options
  • XDBStreamOptions - Streaming options

Response Data

  • XDBBalance - Account balance
  • XDBTransaction - Transaction
  • XDBClaimableBalance - Claimable balance
  • XDBEffect - Effect
  • XDBTrade - Trade
  • XDBOrderbook - Orderbook
  • XDBLedger - Ledger
  • XDBOffer - Offer
  • XDBPayment - Payment

Exported Error Classes

  • XDBChainError - Generic error
  • XDBNetworkError - Network error
  • XDBValidationError - Validation error
  • XDBTransactionError - Transaction error
  • XDBAssetError - Asset error
  • XDBOfferError - Offer error

Exported Constants

Account Flags

  • ACCOUNT_FLAGS - Account authorization flags
    • AUTH_REQUIRED_FLAG: 0x1
    • AUTH_REVOCABLE_FLAG: 0x2
    • AUTH_IMMUTABLE_FLAG: 0x4
    • AUTH_CLAWBACK_ENABLED_FLAG: 0x8

Asset Types

  • ASSET_TYPE - Asset types
    • NATIVE: 'native'
    • CREDIT_ALPHANUM4: 'credit_alphanum4'
    • CREDIT_ALPHANUM12: 'credit_alphanum12'

Operation Types

  • OPERATION_TYPE - All supported operation types
    • CREATE_ACCOUNT, PAYMENT, PATH_PAYMENT_STRICT_RECEIVE, etc.

Default Configurations

Mainnet

  • Horizon URL: https://horizon.livenet.xdbchain.com/
  • Network Passphrase: LiveNet Global XDBChain Network ; November 2023

Futurenet (Testnet)

  • Horizon URL: https://horizon.futurenet.xdbchain.com/
  • Network Passphrase: Future XDBChain Network ; November 2023
  • Friendbot: https://friendbot.futurenet.xdbchain.com

Quick Usage Example

import { createMainnetSDK } from './xdbchain-sdk';

// Create SDK for mainnet
const sdk = createMainnetSDK();

// Create wallet
const wallet = await sdk.createWallet();

// Load account
const account = await sdk.loadAccount(wallet.publicKey);

// Send payment
await sdk.sendPayment(wallet.secretKey, {
  destination: 'GDEST...',
  amount: '10.5',
  memo: 'Payment memo'
});