blob: 487898ae5e330040f7b95a1dfa814fe970eddd4d (
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
24
25
26
27
|
import { persistLocal } from "$lib/store";
import { SingleKey, Wallet } from "@arkade-os/sdk";
import { get } from "svelte/store";
export const arkServerUrl = "http://localhost:7070";
export const arkkey = persistLocal("arkkey", "");
export const getWallet = async () => {
const key = get(arkkey);
if (!key) return;
const identity = SingleKey.fromHex(key);
return Wallet.create({
identity,
arkServerUrl,
});
};
export const getAddress = async (): Promise<string> => {
const wallet = await getWallet();
return wallet.getAddress();
};
export const getBalance = async (): Promise<{ available: number }> => {
const wallet = await getWallet();
return wallet.getBalance();
};
|