@hsuite/smart-engines-cli 1.8.0 → 1.9.0

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 (73) hide show
  1. package/dist/_lib/cluster-provisioning-report.d.ts +29 -0
  2. package/dist/_lib/cluster-provisioning-report.d.ts.map +1 -0
  3. package/dist/_lib/cluster-provisioning-report.js +35 -0
  4. package/dist/_lib/cluster-provisioning-report.js.map +1 -0
  5. package/dist/_lib/create-outcome.d.ts +43 -0
  6. package/dist/_lib/create-outcome.d.ts.map +1 -0
  7. package/dist/_lib/create-outcome.js +121 -0
  8. package/dist/_lib/create-outcome.js.map +1 -0
  9. package/dist/_lib/decimal-compare.d.ts +23 -0
  10. package/dist/_lib/decimal-compare.d.ts.map +1 -0
  11. package/dist/_lib/decimal-compare.js +69 -0
  12. package/dist/_lib/decimal-compare.js.map +1 -0
  13. package/dist/_lib/env.d.ts +6 -0
  14. package/dist/_lib/env.d.ts.map +1 -1
  15. package/dist/_lib/env.js +68 -1
  16. package/dist/_lib/env.js.map +1 -1
  17. package/dist/_lib/order-deadline.d.ts +35 -0
  18. package/dist/_lib/order-deadline.d.ts.map +1 -0
  19. package/dist/_lib/order-deadline.js +78 -0
  20. package/dist/_lib/order-deadline.js.map +1 -0
  21. package/dist/_lib/runtime-env.d.ts.map +1 -1
  22. package/dist/_lib/runtime-env.js +3 -0
  23. package/dist/_lib/runtime-env.js.map +1 -1
  24. package/dist/_lib/subscription-client.d.ts +103 -1
  25. package/dist/_lib/subscription-client.d.ts.map +1 -1
  26. package/dist/_lib/subscription-client.js +29 -41
  27. package/dist/_lib/subscription-client.js.map +1 -1
  28. package/dist/_lib/xrpl-login-signer.d.ts +39 -0
  29. package/dist/_lib/xrpl-login-signer.d.ts.map +1 -0
  30. package/dist/_lib/xrpl-login-signer.js +78 -0
  31. package/dist/_lib/xrpl-login-signer.js.map +1 -0
  32. package/dist/commands/app-lifecycle.d.ts.map +1 -1
  33. package/dist/commands/app-lifecycle.js +8 -2
  34. package/dist/commands/app-lifecycle.js.map +1 -1
  35. package/dist/commands/deploy.d.ts.map +1 -1
  36. package/dist/commands/deploy.js +8 -0
  37. package/dist/commands/deploy.js.map +1 -1
  38. package/dist/commands/personhood.d.ts +2 -2
  39. package/dist/commands/personhood.d.ts.map +1 -1
  40. package/dist/commands/personhood.js +11 -14
  41. package/dist/commands/personhood.js.map +1 -1
  42. package/dist/commands/redeploy.d.ts.map +1 -1
  43. package/dist/commands/redeploy.js +6 -0
  44. package/dist/commands/redeploy.js.map +1 -1
  45. package/dist/commands/subscribe.d.ts +52 -5
  46. package/dist/commands/subscribe.d.ts.map +1 -1
  47. package/dist/commands/subscribe.js +656 -70
  48. package/dist/commands/subscribe.js.map +1 -1
  49. package/dist/commands/topup.d.ts.map +1 -1
  50. package/dist/commands/topup.js +16 -1
  51. package/dist/commands/topup.js.map +1 -1
  52. package/dist/commands/transactions.d.ts +28 -31
  53. package/dist/commands/transactions.d.ts.map +1 -1
  54. package/dist/commands/transactions.js +36 -41
  55. package/dist/commands/transactions.js.map +1 -1
  56. package/dist/commands/upgrade.d.ts.map +1 -1
  57. package/dist/commands/upgrade.js +9 -1
  58. package/dist/commands/upgrade.js.map +1 -1
  59. package/dist/commands/verify.d.ts +19 -2
  60. package/dist/commands/verify.d.ts.map +1 -1
  61. package/dist/commands/verify.js +152 -23
  62. package/dist/commands/verify.js.map +1 -1
  63. package/dist/index.js +0 -4
  64. package/dist/index.js.map +1 -1
  65. package/package.json +2 -2
  66. package/dist/commands/governance.d.ts +0 -42
  67. package/dist/commands/governance.d.ts.map +0 -1
  68. package/dist/commands/governance.js +0 -155
  69. package/dist/commands/governance.js.map +0 -1
  70. package/dist/commands/hist-balance.d.ts +0 -52
  71. package/dist/commands/hist-balance.d.ts.map +0 -1
  72. package/dist/commands/hist-balance.js +0 -134
  73. package/dist/commands/hist-balance.js.map +0 -1
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Report the per-cluster Harbor provisioning outcome (issue #1257
3
+ * requirement 4) from `init` / `pushCredentials` / `reissuePushCredentials`'s
4
+ * `registry.{completedClusters,failedClusters}`.
5
+ *
6
+ * Pure formatting only — no network, no process exit — so `deploy.ts` /
7
+ * `redeploy.ts` can both call it right after fetching push credentials, and
8
+ * it's independently unit-testable.
9
+ */
10
+ export type ClusterProvisioningRegistry = {
11
+ completedClusters?: Array<{
12
+ clusterId: string;
13
+ pushHost: string;
14
+ }>;
15
+ failedClusters?: Array<{
16
+ clusterId: string;
17
+ error: string;
18
+ code: string;
19
+ }>;
20
+ };
21
+ /**
22
+ * Format lines describing the completed/failed cluster partition. Returns
23
+ * `[]` when there is nothing to report (no failures AND no completed-cluster
24
+ * attribution — e.g. a local/dev single-cluster registry). A completed list
25
+ * with zero failures still gets a line naming the clusters, per requirement
26
+ * 4 ("prints which cluster it pushed to").
27
+ */
28
+ export declare function formatClusterProvisioningReport(registry: ClusterProvisioningRegistry): string[];
29
+ //# sourceMappingURL=cluster-provisioning-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cluster-provisioning-report.d.ts","sourceRoot":"","sources":["../../src/_lib/cluster-provisioning-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,2BAA2B,GAAG;IACxC,iBAAiB,CAAC,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnE,cAAc,CAAC,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5E,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,2BAA2B,GAAG,MAAM,EAAE,CAmB/F"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /**
3
+ * Report the per-cluster Harbor provisioning outcome (issue #1257
4
+ * requirement 4) from `init` / `pushCredentials` / `reissuePushCredentials`'s
5
+ * `registry.{completedClusters,failedClusters}`.
6
+ *
7
+ * Pure formatting only — no network, no process exit — so `deploy.ts` /
8
+ * `redeploy.ts` can both call it right after fetching push credentials, and
9
+ * it's independently unit-testable.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.formatClusterProvisioningReport = formatClusterProvisioningReport;
13
+ /**
14
+ * Format lines describing the completed/failed cluster partition. Returns
15
+ * `[]` when there is nothing to report (no failures AND no completed-cluster
16
+ * attribution — e.g. a local/dev single-cluster registry). A completed list
17
+ * with zero failures still gets a line naming the clusters, per requirement
18
+ * 4 ("prints which cluster it pushed to").
19
+ */
20
+ function formatClusterProvisioningReport(registry) {
21
+ const completed = registry.completedClusters ?? [];
22
+ const failed = registry.failedClusters ?? [];
23
+ const lines = [];
24
+ if (completed.length > 0) {
25
+ lines.push(` harbor: provisioned on ${completed.map((c) => c.clusterId).join(', ')} ` +
26
+ `(${completed.map((c) => c.pushHost).join(', ')})`);
27
+ }
28
+ if (failed.length > 0) {
29
+ lines.push(` harbor: WARNING — provisioning FAILED on ${failed
30
+ .map((f) => `${f.clusterId} (${f.code}: ${f.error})`)
31
+ .join(', ')} — that cluster will not serve this app's image until it converges`);
32
+ }
33
+ return lines;
34
+ }
35
+ //# sourceMappingURL=cluster-provisioning-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cluster-provisioning-report.js","sourceRoot":"","sources":["../../src/_lib/cluster-provisioning-report.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAcH,0EAmBC;AA1BD;;;;;;GAMG;AACH,SAAgB,+BAA+B,CAAC,QAAqC;IACnF,MAAM,SAAS,GAAG,QAAQ,CAAC,iBAAiB,IAAI,EAAE,CAAC;IACnD,MAAM,MAAM,GAAG,QAAQ,CAAC,cAAc,IAAI,EAAE,CAAC;IAC7C,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,KAAK,CAAC,IAAI,CACR,4BAA4B,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YACzE,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACrD,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,KAAK,CAAC,IAAI,CACR,8CAA8C,MAAM;aACjD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,GAAG,CAAC;aACpD,IAAI,CAAC,IAAI,CAAC,oEAAoE,CAClF,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,43 @@
1
+ /** The env key that records a `createApp` whose outcome is not known yet. */
2
+ export declare const PENDING_CREATE_KEY = "SUBSCRIPTION_PENDING_CREATE";
3
+ /**
4
+ * Slack added to the signed intent's `exp`. A responder judges expiry on ITS clock and accepts an
5
+ * `iat` up to a minute ahead of it (`ENTITY_CREATE_INTENT_MAX_FUTURE_SKEW_MS`), and it checks
6
+ * expiry when it ADMITS an intent — the validator's edge needs at least 90 s left
7
+ * (`ENTITY_CREATE_INTENT_EDGE_MIN_REMAINING_MS`) — not when the ceremony it started finishes
8
+ * (a rule publication of up to ~65 s, a share round of ~45 s, deposit-account funding of
9
+ * 60-90 s). `exp` + 3 minutes covers that tail plus the replication of the new subscription.
10
+ */
11
+ export declare const PENDING_CREATE_GRACE_MS: number;
12
+ export type PendingCreate = {
13
+ appId: string;
14
+ until: number;
15
+ };
16
+ export declare function formatPendingCreate(pending: PendingCreate): string;
17
+ /**
18
+ * `<entityId>@<epoch ms>` → the record, or `undefined` for anything else. Strict on purpose: the
19
+ * id is used as a URL path parameter and printed into a command, and the deadline decides whether
20
+ * a second entity may be created, so neither is read by `Number()`'s lenient rules (`0x10`,
21
+ * `1e3`, padding) and a deadline no signed intent could have produced is refused.
22
+ */
23
+ export declare function parsePendingCreate(raw: string, now?: number): PendingCreate | undefined;
24
+ /**
25
+ * When the create that carried `intentMessage` should no longer be able to complete anywhere: the
26
+ * signed intent's own `exp` (every responder refuses an expired intent), or — if the message
27
+ * cannot be read — a full intent lifetime from `now`, plus {@link PENDING_CREATE_GRACE_MS}.
28
+ */
29
+ export declare function pendingCreateDeadline(intentMessage: string, now?: number): number;
30
+ /**
31
+ * The HTTP status an error carries, from either shape the transport raises: the SDK's
32
+ * `SdkHttpError` (`statusCode`) or the CLI test seam's `"<METHOD> <path> → <status>: …"` message.
33
+ */
34
+ export declare function httpStatusOf(err: unknown): number | undefined;
35
+ export declare function createWasRefused(err: unknown): boolean;
36
+ /**
37
+ * Did the request never leave this machine? The SDK reports a network failure as
38
+ * `SdkHttpError(status 0)` carrying the underlying `fetch` error, whose `cause.code` names the
39
+ * connect-phase failure. Only those codes count: ECONNRESET, a socket timeout or an aborted
40
+ * request may have been sent.
41
+ */
42
+ export declare function createNeverSent(err: unknown): boolean;
43
+ //# sourceMappingURL=create-outcome.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-outcome.d.ts","sourceRoot":"","sources":["../../src/_lib/create-outcome.ts"],"names":[],"mappings":"AAcA,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,gCAAgC,CAAC;AAEhE;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,QAAgB,CAAC;AAWrD,MAAM,MAAM,aAAa,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAElE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,MAAmB,GAAG,aAAa,GAAG,SAAS,CAQnG;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,GAAE,MAAmB,GAAG,MAAM,CAS7F;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAK7D;AAWD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGtD;AAUD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAKrD"}
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PENDING_CREATE_GRACE_MS = exports.PENDING_CREATE_KEY = void 0;
4
+ exports.formatPendingCreate = formatPendingCreate;
5
+ exports.parsePendingCreate = parsePendingCreate;
6
+ exports.pendingCreateDeadline = pendingCreateDeadline;
7
+ exports.httpStatusOf = httpStatusOf;
8
+ exports.createWasRefused = createWasRefused;
9
+ exports.createNeverSent = createNeverSent;
10
+ /**
11
+ * What a `createApp` that did not return an entity tells `hsuite subscribe` (#3766).
12
+ *
13
+ * Creating a smart-app entity is a long synchronous ceremony (a DKG run plus deposit-account
14
+ * funding) and the client gives up after 180 s, so a request can end WITHOUT a verdict — a
15
+ * timeout, a dropped connection, a gateway 5xx after the work was done — while the platform goes
16
+ * on to create the entity. The CLI therefore records every create as PENDING before it is sent
17
+ * (`SUBSCRIPTION_PENDING_CREATE=<entityId>@<epoch ms>` in the env file) and reconciles it on the
18
+ * next run. This module holds the pure parts: the record's format, the deadline, and the
19
+ * classification of an error as "the platform refused" / "the request never left" (nothing was
20
+ * created) versus "no verdict" (it may have been).
21
+ */
22
+ const smart_engines_sdk_1 = require("@hsuite/smart-engines-sdk");
23
+ /** The env key that records a `createApp` whose outcome is not known yet. */
24
+ exports.PENDING_CREATE_KEY = 'SUBSCRIPTION_PENDING_CREATE';
25
+ /**
26
+ * Slack added to the signed intent's `exp`. A responder judges expiry on ITS clock and accepts an
27
+ * `iat` up to a minute ahead of it (`ENTITY_CREATE_INTENT_MAX_FUTURE_SKEW_MS`), and it checks
28
+ * expiry when it ADMITS an intent — the validator's edge needs at least 90 s left
29
+ * (`ENTITY_CREATE_INTENT_EDGE_MIN_REMAINING_MS`) — not when the ceremony it started finishes
30
+ * (a rule publication of up to ~65 s, a share round of ~45 s, deposit-account funding of
31
+ * 60-90 s). `exp` + 3 minutes covers that tail plus the replication of the new subscription.
32
+ */
33
+ exports.PENDING_CREATE_GRACE_MS = 3 * 60 * 1000;
34
+ /** How far ahead of now a stored deadline may lie: one intent lifetime, the grace, and clock slack. */
35
+ const MAX_DEADLINE_AHEAD_MS = smart_engines_sdk_1.ENTITY_CREATE_INTENT_TTL_MS + exports.PENDING_CREATE_GRACE_MS + 5 * 60 * 1000;
36
+ /** What the CLI creates: `<entityType>-<first 128 bits of H(owner, nonce)>` (`deriveIntentEntityId`). */
37
+ const ENTITY_ID = /^smart-app-[0-9a-f]{32}$/;
38
+ /** An epoch in milliseconds between 2001 and 2286: exactly 13 digits, no sign, no exponent, no hex. */
39
+ const EPOCH_MS = /^\d{13}$/;
40
+ function formatPendingCreate(pending) {
41
+ return `${pending.appId}@${pending.until}`;
42
+ }
43
+ /**
44
+ * `<entityId>@<epoch ms>` → the record, or `undefined` for anything else. Strict on purpose: the
45
+ * id is used as a URL path parameter and printed into a command, and the deadline decides whether
46
+ * a second entity may be created, so neither is read by `Number()`'s lenient rules (`0x10`,
47
+ * `1e3`, padding) and a deadline no signed intent could have produced is refused.
48
+ */
49
+ function parsePendingCreate(raw, now = Date.now()) {
50
+ const parts = raw.split('@');
51
+ if (parts.length !== 2)
52
+ return undefined;
53
+ const [appId, untilText] = parts;
54
+ if (!ENTITY_ID.test(appId) || !EPOCH_MS.test(untilText))
55
+ return undefined;
56
+ const until = Number(untilText);
57
+ if (until > now + MAX_DEADLINE_AHEAD_MS)
58
+ return undefined;
59
+ return { appId, until };
60
+ }
61
+ /**
62
+ * When the create that carried `intentMessage` should no longer be able to complete anywhere: the
63
+ * signed intent's own `exp` (every responder refuses an expired intent), or — if the message
64
+ * cannot be read — a full intent lifetime from `now`, plus {@link PENDING_CREATE_GRACE_MS}.
65
+ */
66
+ function pendingCreateDeadline(intentMessage, now = Date.now()) {
67
+ let exp;
68
+ try {
69
+ const parsed = JSON.parse(intentMessage);
70
+ if (typeof parsed.exp === 'number' && Number.isFinite(parsed.exp))
71
+ exp = parsed.exp;
72
+ }
73
+ catch {
74
+ // unreadable: fall back below
75
+ }
76
+ return (exp ?? now + smart_engines_sdk_1.ENTITY_CREATE_INTENT_TTL_MS) + exports.PENDING_CREATE_GRACE_MS;
77
+ }
78
+ /**
79
+ * The HTTP status an error carries, from either shape the transport raises: the SDK's
80
+ * `SdkHttpError` (`statusCode`) or the CLI test seam's `"<METHOD> <path> → <status>: …"` message.
81
+ */
82
+ function httpStatusOf(err) {
83
+ const statusCode = err?.statusCode;
84
+ if (typeof statusCode === 'number')
85
+ return statusCode;
86
+ const match = /→\s*(\d{3})\b/.exec(err instanceof Error ? err.message : '');
87
+ return match ? Number(match[1]) : undefined;
88
+ }
89
+ /**
90
+ * The statuses that prove the platform REFUSED a create before it did any work: it rejected the
91
+ * request itself (malformed / unauthenticated / not allowed / too large / wrong media type /
92
+ * semantically invalid). Deliberately NOT every 4xx: after the ceremony the validator answers 409
93
+ * ("already exists", "failed to create the subscription") for an entity that EXISTS, and 408 /
94
+ * 429 say nothing about the work.
95
+ */
96
+ const CREATE_REFUSAL_STATUSES = new Set([400, 401, 403, 413, 415, 422]);
97
+ function createWasRefused(err) {
98
+ const status = httpStatusOf(err);
99
+ return status !== undefined && CREATE_REFUSAL_STATUSES.has(status);
100
+ }
101
+ /** Connect-phase failures: no connection was established, so no request was sent. */
102
+ const NEVER_CONNECTED_CODES = new Set([
103
+ 'ECONNREFUSED',
104
+ 'ENOTFOUND',
105
+ 'EAI_AGAIN',
106
+ 'UND_ERR_CONNECT_TIMEOUT',
107
+ ]);
108
+ /**
109
+ * Did the request never leave this machine? The SDK reports a network failure as
110
+ * `SdkHttpError(status 0)` carrying the underlying `fetch` error, whose `cause.code` names the
111
+ * connect-phase failure. Only those codes count: ECONNRESET, a socket timeout or an aborted
112
+ * request may have been sent.
113
+ */
114
+ function createNeverSent(err) {
115
+ if (httpStatusOf(err) !== 0)
116
+ return false;
117
+ const details = err?.details;
118
+ const code = details?.cause?.code ?? details?.code;
119
+ return typeof code === 'string' && NEVER_CONNECTED_CODES.has(code);
120
+ }
121
+ //# sourceMappingURL=create-outcome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-outcome.js","sourceRoot":"","sources":["../../src/_lib/create-outcome.ts"],"names":[],"mappings":";;;AAsCA,kDAEC;AAQD,gDAQC;AAOD,sDASC;AAMD,oCAKC;AAWD,4CAGC;AAgBD,0CAKC;AAtHD;;;;;;;;;;;GAWG;AACH,iEAAwE;AAExE,6EAA6E;AAChE,QAAA,kBAAkB,GAAG,6BAA6B,CAAC;AAEhE;;;;;;;GAOG;AACU,QAAA,uBAAuB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAErD,uGAAuG;AACvG,MAAM,qBAAqB,GAAG,+CAA2B,GAAG,+BAAuB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAEpG,yGAAyG;AACzG,MAAM,SAAS,GAAG,0BAA0B,CAAC;AAE7C,uGAAuG;AACvG,MAAM,QAAQ,GAAG,UAAU,CAAC;AAI5B,SAAgB,mBAAmB,CAAC,OAAsB;IACxD,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;AAC7C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,GAAW,EA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AAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5E,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAE7F,SAAgB,gBAAgB,CAAC,GAAY;IAC3C,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IACjC,OAAO,MAAM,KAAK,SAAS,IAAI,uBAAuB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACrE,CAAC;AAED,qFAAqF;AACrF,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CAAC;IACzD,cAAc;IACd,WAAW;IACX,WAAW;IACX,yBAAyB;CAC1B,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,GAAY;IAC1C,IAAI,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1C,MAAM,OAAO,GAAI,GAA2E,EAAE,OAAO,CAAC;IACtG,MAAM,IAAI,GAAG,OAAO,EAAE,KAAK,EAAE,IAAI,IAAI,OAAO,EAAE,IAAI,CAAC;IACnD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACrE,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Exact comparison of two decimal amount strings — for on-ledger balances.
3
+ *
4
+ * XRPL reports an IOU balance as a decimal STRING, with fractions as a matter of course
5
+ * (the 0.25% HST transfer fee alone leaves them) and exponent notation for small values
6
+ * (`"1e-7"`). `Number()` loses precision above 2^53 and `BigInt()` throws on a fraction, so
7
+ * neither is safe to decide "does this account already hold what the quote asks?" with. The
8
+ * validator's `membership/decimal-units.ts` solves the same problem for its deposit check; this
9
+ * is the CLI's own copy, because the CLI deliberately has no runtime dependency on
10
+ * `@hsuite/smart-engines-multi-chain-core`.
11
+ *
12
+ * A ledger answer is untrusted input: both the length of the string and the size of its
13
+ * exponent are bounded, so `"1e999999"` is refused instead of becoming a `10n ** 999999n`.
14
+ */
15
+ /**
16
+ * Compare two decimal amount strings exactly.
17
+ *
18
+ * @returns `-1` / `0` / `1` as `a` is below / equal to / above `b`, or `undefined` when either
19
+ * is not a plain decimal number (empty, garbled, or outside the bounds above) — the caller must
20
+ * treat that as "cannot tell", never as a number.
21
+ */
22
+ export declare function compareDecimals(a: unknown, b: unknown): -1 | 0 | 1 | undefined;
23
+ //# sourceMappingURL=decimal-compare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decimal-compare.d.ts","sourceRoot":"","sources":["../../src/_lib/decimal-compare.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAiCH;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAY9E"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ /**
3
+ * Exact comparison of two decimal amount strings — for on-ledger balances.
4
+ *
5
+ * XRPL reports an IOU balance as a decimal STRING, with fractions as a matter of course
6
+ * (the 0.25% HST transfer fee alone leaves them) and exponent notation for small values
7
+ * (`"1e-7"`). `Number()` loses precision above 2^53 and `BigInt()` throws on a fraction, so
8
+ * neither is safe to decide "does this account already hold what the quote asks?" with. The
9
+ * validator's `membership/decimal-units.ts` solves the same problem for its deposit check; this
10
+ * is the CLI's own copy, because the CLI deliberately has no runtime dependency on
11
+ * `@hsuite/smart-engines-multi-chain-core`.
12
+ *
13
+ * A ledger answer is untrusted input: both the length of the string and the size of its
14
+ * exponent are bounded, so `"1e999999"` is refused instead of becoming a `10n ** 999999n`.
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.compareDecimals = compareDecimals;
18
+ /** `-?digits[.digits][e±digits]` — at least one digit before or after the point. */
19
+ const DECIMAL = /^(-?)(\d*)(?:\.(\d*))?(?:[eE]([+-]?\d+))?$/;
20
+ /** Longest string accepted. An XRPL IOU value has at most 16 significant digits plus an exponent. */
21
+ const MAX_LENGTH = 64;
22
+ /** Largest |exponent| accepted — XRPL IOU values stay within roughly 1e-96 … 1e96. */
23
+ const MAX_EXPONENT = 100;
24
+ function parse(raw) {
25
+ // The strings come off the wire (`depositInstructions.amount`, a ledger `balance`): a number or
26
+ // a null from a misbehaving server must read as "cannot tell", not throw out of `trim()`.
27
+ if (typeof raw !== 'string')
28
+ return undefined;
29
+ const text = raw.trim();
30
+ if (text.length === 0 || text.length > MAX_LENGTH)
31
+ return undefined;
32
+ const match = DECIMAL.exec(text);
33
+ if (!match)
34
+ return undefined;
35
+ const [, sign, whole = '', fraction = '', exponentText] = match;
36
+ if (whole === '' && fraction === '')
37
+ return undefined;
38
+ const exponent = exponentText === undefined ? 0 : Number(exponentText);
39
+ if (!Number.isSafeInteger(exponent) || Math.abs(exponent) > MAX_EXPONENT)
40
+ return undefined;
41
+ return {
42
+ negative: sign === '-',
43
+ digits: BigInt(`${whole}${fraction}`),
44
+ // value = digits × 10^(exponent − fraction digits)
45
+ exponent: exponent - fraction.length,
46
+ };
47
+ }
48
+ /**
49
+ * Compare two decimal amount strings exactly.
50
+ *
51
+ * @returns `-1` / `0` / `1` as `a` is below / equal to / above `b`, or `undefined` when either
52
+ * is not a plain decimal number (empty, garbled, or outside the bounds above) — the caller must
53
+ * treat that as "cannot tell", never as a number.
54
+ */
55
+ function compareDecimals(a, b) {
56
+ const left = parse(a);
57
+ const right = parse(b);
58
+ if (!left || !right)
59
+ return undefined;
60
+ const floor = Math.min(left.exponent, right.exponent);
61
+ const scale = (p) => {
62
+ const magnitude = p.digits * 10n ** BigInt(p.exponent - floor);
63
+ return p.negative ? -magnitude : magnitude;
64
+ };
65
+ const x = scale(left);
66
+ const y = scale(right);
67
+ return x < y ? -1 : x > y ? 1 : 0;
68
+ }
69
+ //# sourceMappingURL=decimal-compare.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decimal-compare.js","sourceRoot":"","sources":["../../src/_lib/decimal-compare.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AAwCH,0CAYC;AAlDD,oFAAoF;AACpF,MAAM,OAAO,GAAG,4CAA4C,CAAC;AAE7D,qGAAqG;AACrG,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,sFAAsF;AACtF,MAAM,YAAY,GAAG,GAAG,CAAC;AAIzB,SAAS,KAAK,CAAC,GAAY;IACzB,gGAAgG;IAChG,0FAA0F;IAC1F,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC9C,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IACxB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,UAAU;QAAE,OAAO,SAAS,CAAC;IACpE,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,GAAG,EAAE,EAAE,QAAQ,GAAG,EAAE,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC;IAChE,IAAI,KAAK,KAAK,EAAE,IAAI,QAAQ,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IACtD,MAAM,QAAQ,GAAG,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACvE,IAAI,CAAC,MAAM,CAAC,aAAa,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string>;
2
2
  export declare function readEnv(path: string): EnvMap;
3
3
  export declare function upsertEnv(path: string, updates: Record<string, string>): void;
4
+ /**
5
+ * Delete every line that sets one of `keys`; everything else — comments, ordering, the final
6
+ * newline — is kept verbatim. A no-op (the file is not rewritten) when the file is missing or
7
+ * none of the keys is set.
8
+ */
9
+ export declare function removeEnvKeys(path: string, keys: readonly string[]): void;
4
10
  export type AuthSigner = {
5
11
  chain: 'xrpl';
6
12
  walletAddress: string;
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/_lib/env.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEzC,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgB5C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAuB7E;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CACrC,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAyB1D"}
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/_lib/env.ts"],"names":[],"mappings":"AA2BA,MAAM,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEzC,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgB5C;AA4CD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAuB7E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAYzE;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CACrC,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAyB1D"}
package/dist/_lib/env.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.readEnv = readEnv;
4
4
  exports.upsertEnv = upsertEnv;
5
+ exports.removeEnvKeys = removeEnvKeys;
5
6
  exports.buildSignerFromEnv = buildSignerFromEnv;
6
7
  /**
7
8
  * Tiny .env parser/writer + XRPL signer factory.
@@ -14,6 +15,7 @@ exports.buildSignerFromEnv = buildSignerFromEnv;
14
15
  * still available for downstream consumers that want to authenticate via
15
16
  * other chains, but the CLI's prescriptive boilerplate writes XRPL only.
16
17
  */
18
+ const crypto_1 = require("crypto");
17
19
  const fs_1 = require("fs");
18
20
  const xrpl_1 = require("xrpl");
19
21
  function readEnv(path) {
@@ -36,6 +38,50 @@ function readEnv(path) {
36
38
  }
37
39
  return out;
38
40
  }
41
+ /**
42
+ * Replace the contents of `path` without ever leaving it truncated.
43
+ *
44
+ * The env file holds `XRPL_SEED`, and `writeFileSync` truncates the file BEFORE it writes: a full
45
+ * disk or a kill in that window leaves the developer's wallet seed gone. This writes a temp file
46
+ * in the same directory, fsyncs it, then renames it over the target (an atomic replace), so a
47
+ * reader — and a crash — only ever sees the old file or the new one. A symlinked env file is
48
+ * updated through the link (the link is kept, not replaced by a regular file), and an existing
49
+ * file keeps its permission bits.
50
+ */
51
+ function writeFileAtomic(path, contents) {
52
+ const exists = (0, fs_1.existsSync)(path);
53
+ const target = exists ? (0, fs_1.realpathSync)(path) : path;
54
+ const mode = exists ? (0, fs_1.statSync)(target).mode & 0o777 : undefined;
55
+ const temp = `${target}.${process.pid}.${(0, crypto_1.randomBytes)(4).toString('hex')}.tmp`;
56
+ const fd = (0, fs_1.openSync)(temp, 'wx', 0o666);
57
+ try {
58
+ if (mode !== undefined)
59
+ (0, fs_1.fchmodSync)(fd, mode);
60
+ (0, fs_1.writeSync)(fd, contents);
61
+ (0, fs_1.fsyncSync)(fd);
62
+ }
63
+ catch (err) {
64
+ (0, fs_1.closeSync)(fd);
65
+ discard(temp);
66
+ throw err;
67
+ }
68
+ (0, fs_1.closeSync)(fd);
69
+ try {
70
+ (0, fs_1.renameSync)(temp, target);
71
+ }
72
+ catch (err) {
73
+ discard(temp);
74
+ throw err;
75
+ }
76
+ }
77
+ function discard(path) {
78
+ try {
79
+ (0, fs_1.unlinkSync)(path);
80
+ }
81
+ catch {
82
+ // already gone
83
+ }
84
+ }
39
85
  function upsertEnv(path, updates) {
40
86
  const lines = (0, fs_1.existsSync)(path) ? (0, fs_1.readFileSync)(path, 'utf8').split('\n') : [];
41
87
  const seen = new Set();
@@ -60,7 +106,28 @@ function upsertEnv(path, updates) {
60
106
  let out = next.join('\n');
61
107
  if (!out.endsWith('\n'))
62
108
  out += '\n';
63
- (0, fs_1.writeFileSync)(path, out);
109
+ writeFileAtomic(path, out);
110
+ }
111
+ /**
112
+ * Delete every line that sets one of `keys`; everything else — comments, ordering, the final
113
+ * newline — is kept verbatim. A no-op (the file is not rewritten) when the file is missing or
114
+ * none of the keys is set.
115
+ */
116
+ function removeEnvKeys(path, keys) {
117
+ if (!(0, fs_1.existsSync)(path))
118
+ return;
119
+ const drop = new Set(keys);
120
+ const lines = (0, fs_1.readFileSync)(path, 'utf8').split('\n');
121
+ const kept = lines.filter((raw) => {
122
+ const line = raw.trim();
123
+ const eq = line.indexOf('=');
124
+ if (!line || line.startsWith('#') || eq <= 0)
125
+ return true;
126
+ return !drop.has(line.slice(0, eq).trim());
127
+ });
128
+ if (kept.length === lines.length)
129
+ return;
130
+ writeFileAtomic(path, kept.join('\n'));
64
131
  }
65
132
  function buildSignerFromEnv(env) {
66
133
  const seed = env.get('XRPL_SEED');
@@ -1 +1 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/_lib/env.ts"],"names":[],"mappings":";;AAgBA,0BAgBC;AAED,8BAuBC;AASD,gDAyBC;AA3FD;;;;;;;;;;GAUG;AACH,2BAA6D;AAC7D,+BAA8B;AAI9B,SAAgB,OAAO,CAAC,IAAY;IAClC,IAAI,CAAC,IAAA,eAAU,EAAC,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;IACtE,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IACtC,KAAK,MAAM,GAAG,IAAI,IAAA,iBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QACxB,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAC5C,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,EAAE,GAAG,CAAC;YAAE,SAAS;QACrB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACrC,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACpC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,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,CAAC,MAAM;QAAE,OAAO;IACzC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACzC,CAAC;AASD,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACxC,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,aAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACrC,OAAO;QACL,KAAK,EAAE,MAAM;QACb,aAAa,EAAE,OAAO;QACtB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,MAAM,EAAE,CAAC,OAAe,EAAE,EAAE;YAC1B,uEAAuE;YACvE,yEAAyE;YACzE,8DAA8D;YAC9D,sEAAsE;YACtE,wDAAwD;YACxD,8DAA8D;YAC9D,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAC5C,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;YAC/E,OAAO,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { SubscriptionClient } from './subscription-client';
2
+ /** The subset of a quote response {@link renderOrderDeadline} /
3
+ * {@link ensureUnexpiredQuote} actually need — satisfied by both
4
+ * `DepositInstructions` and `SubscriptionClient.topUp`'s response. */
5
+ export type OrderQuoteFields = {
6
+ orderId?: string;
7
+ expiresAt?: string;
8
+ amount?: string;
9
+ destinationTag?: number;
10
+ rate?: {
11
+ hsuiteUsd: string;
12
+ source: string;
13
+ };
14
+ priceUsd?: number;
15
+ hsuiteDue?: string;
16
+ };
17
+ /**
18
+ * Print the quote's deadline (local time + minutes remaining) and the
19
+ * locked rate source alongside the amount. No-op when the server didn't
20
+ * wire a price-locked order (`SubscriptionOrderService` unbound, or an
21
+ * older server) — `expiresAt` is absent in that case, same as today.
22
+ */
23
+ export declare function renderOrderDeadline(quote: Pick<OrderQuoteFields, 'expiresAt' | 'rate'>): void;
24
+ /**
25
+ * Before showing or paying a quote: if its order has already expired, requote
26
+ * it and return a quote for the NEW amount/tag instead — never put an expired
27
+ * order's stale amount in front of a payer (#3699 D8, #3765). A no-op (returns `quote` unchanged) when
28
+ * there is no `orderId`/`expiresAt` to check (older server / order creation
29
+ * unavailable) or the quote is still within its deadline. Preserves every
30
+ * OTHER field on `quote` (e.g. `walletAddress`/`depositAddress`,
31
+ * `success`) — a requote never moves the deposit account, only the
32
+ * economic terms this function overrides.
33
+ */
34
+ export declare function ensureUnexpiredQuote<T extends OrderQuoteFields>(client: Pick<SubscriptionClient, 'requoteOrder'>, quote: T): Promise<T>;
35
+ //# sourceMappingURL=order-deadline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-deadline.d.ts","sourceRoot":"","sources":["../../src/_lib/order-deadline.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE;;sEAEsE;AACtE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,WAAW,GAAG,MAAM,CAAC,GAAG,IAAI,CAY7F;AAED;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,SAAS,gBAAgB,EACnE,MAAM,EAAE,IAAI,CAAC,kBAAkB,EAAE,cAAc,CAAC,EAChD,KAAK,EAAE,CAAC,GACP,OAAO,CAAC,CAAC,CAAC,CAgCZ"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.renderOrderDeadline = renderOrderDeadline;
7
+ exports.ensureUnexpiredQuote = ensureUnexpiredQuote;
8
+ /**
9
+ * #3699 PR1b-ii, D8 — deadline display + requote-before-pay guard shared by
10
+ * `hsuite subscribe` / `hsuite topup` (both auto-pay a price-locked-order
11
+ * quote carrying `orderId`/`expiresAt`/`rate`/`destinationTag` — PR1a wired
12
+ * the fields, PR1b-i wired the server-side expiry/requote enforcement; THIS
13
+ * closes the CLI's own half: show the deadline, and never submit a payment
14
+ * against an order the server has already — or is about to have — marked
15
+ * expired).
16
+ *
17
+ * Generic over the two distinct response shapes that carry these fields
18
+ * (`DepositInstructions` for subscribe/upgrade, `SubscriptionClient.topUp`'s
19
+ * inline response for topup) rather than forcing either one into the
20
+ * other's shape.
21
+ *
22
+ * `hsuite upgrade` does not auto-pay today (manual XUMM / `--no-autopay`
23
+ * flow only), so only {@link renderOrderDeadline} applies there — there is
24
+ * no auto-pay call site to guard.
25
+ */
26
+ const chalk_1 = __importDefault(require("chalk"));
27
+ /**
28
+ * Print the quote's deadline (local time + minutes remaining) and the
29
+ * locked rate source alongside the amount. No-op when the server didn't
30
+ * wire a price-locked order (`SubscriptionOrderService` unbound, or an
31
+ * older server) — `expiresAt` is absent in that case, same as today.
32
+ */
33
+ function renderOrderDeadline(quote) {
34
+ if (!quote.expiresAt)
35
+ return;
36
+ const expiresAtMs = new Date(quote.expiresAt).getTime();
37
+ const remainingMin = Math.max(0, Math.round((expiresAtMs - Date.now()) / 60_000));
38
+ console.log(chalk_1.default.gray(` deadline: ${new Date(quote.expiresAt).toLocaleString()} (${remainingMin} min remaining)`));
39
+ if (quote.rate) {
40
+ console.log(chalk_1.default.gray(` rate: ${quote.rate.hsuiteUsd} USD/HST (source: ${quote.rate.source})`));
41
+ }
42
+ }
43
+ /**
44
+ * Before showing or paying a quote: if its order has already expired, requote
45
+ * it and return a quote for the NEW amount/tag instead — never put an expired
46
+ * order's stale amount in front of a payer (#3699 D8, #3765). A no-op (returns `quote` unchanged) when
47
+ * there is no `orderId`/`expiresAt` to check (older server / order creation
48
+ * unavailable) or the quote is still within its deadline. Preserves every
49
+ * OTHER field on `quote` (e.g. `walletAddress`/`depositAddress`,
50
+ * `success`) — a requote never moves the deposit account, only the
51
+ * economic terms this function overrides.
52
+ */
53
+ async function ensureUnexpiredQuote(client, quote) {
54
+ if (!quote.orderId || !quote.expiresAt)
55
+ return quote;
56
+ if (new Date(quote.expiresAt).getTime() > Date.now())
57
+ return quote;
58
+ console.log(chalk_1.default.yellow(`\n quote expired (orderId=${quote.orderId}) — requoting at the current rate...`));
59
+ const requoted = await client.requoteOrder(quote.orderId);
60
+ // A requote asks for the REMAINDER and never carries a reserve surcharge (the one-time charge
61
+ // for the deposit account was already counted in the first quote), so the first deposit's
62
+ // `baseAmount` / `reserveSurcharge` line items must not survive next to the new amount.
63
+ const { baseAmount: _base, reserveSurcharge: _surcharge, ...carried } = quote;
64
+ const next = {
65
+ ...carried,
66
+ amount: requoted.pay.amount,
67
+ destinationTag: requoted.pay.destinationTag,
68
+ orderId: requoted.orderId,
69
+ expiresAt: requoted.expiresAt,
70
+ rate: requoted.rate,
71
+ priceUsd: requoted.priceUsd,
72
+ hsuiteDue: requoted.hsuiteDue,
73
+ };
74
+ console.log(chalk_1.default.yellow(` new amount: ${next.amount} HST (tag ${next.destinationTag}), new deadline: ` +
75
+ `${next.expiresAt ? new Date(next.expiresAt).toLocaleString() : 'n/a'}\n`));
76
+ return next;
77
+ }
78
+ //# sourceMappingURL=order-deadline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-deadline.js","sourceRoot":"","sources":["../../src/_lib/order-deadline.ts"],"names":[],"mappings":";;;;;AAwCA,kDAYC;AAYD,oDAmCC;AAnGD;;;;;;;;;;;;;;;;;GAiBG;AACH,kDAA0B;AAgB1B;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,KAAmD;IACrF,IAAI,CAAC,KAAK,CAAC,SAAS;QAAE,OAAO;IAC7B,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC;IACxD,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAClF,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,IAAI,CACR,iBAAiB,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,KAAK,YAAY,iBAAiB,CAC9F,CACF,CAAC;IACF,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,iBAAiB,KAAK,CAAC,IAAI,CAAC,SAAS,qBAAqB,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC1G,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACI,KAAK,UAAU,oBAAoB,CACxC,MAAgD,EAChD,KAAQ;IAER,IAAI,CAAC,KAAK,CAAC,OA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["../../src/_lib/runtime-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CASjD,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAAkB,CAAC;AAE3E,MAAM,WAAW,sBAAsB;IACrC,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAWD;;;;;;GAMG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,SAAS,MAAM,EAAE;CAWvC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,sBAAsB,GAC5B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA6CxB"}
1
+ {"version":3,"file":"runtime-env.d.ts","sourceRoot":"","sources":["../../src/_lib/runtime-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAYjD,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAAkB,CAAC;AAE3E,MAAM,WAAW,sBAAsB;IACrC,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAWD;;;;;;GAMG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,SAAS,MAAM,EAAE;CAWvC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,sBAAsB,GAC5B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA6CxB"}
@@ -17,6 +17,9 @@ exports.NON_FORWARDED_KEYS = new Set([
17
17
  // Local-only safety toggles — never propagate into a live deploy.
18
18
  'DEV_MODE',
19
19
  'ALLOW_INSECURE',
20
+ // `hsuite subscribe`'s own bookkeeping (#3766): an unfinished entity create. Meaningless to the
21
+ // app, and not the developer's to ship into a running container's environment.
22
+ 'SUBSCRIPTION_PENDING_CREATE',
20
23
  ]);
21
24
  /**
22
25
  * Keys whose presence lets the deployed app authenticate as the developer's