1.2.4 • Published 3 months ago

openchain-nodejs-ts v1.2.4

Weekly downloads
-
License
ISC
Repository
github
Last release
3 months ago

@yxchain/sdk-nodejs-chain

YXChain SDK for Node.js with TypeScript support.

Installation

npm install @yxchain/sdk-nodejs-chain

TypeScript Support

This package includes built-in TypeScript type definitions. TypeScript users can get full type support without installing additional packages.

Usage

import OpenChain from '@yxchain/sdk-nodejs-chain';

// Initialize SDK
const sdk = new OpenChain({
  host: 'http://localhost:3000',
  secure: true
});

// Account operations with type support
async function getAccountInfo(address: string) {
  const response = await sdk.account.getInfo(address);
  return response.result;
}

// Token operations with type support
async function getTokenInfo(contractAddress: string) {
  const response = await sdk.token.ctp10Token.getInfo(contractAddress);
  return response.result;
}

// Transaction operations with type support
async function buildTransaction(txInfo: TransactionInfo) {
  const response = await sdk.transaction.buildBlob(txInfo);
  return response.result;
}