@hsuite/smart-engines-cli 2.0.0 → 3.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 +3 -2
- package/dist/_lib/cluster-convergence.d.ts.map +1 -1
- package/dist/_lib/cluster-convergence.js +1 -1
- package/dist/_lib/cluster-convergence.js.map +1 -1
- package/dist/_lib/deposit-verification.d.ts +91 -0
- package/dist/_lib/deposit-verification.d.ts.map +1 -0
- package/dist/_lib/deposit-verification.js +265 -0
- package/dist/_lib/deposit-verification.js.map +1 -0
- package/dist/_lib/payment-guard.d.ts +2 -2
- package/dist/_lib/payment-guard.d.ts.map +1 -1
- package/dist/_lib/payment-guard.js.map +1 -1
- package/dist/_lib/payment-record.d.ts +6 -0
- package/dist/_lib/payment-record.d.ts.map +1 -1
- package/dist/_lib/payment-record.js +7 -1
- package/dist/_lib/payment-record.js.map +1 -1
- package/dist/_lib/subscription-client.d.ts +181 -7
- package/dist/_lib/subscription-client.d.ts.map +1 -1
- package/dist/_lib/subscription-client.js +63 -4
- package/dist/_lib/subscription-client.js.map +1 -1
- package/dist/_lib/swap-payment.d.ts +54 -0
- package/dist/_lib/swap-payment.d.ts.map +1 -0
- package/dist/_lib/swap-payment.js +203 -0
- package/dist/_lib/swap-payment.js.map +1 -0
- package/dist/_lib/xrp-payment.d.ts +20 -5
- package/dist/_lib/xrp-payment.d.ts.map +1 -1
- package/dist/_lib/xrp-payment.js +26 -8
- package/dist/_lib/xrp-payment.js.map +1 -1
- package/dist/commands/billing.d.ts +5 -3
- package/dist/commands/billing.d.ts.map +1 -1
- package/dist/commands/billing.js +12 -6
- package/dist/commands/billing.js.map +1 -1
- package/dist/commands/customer-scope.d.ts +57 -14
- package/dist/commands/customer-scope.d.ts.map +1 -1
- package/dist/commands/customer-scope.js +126 -25
- package/dist/commands/customer-scope.js.map +1 -1
- package/dist/commands/deploy.d.ts +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +15 -2
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +4 -2
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/redeploy.d.ts +4 -3
- package/dist/commands/redeploy.d.ts.map +1 -1
- package/dist/commands/redeploy.js +5 -4
- package/dist/commands/redeploy.js.map +1 -1
- package/dist/commands/renew.d.ts +47 -4
- package/dist/commands/renew.d.ts.map +1 -1
- package/dist/commands/renew.js +338 -9
- package/dist/commands/renew.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +22 -2
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/subscribe.d.ts +28 -0
- package/dist/commands/subscribe.d.ts.map +1 -1
- package/dist/commands/subscribe.js +225 -10
- package/dist/commands/subscribe.js.map +1 -1
- package/dist/commands/topup.d.ts +14 -0
- package/dist/commands/topup.d.ts.map +1 -1
- package/dist/commands/topup.js +22 -2
- package/dist/commands/topup.js.map +1 -1
- package/dist/commands/upgrade.d.ts +7 -0
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +27 -1
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/commands/usage.d.ts +2 -0
- package/dist/commands/usage.d.ts.map +1 -1
- package/dist/commands/usage.js +6 -1
- package/dist/commands/usage.js.map +1 -1
- package/dist/commands/verify.d.ts +17 -17
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +110 -106
- package/dist/commands/verify.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +9 -9
- package/dist/__tests__/helpers/fixtures-image-hygiene.d.ts +0 -18
- package/dist/__tests__/helpers/fixtures-image-hygiene.d.ts.map +0 -1
- package/dist/__tests__/helpers/fixtures-image-hygiene.js +0 -42
- package/dist/__tests__/helpers/fixtures-image-hygiene.js.map +0 -1
- package/dist/__tests__/helpers/fixtures.d.ts +0 -48
- package/dist/__tests__/helpers/fixtures.d.ts.map +0 -1
- package/dist/__tests__/helpers/fixtures.js +0 -79
- package/dist/__tests__/helpers/fixtures.js.map +0 -1
- package/dist/__tests__/helpers/xrpl-signing.d.ts +0 -26
- package/dist/__tests__/helpers/xrpl-signing.d.ts.map +0 -1
- package/dist/__tests__/helpers/xrpl-signing.js +0 -39
- package/dist/__tests__/helpers/xrpl-signing.js.map +0 -1
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.XRPL_FIXTURE = void 0;
|
|
4
|
-
exports.validatorVerifyXrplSignature = validatorVerifyXrplSignature;
|
|
5
|
-
exports.makeTempDir = makeTempDir;
|
|
6
|
-
exports.envPathIn = envPathIn;
|
|
7
|
-
/**
|
|
8
|
-
* Shared test fixtures for the @hsuite/smart-engines-cli specs.
|
|
9
|
-
*
|
|
10
|
-
* Centralises the XRPL seed/address/pubkey we sign with, the expected
|
|
11
|
-
* deterministic signature for a canonical payload, and a tmp-dir helper
|
|
12
|
-
* so individual specs don't repeat boilerplate.
|
|
13
|
-
*
|
|
14
|
-
* The fixture seed is fresh (generated 2026-05-22 with xrpl.Wallet.generate)
|
|
15
|
-
* and is NOT funded on any network. Re-deriving from this seed yields the
|
|
16
|
-
* same address / pubkey / signature on every machine — that's the whole
|
|
17
|
-
* point of an ed25519-with-deterministic-K (RFC 8032) signer.
|
|
18
|
-
*/
|
|
19
|
-
const fs_1 = require("fs");
|
|
20
|
-
const os_1 = require("os");
|
|
21
|
-
const path_1 = require("path");
|
|
22
|
-
/**
|
|
23
|
-
* Deterministic XRPL ed25519 fixture.
|
|
24
|
-
*
|
|
25
|
-
* Provenance — derived once with:
|
|
26
|
-
* node -e "const {Wallet}=require('xrpl'); const w=Wallet.fromSeed('sEdTyaBYHfQhWt9ycB9QJsRKH8UUEuD'); console.log(w.address, w.publicKey)"
|
|
27
|
-
*
|
|
28
|
-
* Expected signature derived by running the validator's exact verifier
|
|
29
|
-
* path (libs/security-core/src/auth/web3-auth.service.ts:334-340):
|
|
30
|
-
* const hex = Buffer.from(message, 'utf-8').toString('hex').toUpperCase();
|
|
31
|
-
* sign(hex, wallet.privateKey) // ripple-keypairs
|
|
32
|
-
*
|
|
33
|
-
* If `EXPECTED_SIGNATURE` drifts, the CLI's signFn no longer produces what
|
|
34
|
-
* the validator's web3-auth verifier accepts. That's an auth-contract
|
|
35
|
-
* regression — every developer's `subscribe`/`deploy` breaks silently.
|
|
36
|
-
*/
|
|
37
|
-
exports.XRPL_FIXTURE = {
|
|
38
|
-
seed: 'sEdTyaBYHfQhWt9ycB9QJsRKH8UUEuD',
|
|
39
|
-
address: 'rNHjsSoFgEMPZi4kE5rfw6c8k6tTUX8eng',
|
|
40
|
-
publicKey: 'ED652CD3EAB154510CBFCF4AEDEE4EAEB295D32EA7CE358F0B25D26203003F5DED',
|
|
41
|
-
/** Plain-text payload signed in the deterministic-signature assertion. */
|
|
42
|
-
payload: 'hello-smart-engines',
|
|
43
|
-
/** Output of `sign(hex(payload).upper, fixture.privateKey)`. */
|
|
44
|
-
expectedSignature: 'CFF9ABD65D3BBC985FE8A8C899DAC26B16DAB95B13AE2B2CB3DEAC2CA0E54F7791307B22971180D6016422EEE2E36ACFECCC7B7C3A1CB7701CE28D243E16BF03',
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Reproduce the validator's verifier check verbatim.
|
|
48
|
-
*
|
|
49
|
-
* Mirrors `verifyXRPLSignature` at
|
|
50
|
-
* libs/security-core/src/auth/web3-auth.service.ts:328-350 — same hex
|
|
51
|
-
* canonicalization, same ripple-keypairs.verify entry point. Used by the
|
|
52
|
-
* signFn spec to cross-check the CLI's output WITHOUT importing the heavy
|
|
53
|
-
* NestJS-bound web3-auth.service.ts class graph.
|
|
54
|
-
*/
|
|
55
|
-
function validatorVerifyXrplSignature(publicKey, message, signature) {
|
|
56
|
-
const messageHex = Buffer.from(message, 'utf-8').toString('hex').toUpperCase();
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
58
|
-
const { verify } = require('ripple-keypairs');
|
|
59
|
-
return verify(messageHex, signature, publicKey);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Build a throwaway tmp directory and return its path + a cleanup fn.
|
|
63
|
-
*
|
|
64
|
-
* Usage:
|
|
65
|
-
* const { dir, cleanup } = makeTempDir('hsuite-init-');
|
|
66
|
-
* afterEach(cleanup);
|
|
67
|
-
*/
|
|
68
|
-
function makeTempDir(prefix = 'hsuite-cli-spec-') {
|
|
69
|
-
const dir = (0, fs_1.mkdtempSync)((0, path_1.join)((0, os_1.tmpdir)(), prefix));
|
|
70
|
-
return {
|
|
71
|
-
dir,
|
|
72
|
-
cleanup: () => (0, fs_1.rmSync)(dir, { recursive: true, force: true }),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
/** Build the path for an env file inside a tmp dir. */
|
|
76
|
-
function envPathIn(dir, name = '.env.local') {
|
|
77
|
-
return (0, path_1.join)(dir, name);
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=fixtures.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../src/__tests__/helpers/fixtures.ts"],"names":[],"mappings":";;;AAmDA,oEASC;AASD,kCASC;AAGD,8BAEC;AAnFD;;;;;;;;;;;GAWG;AACH,2BAAyC;AACzC,2BAA4B;AAC5B,+BAA4B;AAE5B;;;;;;;;;;;;;;GAcG;AACU,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,iCAAiC;IACvC,OAAO,EAAE,oCAAoC;IAC7C,SAAS,EAAE,oEAAoE;IAC/E,0EAA0E;IAC1E,OAAO,EAAE,qBAAqB;IAC9B,gEAAgE;IAChE,iBAAiB,EACf,kIAAkI;CAC5H,CAAC;AAEX;;;;;;;;GAQG;AACH,SAAgB,4BAA4B,CAC1C,SAAiB,EACjB,OAAe,EACf,SAAiB;IAEjB,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/E,8DAA8D;IAC9D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,MAAM,GAAG,kBAAkB;IAIrD,MAAM,GAAG,GAAG,IAAA,gBAAW,EAAC,IAAA,WAAI,EAAC,IAAA,WAAM,GAAE,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,OAAO;QACL,GAAG;QACH,OAAO,EAAE,GAAG,EAAE,CAAC,IAAA,WAAM,EAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;KAC7D,CAAC;AACJ,CAAC;AAED,uDAAuD;AACvD,SAAgB,SAAS,CAAC,GAAW,EAAE,IAAI,GAAG,YAAY;IACxD,OAAO,IAAA,WAAI,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Real-seed fixtures for the signing-identity specs (#3667).
|
|
3
|
-
*
|
|
4
|
-
* `xrpl@4.6.0`'s `Wallet.fromSeed(seed)` forces ed25519 whatever algorithm the seed carries, so a
|
|
5
|
-
* spec that only ever signs with an ed25519 seed cannot tell a correct signer from the broken one.
|
|
6
|
-
* Every path under test is therefore driven twice: with a real secp256k1 seed AND a real ed25519 one.
|
|
7
|
-
*/
|
|
8
|
-
export type SeedAlgorithm = 'ecdsa-secp256k1' | 'ed25519';
|
|
9
|
-
export declare const SEED_ALGORITHMS: readonly SeedAlgorithm[];
|
|
10
|
-
export type SeedIdentity = {
|
|
11
|
-
algorithm: SeedAlgorithm;
|
|
12
|
-
seed: string;
|
|
13
|
-
/** The key `ripple-keypairs.deriveKeypair(seed)` yields: the seed's OWN algorithm. */
|
|
14
|
-
publicKey: string;
|
|
15
|
-
/** The account that key is the master key of. */
|
|
16
|
-
address: string;
|
|
17
|
-
};
|
|
18
|
-
/** A fresh real seed of the given algorithm and the account it controls. */
|
|
19
|
-
export declare function makeSeedIdentity(algorithm: SeedAlgorithm): SeedIdentity;
|
|
20
|
-
/**
|
|
21
|
-
* Assert a signed tx_blob is signed by the key behind `identity.address`: the tx names that account,
|
|
22
|
-
* its SigningPubKey is the seed's own key (and derives to that account), and the signature verifies.
|
|
23
|
-
* Returns the decoded transaction for further assertions.
|
|
24
|
-
*/
|
|
25
|
-
export declare function expectSignedBy(blob: string, identity: SeedIdentity): Record<string, unknown>;
|
|
26
|
-
//# sourceMappingURL=xrpl-signing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xrpl-signing.d.ts","sourceRoot":"","sources":["../../../src/__tests__/helpers/xrpl-signing.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,SAAS,CAAC;AAE1D,eAAO,MAAM,eAAe,EAAE,SAAS,aAAa,EAAmC,CAAC;AAExF,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,aAAa,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,sFAAsF;IACtF,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,aAAa,GAAG,YAAY,CAMvE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAW5F"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Real-seed fixtures for the signing-identity specs (#3667).
|
|
4
|
-
*
|
|
5
|
-
* `xrpl@4.6.0`'s `Wallet.fromSeed(seed)` forces ed25519 whatever algorithm the seed carries, so a
|
|
6
|
-
* spec that only ever signs with an ed25519 seed cannot tell a correct signer from the broken one.
|
|
7
|
-
* Every path under test is therefore driven twice: with a real secp256k1 seed AND a real ed25519 one.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.SEED_ALGORITHMS = void 0;
|
|
11
|
-
exports.makeSeedIdentity = makeSeedIdentity;
|
|
12
|
-
exports.expectSignedBy = expectSignedBy;
|
|
13
|
-
exports.SEED_ALGORITHMS = ['ecdsa-secp256k1', 'ed25519'];
|
|
14
|
-
/** A fresh real seed of the given algorithm and the account it controls. */
|
|
15
|
-
function makeSeedIdentity(algorithm) {
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
17
|
-
const { generateSeed, deriveKeypair, deriveAddress } = require('ripple-keypairs');
|
|
18
|
-
const seed = generateSeed({ algorithm });
|
|
19
|
-
const { publicKey } = deriveKeypair(seed);
|
|
20
|
-
return { algorithm, seed, publicKey, address: deriveAddress(publicKey) };
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Assert a signed tx_blob is signed by the key behind `identity.address`: the tx names that account,
|
|
24
|
-
* its SigningPubKey is the seed's own key (and derives to that account), and the signature verifies.
|
|
25
|
-
* Returns the decoded transaction for further assertions.
|
|
26
|
-
*/
|
|
27
|
-
function expectSignedBy(blob, identity) {
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
29
|
-
const { decode, verifySignature } = require('xrpl');
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
31
|
-
const { deriveAddress } = require('ripple-keypairs');
|
|
32
|
-
const tx = decode(blob);
|
|
33
|
-
expect(tx.Account).toBe(identity.address);
|
|
34
|
-
expect(tx.SigningPubKey).toBe(identity.publicKey);
|
|
35
|
-
expect(deriveAddress(tx.SigningPubKey)).toBe(identity.address);
|
|
36
|
-
expect(verifySignature(blob)).toBe(true);
|
|
37
|
-
return tx;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=xrpl-signing.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xrpl-signing.js","sourceRoot":"","sources":["../../../src/__tests__/helpers/xrpl-signing.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAgBH,4CAMC;AAOD,wCAWC;AApCY,QAAA,eAAe,GAA6B,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;AAWxF,4EAA4E;AAC5E,SAAgB,gBAAgB,CAAC,SAAwB;IACvD,8DAA8D;IAC9D,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAClF,MAAM,IAAI,GAAW,YAAY,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IACjD,MAAM,EAAE,SAAS,EAAE,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IAC1C,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC;AAC3E,CAAC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,QAAsB;IACjE,8DAA8D;IAC9D,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD,8DAA8D;IAC9D,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACrD,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAA4B,CAAC;IACnD,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAClD,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,aAAuB,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzE,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzC,OAAO,EAAE,CAAC;AACZ,CAAC"}
|