Giter Club home page Giter Club logo

bumo-sdk-nodejs's Introduction

bumo-sdk

bumo-sdk Installation

npm install bumo-sdk --save

bumo-sdk Test

npm test

bumo-sdk Usage

'use strict';

//Create BumoSDK instance
const BumoSDK = require('bumo-sdk');

const bumo = new BumoSDK({
  host: 'seed1.bumotest.io:26002',
});

// Create account
bumo.account.create().then(data => {
  console.log(data);
}).catch(err => {
  console.log(err.message);
});

// Get account balance
bumo.account.getBalance('buQXz2qbTb3yx2cRyCz92EnaUKHrwZognnDw').then(data => {
  console.log(data);
}).catch(err => {
  console.log(err.message);
});

// Get account information
bumo.account.getInfo('buQXz2qbTb3yx2cRyCz92EnaUKHrwZognnDw').then(data => {
  console.log(data);
}).catch(err => {
  console.log(err.message);
});

// Check address
bumo.account.checkAddress('buQgE36mydaWh7k4UVdLy5cfBLiPDSVhUoPq').then(data => {
  console.log(data);
}).catch(err => {
  console.log(err.message);
});

// Get transaction information
bumo.getTransaction('e27d287913dcbe5452d38a567b10f6b73a2a22a2f3c393180ab930286eb8ffd9').then(data => {
  console.log(data);
}).catch(err => {
  console.log(err.message);
});

// Get block information
bumo.getBlock(100).then(data => {
  console.log(data);
}).catch(err => {
  console.log(err.message);
});

// Check block status
bumo.checkBlockStatus().then(data => {
  console.log(data);
}).catch(err => {
  console.log(err.message);
});

// Get block number
bumo.getBlockNumber().then(data => {
  console.log(data);
}).catch(err => {
  console.log(err.message);
});

// Send Bu
const args = {
  senderPrivateKey: 'privbsMCSqvv8kJ1A3Zt9RWjDHyG3jRdGpj9Jrgfxw7tdz3jZzhqA55v',
  receiverAddress: 'buQgE36mydaWh7k4UVdLy5cfBLiPDSVhUoPq',
  amount: '10000000',
  nonce: '121',
}
 bumo.sendBu(args).then(data => {
   console.log(data);
 }).catch(err => {
   console.log(err.message);
 });

// Issue asset
const args = {
  privateKey: 'privbwAAXFXsf4z7VtzPtWFmfDM8dEGZ97fsskUaJYeoduCCMxxv8jnH',
  code: 'demo',
  amount: '10000000',
  nonce: '121',
};
bumo.asset.issueAsset(args).then(result => {
  console.log(result)
}).catch(err => {
  console.log(err.message)
});

// Send asset
const args = {
  senderPrivateKey: 'privbwAAXFXsf4z7VtzPtWFmfDM8dEGZ97fsskUaJYeoduCCMxxv8jnH',
  receiverAddress: 'buQtGi7QmaiaMDygKxMAsKPyLicYjPV2xKVq',
  code: 'demo',
  issuer: 'buQsBMbFNH3NRJBbFRCPWDzjx7RqRc1hhvn1',
  amount: '300000',
  nonce: '121',
};
bumo.asset.sendAsset(args).then(result => {
  console.log(result);
}).catch(err => {
  console.log(err.message);
});

License

MIT

bumo-sdk-nodejs's People

Contributors

hunan36 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.