Giter Site home page Giter Site logo

jaggedsoft / node-skycoin-api Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 2.0 17 KB

Node Skycoin API is an asynchronous node.js module designed to interact with the Skycoin blockchain, like Ethereum's web3.js

License: MIT License

JavaScript 100.00%
skycoin node api javascript cryptocurrency

node-skycoin-api's Introduction

GitHub last commit npm downloads

NPM

Node Skycoin API

This project is designed to help you make your own projects that interact with the Skycoin API. You can query the rich list, total coin supply, download block information, view metadata, get account balances and more. This project seeks to have complete API coverage including wallet functionality and sending transactions.

(Currently an experimental release. Wallet functionality will be added later)

Installation

npm install skycoin

Getting started

When using async/await, your entire program must be wrapped in an async block:

(async () => {
    const api = require('skycoin');
    console.log(await api.version());
})();

Setting optional parameters

api.options({
    node: 'http://127.0.0.1:6420/', // Change to alternative node (or your own)
    proxy: { host: '127.0.0.1', port: 3128 }
});

Get wallet balance

// Accepts single address, or array of addresses. divide balance by 1e6
console.log(await api.balance('2CfGyhRyvT8Y4uF9CqoKBgYZuRrgKfCP2nj'));
View Response
{ confirmed: { coins: 265000000, hours: 108286 },
  predicted: { coins: 265000000, hours: 108286 } }

Get node version info

console.log(await api.version());
View Response
{ version: '0.21.1', commit: '' }

Get unconfirmed transactions

console.log(await api.pendingTxs());

Get transaction info by id

console.log(await api.transaction(txid));

Get transactions that are addresses related

// Addresses can be a single address or an array
// Confirmed can be true or false, defaults to all
console.log(await api.transaction(addresses, confirmed));

Get raw transaction by id

console.log(await api.rawtx(txid));

Inject raw transaction

console.log(await api.injectTransaction(txid));

Resend unconfirmed transactions

console.log(await api.resendUnconfirmedTxns());

Get blockchain metadata

console.log(await api.metadata());

Get blockchain progress

console.log(await api.progress());

Get block by hash or seq

console.log(await api.block({seq: 2760}));
console.log(await api.block({hash: '6eafd13ab6823223b714246b32c984b56e0043412950faf17defdbb2cbf3fe30'}));

Get blocks in specific range

console.log(await api.blocks(start, end));

Get last N blocks

console.log(await api.blocks(num));

Get address affected transactions

console.log(await api.explorer('2CfGyhRyvT8Y4uF9CqoKBgYZuRrgKfCP2nj'));

Get uxout

console.log(await api.uxout(uxid));

Get address affected uxouts

console.log(await api.address_uxouts('2CfGyhRyvT8Y4uF9CqoKBgYZuRrgKfCP2nj'));

Get a list of all default connections

console.log(await api.defaultConnections());

Get a list of all connections

console.log(await api.connections());

Get a list of all trusted connections

console.log(await api.trust());

Get a list of all connections discovered through peer exchange

console.log(await api.exchange());

Get information for a specific connection

console.log(await api.connection(addr));

Coin supply

console.log(await api.coinSupply());

Count unique addresses

console.log(await api.addresscount());

Richlist show top N addresses by uxouts

// amount defaults to 20. -1 returns all accounts
// distributions will include distribution address or not, defaults to false
console.log(await api.richlist(amount, distributions));

Coming soon:

Spend coins from wallet

Update wallet label

Generate new address in wallet

Create a wallet from seed

Generate wallet seed

Get wallet folder name

Get wallets

Get wallet transactions

Get wallet

Skycoin Website

Skycoin Reddit

Skycoin Telegram

Views

node-skycoin-api's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jeff-bouchard

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.