-
Notifications
You must be signed in to change notification settings - Fork 68
/
Scratchpad.ts
57 lines (51 loc) · 2.17 KB
/
Scratchpad.ts
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import TestUtils from "./utils/TestUtils";
import WalletSyncPrinter from "./utils/WalletSyncPrinter";
import {connectToDaemonRpc,
connectToWalletRpc,
createWalletFull,
MoneroNetworkType} from "../../index";
describe("Scratchpad", function() {
it("Can be scripted easily", async function() {
// let daemon = await TestUtils.getDaemonRpc();
// let walletRpc = await TestUtils.getWalletRpc();
// let walletFull = await TestUtils.getWalletFull();
// initialize daemon rpc client
let daemon = await connectToDaemonRpc({
uri: "http://localhost:28081",
username: "superuser",
password: "abctesting123",
proxyToWorker: TestUtils.PROXY_TO_WORKER,
rejectUnauthorized: false
});
console.log("Daemon height: " + await daemon.getHeight());
// initialize wallet rpc client
let walletRpc = await connectToWalletRpc({
uri: "http://localhost:28084",
username: "rpc_user",
password: "abc123",
rejectUnauthorized: false
});
await walletRpc.openWallet("test_wallet_1", "supersecretpassword123");
console.log("RPC wallet seed: " + await walletRpc.getSeed());
// create in-memory wallet with mnemonic
let walletFull = await createWalletFull({
//path: "./test_wallets/" + GenUtils.getUUID(), // in-memory wallet if not given
password: "supersecretpassword123",
networkType: MoneroNetworkType.TESTNET,
server: {
uri: "http://localhost:28081",
username: "superuser",
password: "abctesting123",
rejectUnauthorized: false
},
seed: "silk mocked cucumber lettuce hope adrenalin aching lush roles fuel revamp baptism wrist long tender teardrop midst pastry pigment equip frying inbound pinched ravine frying",
restoreHeight: 0,
proxyToWorker: TestUtils.PROXY_TO_WORKER,
});
await walletFull.sync(new WalletSyncPrinter());
console.log("Full wallet daemon height: " + await walletFull.getDaemonHeight());
console.log("Full wallet seed: " + await walletFull.getSeed());
console.log("Wallet balance: " + (await walletFull.getUnlockedBalance()).toString())
await walletFull.close();
});
});