2024-10-16 07:55:11 +02:00
|
|
|
import { assertEquals } from "jsr:@std/assert";
|
|
|
|
|
|
2024-12-30 10:39:28 +01:00
|
|
|
import { WalletManager } from "../impls/monero.ts/mod.ts";
|
|
|
|
|
import { loadDylib } from "./utils.ts";
|
2024-12-01 15:02:20 +01:00
|
|
|
|
2024-10-16 07:55:11 +02:00
|
|
|
const coin = Deno.args[0] as "monero" | "wownero";
|
|
|
|
|
const version = Deno.args[1];
|
|
|
|
|
const walletInfo = JSON.parse(Deno.args[2]);
|
|
|
|
|
|
2024-12-30 10:39:28 +01:00
|
|
|
loadDylib(coin, version);
|
2024-10-16 07:55:11 +02:00
|
|
|
|
|
|
|
|
const walletManager = await WalletManager.new();
|
2024-12-01 15:02:20 +01:00
|
|
|
const wallet = await walletManager.openWallet(walletInfo.path, walletInfo.password);
|
2024-10-16 07:55:11 +02:00
|
|
|
|
|
|
|
|
assertEquals(await wallet.address(), walletInfo.address);
|
|
|
|
|
|
2024-12-01 15:02:20 +01:00
|
|
|
assertEquals(await wallet.publicSpendKey(), walletInfo.publicSpendKey);
|
|
|
|
|
assertEquals(await wallet.secretSpendKey(), walletInfo.secretSpendKey);
|
2024-10-16 07:55:11 +02:00
|
|
|
|
2024-12-01 15:02:20 +01:00
|
|
|
assertEquals(await wallet.publicViewKey(), walletInfo.publicViewKey);
|
|
|
|
|
assertEquals(await wallet.secretViewKey(), walletInfo.secretViewKey);
|
2024-10-16 07:55:11 +02:00
|
|
|
|
|
|
|
|
await wallet.store(walletInfo.path);
|