sdchain-api-core

0.0.1 • Public • Published

sdchain-api-core

const API = require('./src');
const api = new API({url: "https://rpcurl"});

const account = '6GqWPK6ySx9qrid1rd631WbMgHb4jK2VGv';
const secret = 'shEsE54PCw8tzdZJYWeaqhpz2WKxr';

async function index() {
    let wallet = api.generateAddress().wallet;
    console.log(wallet);

    let accountInfo = await api.getAccountInfo(account);
    console.log(accountInfo.balance);
    console.log(accountInfo.sequence);

    const prep = await api.preparePayment(account, {
        "destination": "69XZXjPc3YLBoJ2jaUr74GGZukqTsZ3BYg",
        "amount": '1',
        "fee": "10000"
    });
    let signd = api.sign(prep.txJson, secret, false);
    console.log(prep.txJson);
    console.log(signd.hash);
    console.log(signd.signedTransaction);
}

index().then(() => {
    console.log("====end test=====");
});

/sdchain-api-core/

    Package Sidebar

    Install

    npm i sdchain-api-core

    Weekly Downloads

    0

    Version

    0.0.1

    License

    Apache-2.0

    Unpacked Size

    3.21 MB

    Total Files

    4

    Last publish

    Collaborators

    • sdchaindev