@hsuite/smart-engines-cli 1.1.1 → 1.2.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/dist/_lib/cluster.d.ts +11 -8
- package/dist/_lib/cluster.d.ts.map +1 -1
- package/dist/_lib/cluster.js +8 -35
- package/dist/_lib/cluster.js.map +1 -1
- package/dist/_lib/subscription-client.d.ts +152 -0
- package/dist/_lib/subscription-client.d.ts.map +1 -0
- package/dist/_lib/subscription-client.js +84 -0
- package/dist/_lib/subscription-client.js.map +1 -0
- package/dist/_lib/subscription-env.d.ts +20 -0
- package/dist/_lib/subscription-env.d.ts.map +1 -0
- package/dist/_lib/subscription-env.js +28 -0
- package/dist/_lib/subscription-env.js.map +1 -0
- package/dist/commands/billing.d.ts +17 -0
- package/dist/commands/billing.d.ts.map +1 -0
- package/dist/commands/billing.js +59 -0
- package/dist/commands/billing.js.map +1 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +26 -16
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/downgrade.d.ts +22 -0
- package/dist/commands/downgrade.d.ts.map +1 -0
- package/dist/commands/downgrade.js +55 -0
- package/dist/commands/downgrade.js.map +1 -0
- package/dist/commands/init.js +3 -6
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/renew.d.ts +19 -0
- package/dist/commands/renew.d.ts.map +1 -0
- package/dist/commands/renew.js +58 -0
- package/dist/commands/renew.js.map +1 -0
- package/dist/commands/subscribe.d.ts +40 -4
- package/dist/commands/subscribe.d.ts.map +1 -1
- package/dist/commands/subscribe.js +156 -94
- package/dist/commands/subscribe.js.map +1 -1
- package/dist/commands/upgrade.d.ts +41 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +128 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/commands/usage.d.ts +22 -0
- package/dist/commands/usage.d.ts.map +1 -0
- package/dist/commands/usage.js +81 -0
- package/dist/commands/usage.js.map +1 -0
- package/dist/commands/verify.d.ts +19 -6
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +75 -15
- package/dist/commands/verify.js.map +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/_lib/cluster.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
/** Public SDK-bootstrap host for the Smart Engines testnet. */
|
|
2
|
-
export declare const DEFAULT_GATEWAY = "https://gateway.testnet.hsuite.network";
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* Cluster bootstrap constants.
|
|
3
|
+
*
|
|
4
|
+
* The CLI bootstraps against the public round-robin host
|
|
5
|
+
* `gateway.testnet.hsuite.network` — 3 DNS A-records over the 3 genesis
|
|
6
|
+
* cluster ingress LBs (HANDOFF arc-v13-do-deploy §11).
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Decentralized cluster discovery itself is no longer implemented here:
|
|
9
|
+
* the canonical `BaasClient.connectToCluster({ bootstrap: [...] })` factory
|
|
10
|
+
* in `@hsuite/smart-engines-sdk` (3.4.0+) owns it, and the CLI consumes
|
|
11
|
+
* that factory rather than maintaining a parallel discovery path.
|
|
10
12
|
*/
|
|
11
|
-
|
|
13
|
+
/** Public SDK-bootstrap host for the Smart Engines testnet. */
|
|
14
|
+
export declare const DEFAULT_GATEWAY = "https://gateway.testnet.hsuite.network";
|
|
12
15
|
//# sourceMappingURL=cluster.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cluster.d.ts","sourceRoot":"","sources":["../../src/_lib/cluster.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cluster.d.ts","sourceRoot":"","sources":["../../src/_lib/cluster.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,+DAA+D;AAC/D,eAAO,MAAM,eAAe,2CAA2C,CAAC"}
|
package/dist/_lib/cluster.js
CHANGED
|
@@ -1,45 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_GATEWAY = void 0;
|
|
4
|
-
exports.resolveGatewayUrl = resolveGatewayUrl;
|
|
5
2
|
/**
|
|
6
|
-
* Cluster bootstrap
|
|
7
|
-
* cluster discovery.
|
|
3
|
+
* Cluster bootstrap constants.
|
|
8
4
|
*
|
|
9
5
|
* The CLI bootstraps against the public round-robin host
|
|
10
6
|
* `gateway.testnet.hsuite.network` — 3 DNS A-records over the 3 genesis
|
|
11
|
-
* cluster ingress LBs (HANDOFF arc-v13-do-deploy §11).
|
|
12
|
-
* cluster registry through the SDK's `ClusterDiscoveryClient` and picks a
|
|
13
|
-
* random active cluster, so the CLI follows permissionless cluster
|
|
14
|
-
* join/leave with no code edits.
|
|
7
|
+
* cluster ingress LBs (HANDOFF arc-v13-do-deploy §11).
|
|
15
8
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
9
|
+
* Decentralized cluster discovery itself is no longer implemented here:
|
|
10
|
+
* the canonical `BaasClient.connectToCluster({ bootstrap: [...] })` factory
|
|
11
|
+
* in `@hsuite/smart-engines-sdk` (3.4.0+) owns it, and the CLI consumes
|
|
12
|
+
* that factory rather than maintaining a parallel discovery path.
|
|
19
13
|
*/
|
|
20
|
-
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.DEFAULT_GATEWAY = void 0;
|
|
21
16
|
/** Public SDK-bootstrap host for the Smart Engines testnet. */
|
|
22
17
|
exports.DEFAULT_GATEWAY = 'https://gateway.testnet.hsuite.network';
|
|
23
|
-
/**
|
|
24
|
-
* Resolve the gateway URL to connect to. Bootstraps decentralized cluster
|
|
25
|
-
* discovery against `bootstrap`; on an empty registry or any failure,
|
|
26
|
-
* falls back to `bootstrap` itself (a working round-robin gateway).
|
|
27
|
-
*
|
|
28
|
-
* @param bootstrap fully-qualified bootstrap URL (the `--gateway` value)
|
|
29
|
-
* @returns the gateway URL the CLI should talk to
|
|
30
|
-
*/
|
|
31
|
-
async function resolveGatewayUrl(bootstrap) {
|
|
32
|
-
const allowInsecure = bootstrap.startsWith('http://');
|
|
33
|
-
try {
|
|
34
|
-
const discovery = new smart_engines_sdk_1.ClusterDiscoveryClient({
|
|
35
|
-
bootstrap: [bootstrap],
|
|
36
|
-
allowInsecure,
|
|
37
|
-
});
|
|
38
|
-
const url = await discovery.getRandomGatewayUrl();
|
|
39
|
-
return url ?? bootstrap;
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
return bootstrap;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
18
|
//# sourceMappingURL=cluster.js.map
|
package/dist/_lib/cluster.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cluster.js","sourceRoot":"","sources":["../../src/_lib/cluster.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"cluster.js","sourceRoot":"","sources":["../../src/_lib/cluster.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,+DAA+D;AAClD,QAAA,eAAe,GAAG,wCAAwC,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin HTTP client for the validator-side `/api/v3/subscription/*` surface.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the routes implemented in `apps/smart-validator/src/subscription/
|
|
5
|
+
* subscription.controller.ts`. The endpoints are `@Public()` and live on
|
|
6
|
+
* the same gateway URL the CLI's `init` writes to env as `VALIDATOR_URL`.
|
|
7
|
+
*
|
|
8
|
+
* Kept dependency-free (uses global `fetch`) so the CLI command bodies
|
|
9
|
+
* stay small and easy to unit-test with the standard `jest.fn()` mock
|
|
10
|
+
* pattern. Tests inject a fake `fetch` via the constructor.
|
|
11
|
+
*/
|
|
12
|
+
export type DepositInstructions = {
|
|
13
|
+
walletAddress: string;
|
|
14
|
+
tokenId: string;
|
|
15
|
+
amount: string;
|
|
16
|
+
chain: string;
|
|
17
|
+
};
|
|
18
|
+
export type SubscriptionRequestResponse = {
|
|
19
|
+
success: boolean;
|
|
20
|
+
subscriptionId?: string;
|
|
21
|
+
appId: string;
|
|
22
|
+
status?: string;
|
|
23
|
+
selectedTier: string;
|
|
24
|
+
selectedNetworks: string[];
|
|
25
|
+
depositInstructions?: DepositInstructions;
|
|
26
|
+
message?: string;
|
|
27
|
+
};
|
|
28
|
+
export type SubscriptionStatusResponse = {
|
|
29
|
+
appId: string;
|
|
30
|
+
hasSubscription: boolean;
|
|
31
|
+
subscriptionId?: string;
|
|
32
|
+
appName?: string;
|
|
33
|
+
status?: string;
|
|
34
|
+
subscriptionNftSerial?: number | string;
|
|
35
|
+
expiresAt?: string | number;
|
|
36
|
+
remainingBalance?: string;
|
|
37
|
+
createdAt?: string | number;
|
|
38
|
+
depositWallet?: {
|
|
39
|
+
walletAddress: string;
|
|
40
|
+
chain: string;
|
|
41
|
+
depositAmount: string;
|
|
42
|
+
status: string;
|
|
43
|
+
actualDepositAmount?: string;
|
|
44
|
+
lockedUntil?: string | number;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export type MintResponse = {
|
|
48
|
+
success: boolean;
|
|
49
|
+
subscriptionId?: string;
|
|
50
|
+
appId: string;
|
|
51
|
+
expiresAt?: string | number;
|
|
52
|
+
message?: string;
|
|
53
|
+
};
|
|
54
|
+
export type RenewResponse = {
|
|
55
|
+
success: boolean;
|
|
56
|
+
appId: string;
|
|
57
|
+
newExpiresAt?: string | number;
|
|
58
|
+
message?: string;
|
|
59
|
+
};
|
|
60
|
+
export type TierChangeResponse = {
|
|
61
|
+
success: boolean;
|
|
62
|
+
appId: string;
|
|
63
|
+
fromTier?: string;
|
|
64
|
+
toTier?: string;
|
|
65
|
+
effectiveAt?: string | number;
|
|
66
|
+
depositInstructions?: DepositInstructions;
|
|
67
|
+
message?: string;
|
|
68
|
+
};
|
|
69
|
+
export type UsageSummaryResponse = {
|
|
70
|
+
appId: string;
|
|
71
|
+
total: number;
|
|
72
|
+
byCategory: Record<string, number>;
|
|
73
|
+
recordCount: number;
|
|
74
|
+
lastUpdated?: string;
|
|
75
|
+
};
|
|
76
|
+
export type UsageStatusResponse = {
|
|
77
|
+
appId: string;
|
|
78
|
+
usagePercent: number;
|
|
79
|
+
currentUsage: number;
|
|
80
|
+
dailyLimit: number;
|
|
81
|
+
overagePercent: number;
|
|
82
|
+
inGracePeriod: boolean;
|
|
83
|
+
graceExpiresAt: string | null;
|
|
84
|
+
blocked: boolean;
|
|
85
|
+
suggestUpgrade: boolean;
|
|
86
|
+
nextTier: null | {
|
|
87
|
+
tier: string;
|
|
88
|
+
name: string;
|
|
89
|
+
apiCallsPerDay: number;
|
|
90
|
+
monthlyPriceHsuite: number;
|
|
91
|
+
};
|
|
92
|
+
projectedDaysUntilLimit: number | null;
|
|
93
|
+
};
|
|
94
|
+
export type BillingLedgerResponse = {
|
|
95
|
+
appId: string;
|
|
96
|
+
entries: Array<{
|
|
97
|
+
id: string;
|
|
98
|
+
subscriptionId: string;
|
|
99
|
+
operation: string;
|
|
100
|
+
amount: string;
|
|
101
|
+
balanceAfter: string;
|
|
102
|
+
timestamp: string;
|
|
103
|
+
metadata?: Record<string, unknown>;
|
|
104
|
+
}>;
|
|
105
|
+
total: number;
|
|
106
|
+
hasMore: boolean;
|
|
107
|
+
};
|
|
108
|
+
export type FetchLike = (input: string, init?: any) => Promise<{
|
|
109
|
+
ok: boolean;
|
|
110
|
+
status: number;
|
|
111
|
+
text(): Promise<string>;
|
|
112
|
+
json(): Promise<unknown>;
|
|
113
|
+
}>;
|
|
114
|
+
export type SubscriptionClientOptions = {
|
|
115
|
+
baseUrl: string;
|
|
116
|
+
fetchImpl?: FetchLike;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Validator-side subscription HTTP client.
|
|
120
|
+
*
|
|
121
|
+
* All routes match the controller at
|
|
122
|
+
* apps/smart-validator/src/subscription/subscription.controller.ts.
|
|
123
|
+
*/
|
|
124
|
+
export declare class SubscriptionClient {
|
|
125
|
+
private readonly baseUrl;
|
|
126
|
+
private readonly fetchImpl;
|
|
127
|
+
constructor(opts: SubscriptionClientOptions);
|
|
128
|
+
request(payload: {
|
|
129
|
+
appId: string;
|
|
130
|
+
developerAccountId: string;
|
|
131
|
+
chain: string;
|
|
132
|
+
appName: string;
|
|
133
|
+
selectedTier: string;
|
|
134
|
+
selectedNetworks: string[];
|
|
135
|
+
appDescription?: string;
|
|
136
|
+
logoUrl?: string;
|
|
137
|
+
metadata?: Record<string, unknown>;
|
|
138
|
+
}): Promise<SubscriptionRequestResponse>;
|
|
139
|
+
status(appId: string): Promise<SubscriptionStatusResponse>;
|
|
140
|
+
mint(appId: string): Promise<MintResponse>;
|
|
141
|
+
renew(appId: string, additionalDays?: number): Promise<RenewResponse>;
|
|
142
|
+
upgrade(appId: string, toTier: string): Promise<TierChangeResponse>;
|
|
143
|
+
downgrade(appId: string, toTier: string): Promise<TierChangeResponse>;
|
|
144
|
+
cancelTierChange(appId: string): Promise<TierChangeResponse>;
|
|
145
|
+
usage(appId: string): Promise<UsageSummaryResponse>;
|
|
146
|
+
usageStatus(appId: string): Promise<UsageStatusResponse>;
|
|
147
|
+
billing(appId: string, limit?: number, offset?: number): Promise<BillingLedgerResponse>;
|
|
148
|
+
private post;
|
|
149
|
+
private get;
|
|
150
|
+
private send;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=subscription-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-client.d.ts","sourceRoot":"","sources":["../../src/_lib/subscription-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,aAAa,EAAE,MAAM,CAAC;IAC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gBAAgB,EAAE,MAAM,EAAE,CAAC;QAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAIlC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAM1D,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAO1C,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAOrE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAOnE,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAOrE,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAM5D,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAMnD,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAMxD,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAK,EAAE,MAAM,SAAI,GAAG,OAAO,CAAC,qBAAqB,CAAC;YAOtE,IAAI;YAIJ,GAAG;YAIH,IAAI;CAenB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubscriptionClient = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Validator-side subscription HTTP client.
|
|
6
|
+
*
|
|
7
|
+
* All routes match the controller at
|
|
8
|
+
* apps/smart-validator/src/subscription/subscription.controller.ts.
|
|
9
|
+
*/
|
|
10
|
+
class SubscriptionClient {
|
|
11
|
+
baseUrl;
|
|
12
|
+
fetchImpl;
|
|
13
|
+
constructor(opts) {
|
|
14
|
+
this.baseUrl = opts.baseUrl.replace(/\/$/, '');
|
|
15
|
+
// Bind global fetch so `this` isn't lost when called as a property.
|
|
16
|
+
this.fetchImpl =
|
|
17
|
+
opts.fetchImpl ?? ((input, init) => globalThis.fetch(input, init));
|
|
18
|
+
}
|
|
19
|
+
async request(payload) {
|
|
20
|
+
return this.post('/api/v3/subscription/request', payload);
|
|
21
|
+
}
|
|
22
|
+
async status(appId) {
|
|
23
|
+
return this.get(`/api/v3/subscription/status/${encodeURIComponent(appId)}`);
|
|
24
|
+
}
|
|
25
|
+
async mint(appId) {
|
|
26
|
+
return this.post(`/api/v3/subscription/mint/${encodeURIComponent(appId)}`, {});
|
|
27
|
+
}
|
|
28
|
+
async renew(appId, additionalDays) {
|
|
29
|
+
return this.post('/api/v3/subscription/renew', {
|
|
30
|
+
appId,
|
|
31
|
+
...(additionalDays !== undefined ? { additionalDays } : {}),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
async upgrade(appId, toTier) {
|
|
35
|
+
return this.post('/api/v3/subscription/upgrade', {
|
|
36
|
+
appId,
|
|
37
|
+
toTier,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async downgrade(appId, toTier) {
|
|
41
|
+
return this.post('/api/v3/subscription/downgrade', {
|
|
42
|
+
appId,
|
|
43
|
+
toTier,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
async cancelTierChange(appId) {
|
|
47
|
+
return this.post('/api/v3/subscription/tier-change/cancel', {
|
|
48
|
+
appId,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
async usage(appId) {
|
|
52
|
+
return this.get(`/api/v3/subscription/usage/${encodeURIComponent(appId)}`);
|
|
53
|
+
}
|
|
54
|
+
async usageStatus(appId) {
|
|
55
|
+
return this.get(`/api/v3/subscription/usage/status/${encodeURIComponent(appId)}`);
|
|
56
|
+
}
|
|
57
|
+
async billing(appId, limit = 50, offset = 0) {
|
|
58
|
+
const qs = `?limit=${limit}&offset=${offset}`;
|
|
59
|
+
return this.get(`/api/v3/subscription/billing/${encodeURIComponent(appId)}${qs}`);
|
|
60
|
+
}
|
|
61
|
+
async post(path, body) {
|
|
62
|
+
return this.send('POST', path, body);
|
|
63
|
+
}
|
|
64
|
+
async get(path) {
|
|
65
|
+
return this.send('GET', path);
|
|
66
|
+
}
|
|
67
|
+
async send(method, path, body) {
|
|
68
|
+
const url = `${this.baseUrl}${path}`;
|
|
69
|
+
const init = {
|
|
70
|
+
method,
|
|
71
|
+
headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
|
|
72
|
+
};
|
|
73
|
+
if (body !== undefined)
|
|
74
|
+
init.body = JSON.stringify(body);
|
|
75
|
+
const res = await this.fetchImpl(url, init);
|
|
76
|
+
if (!res.ok) {
|
|
77
|
+
const text = await res.text().catch(() => '');
|
|
78
|
+
throw new Error(`${method} ${path} → ${res.status}: ${text.slice(0, 500)}`);
|
|
79
|
+
}
|
|
80
|
+
return (await res.json());
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.SubscriptionClient = SubscriptionClient;
|
|
84
|
+
//# sourceMappingURL=subscription-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-client.js","sourceRoot":"","sources":["../../src/_lib/subscription-client.ts"],"names":[],"mappings":";;;AAgIA;;;;;GAKG;AACH,MAAa,kBAAkB;IACZ,OAAO,CAAS;IAChB,SAAS,CAAY;IAEtC,YAAY,IAA+B;QACzC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC/C,oEAAoE;QACpE,IAAI,CAAC,SAAS;YACZ,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC,KAAK,EAAE,IAAI,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,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,IAAI,IAAI,MAAM,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAC9E,CAAC;QACD,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAM,CAAC;IACjC,CAAC;CACF;AA3GD,gDA2GC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared resolvers for the subscription command family.
|
|
3
|
+
*
|
|
4
|
+
* Reads VALIDATOR_URL / XRPL_ADDRESS / XRPL_SEED / SUBSCRIPTION_APP_ID from
|
|
5
|
+
* the env file written by `hsuite init` + `hsuite subscribe`. Centralised
|
|
6
|
+
* here so every companion command (renew/upgrade/downgrade/usage/billing)
|
|
7
|
+
* fails-fast with the same actionable error message.
|
|
8
|
+
*/
|
|
9
|
+
import type { EnvMap } from './env';
|
|
10
|
+
export declare function requireValidatorUrl(env: EnvMap, opts: {
|
|
11
|
+
gateway?: string;
|
|
12
|
+
}): string;
|
|
13
|
+
export declare function requireAppId(env: EnvMap, opts: {
|
|
14
|
+
appId?: string;
|
|
15
|
+
}): string;
|
|
16
|
+
export declare function requireXrplCreds(env: EnvMap): {
|
|
17
|
+
address: string;
|
|
18
|
+
seed: string;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=subscription-env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-env.d.ts","sourceRoot":"","sources":["../../src/_lib/subscription-env.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEpC,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAQnF;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAQ1E;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAS/E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requireValidatorUrl = requireValidatorUrl;
|
|
4
|
+
exports.requireAppId = requireAppId;
|
|
5
|
+
exports.requireXrplCreds = requireXrplCreds;
|
|
6
|
+
function requireValidatorUrl(env, opts) {
|
|
7
|
+
const url = opts.gateway ?? env.get('VALIDATOR_URL') ?? env.get('SMART_HOST_URL');
|
|
8
|
+
if (!url) {
|
|
9
|
+
throw new Error('VALIDATOR_URL not set. Pass --gateway <url> or run `hsuite init` to populate the env file.');
|
|
10
|
+
}
|
|
11
|
+
return url.replace(/\/$/, '');
|
|
12
|
+
}
|
|
13
|
+
function requireAppId(env, opts) {
|
|
14
|
+
const appId = opts.appId ?? env.get('SUBSCRIPTION_APP_ID');
|
|
15
|
+
if (!appId) {
|
|
16
|
+
throw new Error('SUBSCRIPTION_APP_ID not set. Pass --app-id <id> or run `hsuite subscribe` first.');
|
|
17
|
+
}
|
|
18
|
+
return appId;
|
|
19
|
+
}
|
|
20
|
+
function requireXrplCreds(env) {
|
|
21
|
+
const address = env.get('XRPL_ADDRESS');
|
|
22
|
+
const seed = env.get('XRPL_SEED');
|
|
23
|
+
if (!address || !seed) {
|
|
24
|
+
throw new Error('XRPL_ADDRESS + XRPL_SEED required. Run `hsuite init` to generate a fresh wallet.');
|
|
25
|
+
}
|
|
26
|
+
return { address, seed };
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=subscription-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-env.js","sourceRoot":"","sources":["../../src/_lib/subscription-env.ts"],"names":[],"mappings":";;AAUA,kDAQC;AAED,oCAQC;AAED,4CASC;AA7BD,SAAgB,mBAAmB,CAAC,GAAW,EAAE,IAA0B;IACzE,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClF,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,4FAA4F,CAC7F,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,SAAgB,YAAY,CAAC,GAAW,EAAE,IAAwB;IAChE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAC3D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAClC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `hsuite billing` — pretty-print the billing ledger.
|
|
3
|
+
*/
|
|
4
|
+
import { Command } from 'commander';
|
|
5
|
+
import { SubscriptionClient } from '../_lib/subscription-client';
|
|
6
|
+
type BillingOpts = {
|
|
7
|
+
env: string;
|
|
8
|
+
gateway?: string;
|
|
9
|
+
appId?: string;
|
|
10
|
+
limit?: string;
|
|
11
|
+
offset?: string;
|
|
12
|
+
clientFactory?: (baseUrl: string) => SubscriptionClient;
|
|
13
|
+
};
|
|
14
|
+
export declare function runBilling(opts: BillingOpts): Promise<import("../_lib/subscription-client").BillingLedgerResponse>;
|
|
15
|
+
export declare const billingCommand: Command;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=billing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/commands/billing.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGjE,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,kBAAkB,CAAC;CACzD,CAAC;AAEF,wBAAsB,UAAU,CAAC,IAAI,EAAE,WAAW,wEAUjD;AAED,eAAO,MAAM,cAAc,SAoCvB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
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.billingCommand = void 0;
|
|
7
|
+
exports.runBilling = runBilling;
|
|
8
|
+
/**
|
|
9
|
+
* `hsuite billing` — pretty-print the billing ledger.
|
|
10
|
+
*/
|
|
11
|
+
const commander_1 = require("commander");
|
|
12
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
13
|
+
const env_1 = require("../_lib/env");
|
|
14
|
+
const subscription_client_1 = require("../_lib/subscription-client");
|
|
15
|
+
const subscription_env_1 = require("../_lib/subscription-env");
|
|
16
|
+
async function runBilling(opts) {
|
|
17
|
+
const env = (0, env_1.readEnv)(opts.env);
|
|
18
|
+
const baseUrl = (0, subscription_env_1.requireValidatorUrl)(env, { gateway: opts.gateway });
|
|
19
|
+
const appId = (0, subscription_env_1.requireAppId)(env, { appId: opts.appId });
|
|
20
|
+
const limit = opts.limit ? Number(opts.limit) : 50;
|
|
21
|
+
const offset = opts.offset ? Number(opts.offset) : 0;
|
|
22
|
+
if (!Number.isFinite(limit) || limit <= 0)
|
|
23
|
+
throw new Error('--limit must be a positive number');
|
|
24
|
+
if (!Number.isFinite(offset) || offset < 0)
|
|
25
|
+
throw new Error('--offset must be >= 0');
|
|
26
|
+
const client = (opts.clientFactory ?? ((b) => new subscription_client_1.SubscriptionClient({ baseUrl: b })))(baseUrl);
|
|
27
|
+
return client.billing(appId, limit, offset);
|
|
28
|
+
}
|
|
29
|
+
exports.billingCommand = new commander_1.Command('billing')
|
|
30
|
+
.description('Print the subscription billing-ledger entries')
|
|
31
|
+
.option('--env <file>', 'Env file with subscription appId', '.env.local')
|
|
32
|
+
.option('--gateway <url>', 'Validator/gateway URL (defaults to VALIDATOR_URL in env)')
|
|
33
|
+
.option('--app-id <id>', 'Override SUBSCRIPTION_APP_ID from env')
|
|
34
|
+
.option('--limit <n>', 'Page size (default 50)')
|
|
35
|
+
.option('--offset <n>', 'Pagination offset (default 0)')
|
|
36
|
+
.action(async (opts) => {
|
|
37
|
+
console.log(chalk_1.default.bold.cyan('\n hsuite billing\n'));
|
|
38
|
+
try {
|
|
39
|
+
const res = await runBilling(opts);
|
|
40
|
+
console.log(chalk_1.default.gray(` app: ${res.appId}`));
|
|
41
|
+
console.log(chalk_1.default.gray(` total: ${res.total} hasMore: ${res.hasMore}\n`));
|
|
42
|
+
if (res.entries.length === 0) {
|
|
43
|
+
console.log(chalk_1.default.gray(' (no entries)\n'));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const headers = ['operation', 'amount', 'balanceAfter', 'timestamp'];
|
|
47
|
+
console.log(chalk_1.default.bold.white(` ${headers[0].padEnd(22)} ${headers[1].padEnd(14)} ${headers[2].padEnd(14)} ${headers[3]}`));
|
|
48
|
+
console.log(chalk_1.default.gray(' ' + '-'.repeat(78)));
|
|
49
|
+
for (const e of res.entries) {
|
|
50
|
+
console.log(chalk_1.default.gray(` ${(e.operation ?? '').padEnd(22)} ${String(e.amount ?? '').padEnd(14)} ${String(e.balanceAfter ?? '').padEnd(14)} ${e.timestamp ?? ''}`));
|
|
51
|
+
}
|
|
52
|
+
console.log('');
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
console.error(chalk_1.default.red(` ${err.message}\n`));
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=billing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/commands/billing.ts"],"names":[],"mappings":";;;;;;AAkBA,gCAUC;AA5BD;;GAEG;AACH,yCAAoC;AACpC,kDAA0B;AAC1B,qCAAsC;AACtC,qEAAiE;AACjE,+DAA6E;AAWtE,KAAK,UAAU,UAAU,CAAC,IAAiB;IAChD,MAAM,GAAG,GAAG,IAAA,aAAO,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,OAAO,GAAG,IAAA,sCAAmB,EAAC,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IACpE,MAAM,KAAK,GAAG,IAAA,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I,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,SAAS,IAAI,EAAE,EAAE,CAC3I,CACF,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,KAAM,GAAa,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgEpC,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgEpC,eAAO,MAAM,aAAa,SAiJtB,CAAC"}
|
package/dist/commands/deploy.js
CHANGED
|
@@ -114,22 +114,32 @@ exports.deployCommand = new commander_1.Command('deploy')
|
|
|
114
114
|
console.log(chalk_1.default.gray(` bootstrap: ${opts.gateway}\n`));
|
|
115
115
|
const env = (0, env_1.readEnv)(opts.env);
|
|
116
116
|
const signer = (0, env_1.buildSignerFromEnv)(env);
|
|
117
|
-
// Decentralized cluster discovery
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
117
|
+
// Decentralized cluster discovery is now handled by the SDK's canonical
|
|
118
|
+
// `BaasClient.connectToCluster` factory (SDK 3.4.0+) — bootstrap →
|
|
119
|
+
// registry → random cluster → BaasClient pointed at the picked cluster's
|
|
120
|
+
// gateway. We no longer maintain a parallel discovery path in the CLI.
|
|
121
|
+
//
|
|
122
|
+
// `pathPrefix` is omitted: the SDK defaults to `/host`, which matches
|
|
123
|
+
// the gateway's `/host(/|$)(.*)` ingress rewrite to the host service
|
|
124
|
+
// (charts/smart-engines/templates/ingress.yaml:131).
|
|
125
|
+
let spinner = (0, ora_1.default)('connecting to cluster...').start();
|
|
126
|
+
let client;
|
|
127
|
+
try {
|
|
128
|
+
client = await smart_engines_sdk_1.BaasClient.connectToCluster({
|
|
129
|
+
bootstrap: [opts.gateway],
|
|
130
|
+
appId: env.get('SUBSCRIPTION_APP_ID') ?? 'pending',
|
|
131
|
+
allowInsecure: opts.gateway.startsWith('http://'),
|
|
132
|
+
// deployment.init runs the smart-app entity DKG ceremony
|
|
133
|
+
// synchronously across the validator cluster — well past the 30s
|
|
134
|
+
// default. 3 min.
|
|
135
|
+
timeout: 180_000,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
catch (err) {
|
|
139
|
+
spinner.fail(`cluster connect failed: ${err.message}`);
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
spinner.succeed(`cluster: ${client.getHostUrl()}`);
|
|
133
143
|
spinner = (0, ora_1.default)('authenticate...').start();
|
|
134
144
|
try {
|
|
135
145
|
await client.authenticate({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":";;;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S,CAAC,GAAG,EAAE,CAAC,CAAC;IAE9C,IAAA,eAAS,EAAC,IAAI,CAAC,GAAG,EAAE,EAAE,eAAe,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `hsuite downgrade --to-tier <T>` — POST /api/v3/subscription/downgrade.
|
|
3
|
+
*
|
|
4
|
+
* Downgrades apply at the next renewal (no top-up, no immediate mint).
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from 'commander';
|
|
7
|
+
import { SubscriptionClient } from '../_lib/subscription-client';
|
|
8
|
+
type DowngradeOpts = {
|
|
9
|
+
env: string;
|
|
10
|
+
gateway?: string;
|
|
11
|
+
appId?: string;
|
|
12
|
+
toTier: string;
|
|
13
|
+
clientFactory?: (baseUrl: string) => SubscriptionClient;
|
|
14
|
+
};
|
|
15
|
+
export declare function runDowngrade(opts: DowngradeOpts): Promise<{
|
|
16
|
+
appId: string;
|
|
17
|
+
toTier: string;
|
|
18
|
+
effectiveAt?: string | number;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const downgradeCommand: Command;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=downgrade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"downgrade.d.ts","sourceRoot":"","sources":["../../src/commands/downgrade.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGjE,KAAK,aAAa,GAAG;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,kBAAkB,CAAC;CACzD,CAAC;AAEF,wBAAsB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC/B,CAAC,CAWD;AAED,eAAO,MAAM,gBAAgB,SAqBzB,CAAC"}
|