@bopen-io/wallet-toolbox 2.15.0-bopen.1 → 2.15.0-bopen.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 (62) hide show
  1. package/CHANGELOG.md +2 -47
  2. package/README.md +7 -73
  3. package/docs/client.md +2729 -3020
  4. package/docs/monitor.md +153 -164
  5. package/docs/services.md +710 -856
  6. package/docs/setup.md +1 -46
  7. package/docs/storage.md +1636 -1654
  8. package/docs/wallet.md +1842 -2090
  9. package/out/src/Setup.d.ts +0 -10
  10. package/out/src/Setup.d.ts.map +1 -1
  11. package/out/src/Setup.js +0 -24
  12. package/out/src/Setup.js.map +1 -1
  13. package/out/src/monitor/MonitorDaemon.d.ts +0 -2
  14. package/out/src/monitor/MonitorDaemon.d.ts.map +1 -1
  15. package/out/src/monitor/MonitorDaemon.js +1 -9
  16. package/out/src/monitor/MonitorDaemon.js.map +1 -1
  17. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageKnex.d.ts +0 -5
  18. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageKnex.d.ts.map +1 -1
  19. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageKnex.js +3 -11
  20. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageKnex.js.map +1 -1
  21. package/out/src/storage/StorageKnex.d.ts +0 -3
  22. package/out/src/storage/StorageKnex.d.ts.map +1 -1
  23. package/out/src/storage/StorageKnex.js +207 -115
  24. package/out/src/storage/StorageKnex.js.map +1 -1
  25. package/out/src/storage/adminServer/adminServer.d.ts.map +1 -1
  26. package/out/src/storage/adminServer/adminServer.js +41 -3
  27. package/out/src/storage/adminServer/adminServer.js.map +1 -1
  28. package/out/src/storage/index.all.d.ts +0 -1
  29. package/out/src/storage/index.all.d.ts.map +1 -1
  30. package/out/src/storage/index.all.js +0 -1
  31. package/out/src/storage/index.all.js.map +1 -1
  32. package/out/src/storage/methods/listActionsKnex.d.ts.map +1 -1
  33. package/out/src/storage/methods/listActionsKnex.js +1 -0
  34. package/out/src/storage/methods/listActionsKnex.js.map +1 -1
  35. package/out/src/storage/methods/listOutputsKnex.d.ts.map +1 -1
  36. package/out/src/storage/methods/listOutputsKnex.js +1 -0
  37. package/out/src/storage/methods/listOutputsKnex.js.map +1 -1
  38. package/out/src/storage/methods/purgeData.d.ts.map +1 -1
  39. package/out/src/storage/methods/purgeData.js +3 -0
  40. package/out/src/storage/methods/purgeData.js.map +1 -1
  41. package/out/src/storage/methods/reviewStatus.d.ts.map +1 -1
  42. package/out/src/storage/methods/reviewStatus.js +3 -0
  43. package/out/src/storage/methods/reviewStatus.js.map +1 -1
  44. package/out/src/storage/portable/index.js +12 -38
  45. package/out/src/storage/portable/index.js.map +1 -1
  46. package/out/src/storage/remoting/StorageServer.d.ts +4 -17
  47. package/out/src/storage/remoting/StorageServer.d.ts.map +1 -1
  48. package/out/src/storage/remoting/StorageServer.js +13 -22
  49. package/out/src/storage/remoting/StorageServer.js.map +1 -1
  50. package/out/src/storage/schema/KnexMigrations.d.ts +2 -7
  51. package/out/src/storage/schema/KnexMigrations.d.ts.map +1 -1
  52. package/out/src/storage/schema/KnexMigrations.js +60 -162
  53. package/out/src/storage/schema/KnexMigrations.js.map +1 -1
  54. package/package.json +4 -5
  55. package/out/src/storage/adminServer/reqReviewQuery.d.ts +0 -41
  56. package/out/src/storage/adminServer/reqReviewQuery.d.ts.map +0 -1
  57. package/out/src/storage/adminServer/reqReviewQuery.js +0 -67
  58. package/out/src/storage/adminServer/reqReviewQuery.js.map +0 -1
  59. package/out/src/storage/knexPostgres.d.ts +0 -16
  60. package/out/src/storage/knexPostgres.d.ts.map +0 -1
  61. package/out/src/storage/knexPostgres.js +0 -34
  62. package/out/src/storage/knexPostgres.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"reqReviewQuery.d.ts","sourceRoot":"","sources":["../../../../src/storage/adminServer/reqReviewQuery.ts"],"names":[],"mappings":"AAAA,OA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+0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.selectReqReview = selectReqReview;
4
- function isPostgres(knex) {
5
- return knex.client.dialect === 'postgresql';
6
- }
7
- /** Whole `unitSeconds` elapsed since `column`, as MySQL TIMESTAMPDIFF reports it. */
8
- function ageSince(knex, column, unitSeconds, alias) {
9
- if (isPostgres(knex)) {
10
- return knex.raw('cast(trunc(extract(epoch from (now() - ??)) / ?) as integer) as ??', [column, unitSeconds, alias]);
11
- }
12
- return knex.raw(`TIMESTAMPDIFF(${unitSeconds === 60 ? 'MINUTE' : 'HOUR'}, ??, NOW()) as ??`, [column, alias]);
13
- }
14
- /** Upper-case hex of a binary column, as MySQL HEX() returns it. */
15
- function upperHex(knex, column, alias) {
16
- if (isPostgres(knex))
17
- return knex.raw("upper(encode(??, 'hex')) as ??", [column, alias]);
18
- return knex.raw('HEX(??) as ??', [column, alias]);
19
- }
20
- /**
21
- * Proven-tx-req rows joined to their transactions for the admin review page.
22
- * Supports MySQL and Postgres.
23
- */
24
- async function selectReqReview(knex, filter) {
25
- const base = knex('proven_tx_reqs as r')
26
- .join('transactions as t', 't.txid', 'r.txid')
27
- .where('t.transactionId', '>=', filter.minTransactionId);
28
- if (filter.status)
29
- void base.andWhere('r.status', filter.status);
30
- if (filter.txid)
31
- void base.andWhere('r.txid', filter.txid);
32
- if (filter.batch)
33
- void base.andWhere('r.batch', filter.batch);
34
- if (filter.userId)
35
- void base.andWhere('t.userId', filter.userId);
36
- const totalResult = (await base.clone().count({ count: '*' }));
37
- const total = Number(totalResult[0]?.count || 0);
38
- const rows = (await base
39
- .clone()
40
- .select([
41
- 'r.updated_at',
42
- 'r.created_at as req_created_at',
43
- 't.created_at as tx_created_at',
44
- ageSince(knex, 'r.created_at', 60, 'minutesOld'),
45
- ageSince(knex, 'r.created_at', 3600, 'hoursOld'),
46
- 'r.provenTxReqId',
47
- 't.transactionId',
48
- 't.userId',
49
- 'r.txid',
50
- 'r.provenTxId',
51
- 'r.status as reqStatus',
52
- 't.status as txStatus',
53
- 't.satoshis',
54
- 'r.attempts',
55
- 'r.notified',
56
- 'r.history',
57
- 'r.notify',
58
- upperHex(knex, 'r.rawTx', 'rawTxHex'),
59
- 'r.batch',
60
- upperHex(knex, 'r.inputBEEF', 'inputBeefHex')
61
- ])
62
- .orderBy('r.provenTxReqId', 'desc')
63
- .limit(filter.limit)
64
- .offset(filter.offset));
65
- return { total, rows };
66
- }
67
- //# sourceMappingURL=reqReviewQuery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reqReviewQuery.js","sourceRoot":"","sources":["../../../../src/storage/adminServer/reqReviewQuery.ts"],"names":[],"mappings":";;;AAmCA,SAAS,UAAU,CAAC,IAAU;IAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,YAAY,CAAA;AAC7C,CAAC;AAED,qFAAqF;AACrF,SAAS,QAAQ,CAAC,IAAU,EAAE,MAAc,EAAE,WAAsB,EAAE,KAAa;IACjF,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC,GAAG,CAAC,oEAAoE,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAA;IACrH,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,iBAAiB,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,oBAAoB,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;AAC/G,CAAC;AAED,oEAAoE;AACpE,SAAS,QAAQ,CAAC,IAAU,EAAE,MAAc,EAAE,KAAa;IACzD,IAAI,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,gCAAgC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;IACxF,OAAO,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC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Q;QACR,cAAc;QACd,uBAAuB;QACvB,sBAAsB;QACtB,YAAY;QACZ,YAAY;QACZ,YAAY;QACZ,WAAW;QACX,UAAU;QACV,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC;QACrC,SAAS;QACT,QAAQ,CAAC,IAAI,EAAE,aAAa,EAAE,cAAc,CAAC;KAC9C,CAAC;SACD,OAAO,CAAC,iBAAiB,EAAE,MAAM,CAAC;SAClC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;SACnB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAa,CAAA;IAErC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;AACxB,CAAC"}
@@ -1,16 +0,0 @@
1
- import { Knex } from 'knex';
2
- /**
3
- * Makes a Postgres knex return int8 values (bigint columns, `count(*)`) as
4
- * JavaScript numbers, as mysql2 and better-sqlite3 do. node-postgres returns
5
- * them as strings by default.
6
- *
7
- * The parser is set on each connection this knex acquires, including
8
- * connections created before this call and connections from a caller-supplied
9
- * pool. The process-wide `pg.types` defaults are not changed, so other pg
10
- * clients in the process are unaffected. Values above 2^53 lose precision;
11
- * wallet amounts and row ids stay well below that.
12
- *
13
- * Does nothing for other dialects, and is idempotent.
14
- */
15
- export declare function usePostgresInt8Numbers(knex: Knex): void;
16
- //# sourceMappingURL=knexPostgres.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"knexPostgres.d.ts","sourceRoot":"","sources":["../../../src/storage/knexPostgres.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAe3B;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAUvD"}
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.usePostgresInt8Numbers = usePostgresInt8Numbers;
4
- const PG_INT8_OID = 20;
5
- const installed = Symbol.for('@bsv/wallet-toolbox/postgres-int8-numbers');
6
- function parseInt8(value) {
7
- return Number.parseInt(value, 10);
8
- }
9
- /**
10
- * Makes a Postgres knex return int8 values (bigint columns, `count(*)`) as
11
- * JavaScript numbers, as mysql2 and better-sqlite3 do. node-postgres returns
12
- * them as strings by default.
13
- *
14
- * The parser is set on each connection this knex acquires, including
15
- * connections created before this call and connections from a caller-supplied
16
- * pool. The process-wide `pg.types` defaults are not changed, so other pg
17
- * clients in the process are unaffected. Values above 2^53 lose precision;
18
- * wallet amounts and row ids stay well below that.
19
- *
20
- * Does nothing for other dialects, and is idempotent.
21
- */
22
- function usePostgresInt8Numbers(knex) {
23
- const client = knex.client;
24
- if (client?.dialect !== 'postgresql' || client[installed] === true)
25
- return;
26
- const acquire = client.acquireConnection.bind(client);
27
- client.acquireConnection = async () => {
28
- const connection = (await acquire());
29
- connection.setTypeParser(PG_INT8_OID, parseInt8);
30
- return connection;
31
- };
32
- client[installed] = true;
33
- }
34
- //# sourceMappingURL=knexPostgres.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"knexPostgres.js","sourceRoot":"","sources":["../../../src/storage/knexPostgres.ts"],"names":[],"mappings":";;;AAEA,MAAM,WAAW,GAAG,EAAE,CAAA;AACtB,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAA;AAQzE,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;AACnC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,gCAAuC,IAAU;IAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAuC,CAAA;IAC3D,IAAI,MAAM,EAAE,OAAO,KAAK,YAAY,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,IAAI;QAAE,OAAM;IAC1E,MAAM,OAAO,GAAG,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACrD,MAAM,CAAC,iBAAiB,GAAG,KAAK,IAAI,EAAE;QACpC,MAAM,UAAU,GAAG,CAAC,MAAM,OAAO,EAAE,CAAiB,CAAA;QACpD,UAAU,CAAC,aAAa,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;QAChD,OAAO,UAAU,CAAA;IACnB,CAAC,CAAA;IACD,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;AAC1B,CAAC"}