@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
@@ -1,4 +1,4 @@
1
- import { CatastrophicReorgError } from "../../api";
1
+ import { CatastrophicReorgError } from "../../xmr3";
2
2
  import { computeKeyImage } from "./computeKeyImage";
3
3
  import { log } from "../../io/logging";
4
4
  import { mergeRanges, findRange, findRangeThrows } from "./scanCache";
@@ -39,7 +39,7 @@ export async function processScanResult(params) {
39
39
  reverted_spends: [],
40
40
  };
41
41
  }
42
- else {
42
+ else if (!cache.reorg_info.split_heights.some((s) => s.block_hash === split_height.block_hash)) {
43
43
  cache.reorg_info.split_heights.push(split_height);
44
44
  }
45
45
  // First, collect reverted spends from all outputs (before any removals)
@@ -56,11 +56,14 @@ export async function processScanResult(params) {
56
56
  for (const [id, old_output_state] of removed_outputs) {
57
57
  // 1. find key_image of output to be removed (as it was reorged)
58
58
  const [key_image] = Object.entries(cache.own_key_images).find(([own_key_image, globalid]) => globalid === id) || [""]; // if this is viewonly the key_image will be empty
59
- cache.reorg_info.removed_outputs.push({
60
- old_output_state,
61
- key_image,
62
- split_height,
63
- });
59
+ if (!cache.reorg_info.removed_outputs.some((r) => r.old_output_state.index_on_blockchain ===
60
+ old_output_state.index_on_blockchain)) {
61
+ cache.reorg_info.removed_outputs.push({
62
+ old_output_state,
63
+ key_image,
64
+ split_height,
65
+ });
66
+ }
64
67
  // 2. remove from outputs and own_key_images
65
68
  delete cache.outputs[id];
66
69
  delete cache.own_key_images[key_image];
@@ -72,11 +75,14 @@ export async function processScanResult(params) {
72
75
  for (const [id, old_output_state_pointer] of reverted_outputs) {
73
76
  const [key_image] = Object.entries(cache.own_key_images).find(([own_key_image, globalid]) => globalid === id) || [""]; // if this is viewonly the key_image will be empty
74
77
  const old_output_state = Object.assign({}, old_output_state_pointer);
75
- cache.reorg_info.reverted_spends.push({
76
- old_output_state,
77
- key_image, // in this case key_image only used here, does not get removed
78
- split_height,
79
- });
78
+ if (!cache.reorg_info.reverted_spends.some((r) => r.old_output_state.index_on_blockchain ===
79
+ old_output_state.index_on_blockchain)) {
80
+ cache.reorg_info.reverted_spends.push({
81
+ old_output_state,
82
+ key_image, // in this case key_image only used here, does not get removed
83
+ split_height,
84
+ });
85
+ }
80
86
  // remove spend info from original cache (if output still exists
81
87
  // it may have been deleted above in the removed_outputs loop)
82
88
  if (cache.outputs[id]) {
@@ -226,7 +232,6 @@ export function outputStatus(output, cache, current_height) {
226
232
  if (unlock_height > current_height) {
227
233
  return { status: "pending", unlock_height };
228
234
  }
229
- // TODO: check that that output is not txlog input indeces
230
235
  return { status: "spendable" };
231
236
  }
232
237
  export function spendable(output, cache, current_height) {
@@ -1,4 +1,4 @@
1
- import { ViewPair, type Output } from "../../api";
1
+ import { ViewPair, type Output } from "../../xmr3";
2
2
  import type { ScanCache, Subaddress, TxLog } from "./scanCache";
3
3
  import { type OutputStatus } from "./scanResult";
4
4
  export type WriteStatsFileParams = {
@@ -1,5 +1,5 @@
1
1
  import { stat } from "fs";
2
- import { atomicWrite, ViewPair } from "../../api";
2
+ import { atomicWrite, ViewPair } from "../../xmr3";
3
3
  import { outputStatus } from "./scanResult";
4
4
  export async function writeStatsFileDefaultLocation(params) {
5
5
  let stats = await readStatsFileDefaultLocation(params.primary_address, params.pathPrefix);
@@ -120,16 +120,19 @@ export function processFoundTransactions(cache, stats, current_height) {
120
120
  }
121
121
  // handle spent case
122
122
  if (output.spent_in_tx_hash) {
123
- const spent_utxo_value = cache.pending_spent_utxos
124
- ? cache.pending_spent_utxos[output.index_on_blockchain]
125
- : null;
126
- const txlog = cache.tx_logs && spent_utxo_value
127
- ? cache.tx_logs[spent_utxo_value]
123
+ const spentIndex = cache.pending_spent_utxos
124
+ ? cache.pending_spent_utxos[String(output.index_on_blockchain)]
125
+ : undefined;
126
+ // index 0 is a real log. do not treat it as missing.
127
+ const txlog = cache.tx_logs && spentIndex !== undefined
128
+ ? cache.tx_logs[spentIndex]
128
129
  : undefined;
129
130
  const spentTx = stats.found_transactions[output.spent_in_tx_hash];
130
131
  if (spentTx) {
131
132
  spentTx.amount -= output.amount;
132
133
  spentTx.inputs.push(output);
134
+ if (!spentTx.txlog && txlog)
135
+ spentTx.txlog = txlog;
133
136
  }
134
137
  else {
135
138
  stats.found_transactions[output.spent_in_tx_hash] = {