0.0.1 • Published 5 years ago

sdchain-api-core v0.0.1

Weekly downloads
1
License
Apache-2.0
Repository
-
Last release
5 years ago

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=====");
});