aboutsummaryrefslogtreecommitdiffstats
path: root/inspect-ark.ts
blob: bc92ae362268200474bca713f6b96678621ebfc1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { EventSource } from "eventsource";
if (!globalThis.EventSource) globalThis.EventSource = EventSource as any;
import { SingleKey, Wallet } from "@arkade-os/sdk";

const key = "0ebe9a690651e9e08d7c2f4db106d8ec264725241fdb34c57aedb26155b0e027";
const identity = SingleKey.fromHex(key);
const wallet = await Wallet.create({ identity, arkServerUrl: "http://localhost:7070" });

const balance = await wallet.getBalance();
console.log("Balance:", JSON.stringify(balance));

console.log("Settling...");
try {
  const txid = await wallet.settle();
  console.log("Settle txid:", txid);

  const balanceAfter = await wallet.getBalance();
  console.log("Balance after:", JSON.stringify(balanceAfter));
} catch (e: any) {
  console.error("Error:", e.message);
}

process.exit(0);