@hsuite/smart-engines-cli 1.8.0 → 2.0.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.
- package/README.md +1 -0
- package/dist/__tests__/helpers/xrpl-signing.d.ts +26 -0
- package/dist/__tests__/helpers/xrpl-signing.d.ts.map +1 -0
- package/dist/__tests__/helpers/xrpl-signing.js +39 -0
- package/dist/__tests__/helpers/xrpl-signing.js.map +1 -0
- package/dist/_lib/cluster-provisioning-report.d.ts +29 -0
- package/dist/_lib/cluster-provisioning-report.d.ts.map +1 -0
- package/dist/_lib/cluster-provisioning-report.js +35 -0
- package/dist/_lib/cluster-provisioning-report.js.map +1 -0
- package/dist/_lib/create-outcome.d.ts +43 -0
- package/dist/_lib/create-outcome.d.ts.map +1 -0
- package/dist/_lib/create-outcome.js +121 -0
- package/dist/_lib/create-outcome.js.map +1 -0
- package/dist/_lib/decimal-compare.d.ts +23 -0
- package/dist/_lib/decimal-compare.d.ts.map +1 -0
- package/dist/_lib/decimal-compare.js +69 -0
- package/dist/_lib/decimal-compare.js.map +1 -0
- package/dist/_lib/env.d.ts +6 -0
- package/dist/_lib/env.d.ts.map +1 -1
- package/dist/_lib/env.js +77 -8
- package/dist/_lib/env.js.map +1 -1
- package/dist/_lib/error-message.d.ts +7 -0
- package/dist/_lib/error-message.d.ts.map +1 -0
- package/dist/_lib/error-message.js +21 -0
- package/dist/_lib/error-message.js.map +1 -0
- package/dist/_lib/order-deadline.d.ts +58 -0
- package/dist/_lib/order-deadline.d.ts.map +1 -0
- package/dist/_lib/order-deadline.js +112 -0
- package/dist/_lib/order-deadline.js.map +1 -0
- package/dist/_lib/payment-guard.d.ts +59 -0
- package/dist/_lib/payment-guard.d.ts.map +1 -0
- package/dist/_lib/payment-guard.js +188 -0
- package/dist/_lib/payment-guard.js.map +1 -0
- package/dist/_lib/payment-lock.d.ts +27 -0
- package/dist/_lib/payment-lock.d.ts.map +1 -0
- package/dist/_lib/payment-lock.js +199 -0
- package/dist/_lib/payment-lock.js.map +1 -0
- package/dist/_lib/payment-record.d.ts +70 -0
- package/dist/_lib/payment-record.d.ts.map +1 -0
- package/dist/_lib/payment-record.js +78 -0
- package/dist/_lib/payment-record.js.map +1 -0
- package/dist/_lib/runtime-env.d.ts.map +1 -1
- package/dist/_lib/runtime-env.js +8 -0
- package/dist/_lib/runtime-env.js.map +1 -1
- package/dist/_lib/subscription-client.d.ts +136 -5
- package/dist/_lib/subscription-client.d.ts.map +1 -1
- package/dist/_lib/subscription-client.js +38 -41
- package/dist/_lib/subscription-client.js.map +1 -1
- package/dist/_lib/xrp-payment.d.ts +33 -0
- package/dist/_lib/xrp-payment.d.ts.map +1 -0
- package/dist/_lib/xrp-payment.js +99 -0
- package/dist/_lib/xrp-payment.js.map +1 -0
- package/dist/_lib/xrpl-login-signer.d.ts +54 -0
- package/dist/_lib/xrpl-login-signer.d.ts.map +1 -0
- package/dist/_lib/xrpl-login-signer.js +102 -0
- package/dist/_lib/xrpl-login-signer.js.map +1 -0
- package/dist/commands/app-lifecycle.d.ts.map +1 -1
- package/dist/commands/app-lifecycle.js +8 -2
- package/dist/commands/app-lifecycle.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +8 -0
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/faucet.d.ts +1 -1
- package/dist/commands/faucet.d.ts.map +1 -1
- package/dist/commands/faucet.js +2 -7
- package/dist/commands/faucet.js.map +1 -1
- package/dist/commands/personhood.d.ts +2 -2
- package/dist/commands/personhood.d.ts.map +1 -1
- package/dist/commands/personhood.js +11 -14
- package/dist/commands/personhood.js.map +1 -1
- package/dist/commands/redeploy.d.ts.map +1 -1
- package/dist/commands/redeploy.js +6 -0
- package/dist/commands/redeploy.js.map +1 -1
- package/dist/commands/subscribe.d.ts +68 -7
- package/dist/commands/subscribe.d.ts.map +1 -1
- package/dist/commands/subscribe.js +793 -91
- package/dist/commands/subscribe.js.map +1 -1
- package/dist/commands/topup.d.ts +19 -7
- package/dist/commands/topup.d.ts.map +1 -1
- package/dist/commands/topup.js +142 -15
- package/dist/commands/topup.js.map +1 -1
- package/dist/commands/transactions.d.ts +28 -31
- package/dist/commands/transactions.d.ts.map +1 -1
- package/dist/commands/transactions.js +36 -41
- package/dist/commands/transactions.js.map +1 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +22 -3
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/commands/verify.d.ts +19 -2
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +158 -23
- package/dist/commands/verify.js.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/commands/governance.d.ts +0 -42
- package/dist/commands/governance.d.ts.map +0 -1
- package/dist/commands/governance.js +0 -155
- package/dist/commands/governance.js.map +0 -1
- package/dist/commands/hist-balance.d.ts +0 -52
- package/dist/commands/hist-balance.d.ts.map +0 -1
- package/dist/commands/hist-balance.js +0 -134
- package/dist/commands/hist-balance.js.map +0 -1
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentLockHeldError = exports.PAYMENT_LOCK_SUFFIX = void 0;
|
|
4
|
+
exports.paymentLockPath = paymentLockPath;
|
|
5
|
+
exports.withPaymentLock = withPaymentLock;
|
|
6
|
+
/**
|
|
7
|
+
* An exclusive lock on the env file for a run that PAYS (#3917 item 3).
|
|
8
|
+
*
|
|
9
|
+
* `hsuite subscribe` and `hsuite topup` keep a record of the payment they send in the env file and,
|
|
10
|
+
* before paying, read that record and ask the ledger what became of it (`payment-guard.ts`). That
|
|
11
|
+
* guard is a read followed, much later, by a write: two runs on one env file (two terminals, a CI
|
|
12
|
+
* job and a laptop, a retry loop) can both read "nothing recorded", both pass, and both pay. The
|
|
13
|
+
* lock makes the whole guarded section — read the record, ask the ledger, record the new payment,
|
|
14
|
+
* submit it — one run at a time per env file.
|
|
15
|
+
*
|
|
16
|
+
* It is a lock FILE next to the env file (`<env>.payment-lock`), created with `O_EXCL` so that
|
|
17
|
+
* exactly one creator wins, naming its owner so the run that loses can say who holds it. It is
|
|
18
|
+
* released in a `finally`, on process exit and on SIGINT / SIGTERM / SIGHUP. A run killed outright
|
|
19
|
+
* (SIGKILL, power loss) leaves it behind, and it is NEVER taken over automatically: the run that
|
|
20
|
+
* finds it is refused with the owner and the path to delete (and, for an owner on this host that is
|
|
21
|
+
* no longer running, says so). A takeover cannot be made atomic with a file lock, two runs finding
|
|
22
|
+
* the same stale lock can each take the other's live one, and the cost of getting that wrong is a
|
|
23
|
+
* second payment, against the cost of deleting one file after a crash.
|
|
24
|
+
*/
|
|
25
|
+
const crypto_1 = require("crypto");
|
|
26
|
+
const fs_1 = require("fs");
|
|
27
|
+
const os_1 = require("os");
|
|
28
|
+
const error_message_1 = require("./error-message");
|
|
29
|
+
/** The lock file is the env file's path plus this. */
|
|
30
|
+
exports.PAYMENT_LOCK_SUFFIX = '.payment-lock';
|
|
31
|
+
/** Another run holds the payment lock for this env file (or the lock file cannot be read). */
|
|
32
|
+
class PaymentLockHeldError extends Error {
|
|
33
|
+
lockPath;
|
|
34
|
+
owner;
|
|
35
|
+
constructor(lockPath, owner, message) {
|
|
36
|
+
super(message);
|
|
37
|
+
this.lockPath = lockPath;
|
|
38
|
+
this.owner = owner;
|
|
39
|
+
this.name = 'PaymentLockHeldError';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.PaymentLockHeldError = PaymentLockHeldError;
|
|
43
|
+
/** The lock path for an env file. Resolved through symlinks, so every spelling of one file shares one lock. */
|
|
44
|
+
function paymentLockPath(envPath) {
|
|
45
|
+
return `${(0, fs_1.realpathSync)(envPath)}${exports.PAYMENT_LOCK_SUFFIX}`;
|
|
46
|
+
}
|
|
47
|
+
function parseOwner(raw) {
|
|
48
|
+
try {
|
|
49
|
+
const value = JSON.parse(raw);
|
|
50
|
+
if (value &&
|
|
51
|
+
Number.isSafeInteger(value.pid) &&
|
|
52
|
+
value.pid > 0 &&
|
|
53
|
+
typeof value.host === 'string' &&
|
|
54
|
+
typeof value.command === 'string' &&
|
|
55
|
+
typeof value.since === 'string' &&
|
|
56
|
+
typeof value.token === 'string') {
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
// not ours
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
function readOwner(lockPath) {
|
|
66
|
+
let raw;
|
|
67
|
+
try {
|
|
68
|
+
raw = (0, fs_1.readFileSync)(lockPath, 'utf8');
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
if (err.code === 'ENOENT')
|
|
72
|
+
return undefined;
|
|
73
|
+
throw err;
|
|
74
|
+
}
|
|
75
|
+
return { raw, owner: parseOwner(raw) };
|
|
76
|
+
}
|
|
77
|
+
/** Is `pid` a live process? `EPERM` means it exists and is somebody else's. */
|
|
78
|
+
function processAlive(pid) {
|
|
79
|
+
try {
|
|
80
|
+
process.kill(pid, 0);
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
return err.code !== 'ESRCH';
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** Create the lock file with `O_EXCL`. `false` when it already exists. */
|
|
88
|
+
function createExclusive(lockPath, owner) {
|
|
89
|
+
let fd;
|
|
90
|
+
try {
|
|
91
|
+
fd = (0, fs_1.openSync)(lockPath, 'wx', 0o600);
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
if (err.code === 'EEXIST')
|
|
95
|
+
return false;
|
|
96
|
+
throw err;
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
(0, fs_1.writeSync)(fd, `${JSON.stringify(owner)}\n`);
|
|
100
|
+
(0, fs_1.fsyncSync)(fd);
|
|
101
|
+
}
|
|
102
|
+
finally {
|
|
103
|
+
(0, fs_1.closeSync)(fd);
|
|
104
|
+
}
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
function describeOwner(owner) {
|
|
108
|
+
return `pid ${owner.pid} on ${owner.host}, \`${owner.command}\`, since ${owner.since}`;
|
|
109
|
+
}
|
|
110
|
+
function heldError(envPath, lockPath, owner) {
|
|
111
|
+
const who = owner ? describeOwner(owner) : 'an owner this CLI cannot read from the lock file';
|
|
112
|
+
const gone = owner && owner.host === (0, os_1.hostname)() && !processAlive(owner.pid);
|
|
113
|
+
return new PaymentLockHeldError(lockPath, owner, `another hsuite run is already paying from ${envPath} (${who}). Two runs on one env file can both pass ` +
|
|
114
|
+
'the paid-twice guard and pay twice, so this one is refused until the other finishes — nothing was ' +
|
|
115
|
+
'requested and nothing was paid. ' +
|
|
116
|
+
(gone
|
|
117
|
+
? `That process is no longer running (a run killed outright leaves its lock behind): check what it paid ` +
|
|
118
|
+
`(\`hsuite status\`, the wallet's history), then delete ${lockPath} and re-run.`
|
|
119
|
+
: `If no hsuite run is active (a run killed outright leaves its lock behind), delete ${lockPath} and re-run.`));
|
|
120
|
+
}
|
|
121
|
+
/** Take the lock, or throw {@link PaymentLockHeldError}. Returns the release function. */
|
|
122
|
+
function acquire(envPath, command) {
|
|
123
|
+
if (!(0, fs_1.existsSync)(envPath))
|
|
124
|
+
throw new Error(`env file not found: ${envPath}`);
|
|
125
|
+
const lockPath = paymentLockPath(envPath);
|
|
126
|
+
const owner = {
|
|
127
|
+
pid: process.pid,
|
|
128
|
+
host: (0, os_1.hostname)(),
|
|
129
|
+
command,
|
|
130
|
+
since: new Date().toISOString(),
|
|
131
|
+
token: (0, crypto_1.randomBytes)(8).toString('hex'),
|
|
132
|
+
};
|
|
133
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
134
|
+
if (createExclusive(lockPath, owner))
|
|
135
|
+
return releaser(lockPath, owner.token);
|
|
136
|
+
const held = readOwner(lockPath);
|
|
137
|
+
// Released between our create and our read: try once more. Anything else is someone's lock.
|
|
138
|
+
if (held)
|
|
139
|
+
throw heldError(envPath, lockPath, held.owner);
|
|
140
|
+
}
|
|
141
|
+
throw heldError(envPath, lockPath, readOwner(lockPath)?.owner);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Release only a lock that is still ours: a lock another run took over (it saw this process dead) is
|
|
145
|
+
* theirs to release. Idempotent; never throws.
|
|
146
|
+
*/
|
|
147
|
+
function releaser(lockPath, token) {
|
|
148
|
+
let released = false;
|
|
149
|
+
const onSignal = (signal) => {
|
|
150
|
+
release();
|
|
151
|
+
// The default action the handler replaced: end the process as the signal would have.
|
|
152
|
+
process.kill(process.pid, signal);
|
|
153
|
+
};
|
|
154
|
+
const signals = ['SIGINT', 'SIGTERM', 'SIGHUP'];
|
|
155
|
+
const release = () => {
|
|
156
|
+
if (released)
|
|
157
|
+
return;
|
|
158
|
+
released = true;
|
|
159
|
+
process.removeListener('exit', release);
|
|
160
|
+
for (const signal of signals)
|
|
161
|
+
process.removeListener(signal, onSignal);
|
|
162
|
+
try {
|
|
163
|
+
if (readOwner(lockPath)?.owner?.token === token)
|
|
164
|
+
(0, fs_1.unlinkSync)(lockPath);
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
// best effort: a lock that survives only makes the next run say who held it
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
process.once('exit', release);
|
|
171
|
+
for (const signal of signals)
|
|
172
|
+
process.once(signal, onSignal);
|
|
173
|
+
return release;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Run `fn` holding the payment lock of `envPath`. A second caller on the same env file is refused
|
|
177
|
+
* with {@link PaymentLockHeldError} while `fn` runs — before it reads, asks or pays anything.
|
|
178
|
+
*/
|
|
179
|
+
async function withPaymentLock(envPath, command, fn) {
|
|
180
|
+
let release;
|
|
181
|
+
try {
|
|
182
|
+
release = acquire(envPath, command);
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
if (err instanceof PaymentLockHeldError || (err instanceof Error && /^env file not found/.test(err.message))) {
|
|
186
|
+
throw err;
|
|
187
|
+
}
|
|
188
|
+
throw new Error(`cannot take the payment lock for ${envPath} (${(0, error_message_1.errorMessage)(err)}) — refusing to pay`, {
|
|
189
|
+
cause: err,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
try {
|
|
193
|
+
return await fn();
|
|
194
|
+
}
|
|
195
|
+
finally {
|
|
196
|
+
release();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=payment-lock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-lock.js","sourceRoot":"","sources":["../../src/_lib/payment-lock.ts"],"names":[],"mappings":";;;AA6DA,0CAEC;AAsID,0CAiBC;AAtND;;;;;;;;;;;;;;;;;;GAkBG;AACH,mCAAqC;AACrC,2BASY;AACZ,2BAA8B;AAC9B,mDAA+C;AAE/C,sDAAsD;AACzC,QAAA,mBAAmB,GAAG,eAAe,CAAC;AAcnD,8FAA8F;AAC9F,MAAa,oBAAqB,SAAQ,KAAK;IAElC;IACA;IAFX,YACW,QAAgB,EAChB,KAAmC,EAC5C,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAJN,aAAQ,GAAR,QAAQ,CAAQ;QAChB,UAAK,GAAL,KAAK,CAA8B;QAI5C,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AATD,oDASC;AAED,+GAA+G;AAC/G,SAAgB,eAAe,CAAC,OAAe;IAC7C,OAAO,GAAG,IAAA,iBAAY,EAAC,OAAO,CAAC,GAAG,2BAAmB,EAAE,CAAC;AAC1D,CAAC;AAED,SAAS,UAAU,CAAC,GAAW;IAC7B,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAqC,CAAC;QAClE,IACE,KAAK;YACL,MAAM,CAAC,aAAa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,CAAC;QACT,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `hsuite subscribe` remembers about the deposit payment it sent (#3917 item 3, #3813).
|
|
3
|
+
*
|
|
4
|
+
* The CLI's guard before paying used to compare the deposit account's HST BALANCE with the quote.
|
|
5
|
+
* A balance says nothing about WHICH payment is in it: a payment the platform has not counted yet,
|
|
6
|
+
* made at an earlier price, followed by a requote at a higher price, left the balance short of the
|
|
7
|
+
* new ask and the CLI paid in full a second time. So the CLI records the hash of the payment it is
|
|
8
|
+
* about to submit (`SUBSCRIPTION_PENDING_PAYMENT=<appId>@<tx hash>@<LastLedgerSequence>` in the env
|
|
9
|
+
* file, written BEFORE the blob leaves the process — as the pending-create record is, #3766) and,
|
|
10
|
+
* on resume, asks the ledger what became of THAT transaction. This module holds the pure parts: the
|
|
11
|
+
* record's format and the classification of the ledger's answer.
|
|
12
|
+
*/
|
|
13
|
+
/** The env key that records the deposit payment `hsuite subscribe` sent for an entity. */
|
|
14
|
+
export declare const PENDING_PAYMENT_KEY = "SUBSCRIPTION_PENDING_PAYMENT";
|
|
15
|
+
/**
|
|
16
|
+
* The env key that records the credit payment `hsuite topup` sent for an entity (#3917 item 5).
|
|
17
|
+
* Its own slot, in the same format: a top-up must not read a deposit payment `subscribe` could not
|
|
18
|
+
* clear, nor the other way round.
|
|
19
|
+
*/
|
|
20
|
+
export declare const PENDING_TOPUP_PAYMENT_KEY = "SUBSCRIPTION_PENDING_TOPUP_PAYMENT";
|
|
21
|
+
export type PendingPayment = {
|
|
22
|
+
appId: string;
|
|
23
|
+
/** `hashSignedTx` of the signed blob: 64 upper-case hex characters. */
|
|
24
|
+
txHash: string;
|
|
25
|
+
/** The last ledger the transaction can validate in; absent when the blob carried none. */
|
|
26
|
+
lastLedgerSequence?: number;
|
|
27
|
+
};
|
|
28
|
+
export declare function formatPendingPayment(p: PendingPayment): string;
|
|
29
|
+
/**
|
|
30
|
+
* `<appId>@<tx hash>@<LastLedgerSequence or empty>` → the record, or `undefined` for anything else.
|
|
31
|
+
* Strict on purpose: the hash is sent to the ledger and printed into advice, and the sequence
|
|
32
|
+
* decides whether a payment may be sent again, so neither is read by `Number()`'s lenient rules.
|
|
33
|
+
*/
|
|
34
|
+
export declare function parsePendingPayment(raw: string): PendingPayment | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* How far behind its `LastLedgerSequence` a transaction can sit in a ledger: autofill sets
|
|
37
|
+
* LLS = the current ledger + a small buffer, so the payment cannot be in a ledger older than
|
|
38
|
+
* `LLS - 256`. The `tx` lookup searches exactly `[LLS - 256, LLS]`, which is what lets a
|
|
39
|
+
* `txnNotFound` answer mean "not in any ledger it could have been in" (`searched_all`).
|
|
40
|
+
*/
|
|
41
|
+
export declare const LLS_HISTORY_WINDOW = 256;
|
|
42
|
+
/**
|
|
43
|
+
* What the ledger says became of a recorded payment:
|
|
44
|
+
* - `delivered`: validated `tesSUCCESS` — the HST is in the deposit account;
|
|
45
|
+
* - `failed`: validated with a readable non-success result — nothing was delivered, paying again
|
|
46
|
+
* is safe;
|
|
47
|
+
* - `never-landed`: the server searched the whole `[LLS - 256, LLS]` range and did not find it,
|
|
48
|
+
* and the validated ledger is past `LastLedgerSequence`, so it can never validate — paying
|
|
49
|
+
* again is safe;
|
|
50
|
+
* - `pending`: anything that could still turn into a delivery, or that cannot be read (found but
|
|
51
|
+
* not validated; validated with no readable result; not found while it still could be, or
|
|
52
|
+
* not found by a server that did not search the whole range). Paying again could pay twice.
|
|
53
|
+
*/
|
|
54
|
+
export type RecordedPaymentVerdict = 'delivered' | 'failed' | 'never-landed' | 'pending';
|
|
55
|
+
/**
|
|
56
|
+
* What a `tx` lookup came back with. `{ found: false }` is the ledger's `txnNotFound`;
|
|
57
|
+
* `searchedAll` is its `searched_all`: true only when the server held every ledger in the range
|
|
58
|
+
* asked for (a pruned or partial-history server answers the same `txnNotFound` for a payment that
|
|
59
|
+
* DID validate).
|
|
60
|
+
*/
|
|
61
|
+
export type TxLookup = {
|
|
62
|
+
found: true;
|
|
63
|
+
validated: boolean;
|
|
64
|
+
result?: string;
|
|
65
|
+
} | {
|
|
66
|
+
found: false;
|
|
67
|
+
searchedAll: boolean;
|
|
68
|
+
};
|
|
69
|
+
export declare function classifyRecordedPayment(lookup: TxLookup, payment: Pick<PendingPayment, 'lastLedgerSequence'>, validatedLedger: number | undefined): RecordedPaymentVerdict;
|
|
70
|
+
//# sourceMappingURL=payment-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-record.d.ts","sourceRoot":"","sources":["../../src/_lib/payment-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,0FAA0F;AAC1F,eAAO,MAAM,mBAAmB,iCAAiC,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,uCAAuC,CAAC;AAE9E,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;IACf,0FAA0F;IAC1F,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAOF,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,cAAc,GAAG,MAAM,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAS3E;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,sBAAsB,GAAG,WAAW,GAAG,QAAQ,GAAG,cAAc,GAAG,SAAS,CAAC;AAEzF;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAChB;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,CAAC;AAE3C,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,QAAQ,EAChB,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,oBAAoB,CAAC,EACnD,eAAe,EAAE,MAAM,GAAG,SAAS,GAClC,sBAAsB,CAiBxB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* What `hsuite subscribe` remembers about the deposit payment it sent (#3917 item 3, #3813).
|
|
4
|
+
*
|
|
5
|
+
* The CLI's guard before paying used to compare the deposit account's HST BALANCE with the quote.
|
|
6
|
+
* A balance says nothing about WHICH payment is in it: a payment the platform has not counted yet,
|
|
7
|
+
* made at an earlier price, followed by a requote at a higher price, left the balance short of the
|
|
8
|
+
* new ask and the CLI paid in full a second time. So the CLI records the hash of the payment it is
|
|
9
|
+
* about to submit (`SUBSCRIPTION_PENDING_PAYMENT=<appId>@<tx hash>@<LastLedgerSequence>` in the env
|
|
10
|
+
* file, written BEFORE the blob leaves the process — as the pending-create record is, #3766) and,
|
|
11
|
+
* on resume, asks the ledger what became of THAT transaction. This module holds the pure parts: the
|
|
12
|
+
* record's format and the classification of the ledger's answer.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.LLS_HISTORY_WINDOW = exports.PENDING_TOPUP_PAYMENT_KEY = exports.PENDING_PAYMENT_KEY = void 0;
|
|
16
|
+
exports.formatPendingPayment = formatPendingPayment;
|
|
17
|
+
exports.parsePendingPayment = parsePendingPayment;
|
|
18
|
+
exports.classifyRecordedPayment = classifyRecordedPayment;
|
|
19
|
+
/** The env key that records the deposit payment `hsuite subscribe` sent for an entity. */
|
|
20
|
+
exports.PENDING_PAYMENT_KEY = 'SUBSCRIPTION_PENDING_PAYMENT';
|
|
21
|
+
/**
|
|
22
|
+
* The env key that records the credit payment `hsuite topup` sent for an entity (#3917 item 5).
|
|
23
|
+
* Its own slot, in the same format: a top-up must not read a deposit payment `subscribe` could not
|
|
24
|
+
* clear, nor the other way round.
|
|
25
|
+
*/
|
|
26
|
+
exports.PENDING_TOPUP_PAYMENT_KEY = 'SUBSCRIPTION_PENDING_TOPUP_PAYMENT';
|
|
27
|
+
/** An entity id as the CLI saves it (`SUBSCRIPTION_APP_ID`): no `@`, so the record splits unambiguously. */
|
|
28
|
+
const APP_ID = /^[A-Za-z0-9._-]{1,128}$/;
|
|
29
|
+
const TX_HASH = /^[0-9A-F]{64}$/;
|
|
30
|
+
const LEDGER_SEQUENCE = /^\d{1,10}$/;
|
|
31
|
+
function formatPendingPayment(p) {
|
|
32
|
+
return `${p.appId}@${p.txHash}@${p.lastLedgerSequence ?? ''}`;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* `<appId>@<tx hash>@<LastLedgerSequence or empty>` → the record, or `undefined` for anything else.
|
|
36
|
+
* Strict on purpose: the hash is sent to the ledger and printed into advice, and the sequence
|
|
37
|
+
* decides whether a payment may be sent again, so neither is read by `Number()`'s lenient rules.
|
|
38
|
+
*/
|
|
39
|
+
function parsePendingPayment(raw) {
|
|
40
|
+
const parts = raw.trim().split('@');
|
|
41
|
+
if (parts.length !== 3)
|
|
42
|
+
return undefined;
|
|
43
|
+
const [appId, hash, sequence] = parts;
|
|
44
|
+
const txHash = hash.toUpperCase();
|
|
45
|
+
if (!APP_ID.test(appId) || !TX_HASH.test(txHash))
|
|
46
|
+
return undefined;
|
|
47
|
+
if (sequence === '')
|
|
48
|
+
return { appId, txHash };
|
|
49
|
+
if (!LEDGER_SEQUENCE.test(sequence))
|
|
50
|
+
return undefined;
|
|
51
|
+
return { appId, txHash, lastLedgerSequence: Number(sequence) };
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* How far behind its `LastLedgerSequence` a transaction can sit in a ledger: autofill sets
|
|
55
|
+
* LLS = the current ledger + a small buffer, so the payment cannot be in a ledger older than
|
|
56
|
+
* `LLS - 256`. The `tx` lookup searches exactly `[LLS - 256, LLS]`, which is what lets a
|
|
57
|
+
* `txnNotFound` answer mean "not in any ledger it could have been in" (`searched_all`).
|
|
58
|
+
*/
|
|
59
|
+
exports.LLS_HISTORY_WINDOW = 256;
|
|
60
|
+
function classifyRecordedPayment(lookup, payment, validatedLedger) {
|
|
61
|
+
if (lookup.found) {
|
|
62
|
+
if (!lookup.validated)
|
|
63
|
+
return 'pending';
|
|
64
|
+
// A validated transaction whose result cannot be read may be a success.
|
|
65
|
+
if (lookup.result === undefined)
|
|
66
|
+
return 'pending';
|
|
67
|
+
return lookup.result === 'tesSUCCESS' ? 'delivered' : 'failed';
|
|
68
|
+
}
|
|
69
|
+
const { lastLedgerSequence } = payment;
|
|
70
|
+
if (lookup.searchedAll &&
|
|
71
|
+
lastLedgerSequence !== undefined &&
|
|
72
|
+
validatedLedger !== undefined &&
|
|
73
|
+
validatedLedger > lastLedgerSequence) {
|
|
74
|
+
return 'never-landed';
|
|
75
|
+
}
|
|
76
|
+
return 'pending';
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=payment-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-record.js","sourceRoot":"","sources":["../../src/_lib/payment-record.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAyBH,oDAEC;AAOD,kDASC;AAkCD,0DAqBC;AAhGD,0FAA0F;AAC7E,QAAA,mBAAmB,GAAG,8BAA8B,CAAC;AAElE;;;;GAIG;AACU,QAAA,yBAAyB,GAAG,oCAAoC,CAAC;AAU9E,4GAA4G;AAC5G,MAAM,MAAM,GAAG,yBAAyB,CAAC;AACzC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AACjC,MAAM,eAAe,GAAG,YAAY,CAAC;AAErC,SAAgB,oBAAoB,CAAC,CAAiB;IACpD,OAAO,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC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E,MAAM,CAAC,WAAW;QAClB,kBAAkB,KAAK,SAAS;QAChC,eAAe,KAAK,SAAS;QAC7B,eAAe,GAAG,kBAAkB,EACpC,CAAC;QACD,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,CAiBjD,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"}
|
package/dist/_lib/runtime-env.js
CHANGED
|
@@ -17,6 +17,14 @@ 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',
|
|
23
|
+
// Likewise (#3917): the hash of the deposit payment `subscribe` last signed, kept until the
|
|
24
|
+
// platform credits it so a re-priced quote is never paid over it.
|
|
25
|
+
'SUBSCRIPTION_PENDING_PAYMENT',
|
|
26
|
+
// And the same for `hsuite topup`'s credit payment (#3917 item 5).
|
|
27
|
+
'SUBSCRIPTION_PENDING_TOPUP_PAYMENT',
|
|
20
28
|
]);
|
|
21
29
|
/**
|
|
22
30
|
* Keys whose presence lets the deployed app authenticate as the developer's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-env.js","sourceRoot":"","sources":["../../src/_lib/runtime-env.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"runtime-env.js","sourceRoot":"","sources":["../../src/_lib/runtime-env.ts"],"names":[],"mappings":";;;AAoJA,8CA+CC;AA/JD;;;;;GAKG;AACU,QAAA,kBAAkB,GAAwB,IAAI,GAAG,CAAC;IAC7D,6EAA6E;IAC7E,+EAA+E;IAC/E,gBAAgB;IAChB,eAAe;IACf,aAAa;IACb,kEAAkE;IAClE,UAAU;IACV,gBAAgB;IAChB,gGAAgG;IAChG,+EAA+E;IAC/E,6BAA6B;IAC7B,4FAA4F;IAC5F,kEAAkE;IAClE,8BAA8B;IAC9B,mEAAmE;IACnE,oC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6EAA6E;IAC7E,oEAAoE;IACpE,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QACrD,IAAI,IAAI,IAAI,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,IAAI,CACF,kDAAkD,GAAG,sBAAsB;gBACzE,kEAAkE;gBAClE,kEAAkE;gBAClE,mCAAmC,CACtC,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IACpB,CAAC;IAED,4DAA4D;IAC5D,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,OAAO,GAAG,kCAA0B,CAAC,MAAM,CAC/C,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,EAAE,CACnD,CAAC;QACF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,8 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin CLI adapter over the SDK's subscription + validator-auth clients.
|
|
3
|
+
*
|
|
4
|
+
* The validator-side `/api/v3/subscription/*` surface and the Web3 validator
|
|
5
|
+
* auth (`/auth/validator/*`) are already covered by `SubscriptionClient` and
|
|
6
|
+
* `ValidatorAuthClient` in `@hsuite/smart-engines-sdk`. To keep the CLI from
|
|
7
|
+
* drifting from the SDK, this file no longer hand-rolls its own `fetch`/auth
|
|
8
|
+
* plumbing — it delegates to the SDK clients, built on the SDK's shared
|
|
9
|
+
* `createHttpClient`.
|
|
10
|
+
*
|
|
11
|
+
* The public shape (class name, method names, response types) is preserved so
|
|
12
|
+
* the CLI command bodies (subscribe/renew/upgrade/downgrade/billing/usage) and
|
|
13
|
+
* their unit tests are unchanged. Tests still inject a fake transport via the
|
|
14
|
+
* constructor's `fetchImpl` seam (and stub `authenticate()` to a no-op).
|
|
15
|
+
*
|
|
16
|
+
* Mapping to the SDK client:
|
|
17
|
+
* request → SubscriptionClient.request (flat body matches SubscriptionRequest)
|
|
18
|
+
* status → SubscriptionClient.getStatus
|
|
19
|
+
* mint → SubscriptionClient.mintNft
|
|
20
|
+
* renew → SubscriptionClient.renew({ appId, additionalDays })
|
|
21
|
+
* upgrade → SubscriptionClient.upgrade({ appId, toTier }) (+ flatten effectiveAt)
|
|
22
|
+
* downgrade → SubscriptionClient.downgrade({ appId, toTier }) (+ flatten effectiveAt)
|
|
23
|
+
* cancelTierChange → SubscriptionClient.cancelTierChange({ appId })
|
|
24
|
+
* usage → SubscriptionClient.getUsage
|
|
25
|
+
* usageStatus → SubscriptionClient.getUsageStatus
|
|
26
|
+
* billing → SubscriptionClient.getBilling(appId, { limit, offset })
|
|
27
|
+
*
|
|
28
|
+
* `createApp` (POST /api/v3/smart-apps) is NOT part of the SDK's subscription
|
|
29
|
+
* surface, so it is kept here as a thin shim against the validator's smart-app
|
|
30
|
+
* create route, posting on the same shared `${origin}/api/v3` client.
|
|
31
|
+
*/
|
|
32
|
+
import { type SubscriptionOrder } from '@hsuite/smart-engines-sdk';
|
|
33
|
+
export type { SubscriptionOrder } from '@hsuite/smart-engines-sdk';
|
|
1
34
|
export type DepositInstructions = {
|
|
2
35
|
walletAddress: string;
|
|
3
36
|
tokenId: string;
|
|
37
|
+
/** Total HST to pay in ONE payment (base + any reserve surcharge). */
|
|
4
38
|
amount: string;
|
|
5
39
|
chain: string;
|
|
40
|
+
/** #3022 — base price, present when a reserve surcharge applies. */
|
|
41
|
+
baseAmount?: string;
|
|
42
|
+
/** #3022 — XRPL deposit-account reserve surcharge line item. */
|
|
43
|
+
reserveSurcharge?: {
|
|
44
|
+
hstAmount: string;
|
|
45
|
+
xrpOutlayDrops: string;
|
|
46
|
+
xrpPriceInHst: string;
|
|
47
|
+
treasury: string;
|
|
48
|
+
};
|
|
49
|
+
/** #3699 — the price-locked SubscriptionOrder's id (PR1a: informational
|
|
50
|
+
* only; PR1b wires requote/deadline enforcement). */
|
|
51
|
+
orderId?: string;
|
|
52
|
+
/** #3699 — the order's locked quote expiry (deadline display comes in PR1b). */
|
|
53
|
+
expiresAt?: string;
|
|
54
|
+
/** #3699 — the CSPRNG tag the auto-pay Payment must carry so PR1b's
|
|
55
|
+
* `account_tx` matcher (never bare `Amount`) can find it. */
|
|
56
|
+
destinationTag?: number;
|
|
57
|
+
/** #3699 — the locked HSUITE/USD rate snapshot the quote was priced at. */
|
|
58
|
+
rate?: {
|
|
59
|
+
hsuiteUsd: string;
|
|
60
|
+
source: string;
|
|
61
|
+
};
|
|
62
|
+
/** #3699 — the locked USD price the quote was priced at. */
|
|
63
|
+
priceUsd?: number;
|
|
64
|
+
/** #3699 — the locked HSUITE smallest-units due. */
|
|
65
|
+
hsuiteDue?: string;
|
|
66
|
+
/**
|
|
67
|
+
* #3699 PR2 — present ONLY for an order priced in XRP: pay THIS (XRP drops to `address`, carrying the tag)
|
|
68
|
+
* instead of the HST `amount`, which then describes what the deposit account holds once the platform has
|
|
69
|
+
* converted the XRP.
|
|
70
|
+
*/
|
|
71
|
+
pay?: {
|
|
72
|
+
asset: string;
|
|
73
|
+
amount: string;
|
|
74
|
+
address: string;
|
|
75
|
+
destinationTag: number;
|
|
76
|
+
};
|
|
6
77
|
};
|
|
7
78
|
/**
|
|
8
79
|
* Canonical `ValidatorRules` block — what the validator's mandatory creation
|
|
@@ -15,6 +86,19 @@ export type ValidatorRules = Record<string, unknown> & {
|
|
|
15
86
|
type: 'account' | 'token' | 'topic' | 'agent';
|
|
16
87
|
created: string;
|
|
17
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* Requestor-signed entity-create intent proof (#3506 A3) — mirrors
|
|
91
|
+
* `EntityCreateIntentProofSchema`
|
|
92
|
+
* (`libs/multi-chain-core/src/rules/canonical/entity-create-intent.ts`).
|
|
93
|
+
* Structural type here so the CLI has no runtime dependency on
|
|
94
|
+
* `@hsuite/smart-engines-multi-chain-core`; built via the SDK's
|
|
95
|
+
* `signEntityCreateIntent`.
|
|
96
|
+
*/
|
|
97
|
+
export type CreationIntentProof = {
|
|
98
|
+
message: string;
|
|
99
|
+
signature: string;
|
|
100
|
+
publicKey?: string;
|
|
101
|
+
};
|
|
18
102
|
/**
|
|
19
103
|
* Smart-app create payload — mirrors `CreateSmartAppSchema`
|
|
20
104
|
* (apps/smart-validator/src/smart-app/dto/create-smart-app.dto.ts).
|
|
@@ -26,12 +110,31 @@ export type CreateAppPayload = {
|
|
|
26
110
|
tier: string;
|
|
27
111
|
networks: string[];
|
|
28
112
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
|
|
113
|
+
* The exact rule the intent signs. Required by the validator (#3632): it no
|
|
114
|
+
* longer synthesizes a default, so `hsuite subscribe` sends
|
|
115
|
+
* `buildDefaultSmartAppValidatorRules()` from `@hsuite/smart-engines-sdk`.
|
|
116
|
+
*/
|
|
117
|
+
validatorRules: ValidatorRules;
|
|
118
|
+
/**
|
|
119
|
+
* The requestor-signed proof (#3506 A3) binding this create to `validatorRules`
|
|
120
|
+
* and to a leader-independent `entityId`. Required by the validator (#3632):
|
|
121
|
+
* a create without it is refused (400), and every responder withholds an
|
|
122
|
+
* intent-less smart-app.
|
|
123
|
+
*/
|
|
124
|
+
creationIntent: CreationIntentProof;
|
|
125
|
+
/**
|
|
126
|
+
* The DEVELOPER's signed create intent for the subscription's deposit wallet (#3506 A2c):
|
|
127
|
+
* app-bound (v2) to the smart-app's own intent-derived entityId, signing the canonical
|
|
128
|
+
* `subscription` deposit rule. Required by the validator: it checks it before the smart-app's
|
|
129
|
+
* DKG runs, so a bad one is a 400 with nothing created.
|
|
130
|
+
*/
|
|
131
|
+
depositCreationIntent: CreationIntentProof;
|
|
132
|
+
/**
|
|
133
|
+
* #3699 PR2 — the asset to pay the subscription in (a symbol; omitted = HSUITE). `hsuite subscribe
|
|
134
|
+
* --pay-with xrp` sends `'XRP'`; the validator answers with `depositInstructions.pay` (XRP drops, with
|
|
135
|
+
* the order's tag) or refuses (`xrp_quote_unavailable:`, or "not yet supported" when XRP payments are off).
|
|
33
136
|
*/
|
|
34
|
-
|
|
137
|
+
paymentAsset?: string;
|
|
35
138
|
};
|
|
36
139
|
/**
|
|
37
140
|
* Response from `POST /api/v3/smart-apps` (SmartAppController.create).
|
|
@@ -269,7 +372,15 @@ export declare class SubscriptionClient {
|
|
|
269
372
|
appDescription?: string;
|
|
270
373
|
logoUrl?: string;
|
|
271
374
|
metadata?: Record<string, unknown>;
|
|
375
|
+
/** The developer's signed intent for the deposit wallet this request creates (#3506 A2c). */
|
|
376
|
+
depositCreationIntent?: CreationIntentProof;
|
|
272
377
|
}): Promise<SubscriptionRequestResponse>;
|
|
378
|
+
/**
|
|
379
|
+
* The deposit token a deposit-rule intent is signed over for `chain` (XRPL: `HST.<issuer>`), from
|
|
380
|
+
* the PUBLIC `GET /api/v3/subscription/config` (`depositTokenIds`). `undefined` when the cluster
|
|
381
|
+
* reports none or predates payer-signed deposit wallets (#3506 A2c) — the caller must not sign.
|
|
382
|
+
*/
|
|
383
|
+
depositTokenId(chain: string): Promise<string | undefined>;
|
|
273
384
|
status(appId: string): Promise<SubscriptionStatusResponse>;
|
|
274
385
|
mint(appId: string): Promise<MintResponse>;
|
|
275
386
|
renew(appId: string, additionalDays?: number): Promise<RenewResponse>;
|
|
@@ -286,10 +397,30 @@ export declare class SubscriptionClient {
|
|
|
286
397
|
depositAddress?: string;
|
|
287
398
|
expectedTotal?: string;
|
|
288
399
|
message?: string;
|
|
400
|
+
orderId?: string;
|
|
401
|
+
expiresAt?: string;
|
|
402
|
+
destinationTag?: number;
|
|
403
|
+
rate?: {
|
|
404
|
+
hsuiteUsd: string;
|
|
405
|
+
source: string;
|
|
406
|
+
};
|
|
407
|
+
priceUsd?: number;
|
|
408
|
+
hsuiteDue?: string;
|
|
289
409
|
}>;
|
|
290
410
|
upgrade(appId: string, toTier: string): Promise<TierChangeResponse>;
|
|
291
411
|
downgrade(appId: string, toTier: string): Promise<TierChangeResponse>;
|
|
292
412
|
cancelTierChange(appId: string): Promise<TierChangeResponse>;
|
|
413
|
+
/**
|
|
414
|
+
* Read a price-locked SubscriptionOrder quote (#3699). Owner-only.
|
|
415
|
+
*/
|
|
416
|
+
getOrder(orderId: string): Promise<SubscriptionOrder>;
|
|
417
|
+
/**
|
|
418
|
+
* Re-quote an expired/underpaid order at the current rate (#3699 PR1b,
|
|
419
|
+
* D6/D8) — the CLI's deadline-aware auto-pay (`subscribe`/`topup`) calls
|
|
420
|
+
* this before paying an order whose `expiresAt` has passed, then pays the
|
|
421
|
+
* NEW amount/tag. Never submit a payment for an expired order.
|
|
422
|
+
*/
|
|
423
|
+
requoteOrder(orderId: string): Promise<SubscriptionOrder>;
|
|
293
424
|
usage(appId: string): Promise<UsageSummaryResponse>;
|
|
294
425
|
usageStatus(appId: string): Promise<UsageStatusResponse>;
|
|
295
426
|
billing(appId: string, limit?: number, offset?: number): Promise<BillingLedgerResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-client.d.ts","sourceRoot":"","sources":["../../src/_lib/subscription-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subscription-client.d.ts","sourceRoot":"","sources":["../../src/_lib/subscription-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAML,KAAK,iBAAiB,EACvB,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAInE,MAAM,MAAM,mBAAmB,GAAG;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;IACf,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