near-batch-tx
v1.1.4268
Published
npm Package - near-batch-tx
Downloads
46
Readme
near-batch-tx
A lightweight npm package for sending batch transactions and interacting with the NEAR blockchain.
Installation
npm install near-batch-tx
API & Usage
getAccountInfo
import { getAccountInfo } from 'near-batch-tx';
const info = await getAccountInfo('alice.near', { nodeUrl: 'https://rpc.mainnet.near.org' });
generateKeyPair
import { generateKeyPair } from 'near-batch-tx';
const { keyPair, publicKey } = await generateKeyPair();
sendBatchTransaction
import { sendBatchTransaction } from 'near-batch-tx';
const result = await sendBatchTransaction( 'alice.near', 'contract.near', [ { type: 'FunctionCall', methodName: 'mint', args: { token_id: '1' }, gas: '30000000000000', deposit: '0' } ], { keyPair, nodeUrl: 'https://rpc.mainnet.near.org' } );
viewFunction
import { viewFunction } from 'near-batch-tx';
const data = await viewFunction( 'contract.near', 'get_token', { token_id: '1' }, { nodeUrl: 'https://rpc.mainnet.near.org' } );
transferNear
import { transferNear } from 'near-batch-tx';
const result = await transferNear( 'alice.near', 'bob.near', '1000000000000000000000000', { keyPair, nodeUrl: 'https://rpc.mainnet.near.org' } );
License
MIT
