Skip to content

vryazanov/zold-node-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zold Node SDK

Base library to working with Zold Cryprocurrency.

See https://wts.zold.io for details.

How to use

Mobile Token

It creates a new wallet linked to your phone number and returns API token.

const MobileToken = require('zold-node-sdk/lib/MobileToken')

const mobileToken = new MobileToken(/* your phone number */)

await mobileToken.send()

const token = await mobileToken.token(/* code from SMS */)
console.log('Your API token: ', token)

Wallet

const Wallet = require('zold-node-sdk/lib/Wallet')

const wallet = new Wallet(/* Your X-Zold-Wts token*/)

const jobId = await wallet.pull()  /* wallet has to be presented on server before checking the balance */

await wallet.job(jobId, { wait: true })

const isConfirmed = await wallet.confirmed()

if (!isConfirmed) {
    const keygap = await wallet.keygap()
    // user has to save keygap before confimation
    console.log('Keygap: ', keygap)
    await wallet.confirm(keygap)
}

const id = await wallet.id()
const balance = await wallet.balance()

console.log('Wallet ID: ', id)
console.log('Balance: ', balance)

How to run tests

npm run test

About

Zold SDK for Node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published