@spirobel/monero-wallet-api 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/README.md +40 -4
  2. package/dist/frost_dkg.wasm +0 -0
  3. package/dist/io/logging.js +1 -1
  4. package/dist/keypairs-seeds/keypairs.js +5 -5
  5. package/dist/monero_wallet_api.wasm +0 -0
  6. package/dist/multisig/DistributedKeyGenerator.js +3 -3
  7. package/dist/multisig/MultiSigTxSigner.js +2 -2
  8. package/dist/multisig/escrow.js +1 -1
  9. package/dist/multisig/multisig.js +4 -0
  10. package/dist/node-interaction/binaryEndpoints.d.ts +3 -3
  11. package/dist/node-interaction/nodeUrl.js +2 -2
  12. package/dist/scanning-syncing/backgroundWorker.d.ts +3 -0
  13. package/dist/scanning-syncing/backgroundWorker.js +38 -8
  14. package/dist/scanning-syncing/blocksbuffer/blocksBufferFetchLoop.d.ts +1 -1
  15. package/dist/scanning-syncing/blocksbuffer/blocksBufferFetchLoop.js +1 -1
  16. package/dist/scanning-syncing/blocksbuffer/blocksbufferCoordination.d.ts +1 -1
  17. package/dist/scanning-syncing/blocksbuffer/blocksbufferCoordination.js +1 -1
  18. package/dist/scanning-syncing/connectionStatus.d.ts +1 -1
  19. package/dist/scanning-syncing/connectionStatus.js +2 -2
  20. package/dist/scanning-syncing/openWallet.js +1 -1
  21. package/dist/scanning-syncing/scanresult/computeKeyImage.d.ts +1 -1
  22. package/dist/scanning-syncing/scanresult/computeKeyImage.js +2 -2
  23. package/dist/scanning-syncing/scanresult/scanCache.d.ts +1 -1
  24. package/dist/scanning-syncing/scanresult/scanCache.js +1 -1
  25. package/dist/scanning-syncing/scanresult/scanCacheOpened.d.ts +1 -1
  26. package/dist/scanning-syncing/scanresult/scanCacheOpened.js +11 -8
  27. package/dist/scanning-syncing/scanresult/scanCoordination.d.ts +2 -2
  28. package/dist/scanning-syncing/scanresult/scanCoordination.js +2 -2
  29. package/dist/scanning-syncing/scanresult/scanLoop.d.ts +1 -1
  30. package/dist/scanning-syncing/scanresult/scanLoop.js +1 -1
  31. package/dist/scanning-syncing/scanresult/scanResult.d.ts +1 -1
  32. package/dist/scanning-syncing/scanresult/scanResult.js +3 -3
  33. package/dist/scanning-syncing/scanresult/scanStats.d.ts +1 -1
  34. package/dist/scanning-syncing/scanresult/scanStats.js +1 -2
  35. package/dist/scanning-syncing/worker-entrypoints/worker.js +1 -1
  36. package/dist/scanning-syncing/worker-mains/cpubound-main.js +1 -1
  37. package/dist/scanning-syncing/worker-mains/multisig-main.d.ts +1 -1
  38. package/dist/scanning-syncing/worker-mains/multisig-main.js +1 -1
  39. package/dist/scanning-syncing/worker-mains/worker.js +9 -1
  40. package/dist/scansettings/scanSettings.js +1 -1
  41. package/dist/scansettings/scanSettingsOpened.d.ts +1 -1
  42. package/dist/scansettings/scanSettingsOpened.js +1 -1
  43. package/dist/send-functionality/inputSelection.d.ts +1 -1
  44. package/dist/send-functionality/transactionBuilding.d.ts +1 -1
  45. package/dist/send-functionality/transactionBuilding.js +3 -3
  46. package/dist/tools/content.js +1 -1
  47. package/dist/viewpair/ViewPair.d.ts +4 -4
  48. package/dist/viewpair/ViewPair.js +4 -4
  49. package/dist/wasm-processing/wasmLoader.d.ts +10 -0
  50. package/dist/wasm-processing/wasmLoader.js +108 -0
  51. package/dist/worker_unpacked.js +14055 -0
  52. package/dist/xmr3.d.ts +1 -0
  53. package/dist/xmr3.js +10 -0
  54. package/dist/{api.d.ts → xmr3_common.d.ts} +1 -1
  55. package/dist/{api.js → xmr3_common.js} +1 -1
  56. package/dist/xmr3_unpacked.d.ts +9 -0
  57. package/dist/xmr3_unpacked.js +14 -0
  58. package/package.json +14 -7
  59. package/dist/actionlog/actionLog.d.ts +0 -4
  60. package/dist/actionlog/actionLog.js +0 -9
  61. package/dist/actionlog/backend/jsonlBackend.d.ts +0 -19
  62. package/dist/actionlog/backend/jsonlBackend.js +0 -110
  63. package/dist/actionlog/backend/memoryBackend.d.ts +0 -11
  64. package/dist/actionlog/backend/memoryBackend.js +0 -31
  65. package/dist/actionlog/backend.d.ts +0 -12
  66. package/dist/actionlog/backend.js +0 -1
  67. package/dist/actionlog/idbBackend.d.ts +0 -19
  68. package/dist/actionlog/idbBackend.js +0 -98
  69. package/dist/actionlog/jsonlBackend.d.ts +0 -19
  70. package/dist/actionlog/jsonlBackend.js +0 -75
  71. package/dist/actionlog/memoryBackend.d.ts +0 -14
  72. package/dist/actionlog/memoryBackend.js +0 -38
  73. package/dist/actionlog/openMaps.d.ts +0 -11
  74. package/dist/actionlog/openMaps.js +0 -32
  75. package/dist/actionlog/sqliteBackend.d.ts +0 -18
  76. package/dist/actionlog/sqliteBackend.js +0 -105
  77. package/dist/actionlog/toolContext.d.ts +0 -36
  78. package/dist/actionlog/toolContext.js +0 -1
  79. package/dist/actionlog/types.d.ts +0 -62
  80. package/dist/actionlog/types.js +0 -62
  81. package/dist/scanning-syncing/blocksbuffer/getBlocksbinBuffer.d.ts +0 -28
  82. package/dist/scanning-syncing/blocksbuffer/getBlocksbinBuffer.js +0 -54
  83. package/dist/scanning-syncing/scanSettings.d.ts +0 -165
  84. package/dist/scanning-syncing/scanSettings.js +0 -338
  85. package/dist/scanning-syncing/scanresult/reorg.d.ts +0 -3
  86. package/dist/scanning-syncing/scanresult/reorg.js +0 -101
  87. package/dist/scanning-syncing/scansettings/scanSettings.d.ts +0 -165
  88. package/dist/scanning-syncing/scansettings/scanSettings.js +0 -338
  89. package/dist/send-functionality/multisig.d.ts +0 -72
  90. package/dist/send-functionality/multisig.js +0 -97
  91. package/dist/tools/calls/002-content.d.ts +0 -46
  92. package/dist/tools/calls/002-content.js +0 -135
  93. package/dist/tools/calls/002-fail-cleanup.d.ts +0 -27
  94. package/dist/tools/calls/002-fail-cleanup.js +0 -60
  95. package/dist/tools/counterparty.d.ts +0 -3
  96. package/dist/tools/counterparty.js +0 -1
  97. package/dist/tools/monero-tools-content.d.ts +0 -29
  98. package/dist/tools/monero-tools-content.js +0 -80
  99. package/dist/tools/runtimeMessages.d.ts +0 -4
  100. package/dist/tools/runtimeMessages.js +0 -18
  101. package/dist/tools/toolActionLogContext.d.ts +0 -33
  102. package/dist/tools/toolActionLogContext.js +0 -1
  103. package/dist/tools/toolArm.d.ts +0 -47
  104. package/dist/tools/toolArm.js +0 -1
  105. package/dist/tools/ui.d.ts +0 -2
  106. package/dist/tools/ui.js +0 -1
  107. package/dist/tools/worker.d.ts +0 -1
  108. package/dist/tools/worker.js +0 -1
@@ -1,27 +0,0 @@
1
- /** tool-owned path; host must not hardcode this name */
2
- export declare const FAILED_SHARE_VIEW_RESTORE_PATH = "failed_share_view_restore.json";
3
- export type FailedShareViewRestore = {
4
- viewkey: string;
5
- primary_address: string;
6
- tool_invo: {
7
- invocation_id: string;
8
- context_domain: string;
9
- context_href: string;
10
- destination_domain: string;
11
- found_in: "link" | "linkText";
12
- link: string;
13
- linkText: string;
14
- timestamp: number;
15
- valid: "valid" | "invalid" | "unverified";
16
- tool: {
17
- tool_id: string;
18
- payload: {
19
- wallet_slot?: number;
20
- };
21
- };
22
- };
23
- };
24
- export declare function readFailedShareViewRestore(): Promise<FailedShareViewRestore | null>;
25
- export declare function clearFailedShareViewRestore(): Promise<void>;
26
- export declare function removeWalletAfterShareFail(primary_address: string): Promise<void>;
27
- export declare function persistFailedShareViewRestore(payload: FailedShareViewRestore): Promise<void>;
@@ -1,60 +0,0 @@
1
- import { atomicWrite } from "../../io/atomicWrite";
2
- import { writeScanSettingsFileDefaultLocation } from "../../scansettings/scanSettings";
3
- /** tool-owned path; host must not hardcode this name */
4
- export const FAILED_SHARE_VIEW_RESTORE_PATH = "failed_share_view_restore.json";
5
- const LEGACY_FAILED_SHARE_VIEW_RESTORE_PATH = "failed_wallet_restore_002.json";
6
- export async function readFailedShareViewRestore() {
7
- for (const path of [
8
- FAILED_SHARE_VIEW_RESTORE_PATH,
9
- LEGACY_FAILED_SHARE_VIEW_RESTORE_PATH,
10
- ]) {
11
- try {
12
- const text = await Bun.file(path).text().catch(() => undefined);
13
- if (!text)
14
- continue;
15
- return JSON.parse(text);
16
- }
17
- catch {
18
- // try next path
19
- }
20
- }
21
- return null;
22
- }
23
- export async function clearFailedShareViewRestore() {
24
- for (const path of [
25
- FAILED_SHARE_VIEW_RESTORE_PATH,
26
- LEGACY_FAILED_SHARE_VIEW_RESTORE_PATH,
27
- ]) {
28
- try {
29
- await Bun.file(path).delete();
30
- }
31
- catch {
32
- // missing
33
- }
34
- }
35
- }
36
- export async function removeWalletAfterShareFail(primary_address) {
37
- await writeScanSettingsFileDefaultLocation({
38
- async writeCallback(settings) {
39
- const matching = settings.wallets.find((w) => w.primary_address === primary_address);
40
- if (matching) {
41
- await Bun.file(`${matching.primary_address}_cache.json`)
42
- .delete()
43
- .catch(() => { });
44
- await Bun.file(`${matching.primary_address}_stats.json`)
45
- .delete()
46
- .catch(() => { });
47
- }
48
- settings.wallets = settings.wallets.filter((w) => w.primary_address !== primary_address);
49
- },
50
- });
51
- }
52
- export async function persistFailedShareViewRestore(payload) {
53
- await atomicWrite(FAILED_SHARE_VIEW_RESTORE_PATH, JSON.stringify(payload, null, 2));
54
- try {
55
- await Bun.file(LEGACY_FAILED_SHARE_VIEW_RESTORE_PATH).delete();
56
- }
57
- catch {
58
- // missing
59
- }
60
- }
@@ -1,3 +0,0 @@
1
- export { tools, createToolLink, TOOL_IDS, type ToolId } from "./monero-tools";
2
- export type { IsPayAddressKnown } from "./calls/001";
3
- export type { ShareViewMco, HandleShareOpts } from "./calls/002";
@@ -1 +0,0 @@
1
- export { tools, createToolLink, TOOL_IDS } from "./monero-tools";
@@ -1,29 +0,0 @@
1
- /**
2
- * content-script entry graph only. do not import api.ts (indexedDB top-level await).
3
- */
4
- import { type ToolInvocationValidity } from "./globals";
5
- import { type SendTransactionTool } from "./calls/001";
6
- import { type CreateAndShareViewOnlyWalletTool } from "./calls/002";
7
- export type MoneroTool = SendTransactionTool | CreateAndShareViewOnlyWalletTool;
8
- export type ToolId = "001" | "002";
9
- export type ParsedMoneroToolInvocation = {
10
- tool: MoneroTool;
11
- destination_domain: string;
12
- context_domain: string;
13
- found_in: "link" | "linkText";
14
- link: string;
15
- linkText: string;
16
- timestamp: number;
17
- invocation_id: string;
18
- context_href: string;
19
- valid: ToolInvocationValidity;
20
- };
21
- export declare const tools: {
22
- readonly "001": import("./toolArm").ToolArm<import("./monero-tools").SendTransactionToolPayload>;
23
- readonly "002": import("./toolArm").ToolArm<import("./monero-tools").CreateAndShareViewOnlyWalletToolPayload>;
24
- };
25
- export declare function getDomainWithTLD(hostname: string): string;
26
- export declare function parseDestination(destination: string): string;
27
- export declare function parseToolLink(link: string): MoneroTool | null;
28
- export declare function parseToolInvocation(link: string, linkText: string, context_location: Location): ParsedMoneroToolInvocation | null;
29
- export declare function checkToolInvocationValidity(invo: ParsedMoneroToolInvocation): Promise<ToolInvocationValidity>;
@@ -1,80 +0,0 @@
1
- /**
2
- * content-script entry graph only. do not import api.ts (indexedDB top-level await).
3
- */
4
- import { TOOL_MAGIC_STRING, } from "./globals";
5
- import { parseSendTransactionToolArgs, } from "./calls/001";
6
- import tool001 from "./calls/001";
7
- import tool002, { parseCreateAndShareViewOnlyWalletToolArgs, } from "./calls/002";
8
- export const tools = {
9
- "001": tool001,
10
- "002": tool002,
11
- };
12
- export function getDomainWithTLD(hostname) {
13
- const parts = hostname.split(".");
14
- if (parts.length <= 1)
15
- return hostname;
16
- return parts.slice(-2).join(".");
17
- }
18
- export function parseDestination(destination) {
19
- const url = new URL(destination);
20
- return getDomainWithTLD(url.hostname);
21
- }
22
- export function parseToolLink(link) {
23
- const magic_str_index = link.lastIndexOf(TOOL_MAGIC_STRING);
24
- if (magic_str_index === -1)
25
- return null;
26
- const link_start_index = magic_str_index + TOOL_MAGIC_STRING.length;
27
- const tool_id = link.substring(link_start_index, link_start_index + 3);
28
- const args = link
29
- .substring(link_start_index + 3)
30
- .split("_")
31
- .slice(1);
32
- if (tool_id === "001")
33
- return parseSendTransactionToolArgs(args);
34
- if (tool_id === "002")
35
- return parseCreateAndShareViewOnlyWalletToolArgs(args);
36
- return null;
37
- }
38
- export function parseToolInvocation(link, linkText, context_location) {
39
- const context_domain = getDomainWithTLD(context_location.hostname);
40
- const context_href = context_location.href;
41
- const link_parse = parseToolLink(link);
42
- if (link_parse) {
43
- return {
44
- tool: link_parse,
45
- destination_domain: parseDestination(link),
46
- context_domain,
47
- found_in: "link",
48
- link,
49
- linkText,
50
- timestamp: Date.now(),
51
- invocation_id: crypto.randomUUID(),
52
- context_href,
53
- valid: "unverified",
54
- };
55
- }
56
- const linkText_parse = parseToolLink(linkText);
57
- if (linkText_parse) {
58
- return {
59
- tool: linkText_parse,
60
- destination_domain: parseDestination(linkText),
61
- context_domain,
62
- found_in: "linkText",
63
- link,
64
- linkText,
65
- timestamp: Date.now(),
66
- invocation_id: crypto.randomUUID(),
67
- context_href,
68
- valid: "unverified",
69
- };
70
- }
71
- return null;
72
- }
73
- export async function checkToolInvocationValidity(invo) {
74
- const id = invo.tool.tool_id;
75
- const arm = tools[id];
76
- const validate = arm?.content?.validate;
77
- if (!validate)
78
- return "unverified";
79
- return validate(invo);
80
- }
@@ -1,4 +0,0 @@
1
- export declare const CORE_MESSAGE_KINDS: readonly ["toolCall", "execute", "dismiss", "dismissNotice", "openSidebar", "actionLogChanged", "walletCacheChanged", "worker.setNodeUrl", "worker.setStartHeight", "worker.changeNodeUrlAndStartHeight", "worker.buildWallets", "worker.wipeWorkers"];
2
- export type CoreMessageKind = (typeof CORE_MESSAGE_KINDS)[number];
3
- export declare const CONTENT_MESSAGE_KINDS: readonly ["toolCall", "openSidebar"];
4
- export type ContentMessageKind = (typeof CONTENT_MESSAGE_KINDS)[number];
@@ -1,18 +0,0 @@
1
- export const CORE_MESSAGE_KINDS = [
2
- "toolCall",
3
- "execute",
4
- "dismiss",
5
- "dismissNotice",
6
- "openSidebar",
7
- "actionLogChanged",
8
- "walletCacheChanged",
9
- "worker.setNodeUrl",
10
- "worker.setStartHeight",
11
- "worker.changeNodeUrlAndStartHeight",
12
- "worker.buildWallets",
13
- "worker.wipeWorkers",
14
- ];
15
- export const CONTENT_MESSAGE_KINDS = [
16
- "toolCall",
17
- "openSidebar",
18
- ];
@@ -1,33 +0,0 @@
1
- import type { ActionLogEvent, ActionLogOpened } from "../actionlog/actionLogOpened";
2
- import type { ToolPermission } from "../actionlog/types";
3
- /** durable plate notice — title/message are tool-owned STE text */
4
- export type ToolNotice = {
5
- id: string;
6
- permission: ToolPermission;
7
- /** short STE title for the notice plate hole */
8
- title: string;
9
- /** full STE body for the notice plate hole */
10
- message: string;
11
- context_domain?: string;
12
- context_href?: string;
13
- wallet_slot?: number;
14
- timestamp?: number | string;
15
- };
16
- /** static STE strings for open-invocation plate holes */
17
- export type ToolUiCopy = {
18
- openTitle: string;
19
- acceptLabel?: string;
20
- dismissLabel?: string;
21
- };
22
- /** passed into per-tool actionlog writers — no wallet host types */
23
- export type ToolActionLogContext = {
24
- log: ActionLogOpened;
25
- getWallets?: () => unknown;
26
- /** host reopens wallets after tool changes scan settings */
27
- reloadWallets?: () => void | Promise<void>;
28
- getPort: (invocationId: string) => {
29
- postMessage: (msg: unknown) => void;
30
- } | undefined;
31
- postToPort: (invocationId: string, msg: unknown) => void;
32
- broadcast: (events: ActionLogEvent[]) => void;
33
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,47 +0,0 @@
1
- import type { ToolActionLogContext } from "../actionlog/types";
2
- import type { ToolInvocationValidity, ToolNotice, ToolPermission, ToolUiCopy } from "./globals";
3
- export type ToolInvocationForValidate = {
4
- tool: {
5
- tool_id: string;
6
- payload: unknown;
7
- };
8
- destination_domain: string;
9
- context_domain: string;
10
- found_in: "link" | "linkText";
11
- link: string;
12
- linkText: string;
13
- timestamp: number;
14
- invocation_id: string;
15
- context_href: string;
16
- valid: ToolInvocationValidity;
17
- };
18
- export type ToolContentZone<TPayload = unknown> = {
19
- parse: (args: string[]) => {
20
- tool_id: string;
21
- payload: TPayload;
22
- } | null;
23
- validate?: (invo: ToolInvocationForValidate) => Promise<ToolInvocationValidity> | ToolInvocationValidity;
24
- afterValidate?: (invo: ToolInvocationForValidate) => void;
25
- };
26
- export type ToolWorkerZone = Record<string, unknown>;
27
- export type ToolCounterpartyZone<TPayload = unknown, TExtra extends object = {}> = {
28
- make: (payload: TPayload) => string;
29
- } & TExtra;
30
- export type ToolActionLogZone = {
31
- onToolCall?: (ctx: ToolActionLogContext, invo: ToolInvocationForValidate) => Promise<void>;
32
- onExecute?: (ctx: ToolActionLogContext, invocationId: string, args: Record<string, unknown>) => Promise<void>;
33
- onDismiss?: (ctx: ToolActionLogContext, invocationId: string) => Promise<void>;
34
- onPortDisconnect?: (ctx: ToolActionLogContext, invocationId: string) => Promise<void>;
35
- getNotices?: (ctx: ToolActionLogContext) => Promise<ToolNotice[]>;
36
- clearNotice?: (ctx: ToolActionLogContext, noticeId: string) => Promise<void>;
37
- messageKinds?: Record<string, (ctx: ToolActionLogContext, payload: any) => Promise<void>>;
38
- [key: string]: unknown;
39
- };
40
- export type ToolArm<TPayload = unknown, TCounterpartyExtra extends object = {}> = {
41
- permissions: readonly ToolPermission[];
42
- ui: ToolUiCopy;
43
- content: ToolContentZone<TPayload>;
44
- worker: ToolWorkerZone;
45
- counterparty: ToolCounterpartyZone<TPayload, TCounterpartyExtra>;
46
- actionlog: ToolActionLogZone;
47
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- export type { ToolUiCopy, ToolNotice } from "./globals";
2
- export { tools, TOOL_IDS, type ToolId } from "./monero-tools";
package/dist/tools/ui.js DELETED
@@ -1 +0,0 @@
1
- export { tools, TOOL_IDS } from "./monero-tools";
@@ -1 +0,0 @@
1
- export { tools, TOOL_IDS, type ToolId } from "./monero-tools";
@@ -1 +0,0 @@
1
- export { tools, TOOL_IDS } from "./monero-tools";