@hsuite/smart-engines-cli 2.0.0 → 2.1.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 (77) hide show
  1. package/README.md +3 -2
  2. package/dist/_lib/cluster-convergence.d.ts.map +1 -1
  3. package/dist/_lib/cluster-convergence.js +1 -1
  4. package/dist/_lib/cluster-convergence.js.map +1 -1
  5. package/dist/_lib/deposit-verification.d.ts +91 -0
  6. package/dist/_lib/deposit-verification.d.ts.map +1 -0
  7. package/dist/_lib/deposit-verification.js +265 -0
  8. package/dist/_lib/deposit-verification.js.map +1 -0
  9. package/dist/_lib/payment-guard.d.ts +2 -2
  10. package/dist/_lib/payment-guard.d.ts.map +1 -1
  11. package/dist/_lib/payment-guard.js.map +1 -1
  12. package/dist/_lib/payment-record.d.ts +6 -0
  13. package/dist/_lib/payment-record.d.ts.map +1 -1
  14. package/dist/_lib/payment-record.js +7 -1
  15. package/dist/_lib/payment-record.js.map +1 -1
  16. package/dist/_lib/subscription-client.d.ts +152 -4
  17. package/dist/_lib/subscription-client.d.ts.map +1 -1
  18. package/dist/_lib/subscription-client.js +35 -2
  19. package/dist/_lib/subscription-client.js.map +1 -1
  20. package/dist/_lib/swap-payment.d.ts +54 -0
  21. package/dist/_lib/swap-payment.d.ts.map +1 -0
  22. package/dist/_lib/swap-payment.js +203 -0
  23. package/dist/_lib/swap-payment.js.map +1 -0
  24. package/dist/_lib/xrp-payment.d.ts +20 -5
  25. package/dist/_lib/xrp-payment.d.ts.map +1 -1
  26. package/dist/_lib/xrp-payment.js +26 -8
  27. package/dist/_lib/xrp-payment.js.map +1 -1
  28. package/dist/commands/billing.d.ts +5 -3
  29. package/dist/commands/billing.d.ts.map +1 -1
  30. package/dist/commands/billing.js +12 -6
  31. package/dist/commands/billing.js.map +1 -1
  32. package/dist/commands/deploy.d.ts +1 -1
  33. package/dist/commands/deploy.js +2 -2
  34. package/dist/commands/deploy.js.map +1 -1
  35. package/dist/commands/list.d.ts.map +1 -1
  36. package/dist/commands/list.js +4 -2
  37. package/dist/commands/list.js.map +1 -1
  38. package/dist/commands/redeploy.d.ts +4 -3
  39. package/dist/commands/redeploy.d.ts.map +1 -1
  40. package/dist/commands/redeploy.js +5 -4
  41. package/dist/commands/redeploy.js.map +1 -1
  42. package/dist/commands/renew.d.ts +47 -4
  43. package/dist/commands/renew.d.ts.map +1 -1
  44. package/dist/commands/renew.js +338 -9
  45. package/dist/commands/renew.js.map +1 -1
  46. package/dist/commands/status.d.ts.map +1 -1
  47. package/dist/commands/status.js +22 -2
  48. package/dist/commands/status.js.map +1 -1
  49. package/dist/commands/subscribe.d.ts +22 -0
  50. package/dist/commands/subscribe.d.ts.map +1 -1
  51. package/dist/commands/subscribe.js +207 -9
  52. package/dist/commands/subscribe.js.map +1 -1
  53. package/dist/commands/topup.d.ts +14 -0
  54. package/dist/commands/topup.d.ts.map +1 -1
  55. package/dist/commands/topup.js +22 -2
  56. package/dist/commands/topup.js.map +1 -1
  57. package/dist/commands/upgrade.d.ts +7 -0
  58. package/dist/commands/upgrade.d.ts.map +1 -1
  59. package/dist/commands/upgrade.js +20 -1
  60. package/dist/commands/upgrade.js.map +1 -1
  61. package/dist/commands/verify.js +1 -1
  62. package/dist/commands/verify.js.map +1 -1
  63. package/dist/index.d.ts +1 -1
  64. package/dist/index.js +1 -1
  65. package/package.json +9 -9
  66. package/dist/__tests__/helpers/fixtures-image-hygiene.d.ts +0 -18
  67. package/dist/__tests__/helpers/fixtures-image-hygiene.d.ts.map +0 -1
  68. package/dist/__tests__/helpers/fixtures-image-hygiene.js +0 -42
  69. package/dist/__tests__/helpers/fixtures-image-hygiene.js.map +0 -1
  70. package/dist/__tests__/helpers/fixtures.d.ts +0 -48
  71. package/dist/__tests__/helpers/fixtures.d.ts.map +0 -1
  72. package/dist/__tests__/helpers/fixtures.js +0 -79
  73. package/dist/__tests__/helpers/fixtures.js.map +0 -1
  74. package/dist/__tests__/helpers/xrpl-signing.d.ts +0 -26
  75. package/dist/__tests__/helpers/xrpl-signing.d.ts.map +0 -1
  76. package/dist/__tests__/helpers/xrpl-signing.js +0 -39
  77. package/dist/__tests__/helpers/xrpl-signing.js.map +0 -1
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hygieneTar = exports.HYGIENE_CID = void 0;
4
- exports.setHygieneTar = setHygieneTar;
5
- exports.hygieneLeg = hygieneLeg;
6
- exports.tarWith = tarWith;
7
- /**
8
- * Canned answers for the image-hygiene gate legs every `buildAndPush` runs
9
- * (HSUITEPT-5): `docker inspect` → WorkingDir, `docker create` → container id,
10
- * `docker cp` → the current {@link hygieneTar}, `docker rm` → nothing.
11
- *
12
- * Fold into any fake `execFileSync` / `runFn` as its fallthrough
13
- * (`return hygieneLeg(file, args)`), so the gate sees a CLEAN image by default
14
- * and the suite under test keeps asserting only its own legs. Plant an
15
- * offending file with `hygieneTar = tarWith('dist/main.js.map')`.
16
- */
17
- exports.HYGIENE_CID = 'c'.repeat(64);
18
- /** Empty archive = clean image. Reassign per test; reset in `beforeEach` where it matters. */
19
- exports.hygieneTar = Buffer.alloc(1024);
20
- function setHygieneTar(tar) {
21
- exports.hygieneTar = tar;
22
- }
23
- function hygieneLeg(file, args) {
24
- if (file !== 'docker')
25
- return undefined;
26
- if (args[0] === 'inspect')
27
- return '/app\n';
28
- if (args[0] === 'create')
29
- return `${exports.HYGIENE_CID}\n`;
30
- if (args[0] === 'cp')
31
- return exports.hygieneTar;
32
- return undefined;
33
- }
34
- /** One-entry ustar archive (enough to plant an offending file). */
35
- function tarWith(name) {
36
- const header = Buffer.alloc(512);
37
- header.write(name, 0, 100, 'utf8');
38
- header.write('00000000000\0', 124, 12, 'ascii');
39
- header.write('0', 156, 1, 'ascii');
40
- return Buffer.concat([header, Buffer.alloc(1024)]);
41
- }
42
- //# sourceMappingURL=fixtures-image-hygiene.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fixtures-image-hygiene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**
2
- * Deterministic XRPL ed25519 fixture.
3
- *
4
- * Provenance — derived once with:
5
- * node -e "const {Wallet}=require('xrpl'); const w=Wallet.fromSeed('sEdTyaBYHfQhWt9ycB9QJsRKH8UUEuD'); console.log(w.address, w.publicKey)"
6
- *
7
- * Expected signature derived by running the validator's exact verifier
8
- * path (libs/security-core/src/auth/web3-auth.service.ts:334-340):
9
- * const hex = Buffer.from(message, 'utf-8').toString('hex').toUpperCase();
10
- * sign(hex, wallet.privateKey) // ripple-keypairs
11
- *
12
- * If `EXPECTED_SIGNATURE` drifts, the CLI's signFn no longer produces what
13
- * the validator's web3-auth verifier accepts. That's an auth-contract
14
- * regression — every developer's `subscribe`/`deploy` breaks silently.
15
- */
16
- export declare const XRPL_FIXTURE: {
17
- readonly seed: "sEdTyaBYHfQhWt9ycB9QJsRKH8UUEuD";
18
- readonly address: "rNHjsSoFgEMPZi4kE5rfw6c8k6tTUX8eng";
19
- readonly publicKey: "ED652CD3EAB154510CBFCF4AEDEE4EAEB295D32EA7CE358F0B25D26203003F5DED";
20
- /** Plain-text payload signed in the deterministic-signature assertion. */
21
- readonly payload: "hello-smart-engines";
22
- /** Output of `sign(hex(payload).upper, fixture.privateKey)`. */
23
- readonly expectedSignature: "CFF9ABD65D3BBC985FE8A8C899DAC26B16DAB95B13AE2B2CB3DEAC2CA0E54F7791307B22971180D6016422EEE2E36ACFECCC7B7C3A1CB7701CE28D243E16BF03";
24
- };
25
- /**
26
- * Reproduce the validator's verifier check verbatim.
27
- *
28
- * Mirrors `verifyXRPLSignature` at
29
- * libs/security-core/src/auth/web3-auth.service.ts:328-350 — same hex
30
- * canonicalization, same ripple-keypairs.verify entry point. Used by the
31
- * signFn spec to cross-check the CLI's output WITHOUT importing the heavy
32
- * NestJS-bound web3-auth.service.ts class graph.
33
- */
34
- export declare function validatorVerifyXrplSignature(publicKey: string, message: string, signature: string): boolean;
35
- /**
36
- * Build a throwaway tmp directory and return its path + a cleanup fn.
37
- *
38
- * Usage:
39
- * const { dir, cleanup } = makeTempDir('hsuite-init-');
40
- * afterEach(cleanup);
41
- */
42
- export declare function makeTempDir(prefix?: string): {
43
- dir: string;
44
- cleanup: () => void;
45
- };
46
- /** Build the path for an env file inside a tmp dir. */
47
- export declare function envPathIn(dir: string, name?: string): string;
48
- //# sourceMappingURL=fixtures.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../src/__tests__/helpers/fixtures.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY;;;;IAIvB,0EAA0E;;IAE1E,gEAAgE;;CAGxD,CAAC;AAEX;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,OAAO,CAKT;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,SAAqB,GAAG;IACxD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAMA;AAED,uDAAuD;AACvD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,SAAe,GAAG,MAAM,CAElE"}
@@ -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;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