mirror of
https://github.com/stjet/banani.git
synced 2025-12-29 09:39:23 +00:00
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
import * as banani from "../main.js"//"banani";
|
|
import * as fs from "fs";
|
|
|
|
let rpc = new banani.RPC("https://kaliumapi.appditto.com/api");
|
|
//rpc.debug = true
|
|
console.log(rpc.rpc_url);
|
|
|
|
console.log(await rpc.get_block_count())
|
|
|
|
let test_seed = fs.readFileSync("./.secret", "utf-8").trim();
|
|
|
|
let wallet = new banani.Wallet(rpc, test_seed);
|
|
|
|
let z_address = wallet.address; //0 index
|
|
|
|
wallet.index = 2; //3rd account
|
|
let t_address = wallet.address;
|
|
console.log(wallet.address);
|
|
//console.log(await wallet.receive("03EEE28C2CB5CA0552BF31A60A797929920FDE044B5E021B8CEC16F57278F79A"));
|
|
console.log("send 1");
|
|
let send_hash = await wallet.send(z_address, "1.001");
|
|
|
|
wallet.index = 0;
|
|
console.log("receive 1");
|
|
await wallet.receive(send_hash);
|
|
console.log("send 2");
|
|
await wallet.send(t_address, "0.1");
|
|
console.log("send 3");
|
|
await wallet.send_all(t_address);
|
|
|
|
wallet.index = 2;
|
|
console.log("receive 2");
|
|
console.log(await wallet.receive_all());
|
|
|
|
await wallet.change_rep("ban_3p3sp1ynb5i3qxmqoha3pt79hyk8gxhtr58tk51qctwyyik6hy4dbbqbanan");
|
|
|
|
//
|
|
|