@spirobel/monero-wallet-api 0.5.5 → 0.6.1

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 (101) hide show
  1. package/dist/actionlog/actionLogOpened.d.ts +96 -1
  2. package/dist/actionlog/actionLogOpened.js +386 -1
  3. package/dist/actionlog/actionLogTypes.d.ts +114 -0
  4. package/dist/actionlog/actionLogTypes.js +198 -0
  5. package/dist/actionlog/backend/idbBackend.d.ts +13 -0
  6. package/dist/actionlog/backend/idbBackend.js +109 -0
  7. package/dist/actionlog/backend/jsonlBackend.d.ts +19 -0
  8. package/dist/actionlog/backend/jsonlBackend.js +110 -0
  9. package/dist/actionlog/backend/memoryBackend.d.ts +11 -0
  10. package/dist/actionlog/backend/memoryBackend.js +31 -0
  11. package/dist/actionlog/backend/sqliteBackend.d.ts +14 -0
  12. package/dist/actionlog/backend/sqliteBackend.js +96 -0
  13. package/dist/actionlog/backend.d.ts +12 -0
  14. package/dist/actionlog/backend.js +1 -0
  15. package/dist/actionlog/idbBackend.d.ts +19 -0
  16. package/dist/actionlog/idbBackend.js +98 -0
  17. package/dist/actionlog/jsonlBackend.d.ts +19 -0
  18. package/dist/actionlog/jsonlBackend.js +75 -0
  19. package/dist/actionlog/memoryBackend.d.ts +14 -0
  20. package/dist/actionlog/memoryBackend.js +38 -0
  21. package/dist/actionlog/openMaps.d.ts +11 -0
  22. package/dist/actionlog/openMaps.js +32 -0
  23. package/dist/actionlog/sqliteBackend.d.ts +18 -0
  24. package/dist/actionlog/sqliteBackend.js +105 -0
  25. package/dist/actionlog/toolContext.d.ts +36 -0
  26. package/dist/actionlog/toolContext.js +1 -0
  27. package/dist/actionlog/types.d.ts +62 -0
  28. package/dist/actionlog/types.js +62 -0
  29. package/dist/io/logging.js +1 -1
  30. package/dist/multisig/escrow.js +1 -1
  31. package/dist/scanning-syncing/backgroundWorker.js +1 -1
  32. package/dist/scanning-syncing/blocksbuffer/blocksBufferFetchLoop.d.ts +1 -1
  33. package/dist/scanning-syncing/blocksbuffer/blocksBufferFetchLoop.js +1 -1
  34. package/dist/scanning-syncing/blocksbuffer/blocksbufferCoordination.d.ts +1 -1
  35. package/dist/scanning-syncing/blocksbuffer/blocksbufferCoordination.js +2 -2
  36. package/dist/scanning-syncing/connectionStatus.d.ts +3 -1
  37. package/dist/scanning-syncing/connectionStatus.js +38 -3
  38. package/dist/scanning-syncing/connectionStatusOpened.d.ts +1 -1
  39. package/dist/scanning-syncing/connectionStatusOpened.js +2 -11
  40. package/dist/scanning-syncing/openWallet.js +1 -1
  41. package/dist/scanning-syncing/scanresult/computeKeyImage.d.ts +1 -1
  42. package/dist/scanning-syncing/scanresult/scanCache.d.ts +6 -2
  43. package/dist/scanning-syncing/scanresult/scanCache.js +12 -3
  44. package/dist/scanning-syncing/scanresult/scanCacheOpened.d.ts +47 -2
  45. package/dist/scanning-syncing/scanresult/scanCacheOpened.js +328 -47
  46. package/dist/scanning-syncing/scanresult/scanCoordination.d.ts +3 -2
  47. package/dist/scanning-syncing/scanresult/scanCoordination.js +42 -6
  48. package/dist/scanning-syncing/scanresult/scanLoop.d.ts +1 -1
  49. package/dist/scanning-syncing/scanresult/scanLoop.js +1 -1
  50. package/dist/scanning-syncing/scanresult/scanResult.d.ts +1 -1
  51. package/dist/scanning-syncing/scanresult/scanResult.js +18 -13
  52. package/dist/scanning-syncing/scanresult/scanStats.d.ts +1 -1
  53. package/dist/scanning-syncing/scanresult/scanStats.js +9 -6
  54. package/dist/scanning-syncing/worker-entrypoints/worker.js +1 -1
  55. package/dist/scanning-syncing/worker-mains/cpubound-main.js +1 -1
  56. package/dist/scanning-syncing/worker-mains/multisig-main.d.ts +1 -1
  57. package/dist/scanning-syncing/worker-mains/multisig-main.js +1 -1
  58. package/dist/scanning-syncing/worker-mains/worker.js +1 -1
  59. package/dist/scansettings/scanSettings.js +1 -1
  60. package/dist/scansettings/scanSettingsOpened.d.ts +1 -1
  61. package/dist/scansettings/scanSettingsOpened.js +1 -1
  62. package/dist/send-functionality/inputSelection.d.ts +1 -1
  63. package/dist/send-functionality/transactionBuilding.d.ts +1 -1
  64. package/dist/tools/calls/001.d.ts +20 -0
  65. package/dist/tools/calls/001.js +236 -0
  66. package/dist/tools/calls/002-content.d.ts +46 -0
  67. package/dist/tools/calls/002-content.js +135 -0
  68. package/dist/tools/calls/002-fail-cleanup.d.ts +27 -0
  69. package/dist/tools/calls/002-fail-cleanup.js +60 -0
  70. package/dist/tools/calls/002.d.ts +64 -0
  71. package/dist/tools/calls/002.js +353 -0
  72. package/dist/tools/content.d.ts +22 -0
  73. package/dist/tools/content.js +41 -0
  74. package/dist/tools/counterparty.d.ts +3 -0
  75. package/dist/tools/counterparty.js +1 -0
  76. package/dist/tools/download-public-suffix.d.ts +1 -0
  77. package/dist/tools/download-public-suffix.js +20 -0
  78. package/dist/tools/globals.d.ts +196 -0
  79. package/dist/tools/globals.js +14 -0
  80. package/dist/tools/monero-tools-content.d.ts +29 -0
  81. package/dist/tools/monero-tools-content.js +80 -0
  82. package/dist/tools/monero-tools.d.ts +27 -52
  83. package/dist/tools/monero-tools.js +127 -222
  84. package/dist/tools/public-suffix-list.d.ts +1 -0
  85. package/dist/tools/public-suffix-list.js +10336 -0
  86. package/dist/tools/runtimeMessages.d.ts +4 -0
  87. package/dist/tools/runtimeMessages.js +18 -0
  88. package/dist/tools/toolActionLogContext.d.ts +33 -0
  89. package/dist/tools/toolActionLogContext.js +1 -0
  90. package/dist/tools/toolArm.d.ts +47 -0
  91. package/dist/tools/toolArm.js +1 -0
  92. package/dist/tools/ui.d.ts +2 -0
  93. package/dist/tools/ui.js +1 -0
  94. package/dist/tools/worker.d.ts +1 -0
  95. package/dist/tools/worker.js +1 -0
  96. package/dist/viewpair/ViewPair.d.ts +3 -3
  97. package/dist/viewpair/ViewPair.js +2 -2
  98. package/dist/wasm-processing/wasmFile.js +2 -2
  99. package/dist/{api.d.ts → xmr3.d.ts} +4 -0
  100. package/dist/{api.js → xmr3.js} +3 -0
  101. package/package.json +13 -6
@@ -0,0 +1,4 @@
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];
@@ -0,0 +1,18 @@
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
+ ];
@@ -0,0 +1,33 @@
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
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,47 @@
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
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export type { ToolUiCopy, ToolNotice } from "./globals";
2
+ export { tools, TOOL_IDS, type ToolId } from "./monero-tools";
@@ -0,0 +1 @@
1
+ export { tools, TOOL_IDS } from "./monero-tools";
@@ -0,0 +1 @@
1
+ export { tools, TOOL_IDS, type ToolId } from "./monero-tools";
@@ -0,0 +1 @@
1
+ export { tools, TOOL_IDS } from "./monero-tools";
@@ -6,7 +6,7 @@ import { type ScanCache } from "../scanning-syncing/scanresult/scanCache";
6
6
  import { type MakeTransactionParams, type UnsignedTransaction } from "../send-functionality/transactionBuilding";
7
7
  import { WasmProcessor } from "../wasm-processing/wasmProcessor";
8
8
  import { type NETWORKS } from "../node-interaction/nodeUrl";
9
- import { type GetBlockHeadersRangeParams } from "../api";
9
+ import { type GetBlockHeadersRangeParams } from "../xmr3";
10
10
  /**
11
11
  * This class is useful to interact with Moneros DaemonRpc binary requests in a convenient way.
12
12
  * (similar to how you would interact with a REST api that gives you json back.)
@@ -66,7 +66,7 @@ export declare class ViewPair extends WasmProcessor {
66
66
  * @param getBlocksBinResponseBuffer the raw binary response from the get_blocks.bin endpoint
67
67
  * @returns metadata about the loaded blocks (new_height, daemon_height, status, block_infos)
68
68
  */
69
- loadGetBlocksBinResponse(getBlocksBinResponseBuffer: Uint8Array): Promise<import("../api").GetBlocksResultMeta>;
69
+ loadGetBlocksBinResponse(getBlocksBinResponseBuffer: Uint8Array): Promise<import("../xmr3").GetBlocksResultMeta>;
70
70
  /**
71
71
  * scan one block from a getblocks.bin response that was loaded into wasm memory.
72
72
  * call loadGetBlocksBinResponse first to populate the response in the wasm module.
@@ -134,7 +134,7 @@ export declare class ViewPair extends WasmProcessor {
134
134
  * @param params The parameters including start_height, end_height, and optional fill_pow_hash.
135
135
  * @returns The result object with headers, status, etc. Throws if the range is invalid:(end_height > daemonheight)
136
136
  */
137
- getBlockHeadersRange(params: GetBlockHeadersRangeParams): Promise<import("../api").GetBlockHeadersRange>;
137
+ getBlockHeadersRange(params: GetBlockHeadersRangeParams): Promise<import("../xmr3").GetBlockHeadersRange>;
138
138
  /**
139
139
  * Fetch general information about the Monero daemon.
140
140
  * @link https://docs.getmonero.org/rpc-library/monerod-rpc/#get_info
@@ -7,8 +7,8 @@ import { makeSweepTransaction, makeTransaction, } from "../send-functionality/tr
7
7
  import { monero_wallet_api_wasm } from "../wasm-processing/wasmFile";
8
8
  import { WasmProcessor } from "../wasm-processing/wasmProcessor";
9
9
  import { LOCAL_NODE_DEFAULT_URL, } from "../node-interaction/nodeUrl";
10
- import { get_block_headers_range, get_info, } from "../api";
11
- import { readWalletFromScanSettings } from "../api";
10
+ import { get_block_headers_range, get_info, } from "../xmr3";
11
+ import { readWalletFromScanSettings } from "../xmr3";
12
12
  import { sleep } from "../io/sleep";
13
13
  /**
14
14
  * This class is useful to interact with Moneros DaemonRpc binary requests in a convenient way.
@@ -8,6 +8,6 @@ var frost_dkg_wasm = new Uint8Array(atob(dkg_source).split("").map(function(c) {
8
8
  return c.charCodeAt(0);
9
9
  }));
10
10
  export {
11
- monero_wallet_api_wasm,
12
- frost_dkg_wasm
11
+ frost_dkg_wasm,
12
+ monero_wallet_api_wasm
13
13
  };
@@ -8,6 +8,7 @@ export * from "./node-interaction/jsonEndpoints";
8
8
  export * from "./io/readDir";
9
9
  export * from "./io/atomicWrite";
10
10
  export * from "./io/sleep";
11
+ export { LOGGING_FUNCTIONS, type PossibleLogs, type LogSetting, } from "./io/logging";
11
12
  export { signTransaction, parseAddress, type ParsedAddress, type ParseAddressError, } from "./send-functionality/transactionBuilding";
12
13
  export { computeKeyImage } from "./scanning-syncing/scanresult/computeKeyImage";
13
14
  export * from "./multisig/multisig";
@@ -21,6 +22,7 @@ export * from "./scanning-syncing/blocksbuffer/blocksBufferFetchLoop";
21
22
  export * from "./scanning-syncing/blocksbuffer/blocksbufferCoordination";
22
23
  export * from "./scanning-syncing/connectionStatus";
23
24
  export { ConnectionStatusOpened } from "./scanning-syncing/connectionStatusOpened";
25
+ export { ActionLogOpened, type ActionLogOpenedCreateOptions, type ActionLogBackendKind, type ActionLogEvent, type ActionLogEventType, type ActionLogStage, Invocation, type InvocationDisplayStatus, type InvocationState, type ToolPermission, type ToolNotice, type ToolUiCopy, type ToolWorkerContext, } from "./actionlog/actionLogOpened";
24
26
  export * from "./scansettings/scanSettings";
25
27
  export { ScanSettingsOpened } from "./scansettings/scanSettingsOpened";
26
28
  export * from "./scanning-syncing/scanresult/scanResult";
@@ -33,3 +35,5 @@ export * from "./keypairs-seeds/keypairs";
33
35
  export * from "./send-functionality/conversion";
34
36
  export * from "./send-functionality/inputSelection";
35
37
  export * from "./tools/monero-tools";
38
+ export type { ToolArm, ToolContentZone, ToolCounterpartyZone, ToolWorkerZone, ToolInvocationForValidate, } from "./tools/globals";
39
+ export { sendToBackground } from "./tools/globals";
@@ -7,6 +7,7 @@ export * from "./node-interaction/jsonEndpoints";
7
7
  export * from "./io/readDir";
8
8
  export * from "./io/atomicWrite";
9
9
  export * from "./io/sleep";
10
+ export { LOGGING_FUNCTIONS, } from "./io/logging";
10
11
  export { signTransaction, parseAddress, } from "./send-functionality/transactionBuilding";
11
12
  export { computeKeyImage } from "./scanning-syncing/scanresult/computeKeyImage";
12
13
  export * from "./multisig/multisig";
@@ -20,6 +21,7 @@ export * from "./scanning-syncing/blocksbuffer/blocksBufferFetchLoop";
20
21
  export * from "./scanning-syncing/blocksbuffer/blocksbufferCoordination";
21
22
  export * from "./scanning-syncing/connectionStatus";
22
23
  export { ConnectionStatusOpened } from "./scanning-syncing/connectionStatusOpened";
24
+ export { ActionLogOpened, Invocation, } from "./actionlog/actionLogOpened";
23
25
  export * from "./scansettings/scanSettings";
24
26
  export { ScanSettingsOpened } from "./scansettings/scanSettingsOpened";
25
27
  export * from "./scanning-syncing/scanresult/scanResult";
@@ -32,3 +34,4 @@ export * from "./keypairs-seeds/keypairs";
32
34
  export * from "./send-functionality/conversion";
33
35
  export * from "./send-functionality/inputSelection";
34
36
  export * from "./tools/monero-tools";
37
+ export { sendToBackground } from "./tools/globals";
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@spirobel/monero-wallet-api",
3
- "version": "0.5.5",
4
- "main": "dist/api.js",
5
- "module": "dist/api.js",
3
+ "version": "0.6.1",
4
+ "main": "dist/xmr3.js",
5
+ "module": "dist/xmr3.js",
6
6
  "devDependencies": {
7
7
  "@types/bun": "latest"
8
8
  },
@@ -11,14 +11,21 @@
11
11
  },
12
12
  "exports": {
13
13
  ".": {
14
- "types": "./dist/api.d.ts",
15
- "import": "./dist/api.js"
14
+ "types": "./dist/xmr3.d.ts",
15
+ "import": "./dist/xmr3.js"
16
16
  },
17
17
  "./tools": {
18
18
  "types": "./dist/tools/monero-tools.d.ts",
19
19
  "import": "./dist/tools/monero-tools.js"
20
+ },
21
+ "./tools/content": {
22
+ "types": "./dist/tools/content.d.ts",
23
+ "import": "./dist/tools/content.js"
20
24
  }
21
25
  },
26
+ "browser": {
27
+ "./dist/actionlog/backend/sqliteBackend.js": false
28
+ },
22
29
  "files": ["dist"],
23
30
  "license": "MIT",
24
31
  "publishConfig": {
@@ -47,7 +54,7 @@
47
54
  "clean": "rm -rf ./dist"
48
55
  },
49
56
  "type": "module",
50
- "types": "dist/api.d.ts",
57
+ "types": "dist/xmr3.d.ts",
51
58
  "dependencies": {
52
59
  "@noble/curves": "2.2.0",
53
60
  "@noble/hashes": "2.2.0"