@hsuite/smart-engines-cli 1.2.0 → 1.4.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 +272 -58
- package/dist/_lib/attestation.d.ts +45 -0
- package/dist/_lib/attestation.d.ts.map +1 -0
- package/dist/_lib/attestation.js +76 -0
- package/dist/_lib/attestation.js.map +1 -0
- package/dist/_lib/baas.d.ts +147 -0
- package/dist/_lib/baas.d.ts.map +1 -0
- package/dist/_lib/baas.js +260 -0
- package/dist/_lib/baas.js.map +1 -0
- package/dist/_lib/cluster.d.ts +6 -6
- package/dist/_lib/cluster.js +6 -6
- package/dist/_lib/deploy-manifest.d.ts +69 -0
- package/dist/_lib/deploy-manifest.d.ts.map +1 -0
- package/dist/_lib/deploy-manifest.js +87 -0
- package/dist/_lib/deploy-manifest.js.map +1 -0
- package/dist/_lib/docker.d.ts +82 -0
- package/dist/_lib/docker.d.ts.map +1 -0
- package/dist/_lib/docker.js +164 -0
- package/dist/_lib/docker.js.map +1 -0
- package/dist/_lib/faucet-client.d.ts +64 -0
- package/dist/_lib/faucet-client.d.ts.map +1 -0
- package/dist/_lib/faucet-client.js +92 -0
- package/dist/_lib/faucet-client.js.map +1 -0
- package/dist/_lib/framework.d.ts +59 -0
- package/dist/_lib/framework.d.ts.map +1 -0
- package/dist/_lib/framework.js +149 -0
- package/dist/_lib/framework.js.map +1 -0
- package/dist/_lib/frontend-guard.d.ts +13 -0
- package/dist/_lib/frontend-guard.d.ts.map +1 -0
- package/dist/_lib/frontend-guard.js +41 -0
- package/dist/_lib/frontend-guard.js.map +1 -0
- package/dist/_lib/registry-fanout.d.ts +114 -0
- package/dist/_lib/registry-fanout.d.ts.map +1 -0
- package/dist/_lib/registry-fanout.js +435 -0
- package/dist/_lib/registry-fanout.js.map +1 -0
- package/dist/_lib/runtime-env.d.ts +126 -0
- package/dist/_lib/runtime-env.d.ts.map +1 -0
- package/dist/_lib/runtime-env.js +172 -0
- package/dist/_lib/runtime-env.js.map +1 -0
- package/dist/_lib/subscription-client.d.ts +129 -18
- package/dist/_lib/subscription-client.d.ts.map +1 -1
- package/dist/_lib/subscription-client.js +268 -40
- package/dist/_lib/subscription-client.js.map +1 -1
- package/dist/_lib/subscription-env.d.ts +35 -0
- package/dist/_lib/subscription-env.d.ts.map +1 -1
- package/dist/_lib/subscription-env.js +46 -2
- package/dist/_lib/subscription-env.js.map +1 -1
- package/dist/commands/app-lifecycle.d.ts +36 -0
- package/dist/commands/app-lifecycle.d.ts.map +1 -0
- package/dist/commands/app-lifecycle.js +145 -0
- package/dist/commands/app-lifecycle.js.map +1 -0
- package/dist/commands/ci.d.ts +45 -0
- package/dist/commands/ci.d.ts.map +1 -0
- package/dist/commands/ci.js +174 -0
- package/dist/commands/ci.js.map +1 -0
- package/dist/commands/deploy-manifest.d.ts +11 -0
- package/dist/commands/deploy-manifest.d.ts.map +1 -0
- package/dist/commands/deploy-manifest.js +17 -0
- package/dist/commands/deploy-manifest.js.map +1 -0
- package/dist/commands/deploy.d.ts +70 -11
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +263 -150
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/downgrade.js +1 -1
- package/dist/commands/downgrade.js.map +1 -1
- package/dist/commands/faucet.d.ts +78 -0
- package/dist/commands/faucet.d.ts.map +1 -0
- package/dist/commands/faucet.js +184 -0
- package/dist/commands/faucet.js.map +1 -0
- package/dist/commands/governance.js +1 -1
- package/dist/commands/governance.js.map +1 -1
- package/dist/commands/hist-balance.d.ts +1 -1
- package/dist/commands/hist-balance.js +1 -1
- package/dist/commands/init.js +1 -1
- package/dist/commands/list.d.ts +22 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +81 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/personhood.js +2 -2
- package/dist/commands/personhood.js.map +1 -1
- package/dist/commands/redeploy.d.ts +62 -0
- package/dist/commands/redeploy.d.ts.map +1 -0
- package/dist/commands/redeploy.js +310 -0
- package/dist/commands/redeploy.js.map +1 -0
- package/dist/commands/status.d.ts +51 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +138 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/subscribe.d.ts +94 -17
- package/dist/commands/subscribe.d.ts.map +1 -1
- package/dist/commands/subscribe.js +450 -81
- package/dist/commands/subscribe.js.map +1 -1
- package/dist/commands/transactions.d.ts +60 -0
- package/dist/commands/transactions.d.ts.map +1 -0
- package/dist/commands/transactions.js +101 -0
- package/dist/commands/transactions.js.map +1 -0
- package/dist/commands/update.d.ts +40 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +114 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/verify.d.ts +10 -19
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +14 -23
- package/dist/commands/verify.js.map +1 -1
- package/dist/index.d.ts +12 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -3
- package/dist/index.js.map +1 -1
- package/package.json +11 -4
|
@@ -1,38 +1,113 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `hsuite subscribe` —
|
|
3
|
-
*
|
|
2
|
+
* `hsuite subscribe` — Onboard a smart-app the CANONICAL, MINT-FIRST way:
|
|
3
|
+
* create the smart-app's DKG ENTITY first, mint the builder subscription NFT
|
|
4
|
+
* ON THAT ENTITY's id, and land it on the dev wallet — so `1 smart-app =
|
|
5
|
+
* 1 DKG entity = 1 NFT`, ACTIVE from mint.
|
|
4
6
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
7
|
+
* ## Why this creates the entity (the mint-first re-architecture)
|
|
8
|
+
*
|
|
9
|
+
* `subscribe` used to mint the subscription NFT on a throwaway random
|
|
10
|
+
* `app-${uuid}` that was NEVER a DKG entity, while `hsuite deploy` separately
|
|
11
|
+
* minted a FRESH entity (+ a SECOND subscription) at `init` time. Paid id ≠
|
|
12
|
+
* deployed id → the deployed app stayed PENDING, redeploys forked, and two
|
|
13
|
+
* NFTs were minted. Now `subscribe` creates the durable DKG entity up front and
|
|
14
|
+
* uses its `entityId` as the subscription appId end-to-end; `deploy` reuses
|
|
15
|
+
* that same id (it no longer creates anything). Output:
|
|
16
|
+
* `SUBSCRIPTION_APP_ID == DEPLOYED_APP_ID == DKG entityId`, ACTIVE, ONE NFT.
|
|
17
|
+
*
|
|
18
|
+
* Full flow:
|
|
19
|
+
* 1. Read XRPL_ADDRESS + XRPL_SEED from env (written by `hsuite init`) and the
|
|
20
|
+
* validator URL.
|
|
21
|
+
* 2. Web3-auth against the validator (challenge → sign → bearer). The
|
|
22
|
+
* subscription + create routes are session-guarded. (Auth routes have NO
|
|
23
|
+
* /api prefix.)
|
|
24
|
+
* 3. POST /api/v3/smart-apps (createApp) — run the per-entity DKG ceremony
|
|
25
|
+
* to derive the canonical `entityId` AND create the (paid, pending-deposit)
|
|
26
|
+
* subscription in the same in-process flow. The response carries
|
|
27
|
+
* `{ appId: entityId, depositInstructions, subscriptionId }`. THIS replaces
|
|
28
|
+
* the old random-id + standalone `subscription/request`. From here the
|
|
29
|
+
* `entityId` is THE appId for everything downstream.
|
|
30
|
+
* 4. Ensure deposit instructions: the createApp response normally carries them.
|
|
31
|
+
* If a node deferred deposit-account creation, fall back to the idempotent
|
|
32
|
+
* POST /api/v3/subscription/request { appId: entityId, … } (same retry/503
|
|
33
|
+
* semantics, returns the SAME subscription's deposit instructions — no
|
|
34
|
+
* second subscription, no second deposit wallet).
|
|
35
|
+
* 5. Render the deposit instructions.
|
|
36
|
+
* 6. AUTO-PAY the deposit from the dev wallet over the XRPL testnet (HST
|
|
37
|
+
* Payment with a SendMax covering the 0.25% transfer fee). `--no-autopay`
|
|
38
|
+
* skips this and prints instructions for manual (XUMM) payment.
|
|
39
|
+
* 7. Poll GET /api/v3/subscription/status/:entityId until the deposit is
|
|
40
|
+
* confirmed and ready to mint (status in { deposit_confirmed, pending_mint,
|
|
41
|
+
* minting, active }; the real confirmed status is `deposit_confirmed`).
|
|
42
|
+
* 8. POST /api/v3/subscription/mint/:entityId — activates the subscription +
|
|
43
|
+
* flips the SmartApp doc PENDING_SUBSCRIPTION → ACTIVE (via `activateApp`,
|
|
44
|
+
* gated on the deposit-backed NFT mint) and kicks off the async NFT mint.
|
|
45
|
+
* 9. Poll /status until `subscriptionNftSerial` is set OR `chainNfts.xrpl.nftId`
|
|
46
|
+
* is present (the NFT mints asynchronously via the mint subscriber).
|
|
47
|
+
* 10. Accept the brokered NFT sell offer so it lands on the dev wallet.
|
|
48
|
+
* 11. Verify account_nfts, then write SUBSCRIPTION_APP_ID + APP_ID +
|
|
49
|
+
* SUBSCRIPTION_NFT_SERIAL (= entityId) to the env file.
|
|
15
50
|
*/
|
|
16
51
|
import { Command } from 'commander';
|
|
17
52
|
import { SubscriptionClient } from '../_lib/subscription-client';
|
|
53
|
+
/**
|
|
54
|
+
* Minimal structural shape of the bits of the `xrpl` Client we use for the
|
|
55
|
+
* deposit payment + NFT offer acceptance. Lets unit tests inject a fake without
|
|
56
|
+
* a real websocket.
|
|
57
|
+
*/
|
|
58
|
+
export type XrplNftClientLike = {
|
|
59
|
+
connect(): Promise<unknown>;
|
|
60
|
+
disconnect(): Promise<unknown>;
|
|
61
|
+
request(req: Record<string, unknown>): Promise<{
|
|
62
|
+
result: any;
|
|
63
|
+
}>;
|
|
64
|
+
autofill(tx: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
65
|
+
submitAndWait(blob: string): Promise<{
|
|
66
|
+
result: {
|
|
67
|
+
meta?: any;
|
|
68
|
+
};
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
18
71
|
type SubscribeOpts = {
|
|
19
72
|
env: string;
|
|
20
73
|
gateway?: string;
|
|
21
74
|
tier: string;
|
|
22
|
-
|
|
23
|
-
appName?: string;
|
|
75
|
+
/** Explicit appId. Defaults to SUBSCRIPTION_APP_ID env, then a random id. */
|
|
24
76
|
appId?: string;
|
|
77
|
+
appName?: string;
|
|
78
|
+
/** XRPL account that issues the subscription NFT. Optional override for the
|
|
79
|
+
* sell-offer discovery (the /status response now exposes it). */
|
|
80
|
+
nftIssuer?: string;
|
|
81
|
+
/** Skip the auto-pay step — print instructions and exit (manual XUMM pay). */
|
|
82
|
+
noAutopay?: boolean;
|
|
25
83
|
pollIntervalMs?: number;
|
|
26
84
|
pollTimeoutMs?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Max status polls while waiting for the NFT to mint (default 24 × pollIntervalMs
|
|
87
|
+
* ≈ 120s). The 2-of-3 issuer MPC mint + sell-offer creation take ~15-25s, so the
|
|
88
|
+
* default gives ample headroom. Exposed for tests (kept fast via `sleep`).
|
|
89
|
+
*/
|
|
90
|
+
nftPollAttempts?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Max NFTokenAcceptOffer retries while the issuer's sell offer becomes
|
|
93
|
+
* queryable on-ledger (default 10 × acceptRetryMs). Exposed for tests.
|
|
94
|
+
*/
|
|
95
|
+
acceptAttempts?: number;
|
|
96
|
+
/** Delay between accept retries (default pollIntervalMs, then 5000). */
|
|
97
|
+
acceptRetryMs?: number;
|
|
27
98
|
clientFactory?: (baseUrl: string) => SubscriptionClient;
|
|
28
99
|
sleep?: (ms: number) => Promise<void>;
|
|
100
|
+
/** Builds an XRPL client for deposit pay + NFT accept. Defaults to real `xrpl`. */
|
|
101
|
+
xrplClientFactory?: (wss: string) => XrplNftClientLike;
|
|
102
|
+
/** Signs a prepared XRPL tx with the dev seed → tx_blob. Defaults to `xrpl`. */
|
|
103
|
+
walletSignFactory?: (seed: string) => (tx: Record<string, unknown>) => string;
|
|
29
104
|
};
|
|
30
105
|
/**
|
|
31
106
|
* Pure orchestration body — exported for unit tests.
|
|
32
107
|
*
|
|
33
|
-
* Returns the appId + NFT serial (
|
|
34
|
-
* Throws on every error path; the command-level action wraps
|
|
35
|
-
* exits the process.
|
|
108
|
+
* Returns the appId + NFT serial (once minted + accepted) so callers can
|
|
109
|
+
* persist them. Throws on every hard-error path; the command-level action wraps
|
|
110
|
+
* this and exits the process.
|
|
36
111
|
*/
|
|
37
112
|
export declare function runSubscribe(opts: SubscribeOpts): Promise<{
|
|
38
113
|
appId: string;
|
|
@@ -40,6 +115,8 @@ export declare function runSubscribe(opts: SubscribeOpts): Promise<{
|
|
|
40
115
|
nftSerial?: number | string;
|
|
41
116
|
tier: string;
|
|
42
117
|
status?: string;
|
|
118
|
+
depositPaid: boolean;
|
|
119
|
+
nftAccepted: boolean;
|
|
43
120
|
}>;
|
|
44
121
|
export declare const subscribeCommand: Command;
|
|
45
122
|
export {};
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EACL,kBAAkB,EAKnB,MAAM,6BAA6B,CAAC;AAarC;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5B,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;IAChE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAA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