-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
29 lines (22 loc) · 1.01 KB
/
index.js
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
//import * as wasm from "hello-wasm-pack";
import { WalletWrapper } from "bdk-wasm";
//wasm.greet();
const network = "testnet";
const descriptor = "wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/0/*)";
const change_descriptor = "wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/1/*)";
const esplora = "https://blockstream.info/testnet/api";
var wallet = new WalletWrapper(network, descriptor, change_descriptor, esplora, 20);
wallet.then(function(w) {
var a = w.new_address();
console.log("New address: %s", a);
var b = w.balance();
console.log("New balance: %s", b);
console.log("Start sync");
w.sync().then(function(s) {
console.log("End sync");
var b2 = w.balance();
console.log("New balance: %s", b2);
});
var a = w.new_address();
console.log("New address: %s", a);
});