@hsuite/smart-engines-cli 1.9.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/env.d.ts.map +1 -1
- package/dist/_lib/env.js +9 -7
- 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 +23 -0
- package/dist/_lib/order-deadline.d.ts.map +1 -1
- package/dist/_lib/order-deadline.js +40 -6
- package/dist/_lib/order-deadline.js.map +1 -1
- 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 +5 -0
- package/dist/_lib/runtime-env.js.map +1 -1
- package/dist/_lib/subscription-client.d.ts +40 -11
- package/dist/_lib/subscription-client.d.ts.map +1 -1
- package/dist/_lib/subscription-client.js +9 -0
- 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 +16 -1
- package/dist/_lib/xrpl-login-signer.d.ts.map +1 -1
- package/dist/_lib/xrpl-login-signer.js +25 -1
- package/dist/_lib/xrpl-login-signer.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/subscribe.d.ts +17 -3
- package/dist/commands/subscribe.d.ts.map +1 -1
- package/dist/commands/subscribe.js +223 -107
- 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 +126 -14
- package/dist/commands/topup.js.map +1 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +15 -4
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +7 -1
- package/dist/commands/verify.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,99 @@
|
|
|
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.PAY_WITH_VALUES = void 0;
|
|
7
|
+
exports.parsePayWith = parsePayWith;
|
|
8
|
+
exports.xrpPaymentOf = xrpPaymentOf;
|
|
9
|
+
exports.assertXrpPaymentConsistent = assertXrpPaymentConsistent;
|
|
10
|
+
exports.dropsToXrp = dropsToXrp;
|
|
11
|
+
exports.buildXrpPaymentTx = buildXrpPaymentTx;
|
|
12
|
+
exports.xrpSendDeeplink = xrpSendDeeplink;
|
|
13
|
+
exports.renderXrpPayment = renderXrpPayment;
|
|
14
|
+
/**
|
|
15
|
+
* #3699 PR2 — paying a subscription in XRP (`hsuite subscribe --pay-with xrp`).
|
|
16
|
+
*
|
|
17
|
+
* The validator prices the order in XRP and says what to send in `depositInstructions.pay`: an XRP Payment
|
|
18
|
+
* of `pay.amount` DROPS to `pay.address` carrying `pay.destinationTag`. The tag is how the payment is matched
|
|
19
|
+
* to the order; a payment without it is not attributed. The HST fields of the same instructions describe what
|
|
20
|
+
* the deposit account ends up holding once the platform has converted the XRP into it, inside the account.
|
|
21
|
+
* Nothing here signs or submits: it parses the option, reads the instruction and builds the transaction and
|
|
22
|
+
* the text the command prints.
|
|
23
|
+
*/
|
|
24
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
25
|
+
/** The values `--pay-with` accepts, for the option text and the refusal. */
|
|
26
|
+
exports.PAY_WITH_VALUES = ['hsuite', 'xrp'];
|
|
27
|
+
/** Parse `--pay-with` (case-insensitive; omitted = hsuite). Throws, before anything is sent, on any other value. */
|
|
28
|
+
function parsePayWith(raw) {
|
|
29
|
+
if (raw === undefined)
|
|
30
|
+
return 'hsuite';
|
|
31
|
+
const value = raw.trim().toLowerCase();
|
|
32
|
+
if (value === 'hsuite' || value === 'hst')
|
|
33
|
+
return 'hsuite';
|
|
34
|
+
if (value === 'xrp')
|
|
35
|
+
return 'xrp';
|
|
36
|
+
throw new Error(`unknown --pay-with "${raw}". Valid: ${exports.PAY_WITH_VALUES.join(', ')}`);
|
|
37
|
+
}
|
|
38
|
+
function xrpPaymentOf(deposit) {
|
|
39
|
+
return deposit.pay?.asset === 'XRP' ? deposit.pay : undefined;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The CLI pays exactly what the response tells it to, so it checks what it is told before anything is signed
|
|
43
|
+
* or shown: the instruction pays the deposit account the SAME response names (a hostile validator or gateway
|
|
44
|
+
* cannot point the payment elsewhere), for a positive count of drops, with a 32-bit destination tag.
|
|
45
|
+
*/
|
|
46
|
+
function assertXrpPaymentConsistent(deposit, pay) {
|
|
47
|
+
const show = (value) => JSON.stringify(String(value).slice(0, 48));
|
|
48
|
+
if (pay.address !== deposit.walletAddress) {
|
|
49
|
+
throw new Error(`the XRP payment instruction pays ${show(pay.address)}, not the deposit account ${show(deposit.walletAddress)} — nothing was paid`);
|
|
50
|
+
}
|
|
51
|
+
if (typeof pay.amount !== 'string' || !/^[1-9]\d{0,16}$/.test(pay.amount)) {
|
|
52
|
+
throw new Error(`the XRP payment amount ${show(pay.amount)} is not a positive count of drops — nothing was paid`);
|
|
53
|
+
}
|
|
54
|
+
if (!Number.isInteger(pay.destinationTag) || pay.destinationTag < 0 || pay.destinationTag > 0xffffffff) {
|
|
55
|
+
throw new Error(`the XRP payment destination tag ${show(pay.destinationTag)} is not a 32-bit unsigned integer — nothing was paid`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Drops (a plain integer string) as XRP, exact, with the trailing zeros dropped ('99960000000' → '99960',
|
|
60
|
+
* '1500000' → '1.5'). Throws on anything that is not a non-negative integer: an amount that cannot be read
|
|
61
|
+
* is never paid.
|
|
62
|
+
*/
|
|
63
|
+
function dropsToXrp(drops) {
|
|
64
|
+
if (!/^\d+$/.test(drops))
|
|
65
|
+
throw new Error(`not a count of drops: ${JSON.stringify(drops)}`);
|
|
66
|
+
const padded = BigInt(drops).toString().padStart(7, '0');
|
|
67
|
+
const whole = padded.slice(0, -6);
|
|
68
|
+
const fraction = padded.slice(-6).replace(/0+$/, '');
|
|
69
|
+
return fraction === '' ? whole : `${whole}.${fraction}`;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The Payment that pays an XRP order: XRP drops to the order's deposit account, with its Destination Tag.
|
|
73
|
+
* `Amount` is the drops STRING the quote asks, verbatim (never re-derived), and the tag is always present
|
|
74
|
+
* (`0` included): the platform attributes the payment by it.
|
|
75
|
+
*/
|
|
76
|
+
function buildXrpPaymentTx(account, pay) {
|
|
77
|
+
return {
|
|
78
|
+
TransactionType: 'Payment',
|
|
79
|
+
Account: account,
|
|
80
|
+
Destination: pay.address,
|
|
81
|
+
Amount: pay.amount,
|
|
82
|
+
DestinationTag: pay.destinationTag,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** The XUMM deeplink of an XRP order's payment: the tag rides it (`dt=`), `0` included. */
|
|
86
|
+
function xrpSendDeeplink(pay) {
|
|
87
|
+
return (`xumm://xrpl/send?to=${encodeURIComponent(pay.address)}` +
|
|
88
|
+
`&amount=${encodeURIComponent(dropsToXrp(pay.amount))}` +
|
|
89
|
+
`&dt=${encodeURIComponent(String(pay.destinationTag))}`);
|
|
90
|
+
}
|
|
91
|
+
/** The payment lines of an XRP order's instructions, in the style of the HST ones. */
|
|
92
|
+
function renderXrpPayment(d, pay) {
|
|
93
|
+
console.log(chalk_1.default.gray(` amount: ${dropsToXrp(pay.amount)} XRP (${pay.amount} drops)`));
|
|
94
|
+
console.log(chalk_1.default.gray(` to: ${pay.address}`));
|
|
95
|
+
console.log(chalk_1.default.gray(` tag: ${pay.destinationTag} (Destination Tag — REQUIRED on the payment)`));
|
|
96
|
+
console.log(chalk_1.default.gray(` the platform converts it into ${d.amount} HST (${d.tokenId}) inside the deposit account; ` +
|
|
97
|
+
'the buffer in the price covers the exchange, and any XRP left over is returned to the protocol'));
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=xrp-payment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xrp-payment.js","sourceRoot":"","sources":["../../src/_lib/xrp-payment.ts"],"names":[],"mappings":";;;;;;AAoBA,oCAMC;AAID,oCAEC;AAOD,gEAWC;AAOD,gCAMC;AAOD,8CAQC;AAGD,0CAMC;AAGD,4CAUC;AApGD;;;;;;;;;GASG;AACH,kDAA0B;AAM1B,4EAA4E;AAC/D,QAAA,eAAe,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAU,CAAC;AAE1D,oHAAoH;AACpH,SAAgB,YAAY,CAAC,GAAuB;IAClD,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AAC,EAAE;QACxD,WAAW,kBAAkB,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE;QACvD,OAAO,kBAAkB,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,EAAE,CACxD,CAAC;AACJ,CAAC;AAED,sFAAsF;AACtF,SAAgB,gBAAgB,CAAC,CAAoE,EAAE,GAAW;IAChH,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,iBAAiB,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,MAAM,SAAS,CAAC,CAAC,CAAC;IAC7F,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,iBAAiB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,iBAAiB,GAAG,CAAC,cAAc,8CAA8C,CAAC,CAAC,CAAC;IAC3G,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,IAAI,CACR,qCAAqC,CAAC,CAAC,MAAM,SAAS,CAAC,CAAC,OAAO,gCAAgC;QAC7F,gGAAgG,CACnG,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The ONE way the CLI derives an XRPL signing identity from a seed (#3506 A3
|
|
3
|
-
* MEDIUM-1 fix).
|
|
3
|
+
* MEDIUM-1 fix; #3667 for the payment/trustline/accept transactions).
|
|
4
4
|
*
|
|
5
5
|
* Both `SubscriptionClient.authenticate()` (validator web3-auth login) and
|
|
6
6
|
* `hsuite subscribe`'s entity-create-intent signing MUST use the exact SAME
|
|
@@ -36,4 +36,19 @@ export type XrplLoginSigner = {
|
|
|
36
36
|
* command that never touches XRPL never pays for it.
|
|
37
37
|
*/
|
|
38
38
|
export declare function buildXrplLoginSigner(address: string, seed: string): Promise<XrplLoginSigner>;
|
|
39
|
+
/**
|
|
40
|
+
* Signs PREPARED (autofilled) XRPL transactions with the seed's OWN key (#3667):
|
|
41
|
+
* `ripple-keypairs.deriveKeypair(seed)` — the same derivation {@link buildXrplLoginSigner}
|
|
42
|
+
* logs in with — handed to `xrpl.Wallet`'s signing. The transaction's `Account` is
|
|
43
|
+
* whatever the caller put there (`XRPL_ADDRESS`), so a `RegularKey` setup, whose seed
|
|
44
|
+
* is NOT the master key, signs correctly as that account.
|
|
45
|
+
*
|
|
46
|
+
* NEVER `xrpl.Wallet.fromSeed(seed)`: it forces ed25519, so a secp256k1 seed signed
|
|
47
|
+
* `hsuite subscribe`'s deposit, `topup`'s credit, `faucet`'s TrustSet and the NFT accept
|
|
48
|
+
* with a key the account does not have — the create succeeded (its intent already used
|
|
49
|
+
* this derivation, #3648) and the auto-pay then failed, leaving a pending subscription.
|
|
50
|
+
*
|
|
51
|
+
* Synchronous on purpose: the `walletSignFactory` seams that call it are.
|
|
52
|
+
*/
|
|
53
|
+
export declare function buildXrplTxSigner(seed: string): (tx: Record<string, unknown>) => string;
|
|
39
54
|
//# sourceMappingURL=xrpl-login-signer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xrpl-login-signer.d.ts","sourceRoot":"","sources":["../../src/_lib/xrpl-login-signer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,MAAM,eAAe,GAAG;IAC5B,uFAAuF;IACvF,OAAO,EAAE,MAAM,CAAC;IAChB,8GAA8G;IAC9G,SAAS,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,eAAe,CAAC,CAW1B"}
|
|
1
|
+
{"version":3,"file":"xrpl-login-signer.d.ts","sourceRoot":"","sources":["../../src/_lib/xrpl-login-signer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,MAAM,eAAe,GAAG;IAC5B,uFAAuF;IACvF,OAAO,EAAE,MAAM,CAAC;IAChB,8GAA8G;IAC9G,SAAS,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,eAAe,CAAC,CAW1B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAQvF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* The ONE way the CLI derives an XRPL signing identity from a seed (#3506 A3
|
|
4
|
-
* MEDIUM-1 fix).
|
|
4
|
+
* MEDIUM-1 fix; #3667 for the payment/trustline/accept transactions).
|
|
5
5
|
*
|
|
6
6
|
* Both `SubscriptionClient.authenticate()` (validator web3-auth login) and
|
|
7
7
|
* `hsuite subscribe`'s entity-create-intent signing MUST use the exact SAME
|
|
@@ -58,6 +58,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
58
58
|
})();
|
|
59
59
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
60
|
exports.buildXrplLoginSigner = buildXrplLoginSigner;
|
|
61
|
+
exports.buildXrplTxSigner = buildXrplTxSigner;
|
|
61
62
|
/**
|
|
62
63
|
* Build the CLI's XRPL login/signing identity. `ripple-keypairs` is a
|
|
63
64
|
* transitive dep of `xrpl` (a CLI runtime dep); imported lazily so a CLI
|
|
@@ -75,4 +76,27 @@ async function buildXrplLoginSigner(address, seed) {
|
|
|
75
76
|
},
|
|
76
77
|
};
|
|
77
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Signs PREPARED (autofilled) XRPL transactions with the seed's OWN key (#3667):
|
|
81
|
+
* `ripple-keypairs.deriveKeypair(seed)` — the same derivation {@link buildXrplLoginSigner}
|
|
82
|
+
* logs in with — handed to `xrpl.Wallet`'s signing. The transaction's `Account` is
|
|
83
|
+
* whatever the caller put there (`XRPL_ADDRESS`), so a `RegularKey` setup, whose seed
|
|
84
|
+
* is NOT the master key, signs correctly as that account.
|
|
85
|
+
*
|
|
86
|
+
* NEVER `xrpl.Wallet.fromSeed(seed)`: it forces ed25519, so a secp256k1 seed signed
|
|
87
|
+
* `hsuite subscribe`'s deposit, `topup`'s credit, `faucet`'s TrustSet and the NFT accept
|
|
88
|
+
* with a key the account does not have — the create succeeded (its intent already used
|
|
89
|
+
* this derivation, #3648) and the auto-pay then failed, leaving a pending subscription.
|
|
90
|
+
*
|
|
91
|
+
* Synchronous on purpose: the `walletSignFactory` seams that call it are.
|
|
92
|
+
*/
|
|
93
|
+
function buildXrplTxSigner(seed) {
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
95
|
+
const { Wallet } = require('xrpl');
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
97
|
+
const { deriveKeypair } = require('ripple-keypairs');
|
|
98
|
+
const { publicKey, privateKey } = deriveKeypair(seed);
|
|
99
|
+
const wallet = new Wallet(publicKey, privateKey);
|
|
100
|
+
return (tx) => wallet.sign(tx).tx_blob;
|
|
101
|
+
}
|
|
78
102
|
//# sourceMappingURL=xrpl-login-signer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xrpl-login-signer.js","sourceRoot":"","sources":["../../src/_lib/xrpl-login-signer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;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AC,OAAiB,CAAC;AAC5E,CAAC"}
|
|
@@ -46,7 +46,7 @@ export type FaucetOpts = {
|
|
|
46
46
|
};
|
|
47
47
|
/**
|
|
48
48
|
* Signs a prepared XRPL TrustSet tx with the dev wallet seed, returning the
|
|
49
|
-
* tx_blob to submit. Defaults to
|
|
49
|
+
* tx_blob to submit. Defaults to {@link buildXrplTxSigner}: the seed's OWN key (#3667).
|
|
50
50
|
* Injected by unit tests so they don't need a real-format seed.
|
|
51
51
|
*/
|
|
52
52
|
walletSignFactory?: (seed: string) => (tx: Record<string, unknown>) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faucet.d.ts","sourceRoot":"","sources":["../../src/commands/faucet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EACL,YAAY,EAIb,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"faucet.d.ts","sourceRoot":"","sources":["../../src/commands/faucet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EACL,YAAY,EAIb,MAAM,uBAAuB,CAAC;AAO/B;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5B,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACxE,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE;YAAE,IAAI,CAAC,EAAE,GAAG,CAAA;SAAE,CAAA;KAAE,CAAC,CAAC;CAClE,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IAEd,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,YAAY,CAAC;IAClD,+EAA+E;IAC/E,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,cAAc,CAAC;IACpD,uEAAuE;IACvE,WAAW,CAAC,EAAE,CACZ,IAAI,EAAE,MAAM,KACT;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAA;KAAE,CAAC;IAC9D;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,CAClB,IAAI,EAAE,MAAM,KACT,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,uBAAuB,EAAE,MAAM,CAAC;IAChC,0EAA0E;IAC1E,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AA2BF;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;gBACvB,iBAAiB,EAAE,MAAM;CAKtC;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAkCvE;AA0DD,eAAO,MAAM,aAAa,SAkCtB,CAAC"}
|
package/dist/commands/faucet.js
CHANGED
|
@@ -29,6 +29,7 @@ const ora_1 = __importDefault(require("ora"));
|
|
|
29
29
|
const env_1 = require("../_lib/env");
|
|
30
30
|
const faucet_client_1 = require("../_lib/faucet-client");
|
|
31
31
|
const subscription_env_1 = require("../_lib/subscription-env");
|
|
32
|
+
const xrpl_login_signer_1 = require("../_lib/xrpl-login-signer");
|
|
32
33
|
/** Public XRPL testnet websocket endpoint (matches `hsuite init`). */
|
|
33
34
|
const XRPL_TESTNET_WSS = 'wss://s.altnet.rippletest.net:51233';
|
|
34
35
|
/**
|
|
@@ -52,12 +53,6 @@ function defaultXrplClientFactory(wss) {
|
|
|
52
53
|
const { Client } = require('xrpl');
|
|
53
54
|
return new Client(wss);
|
|
54
55
|
}
|
|
55
|
-
function defaultWalletSignFactory(seed) {
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
57
|
-
const { Wallet } = require('xrpl');
|
|
58
|
-
const wallet = Wallet.fromSeed(seed);
|
|
59
|
-
return (tx) => wallet.sign(tx).tx_blob;
|
|
60
|
-
}
|
|
61
56
|
/**
|
|
62
57
|
* Error surfaced when the faucet is rate-limited. The command-level action
|
|
63
58
|
* catches it to print a friendly message + exit non-zero (vs. a crash trace).
|
|
@@ -123,7 +118,7 @@ async function challengeSignDispense(client, chain, recipientAddress, signer) {
|
|
|
123
118
|
* payment can deliver. Requires tesSUCCESS. Always disconnects.
|
|
124
119
|
*/
|
|
125
120
|
async function setTrustLine(opts, address, seed, trustLine) {
|
|
126
|
-
const walletSign = (opts.walletSignFactory ??
|
|
121
|
+
const walletSign = (opts.walletSignFactory ?? xrpl_login_signer_1.buildXrplTxSigner)(seed);
|
|
127
122
|
const client = (opts.xrplClientFactory ?? defaultXrplClientFactory)(XRPL_TESTNET_WSS);
|
|
128
123
|
await client.connect();
|
|
129
124
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faucet.js","sourceRoot":"","sources":["../../src/commands/faucet.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"faucet.js","sourceRoot":"","sources":["../../src/commands/faucet.ts"],"names":[],"mappings":";;;;;;AAwHA,8BAkCC;AA1JD;;;;;;;;;;;;;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deposit from the dev wallet over the XRPL testnet (HST
|
|
46
|
-
* Payment with a SendMax covering the 0.25% transfer fee
|
|
46
|
+
* Payment with a SendMax covering the 0.25% transfer fee; with
|
|
47
|
+
* `--pay-with xrp`, an XRP Payment of the quoted drops carrying the order's
|
|
48
|
+
* Destination Tag, #3699 PR2). `--no-autopay`
|
|
47
49
|
* skips this and prints instructions for manual (XUMM) payment; re-running
|
|
48
50
|
* `hsuite subscribe` afterwards resumes the saved entity. A RESUMED run first
|
|
49
51
|
* asks GET /status and never pays a deposit the platform reports credited
|
|
@@ -113,6 +115,14 @@ type SubscribeOpts = {
|
|
|
113
115
|
* spent HST against the developer's explicit instruction.)
|
|
114
116
|
*/
|
|
115
117
|
autopay?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* #3699 PR2 — what to pay the subscription in: `hsuite` (the default) or `xrp`. With `xrp` the validator
|
|
120
|
+
* prices the order in XRP (a quote at the HST/XRP market plus a buffer) and the deposit is an XRP payment
|
|
121
|
+
* of the quoted drops, carrying the order's Destination Tag; the platform converts it into HST inside the
|
|
122
|
+
* deposit account. A validator with XRP payments off, or with no HST/XRP market, refuses (nothing is
|
|
123
|
+
* created); one that answers with HST instructions anyway is refused HERE before anything is paid.
|
|
124
|
+
*/
|
|
125
|
+
payWith?: string;
|
|
116
126
|
pollIntervalMs?: number;
|
|
117
127
|
pollTimeoutMs?: number;
|
|
118
128
|
/**
|
|
@@ -134,10 +144,12 @@ type SubscribeOpts = {
|
|
|
134
144
|
xrplClientFactory?: (wss: string) => XrplNftClientLike;
|
|
135
145
|
/** Signs a prepared XRPL tx with the dev seed → tx_blob. Defaults to `xrpl`. */
|
|
136
146
|
walletSignFactory?: (seed: string) => (tx: Record<string, unknown>) => string;
|
|
147
|
+
/** The transaction hash of a signed blob (what the ledger knows the payment by). Defaults to `xrpl`'s `hashSignedTx`. */
|
|
148
|
+
hashSignedTx?: (txBlob: string) => string;
|
|
137
149
|
/**
|
|
138
150
|
* Builds the signer used to sign the entity-create intent (#3506 A3) for a
|
|
139
151
|
* FRESH create (no `--app-id`). Defaults to deriving a REAL XRPL signer
|
|
140
|
-
* from the dev seed via
|
|
152
|
+
* from the dev seed via {@link buildXrplLoginSigner} — the SAME key
|
|
141
153
|
* `authenticate()` signs with. Exposed so unit tests can inject a fake
|
|
142
154
|
* signer without a real XRPL seed (mirrors `xrplClientFactory` /
|
|
143
155
|
* `walletSignFactory`).
|
|
@@ -151,7 +163,9 @@ type SubscribeOpts = {
|
|
|
151
163
|
* persist them. Throws on every hard-error path; the command-level action wraps
|
|
152
164
|
* this and exits the process.
|
|
153
165
|
*/
|
|
154
|
-
export declare function runSubscribe(opts: SubscribeOpts):
|
|
166
|
+
export declare function runSubscribe(opts: SubscribeOpts): ReturnType<typeof runSubscribeLocked>;
|
|
167
|
+
/** The body of {@link runSubscribe}, run while it holds the env file's payment lock. */
|
|
168
|
+
declare function runSubscribeLocked(opts: SubscribeOpts): Promise<{
|
|
155
169
|
appId: string;
|
|
156
170
|
subscriptionId?: string;
|
|
157
171
|
nftSerial?: number | string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["../../src/commands/subscribe.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["../../src/commands/subscribe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAQL,KAAK,wBAAwB,EAC9B,MAAM,2BAA2B,CAAC;AAqBnC,OAAO,EACL,kBAAkB,EAElB,mBAAmB,EAIpB,MAAM,6BAA6B,CAAC;AA6BrC;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5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