aboutsummaryrefslogtreecommitdiffstats
path: root/inspect-ark.ts
diff options
context:
space:
mode:
Diffstat (limited to 'inspect-ark.ts')
-rw-r--r--inspect-ark.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/inspect-ark.ts b/inspect-ark.ts
new file mode 100644
index 00000000..8c1a551b
--- /dev/null
+++ b/inspect-ark.ts
@@ -0,0 +1,23 @@
+import { EventSource } from "eventsource";
+if (!globalThis.EventSource) globalThis.EventSource = EventSource;
+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);