UNPKG

bifcore-sdk-nodejs-bop

Version:
77 lines (70 loc) 1.92 kB
'use strict' const BIFCoreSDK = require('../index') const sdk = new BIFCoreSDK({ host: 'https://domestic-mainnet.bitfactory.cn', apiKey: 'WZ1RU5DL0UOM47HTNT2MZESZQY5K0IQ8' }) /** * 查询最新的区块高度 */ it('test getBlockNumber', async () => { let param = { domainId: '0' } let data = await sdk.block.getBlockNumber(param) console.log('getBlockNumber() : ', JSON.stringify(data)) }) /** * 查询指定区块高度下的所有交易 */ it('test getTransactions', async () => { let param = { blockNumber: '1', domainId: '0' } let data = await sdk.block.getTransactions(param) console.log('getTransactions() : ', JSON.stringify(data)) }) /** * 查询指定区块高度的区块信息 */ it('test getBlockInfo', async () => { let param = { blockNumber: '61360', domainId: '0', withLeader: true } let data = await sdk.block.getBlockInfo(param) console.log('getBlockInfo() : ', JSON.stringify(data)) }) /** * 查询指定区块高度的区块信息 */ it('test getBlockLatestInfo', async () => { let param = { domainId: '20' } let data = await sdk.block.getBlockLatestInfo(param) console.log('getBlockLatestInfo() : ', JSON.stringify(data)) }) /** * 获取指定区块中所有验证节点数 */ it('test getValidators', async () => { let param = { blockNumber: '3788295', domainId: '20' } let data = await sdk.block.getValidators(param) console.log('getValidators() : ', JSON.stringify(data)) }) /** * 获取最新区块中所有验证节点数 */ it('test getLatestValidators', async () => { let param = { domainId: '20' } let data = await sdk.block.getLatestValidators(param) console.log('getLatestValidators() : ', JSON.stringify(data)) })