@bsv/wallet-toolbox 2.1.25 → 2.1.27

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 (206) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +8 -17
  3. package/docs/client.md +1671 -989
  4. package/docs/monitor.md +34 -19
  5. package/docs/services.md +303 -279
  6. package/docs/setup.md +24 -24
  7. package/docs/storage.md +864 -199
  8. package/docs/wallet.md +5285 -10988
  9. package/out/src/Wallet.d.ts +46 -2
  10. package/out/src/Wallet.d.ts.map +1 -1
  11. package/out/src/Wallet.js +65 -4
  12. package/out/src/Wallet.js.map +1 -1
  13. package/out/src/__tests/CWIStyleWalletManager.test.js +3 -2
  14. package/out/src/__tests/CWIStyleWalletManager.test.js.map +1 -1
  15. package/out/src/__tests/ShamirWalletManager.test.js +4 -0
  16. package/out/src/__tests/ShamirWalletManager.test.js.map +1 -1
  17. package/out/src/__tests/WalletPermissionsManager.callbacks.test.js +9 -17
  18. package/out/src/__tests/WalletPermissionsManager.callbacks.test.js.map +1 -1
  19. package/out/src/__tests/WalletPermissionsManager.checks.test.js +4 -4
  20. package/out/src/__tests/WalletPermissionsManager.checks.test.js.map +1 -1
  21. package/out/src/__tests/WalletPermissionsManager.encryption.test.js +8 -8
  22. package/out/src/__tests/WalletPermissionsManager.encryption.test.js.map +1 -1
  23. package/out/src/__tests/WalletPermissionsManager.fixtures.d.ts +2 -1
  24. package/out/src/__tests/WalletPermissionsManager.fixtures.d.ts.map +1 -1
  25. package/out/src/__tests/WalletPermissionsManager.fixtures.js +7 -5
  26. package/out/src/__tests/WalletPermissionsManager.fixtures.js.map +1 -1
  27. package/out/src/__tests/WalletPermissionsManager.flows.test.js +14 -14
  28. package/out/src/__tests/WalletPermissionsManager.flows.test.js.map +1 -1
  29. package/out/src/__tests/WalletPermissionsManager.initialization.test.js +4 -4
  30. package/out/src/__tests/WalletPermissionsManager.initialization.test.js.map +1 -1
  31. package/out/src/__tests/WalletPermissionsManager.pmodules.test.js +4 -4
  32. package/out/src/__tests/WalletPermissionsManager.pmodules.test.js.map +1 -1
  33. package/out/src/__tests/WalletPermissionsManager.proxying.test.js +6 -5
  34. package/out/src/__tests/WalletPermissionsManager.proxying.test.js.map +1 -1
  35. package/out/src/__tests/WalletPermissionsManager.tokens.test.js +2 -1
  36. package/out/src/__tests/WalletPermissionsManager.tokens.test.js.map +1 -1
  37. package/out/src/entropy/EntropyCollector.js.map +1 -1
  38. package/out/src/mockchain/MockChainMigrations.d.ts.map +1 -1
  39. package/out/src/mockchain/MockChainStorage.js +3 -3
  40. package/out/src/mockchain/MockChainStorage.js.map +1 -1
  41. package/out/src/mockchain/MockMiner.js +1 -1
  42. package/out/src/mockchain/MockMiner.js.map +1 -1
  43. package/out/src/mockchain/MockServices.js +14 -13
  44. package/out/src/mockchain/MockServices.js.map +1 -1
  45. package/out/src/monitor/Monitor.js +8 -6
  46. package/out/src/monitor/Monitor.js.map +1 -1
  47. package/out/src/monitor/MonitorDaemon.d.ts.map +1 -1
  48. package/out/src/monitor/MonitorDaemon.js +11 -13
  49. package/out/src/monitor/MonitorDaemon.js.map +1 -1
  50. package/out/src/sdk/PrivilegedKeyManager.d.ts.map +1 -1
  51. package/out/src/sdk/PrivilegedKeyManager.js +6 -3
  52. package/out/src/sdk/PrivilegedKeyManager.js.map +1 -1
  53. package/out/src/sdk/WalletError.d.ts.map +1 -1
  54. package/out/src/sdk/WalletError.js +19 -18
  55. package/out/src/sdk/WalletError.js.map +1 -1
  56. package/out/src/sdk/WalletErrorFromJson.js +1 -1
  57. package/out/src/sdk/WalletErrorFromJson.js.map +1 -1
  58. package/out/src/sdk/WalletStorage.interfaces.d.ts +59 -59
  59. package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
  60. package/out/src/services/ServiceCollection.d.ts.map +1 -1
  61. package/out/src/services/ServiceCollection.js +3 -4
  62. package/out/src/services/ServiceCollection.js.map +1 -1
  63. package/out/src/services/Services.d.ts.map +1 -1
  64. package/out/src/services/Services.js +27 -25
  65. package/out/src/services/Services.js.map +1 -1
  66. package/out/src/storage/StorageIdb.d.ts.map +1 -1
  67. package/out/src/storage/StorageIdb.js +99 -94
  68. package/out/src/storage/StorageIdb.js.map +1 -1
  69. package/out/src/storage/StorageKnex.d.ts +1 -1
  70. package/out/src/storage/StorageKnex.d.ts.map +1 -1
  71. package/out/src/storage/StorageKnex.js +159 -156
  72. package/out/src/storage/StorageKnex.js.map +1 -1
  73. package/out/src/storage/StorageProvider.d.ts.map +1 -1
  74. package/out/src/storage/StorageProvider.js +35 -31
  75. package/out/src/storage/StorageProvider.js.map +1 -1
  76. package/out/src/storage/StorageReader.js +7 -7
  77. package/out/src/storage/StorageReader.js.map +1 -1
  78. package/out/src/storage/StorageReaderWriter.d.ts +0 -1
  79. package/out/src/storage/StorageReaderWriter.d.ts.map +1 -1
  80. package/out/src/storage/StorageReaderWriter.js +0 -3
  81. package/out/src/storage/StorageReaderWriter.js.map +1 -1
  82. package/out/src/storage/StorageSyncReader.js +1 -1
  83. package/out/src/storage/StorageSyncReader.js.map +1 -1
  84. package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
  85. package/out/src/storage/WalletStorageManager.js +22 -21
  86. package/out/src/storage/WalletStorageManager.js.map +1 -1
  87. package/out/src/storage/index.all.d.ts +3 -0
  88. package/out/src/storage/index.all.d.ts.map +1 -1
  89. package/out/src/storage/index.all.js +3 -0
  90. package/out/src/storage/index.all.js.map +1 -1
  91. package/out/src/storage/index.client.d.ts +3 -0
  92. package/out/src/storage/index.client.d.ts.map +1 -1
  93. package/out/src/storage/index.client.js +3 -0
  94. package/out/src/storage/index.client.js.map +1 -1
  95. package/out/src/storage/index.mobile.d.ts +3 -0
  96. package/out/src/storage/index.mobile.d.ts.map +1 -1
  97. package/out/src/storage/index.mobile.js +3 -0
  98. package/out/src/storage/index.mobile.js.map +1 -1
  99. package/out/src/storage/portable/index.d.ts +55 -0
  100. package/out/src/storage/portable/index.d.ts.map +1 -0
  101. package/out/src/storage/portable/index.js +830 -0
  102. package/out/src/storage/portable/index.js.map +1 -0
  103. package/out/src/storage/storageProviderHelpers.js +2 -2
  104. package/out/src/storage/storageProviderHelpers.js.map +1 -1
  105. package/out/src/utility/Format.d.ts.map +1 -1
  106. package/out/src/utility/Format.js +10 -45
  107. package/out/src/utility/Format.js.map +1 -1
  108. package/out/src/utility/ScriptTemplateBRC29.d.ts.map +1 -1
  109. package/out/src/utility/ScriptTemplateBRC29.js +3 -2
  110. package/out/src/utility/ScriptTemplateBRC29.js.map +1 -1
  111. package/out/src/utility/brc114ActionTimeLabels.js +1 -1
  112. package/out/src/utility/brc114ActionTimeLabels.js.map +1 -1
  113. package/out/src/utility/identityUtils.d.ts +12 -6
  114. package/out/src/utility/identityUtils.d.ts.map +1 -1
  115. package/out/src/utility/identityUtils.js +83 -35
  116. package/out/src/utility/identityUtils.js.map +1 -1
  117. package/out/src/utility/index.all.d.ts +1 -0
  118. package/out/src/utility/index.all.d.ts.map +1 -1
  119. package/out/src/utility/index.all.js +1 -0
  120. package/out/src/utility/index.all.js.map +1 -1
  121. package/out/src/utility/index.client.d.ts +1 -0
  122. package/out/src/utility/index.client.d.ts.map +1 -1
  123. package/out/src/utility/index.client.js +1 -0
  124. package/out/src/utility/index.client.js.map +1 -1
  125. package/out/src/utility/stampLog.js +3 -3
  126. package/out/src/utility/stampLog.js.map +1 -1
  127. package/out/src/utility/utilityHelpers.buffer.js +1 -1
  128. package/out/src/utility/utilityHelpers.buffer.js.map +1 -1
  129. package/out/src/utility/utilityHelpers.d.ts.map +1 -1
  130. package/out/src/utility/utilityHelpers.js +2 -2
  131. package/out/src/utility/utilityHelpers.js.map +1 -1
  132. package/out/src/wab-client/WABClient.d.ts +2 -2
  133. package/out/src/wab-client/WABClient.d.ts.map +1 -1
  134. package/package.json +2 -2
  135. package/out/src/storage/schema/__tests/v7Backfill.runner.test.d.ts +0 -2
  136. package/out/src/storage/schema/__tests/v7Backfill.runner.test.d.ts.map +0 -1
  137. package/out/src/storage/schema/__tests/v7Backfill.runner.test.js +0 -148
  138. package/out/src/storage/schema/__tests/v7Backfill.runner.test.js.map +0 -1
  139. package/out/src/storage/schema/__tests/v7Backfill.test.d.ts +0 -2
  140. package/out/src/storage/schema/__tests/v7Backfill.test.d.ts.map +0 -1
  141. package/out/src/storage/schema/__tests/v7Backfill.test.js +0 -96
  142. package/out/src/storage/schema/__tests/v7Backfill.test.js.map +0 -1
  143. package/out/src/storage/schema/__tests/v7Fsm.test.d.ts +0 -2
  144. package/out/src/storage/schema/__tests/v7Fsm.test.d.ts.map +0 -1
  145. package/out/src/storage/schema/__tests/v7Fsm.test.js +0 -42
  146. package/out/src/storage/schema/__tests/v7Fsm.test.js.map +0 -1
  147. package/out/src/storage/schema/__tests/v7Spendability.test.d.ts +0 -2
  148. package/out/src/storage/schema/__tests/v7Spendability.test.d.ts.map +0 -1
  149. package/out/src/storage/schema/__tests/v7Spendability.test.js +0 -29
  150. package/out/src/storage/schema/__tests/v7Spendability.test.js.map +0 -1
  151. package/out/src/storage/schema/tables/TableAction.d.ts +0 -38
  152. package/out/src/storage/schema/tables/TableAction.d.ts.map +0 -1
  153. package/out/src/storage/schema/tables/TableAction.js +0 -3
  154. package/out/src/storage/schema/tables/TableAction.js.map +0 -1
  155. package/out/src/storage/schema/tables/TableChainTip.d.ts +0 -17
  156. package/out/src/storage/schema/tables/TableChainTip.d.ts.map +0 -1
  157. package/out/src/storage/schema/tables/TableChainTip.js +0 -3
  158. package/out/src/storage/schema/tables/TableChainTip.js.map +0 -1
  159. package/out/src/storage/schema/tables/TableMonitorLease.d.ts +0 -23
  160. package/out/src/storage/schema/tables/TableMonitorLease.d.ts.map +0 -1
  161. package/out/src/storage/schema/tables/TableMonitorLease.js +0 -3
  162. package/out/src/storage/schema/tables/TableMonitorLease.js.map +0 -1
  163. package/out/src/storage/schema/tables/TableTransactionV7.d.ts +0 -50
  164. package/out/src/storage/schema/tables/TableTransactionV7.d.ts.map +0 -1
  165. package/out/src/storage/schema/tables/TableTransactionV7.js +0 -3
  166. package/out/src/storage/schema/tables/TableTransactionV7.js.map +0 -1
  167. package/out/src/storage/schema/tables/TableTxAudit.d.ts +0 -26
  168. package/out/src/storage/schema/tables/TableTxAudit.d.ts.map +0 -1
  169. package/out/src/storage/schema/tables/TableTxAudit.js +0 -3
  170. package/out/src/storage/schema/tables/TableTxAudit.js.map +0 -1
  171. package/out/src/storage/schema/v7Backfill.d.ts +0 -35
  172. package/out/src/storage/schema/v7Backfill.d.ts.map +0 -1
  173. package/out/src/storage/schema/v7Backfill.idb.d.ts +0 -32
  174. package/out/src/storage/schema/v7Backfill.idb.d.ts.map +0 -1
  175. package/out/src/storage/schema/v7Backfill.idb.js +0 -95
  176. package/out/src/storage/schema/v7Backfill.idb.js.map +0 -1
  177. package/out/src/storage/schema/v7Backfill.js +0 -147
  178. package/out/src/storage/schema/v7Backfill.js.map +0 -1
  179. package/out/src/storage/schema/v7Backfill.knex.d.ts +0 -32
  180. package/out/src/storage/schema/v7Backfill.knex.d.ts.map +0 -1
  181. package/out/src/storage/schema/v7Backfill.knex.js +0 -240
  182. package/out/src/storage/schema/v7Backfill.knex.js.map +0 -1
  183. package/out/src/storage/schema/v7Backfill.runner.d.ts +0 -63
  184. package/out/src/storage/schema/v7Backfill.runner.d.ts.map +0 -1
  185. package/out/src/storage/schema/v7Backfill.runner.js +0 -62
  186. package/out/src/storage/schema/v7Backfill.runner.js.map +0 -1
  187. package/out/src/storage/schema/v7Crud.d.ts +0 -39
  188. package/out/src/storage/schema/v7Crud.d.ts.map +0 -1
  189. package/out/src/storage/schema/v7Crud.js +0 -203
  190. package/out/src/storage/schema/v7Crud.js.map +0 -1
  191. package/out/src/storage/schema/v7Fsm.d.ts +0 -27
  192. package/out/src/storage/schema/v7Fsm.d.ts.map +0 -1
  193. package/out/src/storage/schema/v7Fsm.js +0 -108
  194. package/out/src/storage/schema/v7Fsm.js.map +0 -1
  195. package/out/src/storage/schema/v7MonitorLease.d.ts +0 -57
  196. package/out/src/storage/schema/v7MonitorLease.d.ts.map +0 -1
  197. package/out/src/storage/schema/v7MonitorLease.js +0 -101
  198. package/out/src/storage/schema/v7MonitorLease.js.map +0 -1
  199. package/out/src/storage/schema/v7Spendability.d.ts +0 -45
  200. package/out/src/storage/schema/v7Spendability.d.ts.map +0 -1
  201. package/out/src/storage/schema/v7Spendability.js +0 -52
  202. package/out/src/storage/schema/v7Spendability.js.map +0 -1
  203. package/out/src/storage/schema/v7TxAudit.d.ts +0 -33
  204. package/out/src/storage/schema/v7TxAudit.d.ts.map +0 -1
  205. package/out/src/storage/schema/v7TxAudit.js +0 -64
  206. package/out/src/storage/schema/v7TxAudit.js.map +0 -1
@@ -1,240 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V7KnexBackfillDriver = void 0;
4
- exports.runV7KnexBackfill = runV7KnexBackfill;
5
- const v7Backfill_runner_1 = require("./v7Backfill.runner");
6
- const STREAM_BATCH = 500;
7
- /**
8
- * Knex driver for the V7 backfill.
9
- *
10
- * Reads from the legacy `proven_tx_reqs`, `proven_txs`, and `transactions`
11
- * tables, writes into the new `transactions_v7` and `actions` tables, and
12
- * re-points `tx_labels_map` rows to the new `actionId`.
13
- *
14
- * All work is performed against the `knex` (or transaction) handle passed in.
15
- * The caller is responsible for opening a transaction around the orchestrator
16
- * call when atomicity is desired.
17
- */
18
- class V7KnexBackfillDriver {
19
- constructor(knex) {
20
- this.knex = knex;
21
- }
22
- async *streamLegacyReqs() {
23
- var _a, _b, _c;
24
- let lastId = 0;
25
- /* eslint-disable-next-line no-constant-condition */
26
- while (true) {
27
- const rows = await this.knex('proven_tx_reqs as r')
28
- .leftJoin('proven_txs as p', 'r.provenTxId', 'p.provenTxId')
29
- .select('r.*', this.knex.ref('p.height').as('p_height'), this.knex.ref('p.index').as('p_index'), this.knex.ref('p.merklePath').as('p_merklePath'), this.knex.ref('p.blockHash').as('p_blockHash'), this.knex.ref('p.merkleRoot').as('p_merkleRoot'), this.knex.ref('p.rawTx').as('p_rawTx'), this.knex.ref('p.created_at').as('p_created_at'), this.knex.ref('p.updated_at').as('p_updated_at'), this.knex.ref('p.txid').as('p_txid'))
30
- .where('r.provenTxReqId', '>', lastId)
31
- .orderBy('r.provenTxReqId')
32
- .limit(STREAM_BATCH);
33
- if (rows.length === 0)
34
- return;
35
- for (const row of rows) {
36
- lastId = row.provenTxReqId;
37
- const req = {
38
- created_at: row.created_at,
39
- updated_at: row.updated_at,
40
- provenTxReqId: row.provenTxReqId,
41
- provenTxId: row.provenTxId,
42
- status: row.status,
43
- attempts: row.attempts,
44
- notified: row.notified,
45
- txid: row.txid,
46
- batch: row.batch,
47
- history: row.history,
48
- notify: row.notify,
49
- rawTx: (_a = toBytes(row.rawTx)) !== null && _a !== void 0 ? _a : [],
50
- inputBEEF: toBytes(row.inputBEEF),
51
- wasBroadcast: row.wasBroadcast,
52
- rebroadcastAttempts: row.rebroadcastAttempts
53
- };
54
- let proven;
55
- if (row.p_txid != null) {
56
- proven = {
57
- created_at: row.p_created_at,
58
- updated_at: row.p_updated_at,
59
- provenTxId: row.provenTxId,
60
- txid: row.p_txid,
61
- height: row.p_height,
62
- index: row.p_index,
63
- merklePath: (_b = toBytes(row.p_merklePath)) !== null && _b !== void 0 ? _b : [],
64
- rawTx: (_c = toBytes(row.p_rawTx)) !== null && _c !== void 0 ? _c : [],
65
- blockHash: row.p_blockHash,
66
- merkleRoot: row.p_merkleRoot
67
- };
68
- }
69
- yield { req, proven };
70
- }
71
- }
72
- }
73
- async *streamLegacyTransactions() {
74
- let lastId = 0;
75
- /* eslint-disable-next-line no-constant-condition */
76
- while (true) {
77
- const rows = await this.knex('transactions')
78
- .where('transactionId', '>', lastId)
79
- .orderBy('transactionId')
80
- .limit(STREAM_BATCH)
81
- .select('*');
82
- if (rows.length === 0)
83
- return;
84
- for (const row of rows) {
85
- lastId = row.transactionId;
86
- yield {
87
- created_at: row.created_at,
88
- updated_at: row.updated_at,
89
- transactionId: row.transactionId,
90
- userId: row.userId,
91
- provenTxId: row.provenTxId,
92
- status: row.status,
93
- reference: row.reference,
94
- isOutgoing: !!row.isOutgoing,
95
- satoshis: row.satoshis,
96
- description: row.description,
97
- version: row.version,
98
- lockTime: row.lockTime,
99
- txid: row.txid,
100
- inputBEEF: toBytes(row.inputBEEF),
101
- rawTx: toBytes(row.rawTx)
102
- };
103
- }
104
- }
105
- }
106
- async upsertTransactionV7(row) {
107
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
108
- const existing = await this.knex('transactions_v7').where({ txid: row.txid }).first('transactionId');
109
- if (existing != null) {
110
- await this.knex('transactions_v7')
111
- .where({ transactionId: existing.transactionId })
112
- .update({
113
- processing: row.processing,
114
- processing_changed_at: row.processingChangedAt,
115
- next_action_at: (_a = row.nextActionAt) !== null && _a !== void 0 ? _a : null,
116
- attempts: row.attempts,
117
- rebroadcast_cycles: row.rebroadcastCycles,
118
- was_broadcast: row.wasBroadcast,
119
- batch: (_b = row.batch) !== null && _b !== void 0 ? _b : null,
120
- raw_tx: toBuf(row.rawTx),
121
- input_beef: toBuf(row.inputBeef),
122
- height: (_c = row.height) !== null && _c !== void 0 ? _c : null,
123
- merkle_index: (_d = row.merkleIndex) !== null && _d !== void 0 ? _d : null,
124
- merkle_path: toBuf(row.merklePath),
125
- merkle_root: (_e = row.merkleRoot) !== null && _e !== void 0 ? _e : null,
126
- block_hash: (_f = row.blockHash) !== null && _f !== void 0 ? _f : null,
127
- is_coinbase: row.isCoinbase,
128
- updated_at: row.updated_at
129
- });
130
- return existing.transactionId;
131
- }
132
- const [insertedId] = await this.knex('transactions_v7').insert({
133
- txid: row.txid,
134
- processing: row.processing,
135
- processing_changed_at: row.processingChangedAt,
136
- next_action_at: (_g = row.nextActionAt) !== null && _g !== void 0 ? _g : null,
137
- attempts: row.attempts,
138
- rebroadcast_cycles: row.rebroadcastCycles,
139
- was_broadcast: row.wasBroadcast,
140
- idempotency_key: (_h = row.idempotencyKey) !== null && _h !== void 0 ? _h : null,
141
- batch: (_j = row.batch) !== null && _j !== void 0 ? _j : null,
142
- raw_tx: toBuf(row.rawTx),
143
- input_beef: toBuf(row.inputBeef),
144
- height: (_k = row.height) !== null && _k !== void 0 ? _k : null,
145
- merkle_index: (_l = row.merkleIndex) !== null && _l !== void 0 ? _l : null,
146
- merkle_path: toBuf(row.merklePath),
147
- merkle_root: (_m = row.merkleRoot) !== null && _m !== void 0 ? _m : null,
148
- block_hash: (_o = row.blockHash) !== null && _o !== void 0 ? _o : null,
149
- is_coinbase: row.isCoinbase,
150
- last_provider: (_p = row.lastProvider) !== null && _p !== void 0 ? _p : null,
151
- last_provider_status: (_q = row.lastProviderStatus) !== null && _q !== void 0 ? _q : null,
152
- frozen_reason: (_r = row.frozenReason) !== null && _r !== void 0 ? _r : null,
153
- row_version: row.rowVersion,
154
- created_at: row.created_at,
155
- updated_at: row.updated_at
156
- });
157
- if (typeof insertedId === 'number' && insertedId > 0)
158
- return insertedId;
159
- const row2 = await this.knex('transactions_v7').where({ txid: row.txid }).first('transactionId');
160
- return row2.transactionId;
161
- }
162
- async upsertAction(row) {
163
- var _a, _b;
164
- const existing = await this.knex('actions')
165
- .where({ userId: row.userId, transactionId: row.transactionId })
166
- .first('actionId');
167
- if (existing != null) {
168
- await this.knex('actions')
169
- .where({ actionId: existing.actionId })
170
- .update({
171
- reference: row.reference,
172
- description: row.description,
173
- isOutgoing: row.isOutgoing,
174
- satoshis_delta: row.satoshisDelta,
175
- user_nosend: row.userNosend,
176
- hidden: row.hidden,
177
- user_aborted: row.userAborted,
178
- notify_json: (_a = row.notifyJson) !== null && _a !== void 0 ? _a : null,
179
- updated_at: row.updated_at
180
- });
181
- return existing.actionId;
182
- }
183
- const [insertedId] = await this.knex('actions').insert({
184
- userId: row.userId,
185
- transactionId: row.transactionId,
186
- reference: row.reference,
187
- description: row.description,
188
- isOutgoing: row.isOutgoing,
189
- satoshis_delta: row.satoshisDelta,
190
- user_nosend: row.userNosend,
191
- hidden: row.hidden,
192
- user_aborted: row.userAborted,
193
- notify_json: (_b = row.notifyJson) !== null && _b !== void 0 ? _b : null,
194
- row_version: row.rowVersion,
195
- created_at: row.created_at,
196
- updated_at: row.updated_at
197
- });
198
- if (typeof insertedId === 'number' && insertedId > 0)
199
- return insertedId;
200
- const row2 = await this.knex('actions')
201
- .where({ userId: row.userId, transactionId: row.transactionId })
202
- .first('actionId');
203
- return row2.actionId;
204
- }
205
- async repointTxLabelMap(legacyTransactionId, actionId) {
206
- if (legacyTransactionId === actionId)
207
- return;
208
- await this.knex('tx_labels_map')
209
- .where({ transactionId: legacyTransactionId })
210
- .update({ transactionId: actionId });
211
- }
212
- }
213
- exports.V7KnexBackfillDriver = V7KnexBackfillDriver;
214
- /**
215
- * Convenience entry point. Opens a Knex transaction and runs the orchestrator
216
- * inside it so that the entire backfill either succeeds or rolls back.
217
- */
218
- async function runV7KnexBackfill(knex, now = new Date()) {
219
- return await knex.transaction(async (trx) => {
220
- const driver = new V7KnexBackfillDriver(trx);
221
- return await (0, v7Backfill_runner_1.runV7Backfill)(driver, now);
222
- });
223
- }
224
- function toBytes(v) {
225
- if (v == null)
226
- return undefined;
227
- if (Array.isArray(v))
228
- return v;
229
- if (Buffer.isBuffer(v))
230
- return Array.from(v.values());
231
- if (v instanceof Uint8Array)
232
- return Array.from(v.values());
233
- return undefined;
234
- }
235
- function toBuf(v) {
236
- if (v == null)
237
- return null;
238
- return Buffer.from(v);
239
- }
240
- //# sourceMappingURL=v7Backfill.knex.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"v7Backfill.knex.js","sourceRoot":"","sources":["../../../../src/storage/schema/v7Backfill.knex.ts"],"names":[],"mappings":";;;AAqOA,8CAKC;AAlOD,2DAAsF;AAEtF,MAAM,YAAY,GAAG,GAAG,CAAA;AAExB;;;;;;;;;;GAUG;AACH,MAAa,oBAAoB;IAC/B,YAA8B,IAAU;QAAV,SAAI,G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AAM,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,CAAA;IACxC,CAAC;CACF;AAxMD,oDAwMC;AAED;;;GAGG;AACI,KAAK,UAAU,iBAAiB,CAAE,IAAU,EAAE,MAAY,IAAI,IAAI,EAAE;IACzE,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,EAAC,GAAG,EAAC,EAAE;QACxC,MAAM,MAAM,GAAG,IAAI,oBAAoB,CAAC,GAAG,CAAC,CAAA;QAC5C,OAAO,MAAM,IAAA,iCAAa,EAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACzC,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,OAAO,CAAE,CAAU;IAC1B,IAAI,CAAC,IAAI,IAAI;QAAE,OAAO,SAAS,CAAA;IAC/B,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,CAAa,CAAA;IAC1C,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAA;IACrD,IAAI,CAAC,YAAY,UAAU;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAA;IAC1D,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,KAAK,CAAE,CAAuB;IACrC,IAAI,CAAC,IAAI,IAAI;QAAE,OAAO,IAAI,CAAA;IAC1B,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACvB,CAAC"}
@@ -1,63 +0,0 @@
1
- import { TableAction, TableProvenTx, TableProvenTxReq, TableTransaction, TableTransactionV7 } from './tables';
2
- /**
3
- * Storage-agnostic driver used by the V7 backfill orchestrator.
4
- *
5
- * Implementations must be idempotent — calling each method twice with the same
6
- * input must not produce duplicate rows. The orchestrator is responsible for
7
- * iteration order and chunking; the driver only performs writes.
8
- */
9
- export interface V7BackfillDriver {
10
- /** Stream legacy `proven_tx_reqs` rows joined with their `proven_txs` row when available. */
11
- streamLegacyReqs: () => AsyncIterable<{
12
- req: TableProvenTxReq;
13
- proven?: TableProvenTx;
14
- }>;
15
- /** Stream legacy `transactions` rows ordered by transactionId ascending. */
16
- streamLegacyTransactions: () => AsyncIterable<TableTransaction>;
17
- /**
18
- * Upsert a V7 `transactions` row by `txid`. Returns the resolved
19
- * `transactionId` (PK of `transactions_v7`).
20
- */
21
- upsertTransactionV7: (row: Omit<TableTransactionV7, 'transactionId'>) => Promise<number>;
22
- /**
23
- * Upsert a V7 `actions` row by `(userId, transactionId)`. Returns the
24
- * resolved `actionId`.
25
- */
26
- upsertAction: (row: Omit<TableAction, 'actionId'>) => Promise<number>;
27
- /**
28
- * Re-point a single legacy `tx_labels_map` row whose `transactionId` refers
29
- * to the old `transactions` PK so that it points to the new `actions.actionId`.
30
- *
31
- * Implementations may choose to rewrite the entire mapping in bulk and treat
32
- * this method as a no-op; the orchestrator will still call it once per pair.
33
- */
34
- repointTxLabelMap: (legacyTransactionId: number, actionId: number) => Promise<void>;
35
- }
36
- export interface V7BackfillStats {
37
- reqsBackfilled: number;
38
- legacyTxOnlyBackfilled: number;
39
- actionsBackfilled: number;
40
- labelMapsRepointed: number;
41
- }
42
- /**
43
- * Orchestrates §3 Steps 2-5 of PROD_REQ_V7_TS.md.
44
- *
45
- * Strategy:
46
- * 1. Walk every `proven_tx_reqs` row (joined with its proof) and upsert a row
47
- * in `transactions_v7`. Build a `txid -> transactionId` map.
48
- * 2. Walk every legacy `transactions` row.
49
- * - If the row has a txid AND it is not in the map, upsert a tx-only V7
50
- * row (locally-created actions that never reached the broadcast queue).
51
- * - Compute the V7 `transactionId` for this legacy row. Rows without a
52
- * txid (unsigned, unprocessed) are skipped — they have no canonical V7
53
- * representation yet and are surfaced as gaps in the stats.
54
- * 3. Upsert an `actions` row per legacy `transactions` row that has a V7
55
- * transactionId.
56
- * 4. Re-point `tx_labels_map.transactionId` from legacy PK to new `actionId`.
57
- *
58
- * The driver is invoked one row at a time so that the entire pass can run as
59
- * a single Knex transaction or a single IDB readwrite transaction without
60
- * holding the full row set in memory.
61
- */
62
- export declare function runV7Backfill(driver: V7BackfillDriver, now?: Date): Promise<V7BackfillStats>;
63
- //# sourceMappingURL=v7Backfill.runner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"v7Backfill.runner.d.ts","sourceRoot":"","sources":["../../../../src/storage/schema/v7Backfill.runner.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,UAAU,CAAA;AAEjB;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6FAA6F;IAC7F,gBAAgB,EAAE,MAAM,aAAa,CAAC;QAAE,GAAG,EAAE,gBAAgB,CAAC;QAAC,MAAM,CAAC,EAAE,aAAa,CAAA;KAAE,CAAC,CAAA;IACxF,4EAA4E;IAC5E,wBAAwB,EAAE,MAAM,aAAa,CAAC,gBAAgB,CAAC,CAAA;IAC/D;;;OAGG;IACH,mBAAmB,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,kBAAkB,EAAE,eAAe,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IACxF;;;OAGG;IACH,YAAY,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IACrE;;;;;;OAMG;IACH,iBAAiB,EAAE,CAAC,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACpF;AAED,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,CAAA;IACtB,sBAAsB,EAAE,MAAM,CAAA;IAC9B,iBAAiB,EAAE,MAAM,CAAA;IACzB,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,aAAa,CAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,GAAE,IAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAyC/G"}
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runV7Backfill = runV7Backfill;
4
- const v7Backfill_1 = require("./v7Backfill");
5
- /**
6
- * Orchestrates §3 Steps 2-5 of PROD_REQ_V7_TS.md.
7
- *
8
- * Strategy:
9
- * 1. Walk every `proven_tx_reqs` row (joined with its proof) and upsert a row
10
- * in `transactions_v7`. Build a `txid -> transactionId` map.
11
- * 2. Walk every legacy `transactions` row.
12
- * - If the row has a txid AND it is not in the map, upsert a tx-only V7
13
- * row (locally-created actions that never reached the broadcast queue).
14
- * - Compute the V7 `transactionId` for this legacy row. Rows without a
15
- * txid (unsigned, unprocessed) are skipped — they have no canonical V7
16
- * representation yet and are surfaced as gaps in the stats.
17
- * 3. Upsert an `actions` row per legacy `transactions` row that has a V7
18
- * transactionId.
19
- * 4. Re-point `tx_labels_map.transactionId` from legacy PK to new `actionId`.
20
- *
21
- * The driver is invoked one row at a time so that the entire pass can run as
22
- * a single Knex transaction or a single IDB readwrite transaction without
23
- * holding the full row set in memory.
24
- */
25
- async function runV7Backfill(driver, now = new Date()) {
26
- const stats = {
27
- reqsBackfilled: 0,
28
- legacyTxOnlyBackfilled: 0,
29
- actionsBackfilled: 0,
30
- labelMapsRepointed: 0
31
- };
32
- const txidToV7Id = new Map();
33
- for await (const { req, proven } of driver.streamLegacyReqs()) {
34
- const v7Row = (0, v7Backfill_1.buildTransactionV7Row)(req, proven, now);
35
- const id = await driver.upsertTransactionV7(v7Row);
36
- txidToV7Id.set(v7Row.txid, id);
37
- stats.reqsBackfilled += 1;
38
- }
39
- for await (const legacy of driver.streamLegacyTransactions()) {
40
- let v7Id;
41
- if (legacy.txid != null) {
42
- v7Id = txidToV7Id.get(legacy.txid);
43
- if (v7Id === undefined) {
44
- const v7Row = (0, v7Backfill_1.buildTransactionV7RowFromLegacyTx)(legacy, now);
45
- if (v7Row !== undefined) {
46
- v7Id = await driver.upsertTransactionV7(v7Row);
47
- txidToV7Id.set(legacy.txid, v7Id);
48
- stats.legacyTxOnlyBackfilled += 1;
49
- }
50
- }
51
- }
52
- if (v7Id === undefined)
53
- continue;
54
- const actionRow = (0, v7Backfill_1.buildActionRow)(legacy, v7Id, now);
55
- const actionId = await driver.upsertAction(actionRow);
56
- stats.actionsBackfilled += 1;
57
- await driver.repointTxLabelMap(legacy.transactionId, actionId);
58
- stats.labelMapsRepointed += 1;
59
- }
60
- return stats;
61
- }
62
- //# sourceMappingURL=v7Backfill.runner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"v7Backfill.runner.js","sourceRoot":"","sources":["../../../../src/storage/schema/v7Backfill.runner.ts"],"names":[],"mappings":";;AAoEA,sCAyCC;AA7GD,6CAAuG;AAgDvG;;;;;;;;;;;;;;;;;;;GAmBG;AACI,KAAK,UAAU,aAAa,CAAE,MAAwB,EAAE,MAAY,IAAI,IAAI,EAAE;IACnF,MAAM,KAAK,GAAoB;QAC7B,cAAc,EAAE,CAAC;QACjB,sBAAsB,EAAE,CAAC;QACzB,iBAAiB,EAAE,CAAC;QACpB,kBAAkB,EAAE,CAAC;KACtB,CAAA;IAED,MAAM,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAA;IAE5C,IAAI,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,MAAM,CAAC,gBAAgB,EAAE,EAAE,CAAC;QAC9D,MAAM,KAAK,GAAG,IAAA,kCAAqB,EAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;QACrD,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAA;QAClD,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;QAC9B,KAAK,CAAC,cAAc,IAAI,CAAC,CAAA;IAC3B,CAAC;IAED,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,MAAM,CAAC,wBAAwB,EAAE,EAAE,CAAC;QAC7D,IAAI,IAAwB,CAAA;QAC5B,IAAI,MAAM,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YAClC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,MAAM,KAAK,GAAG,IAAA,8CAAiC,EAAC,MAAM,EAAE,GAAG,CAAC,CAAA;gBAC5D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,IAAI,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAA;oBAC9C,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;oBACjC,KAAK,CAAC,sBAAsB,IAAI,CAAC,CAAA;gBACnC,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,IAAI,KAAK,SAAS;YAAE,SAAQ;QAEhC,MAAM,SAAS,GAAG,IAAA,2BAAc,EAAC,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;QACnD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAA;QACrD,KAAK,CAAC,iBAAiB,IAAI,CAAC,CAAA;QAE5B,MAAM,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAA;QAC9D,KAAK,CAAC,kBAAkB,IAAI,CAAC,CAAA;IAC/B,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -1,39 +0,0 @@
1
- import { Knex } from 'knex';
2
- import * as sdk from '../../sdk';
3
- import { TableAction, TableChainTip, TableTransactionV7 } from './tables';
4
- /** Read a single `transactions_v7` row by txid, returning `undefined` if absent. */
5
- export declare function findTransactionV7ByTxid(knex: Knex, txid: string): Promise<TableTransactionV7 | undefined>;
6
- /** Read a single `transactions_v7` row by PK. */
7
- export declare function findTransactionV7(knex: Knex, transactionId: number): Promise<TableTransactionV7 | undefined>;
8
- /** Insert a new `transactions_v7` row. Caller supplies the full body. */
9
- export declare function insertTransactionV7(knex: Knex, row: Omit<TableTransactionV7, 'transactionId' | 'created_at' | 'updated_at'>, now?: Date): Promise<number>;
10
- /**
11
- * Transition the processing column atomically and append a `tx_audit` row.
12
- * Returns the new `TableTransactionV7` on success and `undefined` when the
13
- * source state did not match the row (CAS failed) or the transition was
14
- * rejected by the FSM.
15
- *
16
- * Optimistic concurrency: the caller passes the `expectedFromState` they
17
- * read in the same logical operation; the update only fires when the row's
18
- * current `processing` still equals that value.
19
- */
20
- export declare function transitionProcessing(knex: Knex, args: {
21
- transactionId: number;
22
- expectedFromState: sdk.ProcessingStatus;
23
- toState: sdk.ProcessingStatus;
24
- details?: Record<string, unknown>;
25
- provider?: string;
26
- providerStatus?: string;
27
- }, now?: Date): Promise<TableTransactionV7 | undefined>;
28
- /** Find an action row by `(userId, transactionId)`. */
29
- export declare function findAction(knex: Knex, userId: number, transactionId: number): Promise<TableAction | undefined>;
30
- export declare function insertAction(knex: Knex, row: Omit<TableAction, 'actionId' | 'created_at' | 'updated_at'>, now?: Date): Promise<number>;
31
- /** Get the singleton chain tip row (`id = 1`). */
32
- export declare function getChainTip(knex: Knex): Promise<TableChainTip | undefined>;
33
- /** Upsert the singleton chain tip. Always uses `id = 1`. */
34
- export declare function setChainTip(knex: Knex, args: {
35
- height: number;
36
- blockHash: string;
37
- merkleRoot?: string;
38
- }, now?: Date): Promise<void>;
39
- //# sourceMappingURL=v7Crud.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"v7Crud.d.ts","sourceRoot":"","sources":["../../../../src/storage/schema/v7Crud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,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WAAW,EAAE,UAAU,GAAG,YAAY,GAAG,YAAY,CAAC,EAChE,GAAG,GAAE,IAAiB,GACrB,OAAO,CAAC,MAAM,CAAC,CAmBjB;AAED,kDAAkD;AAClD,wBAAsB,WAAW,CAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAGjF;AAED,4DAA4D;AAC5D,wBAAsB,WAAW,CAC/B,IAAI,EAAE,IAAI,EACV,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAChE,GAAG,GAAE,IAAiB,GACrB,OAAO,CAAC,IAAI,CAAC,CAqBf"}
@@ -1,203 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findTransactionV7ByTxid = findTransactionV7ByTxid;
4
- exports.findTransactionV7 = findTransactionV7;
5
- exports.insertTransactionV7 = insertTransactionV7;
6
- exports.transitionProcessing = transitionProcessing;
7
- exports.findAction = findAction;
8
- exports.insertAction = insertAction;
9
- exports.getChainTip = getChainTip;
10
- exports.setChainTip = setChainTip;
11
- const v7TxAudit_1 = require("./v7TxAudit");
12
- /** Read a single `transactions_v7` row by txid, returning `undefined` if absent. */
13
- async function findTransactionV7ByTxid(knex, txid) {
14
- const row = await knex('transactions_v7').where({ txid }).first();
15
- return row != null ? mapTransactionRow(row) : undefined;
16
- }
17
- /** Read a single `transactions_v7` row by PK. */
18
- async function findTransactionV7(knex, transactionId) {
19
- const row = await knex('transactions_v7').where({ transactionId }).first();
20
- return row != null ? mapTransactionRow(row) : undefined;
21
- }
22
- /** Insert a new `transactions_v7` row. Caller supplies the full body. */
23
- async function insertTransactionV7(knex, row, now = new Date()) {
24
- const [id] = await knex('transactions_v7').insert(unmapTransactionRow(row, now));
25
- if (typeof id === 'number' && id > 0)
26
- return id;
27
- const r = await knex('transactions_v7').where({ txid: row.txid }).first('transactionId');
28
- return r.transactionId;
29
- }
30
- /**
31
- * Transition the processing column atomically and append a `tx_audit` row.
32
- * Returns the new `TableTransactionV7` on success and `undefined` when the
33
- * source state did not match the row (CAS failed) or the transition was
34
- * rejected by the FSM.
35
- *
36
- * Optimistic concurrency: the caller passes the `expectedFromState` they
37
- * read in the same logical operation; the update only fires when the row's
38
- * current `processing` still equals that value.
39
- */
40
- async function transitionProcessing(knex, args, now = new Date()) {
41
- var _a, _b;
42
- const ok = await (0, v7TxAudit_1.auditProcessingTransition)(knex, args.transactionId, args.expectedFromState, args.toState, args.details, now);
43
- if (!ok)
44
- return undefined;
45
- const updated = await knex('transactions_v7')
46
- .where({ transactionId: args.transactionId, processing: args.expectedFromState })
47
- .update({
48
- processing: args.toState,
49
- processing_changed_at: now,
50
- last_provider: (_a = args.provider) !== null && _a !== void 0 ? _a : null,
51
- last_provider_status: (_b = args.providerStatus) !== null && _b !== void 0 ? _b : null,
52
- updated_at: now
53
- });
54
- if (updated === 0)
55
- return undefined;
56
- const row = await knex('transactions_v7').where({ transactionId: args.transactionId }).first();
57
- return mapTransactionRow(row);
58
- }
59
- /** Find an action row by `(userId, transactionId)`. */
60
- async function findAction(knex, userId, transactionId) {
61
- const row = await knex('actions').where({ userId, transactionId }).first();
62
- return row != null ? mapActionRow(row) : undefined;
63
- }
64
- async function insertAction(knex, row, now = new Date()) {
65
- var _a;
66
- const [id] = await knex('actions').insert({
67
- userId: row.userId,
68
- transactionId: row.transactionId,
69
- reference: row.reference,
70
- description: row.description,
71
- isOutgoing: row.isOutgoing,
72
- satoshis_delta: row.satoshisDelta,
73
- user_nosend: row.userNosend,
74
- hidden: row.hidden,
75
- user_aborted: row.userAborted,
76
- notify_json: (_a = row.notifyJson) !== null && _a !== void 0 ? _a : null,
77
- row_version: row.rowVersion,
78
- created_at: now,
79
- updated_at: now
80
- });
81
- if (typeof id === 'number' && id > 0)
82
- return id;
83
- const r = await knex('actions').where({ userId: row.userId, transactionId: row.transactionId }).first('actionId');
84
- return r.actionId;
85
- }
86
- /** Get the singleton chain tip row (`id = 1`). */
87
- async function getChainTip(knex) {
88
- const row = await knex('chain_tip').where({ id: 1 }).first();
89
- return row != null ? mapChainTipRow(row) : undefined;
90
- }
91
- /** Upsert the singleton chain tip. Always uses `id = 1`. */
92
- async function setChainTip(knex, args, now = new Date()) {
93
- var _a, _b;
94
- const existing = await knex('chain_tip').where({ id: 1 }).first('id');
95
- if (existing == null) {
96
- await knex('chain_tip').insert({
97
- id: 1,
98
- height: args.height,
99
- block_hash: args.blockHash,
100
- merkle_root: (_a = args.merkleRoot) !== null && _a !== void 0 ? _a : null,
101
- observed_at: now,
102
- created_at: now,
103
- updated_at: now
104
- });
105
- return;
106
- }
107
- await knex('chain_tip').where({ id: 1 }).update({
108
- height: args.height,
109
- block_hash: args.blockHash,
110
- merkle_root: (_b = args.merkleRoot) !== null && _b !== void 0 ? _b : null,
111
- observed_at: now,
112
- updated_at: now
113
- });
114
- }
115
- function mapTransactionRow(row) {
116
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
117
- return {
118
- created_at: new Date(row.created_at),
119
- updated_at: new Date(row.updated_at),
120
- transactionId: row.transactionId,
121
- txid: row.txid,
122
- processing: row.processing,
123
- processingChangedAt: new Date(row.processing_changed_at),
124
- nextActionAt: row.next_action_at != null ? new Date(row.next_action_at) : undefined,
125
- attempts: row.attempts,
126
- rebroadcastCycles: row.rebroadcast_cycles,
127
- wasBroadcast: !!row.was_broadcast,
128
- idempotencyKey: (_a = row.idempotency_key) !== null && _a !== void 0 ? _a : undefined,
129
- batch: (_b = row.batch) !== null && _b !== void 0 ? _b : undefined,
130
- rawTx: row.raw_tx != null ? Array.from(row.raw_tx.values()) : undefined,
131
- inputBeef: row.input_beef != null ? Array.from(row.input_beef.values()) : undefined,
132
- height: (_c = row.height) !== null && _c !== void 0 ? _c : undefined,
133
- merkleIndex: (_d = row.merkle_index) !== null && _d !== void 0 ? _d : undefined,
134
- merklePath: row.merkle_path != null ? Array.from(row.merkle_path.values()) : undefined,
135
- merkleRoot: (_e = row.merkle_root) !== null && _e !== void 0 ? _e : undefined,
136
- blockHash: (_f = row.block_hash) !== null && _f !== void 0 ? _f : undefined,
137
- isCoinbase: !!row.is_coinbase,
138
- lastProvider: (_g = row.last_provider) !== null && _g !== void 0 ? _g : undefined,
139
- lastProviderStatus: (_h = row.last_provider_status) !== null && _h !== void 0 ? _h : undefined,
140
- frozenReason: (_j = row.frozen_reason) !== null && _j !== void 0 ? _j : undefined,
141
- rowVersion: row.row_version
142
- };
143
- }
144
- function unmapTransactionRow(row, now) {
145
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
146
- return {
147
- txid: row.txid,
148
- processing: row.processing,
149
- processing_changed_at: row.processingChangedAt,
150
- next_action_at: (_a = row.nextActionAt) !== null && _a !== void 0 ? _a : null,
151
- attempts: row.attempts,
152
- rebroadcast_cycles: row.rebroadcastCycles,
153
- was_broadcast: row.wasBroadcast,
154
- idempotency_key: (_b = row.idempotencyKey) !== null && _b !== void 0 ? _b : null,
155
- batch: (_c = row.batch) !== null && _c !== void 0 ? _c : null,
156
- raw_tx: row.rawTx != null ? Buffer.from(row.rawTx) : null,
157
- input_beef: row.inputBeef != null ? Buffer.from(row.inputBeef) : null,
158
- height: (_d = row.height) !== null && _d !== void 0 ? _d : null,
159
- merkle_index: (_e = row.merkleIndex) !== null && _e !== void 0 ? _e : null,
160
- merkle_path: row.merklePath != null ? Buffer.from(row.merklePath) : null,
161
- merkle_root: (_f = row.merkleRoot) !== null && _f !== void 0 ? _f : null,
162
- block_hash: (_g = row.blockHash) !== null && _g !== void 0 ? _g : null,
163
- is_coinbase: row.isCoinbase,
164
- last_provider: (_h = row.lastProvider) !== null && _h !== void 0 ? _h : null,
165
- last_provider_status: (_j = row.lastProviderStatus) !== null && _j !== void 0 ? _j : null,
166
- frozen_reason: (_k = row.frozenReason) !== null && _k !== void 0 ? _k : null,
167
- row_version: row.rowVersion,
168
- created_at: now,
169
- updated_at: now
170
- };
171
- }
172
- function mapActionRow(row) {
173
- var _a;
174
- return {
175
- created_at: new Date(row.created_at),
176
- updated_at: new Date(row.updated_at),
177
- actionId: row.actionId,
178
- userId: row.userId,
179
- transactionId: row.transactionId,
180
- reference: row.reference,
181
- description: row.description,
182
- isOutgoing: !!row.isOutgoing,
183
- satoshisDelta: row.satoshis_delta,
184
- userNosend: !!row.user_nosend,
185
- hidden: !!row.hidden,
186
- userAborted: !!row.user_aborted,
187
- notifyJson: (_a = row.notify_json) !== null && _a !== void 0 ? _a : undefined,
188
- rowVersion: row.row_version
189
- };
190
- }
191
- function mapChainTipRow(row) {
192
- var _a;
193
- return {
194
- created_at: new Date(row.created_at),
195
- updated_at: new Date(row.updated_at),
196
- id: row.id,
197
- height: row.height,
198
- blockHash: row.block_hash,
199
- merkleRoot: (_a = row.merkle_root) !== null && _a !== void 0 ? _a : undefined,
200
- observedAt: new Date(row.observed_at)
201
- };
202
- }
203
- //# sourceMappingURL=v7Crud.js.map