-
Notifications
You must be signed in to change notification settings - Fork 132
Expand file tree
/
Copy pathtest.js
More file actions
29 lines (23 loc) · 1.18 KB
/
Copy pathtest.js
File metadata and controls
29 lines (23 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2026 Quantova Inc
// SPDX-License-Identifier: Apache-2.0 OR MIT
const { Client, core } = require('./index.js');
(async () => {
const url = process.argv[2] || 'http://127.0.0.1:8645';
const client = new Client(url);
const seed = '0b'.repeat(32);
const info = await client.nodeInfo();
console.log('network', info.chain_id, 'fee', info.fee.transfer_quon, info.denomination);
const to = client.address(seed, 1);
const maxFeeQuon = '1000000';
const { signed, outcome } = await client.transfer(seed, 0, to, '1000', maxFeeQuon);
console.log('submitted', signed.tx_id, outcome.verdict, outcome.state || outcome.reason || '');
if (outcome.verdict !== 'accepted') { console.error('FAIL: not accepted'); process.exit(1); }
for (let i = 0; i < 40; i++) {
const s = await client.transaction(signed.tx_id);
if (s.status === 'finalised') { console.log('finalised at height', s.height, 'in', s.block); break; }
await new Promise((r) => setTimeout(r, 250));
}
const a = await client.account(signed.from);
console.log('sender now balance', a.balance, 'nonce', a.nonce);
console.log('OK');
})().catch((e) => { console.error('FAIL', e.message); process.exit(1); });