@hsuite/smart-engines-sdk 3.7.0 → 3.10.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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/index.d.ts +57 -3
- package/dist/index.js +474 -103
- package/dist/index.js.map +1 -1
- package/dist/nestjs/index.d.ts +56 -2
- package/dist/nestjs/index.js +474 -103
- package/dist/nestjs/index.js.map +1 -1
- package/package.json +1 -1
package/dist/nestjs/index.js
CHANGED
|
@@ -1288,7 +1288,7 @@ function createHttpClient(config) {
|
|
|
1288
1288
|
try {
|
|
1289
1289
|
return await op();
|
|
1290
1290
|
} catch (error) {
|
|
1291
|
-
const refreshable = !!config.onUnauthorized && !path.startsWith("/api/auth/") && error instanceof SdkHttpError && error.statusCode === 401;
|
|
1291
|
+
const refreshable = !!config.onUnauthorized && !path.startsWith("/api/v3/baas/auth/") && !path.startsWith("/api/v3/auth/") && error instanceof SdkHttpError && error.statusCode === 401;
|
|
1292
1292
|
if (!refreshable) throw error;
|
|
1293
1293
|
if (!reauthInFlight) {
|
|
1294
1294
|
reauthInFlight = Promise.resolve(config.onUnauthorized()).finally(() => {
|
|
@@ -2228,7 +2228,7 @@ var HederaTransactionsClient = class {
|
|
|
2228
2228
|
* - `client.hedera.tss.createTopic(...)` makes the cluster sign+submit in one call.
|
|
2229
2229
|
*
|
|
2230
2230
|
* `tssHttp` is the validator's `/api/v3`-rooted HTTP client (different from
|
|
2231
|
-
* the `/api/transactions` one this class uses for prepare paths). Both
|
|
2231
|
+
* the `/api/v3/transactions` one this class uses for prepare paths). Both
|
|
2232
2232
|
* clients are required — the previous single-arg fallback to `http` was
|
|
2233
2233
|
* unreachable through `SmartEngineClient` (the only call site always
|
|
2234
2234
|
* passes both).
|
|
@@ -2938,15 +2938,15 @@ var AgentsClient = class {
|
|
|
2938
2938
|
http;
|
|
2939
2939
|
/** Register a new agent */
|
|
2940
2940
|
async register(request) {
|
|
2941
|
-
return this.http.post("/api/agents/register", request);
|
|
2941
|
+
return this.http.post("/api/v3/baas/agents/register", request);
|
|
2942
2942
|
}
|
|
2943
2943
|
/** Get agent details */
|
|
2944
2944
|
async get(agentId) {
|
|
2945
|
-
return this.http.get(`/api/agents/${encodePathParam(agentId)}`);
|
|
2945
|
+
return this.http.get(`/api/v3/baas/agents/${encodePathParam(agentId)}`);
|
|
2946
2946
|
}
|
|
2947
2947
|
/** List all agents */
|
|
2948
2948
|
async list() {
|
|
2949
|
-
return this.http.get("/api/agents");
|
|
2949
|
+
return this.http.get("/api/v3/baas/agents");
|
|
2950
2950
|
}
|
|
2951
2951
|
/**
|
|
2952
2952
|
* Fund agent treasury (owner-only). Returns a
|
|
@@ -2954,60 +2954,60 @@ var AgentsClient = class {
|
|
|
2954
2954
|
* the caller is expected to sign and submit the prepared bytes.
|
|
2955
2955
|
*/
|
|
2956
2956
|
async fund(agentId, request) {
|
|
2957
|
-
return this.http.post(`/api/agents/${encodePathParam(agentId)}/fund`, request);
|
|
2957
|
+
return this.http.post(`/api/v3/baas/agents/${encodePathParam(agentId)}/fund`, request);
|
|
2958
2958
|
}
|
|
2959
2959
|
/**
|
|
2960
2960
|
* Execute a trade (agent-wallet OR owner). Returns a
|
|
2961
2961
|
* `PreparedTransactionResponse` wrapped in a `success: true` envelope.
|
|
2962
2962
|
*/
|
|
2963
2963
|
async trade(agentId, request) {
|
|
2964
|
-
return this.http.post(`/api/agents/${encodePathParam(agentId)}/trade`, request);
|
|
2964
|
+
return this.http.post(`/api/v3/baas/agents/${encodePathParam(agentId)}/trade`, request);
|
|
2965
2965
|
}
|
|
2966
2966
|
/**
|
|
2967
2967
|
* Withdraw from agent treasury (owner-only). Returns a
|
|
2968
2968
|
* `PreparedTransactionResponse` wrapped in a `success: true` envelope.
|
|
2969
2969
|
*/
|
|
2970
2970
|
async withdraw(agentId, request) {
|
|
2971
|
-
return this.http.post(`/api/agents/${encodePathParam(agentId)}/withdraw`, request);
|
|
2971
|
+
return this.http.post(`/api/v3/baas/agents/${encodePathParam(agentId)}/withdraw`, request);
|
|
2972
2972
|
}
|
|
2973
2973
|
/** Pause an agent */
|
|
2974
2974
|
async pause(agentId) {
|
|
2975
|
-
return this.http.post(`/api/agents/${encodePathParam(agentId)}/pause`, {});
|
|
2975
|
+
return this.http.post(`/api/v3/baas/agents/${encodePathParam(agentId)}/pause`, {});
|
|
2976
2976
|
}
|
|
2977
2977
|
/** Resume a paused agent */
|
|
2978
2978
|
async resume(agentId) {
|
|
2979
|
-
return this.http.post(`/api/agents/${encodePathParam(agentId)}/resume`, {});
|
|
2979
|
+
return this.http.post(`/api/v3/baas/agents/${encodePathParam(agentId)}/resume`, {});
|
|
2980
2980
|
}
|
|
2981
2981
|
/** Revoke an agent (permanent) */
|
|
2982
2982
|
async revoke(agentId) {
|
|
2983
|
-
return this.http.post(`/api/agents/${encodePathParam(agentId)}/revoke`, {});
|
|
2983
|
+
return this.http.post(`/api/v3/baas/agents/${encodePathParam(agentId)}/revoke`, {});
|
|
2984
2984
|
}
|
|
2985
2985
|
/**
|
|
2986
2986
|
* Update agent rules.
|
|
2987
2987
|
*
|
|
2988
|
-
* Server route is PATCH `/api/agents/:agentId/rules`
|
|
2988
|
+
* Server route is PATCH `/api/v3/baas/agents/:agentId/rules`
|
|
2989
2989
|
* (`agents.controller.ts:375`). The previous PUT variant 404'd because
|
|
2990
2990
|
* Nest matched the dynamic `:agentId` GET/POST handlers and rejected
|
|
2991
2991
|
* the verb mismatch.
|
|
2992
2992
|
*/
|
|
2993
2993
|
async updateRules(agentId, rules) {
|
|
2994
|
-
return this.http.patch(`/api/agents/${encodePathParam(agentId)}/rules`, rules);
|
|
2994
|
+
return this.http.patch(`/api/v3/baas/agents/${encodePathParam(agentId)}/rules`, rules);
|
|
2995
2995
|
}
|
|
2996
2996
|
/** Get agent events */
|
|
2997
2997
|
async getEvents(agentId) {
|
|
2998
|
-
return this.http.get(`/api/agents/${encodePathParam(agentId)}/events`);
|
|
2998
|
+
return this.http.get(`/api/v3/baas/agents/${encodePathParam(agentId)}/events`);
|
|
2999
2999
|
}
|
|
3000
3000
|
/** Get agent balances across chains */
|
|
3001
3001
|
async getBalances(agentId) {
|
|
3002
|
-
return this.http.get(`/api/agents/${encodePathParam(agentId)}/balances`);
|
|
3002
|
+
return this.http.get(`/api/v3/baas/agents/${encodePathParam(agentId)}/balances`);
|
|
3003
3003
|
}
|
|
3004
3004
|
/** Approve a pending agent operation */
|
|
3005
3005
|
async approve(agentId, operationId) {
|
|
3006
|
-
return this.http.post(`/api/agents/${encodePathParam(agentId)}/approve/${encodePathParam(operationId)}`, {});
|
|
3006
|
+
return this.http.post(`/api/v3/baas/agents/${encodePathParam(agentId)}/approve/${encodePathParam(operationId)}`, {});
|
|
3007
3007
|
}
|
|
3008
3008
|
/** Reject a pending agent operation */
|
|
3009
3009
|
async reject(agentId, operationId) {
|
|
3010
|
-
return this.http.post(`/api/agents/${encodePathParam(agentId)}/reject/${encodePathParam(operationId)}`, {});
|
|
3010
|
+
return this.http.post(`/api/v3/baas/agents/${encodePathParam(agentId)}/reject/${encodePathParam(operationId)}`, {});
|
|
3011
3011
|
}
|
|
3012
3012
|
};
|
|
3013
3013
|
|
|
@@ -3035,7 +3035,56 @@ var DeploymentClient = class {
|
|
|
3035
3035
|
* {@link deploy} with the pushed image tag.
|
|
3036
3036
|
*/
|
|
3037
3037
|
async init(request) {
|
|
3038
|
-
return this.http.post("/api/deployment/apps/init", request);
|
|
3038
|
+
return this.http.post("/api/v3/baas/deployment/apps/init", request);
|
|
3039
|
+
}
|
|
3040
|
+
/**
|
|
3041
|
+
* Issue ephemeral Harbor push credentials for a smart-app that ALREADY
|
|
3042
|
+
* EXISTS — the MINT-FIRST / DEPLOY-LAST credentials-push call.
|
|
3043
|
+
*
|
|
3044
|
+
* Unlike {@link init} (which historically allocated a fresh entity), this
|
|
3045
|
+
* takes the developer's pre-existing `appId` — the `SUBSCRIPTION_APP_ID`
|
|
3046
|
+
* minted by `hsuite subscribe` (`appId == DKG entityId`) — and ONLY
|
|
3047
|
+
* (re)provisions the per-app Harbor project + push robot. The server creates
|
|
3048
|
+
* no DKG entity and no subscription; it asserts the caller owns the app and
|
|
3049
|
+
* that its subscription is ACTIVE (402 otherwise) first.
|
|
3050
|
+
*
|
|
3051
|
+
* Returns the same `{ appId, registry }` shape as {@link init}. Single-use
|
|
3052
|
+
* secret discipline applies to `registry.password` exactly as in `init`.
|
|
3053
|
+
*
|
|
3054
|
+
* This is the credentials path the mint-first `hsuite deploy` uses to obtain
|
|
3055
|
+
* push creds for the developer's already-minted subscription app
|
|
3056
|
+
* (`POST /apps/:appId/credentials/push`). The `hsuite redeploy` re-push path
|
|
3057
|
+
* uses {@link reissuePushCredentials} instead, which targets a dedicated
|
|
3058
|
+
* `credentials/reissue` route with stricter SUSPENDED-app + Harbor-failure
|
|
3059
|
+
* handling.
|
|
3060
|
+
*/
|
|
3061
|
+
async pushCredentials(appId) {
|
|
3062
|
+
return this.http.post(
|
|
3063
|
+
`/api/v3/baas/deployment/apps/${encodePathParam(appId)}/credentials/push`,
|
|
3064
|
+
{}
|
|
3065
|
+
);
|
|
3066
|
+
}
|
|
3067
|
+
/**
|
|
3068
|
+
* Reissue ephemeral Harbor push credentials for an EXISTING app, WITHOUT
|
|
3069
|
+
* allocating a new appId / entity. Unlike {@link init} — which historically
|
|
3070
|
+
* forked a fresh smart-app entity (and a fresh paid subscription) on every
|
|
3071
|
+
* call — this re-binds to an app the developer already owns: the `appId` is
|
|
3072
|
+
* echoed back unchanged and only a new single-use `registry.password` push
|
|
3073
|
+
* robot is minted. Same `{ appId, registry }` response shape as `init`.
|
|
3074
|
+
*
|
|
3075
|
+
* Owner-only + active-subscription gated server-side. This is the credential
|
|
3076
|
+
* path `hsuite redeploy` uses so a re-push does not cost a new entity +
|
|
3077
|
+
* subscription each run. Targets the dedicated
|
|
3078
|
+
* `POST /apps/:appId/credentials/reissue` route (distinct from
|
|
3079
|
+
* {@link pushCredentials}'s first-deploy `credentials/push`): the reissue
|
|
3080
|
+
* route additionally refuses SUSPENDED apps and surfaces Harbor failures
|
|
3081
|
+
* loudly rather than returning placeholder creds.
|
|
3082
|
+
*/
|
|
3083
|
+
async reissuePushCredentials(appId) {
|
|
3084
|
+
return this.http.post(
|
|
3085
|
+
`/api/v3/baas/deployment/apps/${encodePathParam(appId)}/credentials/reissue`,
|
|
3086
|
+
{}
|
|
3087
|
+
);
|
|
3039
3088
|
}
|
|
3040
3089
|
/**
|
|
3041
3090
|
* Step 3 (optional) — upload the SPA tarball.
|
|
@@ -3046,7 +3095,7 @@ var DeploymentClient = class {
|
|
|
3046
3095
|
*/
|
|
3047
3096
|
async uploadFrontend(appId, bundle, filename = "bundle.tar.gz") {
|
|
3048
3097
|
return this.http.upload(
|
|
3049
|
-
`/api/deployment/apps/${encodePathParam(appId)}/frontend`,
|
|
3098
|
+
`/api/v3/baas/deployment/apps/${encodePathParam(appId)}/frontend`,
|
|
3050
3099
|
bundle,
|
|
3051
3100
|
filename,
|
|
3052
3101
|
void 0,
|
|
@@ -3060,32 +3109,32 @@ var DeploymentClient = class {
|
|
|
3060
3109
|
* until `runtime.runtimeState === 'RUNNING'` for the URL to be live.
|
|
3061
3110
|
*/
|
|
3062
3111
|
async deploy(appId, request) {
|
|
3063
|
-
return this.http.post(`/api/deployment/apps/${encodePathParam(appId)}/deploy`, request);
|
|
3112
|
+
return this.http.post(`/api/v3/baas/deployment/apps/${encodePathParam(appId)}/deploy`, request);
|
|
3064
3113
|
}
|
|
3065
3114
|
/**
|
|
3066
3115
|
* Roll back to a previously-deployed image tag (must exist in
|
|
3067
3116
|
* `runtime.deploymentHistory[]`).
|
|
3068
3117
|
*/
|
|
3069
3118
|
async rollback(appId, request) {
|
|
3070
|
-
return this.http.post(`/api/deployment/apps/${encodePathParam(appId)}/rollback`, request);
|
|
3119
|
+
return this.http.post(`/api/v3/baas/deployment/apps/${encodePathParam(appId)}/rollback`, request);
|
|
3071
3120
|
}
|
|
3072
3121
|
/**
|
|
3073
3122
|
* Live combined lifecycle + runtime status of an app.
|
|
3074
3123
|
*/
|
|
3075
3124
|
async status(appId) {
|
|
3076
|
-
return this.http.get(`/api/deployment/apps/${encodePathParam(appId)}/status`);
|
|
3125
|
+
return this.http.get(`/api/v3/baas/deployment/apps/${encodePathParam(appId)}/status`);
|
|
3077
3126
|
}
|
|
3078
3127
|
/**
|
|
3079
3128
|
* List all deployed apps for the authenticated developer.
|
|
3080
3129
|
*/
|
|
3081
3130
|
async list() {
|
|
3082
|
-
return this.http.get("/api/
|
|
3131
|
+
return this.http.get("/api/v3/smart-apps");
|
|
3083
3132
|
}
|
|
3084
3133
|
/**
|
|
3085
3134
|
* Get app details.
|
|
3086
3135
|
*/
|
|
3087
3136
|
async get(appId) {
|
|
3088
|
-
return this.http.get(`/api/
|
|
3137
|
+
return this.http.get(`/api/v3/smart-apps/${encodePathParam(appId)}`);
|
|
3089
3138
|
}
|
|
3090
3139
|
/**
|
|
3091
3140
|
* Update app configuration.
|
|
@@ -3095,31 +3144,31 @@ var DeploymentClient = class {
|
|
|
3095
3144
|
* @returns The updated app info.
|
|
3096
3145
|
*/
|
|
3097
3146
|
async update(appId, updates) {
|
|
3098
|
-
return this.http.put(`/api/
|
|
3147
|
+
return this.http.put(`/api/v3/smart-apps/${encodePathParam(appId)}`, updates);
|
|
3099
3148
|
}
|
|
3100
3149
|
/**
|
|
3101
3150
|
* Delete an app (runtime effect: namespace teardown).
|
|
3102
3151
|
*/
|
|
3103
3152
|
async delete(appId) {
|
|
3104
|
-
return this.http.delete(`/api/
|
|
3153
|
+
return this.http.delete(`/api/v3/smart-apps/${encodePathParam(appId)}`);
|
|
3105
3154
|
}
|
|
3106
3155
|
/**
|
|
3107
3156
|
* Suspend an app (runtime effect: scale to zero).
|
|
3108
3157
|
*/
|
|
3109
3158
|
async suspend(appId) {
|
|
3110
|
-
return this.http.post(`/api/
|
|
3159
|
+
return this.http.post(`/api/v3/smart-apps/${encodePathParam(appId)}/suspend`, {});
|
|
3111
3160
|
}
|
|
3112
3161
|
/**
|
|
3113
3162
|
* Resume a suspended app (runtime effect: scale back up).
|
|
3114
3163
|
*/
|
|
3115
3164
|
async resume(appId) {
|
|
3116
|
-
return this.http.post(`/api/
|
|
3165
|
+
return this.http.post(`/api/v3/smart-apps/${encodePathParam(appId)}/resume`, {});
|
|
3117
3166
|
}
|
|
3118
3167
|
/**
|
|
3119
3168
|
* Get deployment statistics.
|
|
3120
3169
|
*/
|
|
3121
3170
|
async getStats() {
|
|
3122
|
-
return this.http.get("/api/
|
|
3171
|
+
return this.http.get("/api/v3/smart-apps/stats");
|
|
3123
3172
|
}
|
|
3124
3173
|
/**
|
|
3125
3174
|
* Register or update the developer-facing webhook URL for runtime
|
|
@@ -3140,7 +3189,7 @@ var DeploymentClient = class {
|
|
|
3140
3189
|
* CGNAT / cloud metadata destinations (SSRF guard).
|
|
3141
3190
|
*/
|
|
3142
3191
|
async setWebhook(appId, webhookUrl) {
|
|
3143
|
-
return this.http.put(`/api/deployment/apps/${encodePathParam(appId)}/webhook`, {
|
|
3192
|
+
return this.http.put(`/api/v3/baas/deployment/apps/${encodePathParam(appId)}/webhook`, {
|
|
3144
3193
|
webhookUrl
|
|
3145
3194
|
});
|
|
3146
3195
|
}
|
|
@@ -3156,7 +3205,7 @@ var DeploymentClient = class {
|
|
|
3156
3205
|
* exposition format.
|
|
3157
3206
|
*/
|
|
3158
3207
|
async getMetrics(appId) {
|
|
3159
|
-
return this.http.getText(`/api/deployment/apps/${encodePathParam(appId)}/metrics`);
|
|
3208
|
+
return this.http.getText(`/api/v3/baas/deployment/apps/${encodePathParam(appId)}/metrics`);
|
|
3160
3209
|
}
|
|
3161
3210
|
/**
|
|
3162
3211
|
* Rotate the smart-app's tenant-secret KEK.
|
|
@@ -3167,7 +3216,7 @@ var DeploymentClient = class {
|
|
|
3167
3216
|
*/
|
|
3168
3217
|
async rotateKek(appId) {
|
|
3169
3218
|
return this.http.post(
|
|
3170
|
-
`/api/deployment/apps/${encodePathParam(appId)}/credentials/rotate-kek`,
|
|
3219
|
+
`/api/v3/baas/deployment/apps/${encodePathParam(appId)}/credentials/rotate-kek`,
|
|
3171
3220
|
{}
|
|
3172
3221
|
);
|
|
3173
3222
|
}
|
|
@@ -3181,7 +3230,7 @@ var DeploymentClient = class {
|
|
|
3181
3230
|
*/
|
|
3182
3231
|
async revokeKek(appId, version) {
|
|
3183
3232
|
return this.http.post(
|
|
3184
|
-
`/api/deployment/apps/${encodePathParam(appId)}/credentials/revoke-kek`,
|
|
3233
|
+
`/api/v3/baas/deployment/apps/${encodePathParam(appId)}/credentials/revoke-kek`,
|
|
3185
3234
|
{ version }
|
|
3186
3235
|
);
|
|
3187
3236
|
}
|
|
@@ -3388,7 +3437,7 @@ var SmartEngineClient = class _SmartEngineClient {
|
|
|
3388
3437
|
baseUrl;
|
|
3389
3438
|
allowInsecure;
|
|
3390
3439
|
http;
|
|
3391
|
-
/** Separate HTTP client for /api/transactions
|
|
3440
|
+
/** Separate HTTP client for /api/v3/transactions */
|
|
3392
3441
|
txHttp;
|
|
3393
3442
|
/** Last HTTP error (for getHttpHealth) */
|
|
3394
3443
|
lastHttpError;
|
|
@@ -3449,7 +3498,7 @@ var SmartEngineClient = class _SmartEngineClient {
|
|
|
3449
3498
|
timeout: config.timeout
|
|
3450
3499
|
});
|
|
3451
3500
|
this.txHttp = createHttpClient({
|
|
3452
|
-
baseUrl: `${this.baseUrl}/api/transactions`,
|
|
3501
|
+
baseUrl: `${this.baseUrl}/api/v3/transactions`,
|
|
3453
3502
|
apiKey: config.apiKey,
|
|
3454
3503
|
authToken: config.authToken,
|
|
3455
3504
|
timeout: config.timeout
|
|
@@ -3783,7 +3832,17 @@ var SmartEngineClient = class _SmartEngineClient {
|
|
|
3783
3832
|
return this.http.get("/status");
|
|
3784
3833
|
}
|
|
3785
3834
|
// ========== Messaging Operations ==========
|
|
3786
|
-
/**
|
|
3835
|
+
/**
|
|
3836
|
+
* Submit a message to consensus.
|
|
3837
|
+
*
|
|
3838
|
+
* @deprecated Operator-funded message submission is RETIRED on the validator
|
|
3839
|
+
* under transaction sovereignty — `POST /api/v3/messages/:chain/:topicId`
|
|
3840
|
+
* now returns `403 Forbidden` (the operator must never front the chain fee
|
|
3841
|
+
* for a customer-supplied message). Use the payer-funded prepare path
|
|
3842
|
+
* instead: prepare a topic-message transaction via
|
|
3843
|
+
* `POST /api/transactions/topic/message/prepare`, then have the payer sign
|
|
3844
|
+
* and submit the returned bytes.
|
|
3845
|
+
*/
|
|
3787
3846
|
async submitMessage(chain, topicId, message) {
|
|
3788
3847
|
if (message.length > 1024 * 1024) {
|
|
3789
3848
|
throw new SmartEngineError("Message too large (max 1MB)", 400);
|
|
@@ -4160,7 +4219,7 @@ var DatabaseClient = class {
|
|
|
4160
4219
|
async insert(collection, document) {
|
|
4161
4220
|
const appId = this.getAppId();
|
|
4162
4221
|
return this.http.post(
|
|
4163
|
-
`/api/db/${encodePathParam(appId)}/${encodePathParam(collection)}`,
|
|
4222
|
+
`/api/v3/baas/db/${encodePathParam(appId)}/${encodePathParam(collection)}`,
|
|
4164
4223
|
document
|
|
4165
4224
|
);
|
|
4166
4225
|
}
|
|
@@ -4178,7 +4237,7 @@ var DatabaseClient = class {
|
|
|
4178
4237
|
if (options?.sort) params.set("sort", options.sort);
|
|
4179
4238
|
const qs = params.toString();
|
|
4180
4239
|
return this.http.get(
|
|
4181
|
-
`/api/db/${encodePathParam(appId)}/${encodePathParam(collection)}${qs ? `?${qs}` : ""}`
|
|
4240
|
+
`/api/v3/baas/db/${encodePathParam(appId)}/${encodePathParam(collection)}${qs ? `?${qs}` : ""}`
|
|
4182
4241
|
);
|
|
4183
4242
|
}
|
|
4184
4243
|
/**
|
|
@@ -4187,7 +4246,7 @@ var DatabaseClient = class {
|
|
|
4187
4246
|
async update(collection, documentId, updates) {
|
|
4188
4247
|
const appId = this.getAppId();
|
|
4189
4248
|
return this.http.put(
|
|
4190
|
-
`/api/db/${encodePathParam(appId)}/${encodePathParam(collection)}/${encodePathParam(documentId)}`,
|
|
4249
|
+
`/api/v3/baas/db/${encodePathParam(appId)}/${encodePathParam(collection)}/${encodePathParam(documentId)}`,
|
|
4191
4250
|
updates
|
|
4192
4251
|
);
|
|
4193
4252
|
}
|
|
@@ -4197,19 +4256,19 @@ var DatabaseClient = class {
|
|
|
4197
4256
|
async delete(collection, documentId) {
|
|
4198
4257
|
const appId = this.getAppId();
|
|
4199
4258
|
return this.http.delete(
|
|
4200
|
-
`/api/db/${encodePathParam(appId)}/${encodePathParam(collection)}/${encodePathParam(documentId)}`
|
|
4259
|
+
`/api/v3/baas/db/${encodePathParam(appId)}/${encodePathParam(collection)}/${encodePathParam(documentId)}`
|
|
4201
4260
|
);
|
|
4202
4261
|
}
|
|
4203
4262
|
/**
|
|
4204
4263
|
* List collections for the app.
|
|
4205
4264
|
*
|
|
4206
|
-
* Server route is `/api/db/:appId/collections`
|
|
4265
|
+
* Server route is `/api/v3/baas/db/:appId/collections`
|
|
4207
4266
|
* (`database.controller.ts:106`). The previous bare-`:appId` GET 404'd
|
|
4208
4267
|
* — Nest reserves that pattern for the document-find router below.
|
|
4209
4268
|
*/
|
|
4210
4269
|
async listCollections() {
|
|
4211
4270
|
const appId = this.getAppId();
|
|
4212
|
-
return this.http.get(`/api/db/${encodePathParam(appId)}/collections`);
|
|
4271
|
+
return this.http.get(`/api/v3/baas/db/${encodePathParam(appId)}/collections`);
|
|
4213
4272
|
}
|
|
4214
4273
|
/**
|
|
4215
4274
|
* Create a new collection in the database.
|
|
@@ -4219,7 +4278,7 @@ var DatabaseClient = class {
|
|
|
4219
4278
|
*/
|
|
4220
4279
|
async createCollection(name) {
|
|
4221
4280
|
const appId = this.getAppId();
|
|
4222
|
-
return this.http.post(`/api/db/${encodePathParam(appId)}/collections`, { name });
|
|
4281
|
+
return this.http.post(`/api/v3/baas/db/${encodePathParam(appId)}/collections`, { name });
|
|
4223
4282
|
}
|
|
4224
4283
|
/**
|
|
4225
4284
|
* Drop a collection and all its documents.
|
|
@@ -4230,7 +4289,7 @@ var DatabaseClient = class {
|
|
|
4230
4289
|
async dropCollection(name) {
|
|
4231
4290
|
const appId = this.getAppId();
|
|
4232
4291
|
return this.http.delete(
|
|
4233
|
-
`/api/db/${encodePathParam(appId)}/collections/${encodePathParam(name)}`
|
|
4292
|
+
`/api/v3/baas/db/${encodePathParam(appId)}/collections/${encodePathParam(name)}`
|
|
4234
4293
|
);
|
|
4235
4294
|
}
|
|
4236
4295
|
// ========== State Proofs ==========
|
|
@@ -4239,7 +4298,7 @@ var DatabaseClient = class {
|
|
|
4239
4298
|
*/
|
|
4240
4299
|
async getStateRoot() {
|
|
4241
4300
|
const appId = this.getAppId();
|
|
4242
|
-
return this.http.get(`/api/db/${encodePathParam(appId)}/state/root`);
|
|
4301
|
+
return this.http.get(`/api/v3/baas/db/${encodePathParam(appId)}/state/root`);
|
|
4243
4302
|
}
|
|
4244
4303
|
/**
|
|
4245
4304
|
* Get a Merkle proof for a specific document
|
|
@@ -4247,7 +4306,7 @@ var DatabaseClient = class {
|
|
|
4247
4306
|
async getDocumentProof(documentId) {
|
|
4248
4307
|
const appId = this.getAppId();
|
|
4249
4308
|
return this.http.get(
|
|
4250
|
-
`/api/db/${encodePathParam(appId)}/${encodePathParam(documentId)}/proof`
|
|
4309
|
+
`/api/v3/baas/db/${encodePathParam(appId)}/${encodePathParam(documentId)}/proof`
|
|
4251
4310
|
);
|
|
4252
4311
|
}
|
|
4253
4312
|
/**
|
|
@@ -4261,7 +4320,7 @@ var DatabaseClient = class {
|
|
|
4261
4320
|
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
4262
4321
|
const qs = params.toString();
|
|
4263
4322
|
return this.http.get(
|
|
4264
|
-
`/api/db/${encodePathParam(appId)}/state/transitions${qs ? `?${qs}` : ""}`
|
|
4323
|
+
`/api/v3/baas/db/${encodePathParam(appId)}/state/transitions${qs ? `?${qs}` : ""}`
|
|
4265
4324
|
);
|
|
4266
4325
|
}
|
|
4267
4326
|
/**
|
|
@@ -4269,7 +4328,7 @@ var DatabaseClient = class {
|
|
|
4269
4328
|
*/
|
|
4270
4329
|
async getDbStats() {
|
|
4271
4330
|
const appId = this.getAppId();
|
|
4272
|
-
return this.http.get(`/api/db/${encodePathParam(appId)}/stats`);
|
|
4331
|
+
return this.http.get(`/api/v3/baas/db/${encodePathParam(appId)}/stats`);
|
|
4273
4332
|
}
|
|
4274
4333
|
};
|
|
4275
4334
|
|
|
@@ -4286,28 +4345,28 @@ var StorageClient = class {
|
|
|
4286
4345
|
*/
|
|
4287
4346
|
async upload(file, filename, metadata) {
|
|
4288
4347
|
const appId = this.getAppId();
|
|
4289
|
-
return this.http.upload(`/api/storage/${encodePathParam(appId)}/upload`, file, filename, metadata);
|
|
4348
|
+
return this.http.upload(`/api/v3/baas/storage/${encodePathParam(appId)}/upload`, file, filename, metadata);
|
|
4290
4349
|
}
|
|
4291
4350
|
/**
|
|
4292
4351
|
* Download a file by CID
|
|
4293
4352
|
*/
|
|
4294
4353
|
async download(cid) {
|
|
4295
4354
|
const appId = this.getAppId();
|
|
4296
|
-
return this.http.get(`/api/storage/${encodePathParam(appId)}/download/${encodePathParam(cid)}`);
|
|
4355
|
+
return this.http.get(`/api/v3/baas/storage/${encodePathParam(appId)}/download/${encodePathParam(cid)}`);
|
|
4297
4356
|
}
|
|
4298
4357
|
/**
|
|
4299
4358
|
* Get file metadata
|
|
4300
4359
|
*/
|
|
4301
4360
|
async getMetadata(cid) {
|
|
4302
4361
|
const appId = this.getAppId();
|
|
4303
|
-
return this.http.get(`/api/storage/${encodePathParam(appId)}/metadata/${encodePathParam(cid)}`);
|
|
4362
|
+
return this.http.get(`/api/v3/baas/storage/${encodePathParam(appId)}/metadata/${encodePathParam(cid)}`);
|
|
4304
4363
|
}
|
|
4305
4364
|
/**
|
|
4306
4365
|
* Delete a file
|
|
4307
4366
|
*/
|
|
4308
4367
|
async delete(cid) {
|
|
4309
4368
|
const appId = this.getAppId();
|
|
4310
|
-
return this.http.delete(`/api/storage/${encodePathParam(appId)}/${encodePathParam(cid)}`);
|
|
4369
|
+
return this.http.delete(`/api/v3/baas/storage/${encodePathParam(appId)}/${encodePathParam(cid)}`);
|
|
4311
4370
|
}
|
|
4312
4371
|
/**
|
|
4313
4372
|
* List all files for the app.
|
|
@@ -4322,21 +4381,21 @@ var StorageClient = class {
|
|
|
4322
4381
|
if (pagination?.limit !== void 0) params.set("limit", String(pagination.limit));
|
|
4323
4382
|
if (pagination?.offset !== void 0) params.set("offset", String(pagination.offset));
|
|
4324
4383
|
const qs = params.toString();
|
|
4325
|
-
return this.http.get(`/api/storage/${encodePathParam(appId)}/files${qs ? `?${qs}` : ""}`);
|
|
4384
|
+
return this.http.get(`/api/v3/baas/storage/${encodePathParam(appId)}/files${qs ? `?${qs}` : ""}`);
|
|
4326
4385
|
}
|
|
4327
4386
|
/**
|
|
4328
4387
|
* Get storage usage for the current app
|
|
4329
4388
|
*/
|
|
4330
4389
|
async getUsage() {
|
|
4331
4390
|
const appId = this.getAppId();
|
|
4332
|
-
return this.http.get(`/api/storage/${encodePathParam(appId)}/usage`);
|
|
4391
|
+
return this.http.get(`/api/v3/baas/storage/${encodePathParam(appId)}/usage`);
|
|
4333
4392
|
}
|
|
4334
4393
|
/**
|
|
4335
4394
|
* Check if a file exists
|
|
4336
4395
|
*/
|
|
4337
4396
|
async exists(cid) {
|
|
4338
4397
|
const appId = this.getAppId();
|
|
4339
|
-
return this.http.get(`/api/storage/${encodePathParam(appId)}/exists/${encodePathParam(cid)}`);
|
|
4398
|
+
return this.http.get(`/api/v3/baas/storage/${encodePathParam(appId)}/exists/${encodePathParam(cid)}`);
|
|
4340
4399
|
}
|
|
4341
4400
|
};
|
|
4342
4401
|
|
|
@@ -4353,7 +4412,7 @@ var FunctionsClient = class {
|
|
|
4353
4412
|
*/
|
|
4354
4413
|
async deploy(request) {
|
|
4355
4414
|
const appId = this.getAppId();
|
|
4356
|
-
return this.http.post(`/api/functions/${encodePathParam(appId)}`, request);
|
|
4415
|
+
return this.http.post(`/api/v3/baas/functions/${encodePathParam(appId)}`, request);
|
|
4357
4416
|
}
|
|
4358
4417
|
/**
|
|
4359
4418
|
* Invoke a function
|
|
@@ -4361,7 +4420,7 @@ var FunctionsClient = class {
|
|
|
4361
4420
|
async invoke(functionId, payload) {
|
|
4362
4421
|
const appId = this.getAppId();
|
|
4363
4422
|
return this.http.post(
|
|
4364
|
-
`/api/functions/${encodePathParam(appId)}/${encodePathParam(functionId)}/invoke`,
|
|
4423
|
+
`/api/v3/baas/functions/${encodePathParam(appId)}/${encodePathParam(functionId)}/invoke`,
|
|
4365
4424
|
payload ?? {}
|
|
4366
4425
|
);
|
|
4367
4426
|
}
|
|
@@ -4370,7 +4429,7 @@ var FunctionsClient = class {
|
|
|
4370
4429
|
*/
|
|
4371
4430
|
async list() {
|
|
4372
4431
|
const appId = this.getAppId();
|
|
4373
|
-
return this.http.get(`/api/functions/${encodePathParam(appId)}`);
|
|
4432
|
+
return this.http.get(`/api/v3/baas/functions/${encodePathParam(appId)}`);
|
|
4374
4433
|
}
|
|
4375
4434
|
/**
|
|
4376
4435
|
* Get function details
|
|
@@ -4378,7 +4437,7 @@ var FunctionsClient = class {
|
|
|
4378
4437
|
async get(functionId) {
|
|
4379
4438
|
const appId = this.getAppId();
|
|
4380
4439
|
return this.http.get(
|
|
4381
|
-
`/api/functions/${encodePathParam(appId)}/${encodePathParam(functionId)}`
|
|
4440
|
+
`/api/v3/baas/functions/${encodePathParam(appId)}/${encodePathParam(functionId)}`
|
|
4382
4441
|
);
|
|
4383
4442
|
}
|
|
4384
4443
|
/**
|
|
@@ -4387,7 +4446,7 @@ var FunctionsClient = class {
|
|
|
4387
4446
|
async update(functionId, updates) {
|
|
4388
4447
|
const appId = this.getAppId();
|
|
4389
4448
|
return this.http.put(
|
|
4390
|
-
`/api/functions/${encodePathParam(appId)}/${encodePathParam(functionId)}`,
|
|
4449
|
+
`/api/v3/baas/functions/${encodePathParam(appId)}/${encodePathParam(functionId)}`,
|
|
4391
4450
|
updates
|
|
4392
4451
|
);
|
|
4393
4452
|
}
|
|
@@ -4397,7 +4456,7 @@ var FunctionsClient = class {
|
|
|
4397
4456
|
async delete(functionId) {
|
|
4398
4457
|
const appId = this.getAppId();
|
|
4399
4458
|
return this.http.delete(
|
|
4400
|
-
`/api/functions/${encodePathParam(appId)}/${encodePathParam(functionId)}`
|
|
4459
|
+
`/api/v3/baas/functions/${encodePathParam(appId)}/${encodePathParam(functionId)}`
|
|
4401
4460
|
);
|
|
4402
4461
|
}
|
|
4403
4462
|
/**
|
|
@@ -4411,7 +4470,7 @@ var FunctionsClient = class {
|
|
|
4411
4470
|
if (options?.level) params.set("level", options.level);
|
|
4412
4471
|
const qs = params.toString();
|
|
4413
4472
|
return this.http.get(
|
|
4414
|
-
`/api/functions/${encodePathParam(appId)}/${encodePathParam(functionId)}/logs${qs ? `?${qs}` : ""}`
|
|
4473
|
+
`/api/v3/baas/functions/${encodePathParam(appId)}/${encodePathParam(functionId)}/logs${qs ? `?${qs}` : ""}`
|
|
4415
4474
|
);
|
|
4416
4475
|
}
|
|
4417
4476
|
/**
|
|
@@ -4419,7 +4478,7 @@ var FunctionsClient = class {
|
|
|
4419
4478
|
*/
|
|
4420
4479
|
async getStats() {
|
|
4421
4480
|
const appId = this.getAppId();
|
|
4422
|
-
return this.http.get(`/api/functions/${encodePathParam(appId)}/stats`);
|
|
4481
|
+
return this.http.get(`/api/v3/baas/functions/${encodePathParam(appId)}/stats`);
|
|
4423
4482
|
}
|
|
4424
4483
|
};
|
|
4425
4484
|
|
|
@@ -4436,28 +4495,28 @@ var MessagingClient = class {
|
|
|
4436
4495
|
*/
|
|
4437
4496
|
async createChannel(config) {
|
|
4438
4497
|
const appId = this.getAppId();
|
|
4439
|
-
return this.http.post(`/api/messaging/${encodePathParam(appId)}/channels`, config);
|
|
4498
|
+
return this.http.post(`/api/v3/baas/messaging/${encodePathParam(appId)}/channels`, config);
|
|
4440
4499
|
}
|
|
4441
4500
|
/**
|
|
4442
4501
|
* Delete a channel
|
|
4443
4502
|
*/
|
|
4444
4503
|
async deleteChannel(channelId) {
|
|
4445
4504
|
const appId = this.getAppId();
|
|
4446
|
-
return this.http.delete(`/api/messaging/${encodePathParam(appId)}/channels/${encodePathParam(channelId)}`);
|
|
4505
|
+
return this.http.delete(`/api/v3/baas/messaging/${encodePathParam(appId)}/channels/${encodePathParam(channelId)}`);
|
|
4447
4506
|
}
|
|
4448
4507
|
/**
|
|
4449
4508
|
* Get a channel by ID
|
|
4450
4509
|
*/
|
|
4451
4510
|
async getChannel(channelId) {
|
|
4452
4511
|
const appId = this.getAppId();
|
|
4453
|
-
return this.http.get(`/api/messaging/${encodePathParam(appId)}/channels/${encodePathParam(channelId)}`);
|
|
4512
|
+
return this.http.get(`/api/v3/baas/messaging/${encodePathParam(appId)}/channels/${encodePathParam(channelId)}`);
|
|
4454
4513
|
}
|
|
4455
4514
|
/**
|
|
4456
4515
|
* List all channels for the app
|
|
4457
4516
|
*/
|
|
4458
4517
|
async listChannels() {
|
|
4459
4518
|
const appId = this.getAppId();
|
|
4460
|
-
return this.http.get(`/api/messaging/${encodePathParam(appId)}/channels`);
|
|
4519
|
+
return this.http.get(`/api/v3/baas/messaging/${encodePathParam(appId)}/channels`);
|
|
4461
4520
|
}
|
|
4462
4521
|
/**
|
|
4463
4522
|
* Publish a message to a channel
|
|
@@ -4465,7 +4524,7 @@ var MessagingClient = class {
|
|
|
4465
4524
|
async publish(channel, message, metadata) {
|
|
4466
4525
|
const appId = this.getAppId();
|
|
4467
4526
|
return this.http.post(
|
|
4468
|
-
`/api/messaging/${encodePathParam(appId)}/channels/${encodePathParam(channel)}/publish`,
|
|
4527
|
+
`/api/v3/baas/messaging/${encodePathParam(appId)}/channels/${encodePathParam(channel)}/publish`,
|
|
4469
4528
|
{ data: message, metadata }
|
|
4470
4529
|
);
|
|
4471
4530
|
}
|
|
@@ -4480,7 +4539,7 @@ var MessagingClient = class {
|
|
|
4480
4539
|
if (options?.after) params.set("after", options.after);
|
|
4481
4540
|
const qs = params.toString();
|
|
4482
4541
|
return this.http.get(
|
|
4483
|
-
`/api/messaging/${encodePathParam(appId)}/channels/${encodePathParam(channel)}/history${qs ? `?${qs}` : ""}`
|
|
4542
|
+
`/api/v3/baas/messaging/${encodePathParam(appId)}/channels/${encodePathParam(channel)}/history${qs ? `?${qs}` : ""}`
|
|
4484
4543
|
);
|
|
4485
4544
|
}
|
|
4486
4545
|
/**
|
|
@@ -4494,7 +4553,7 @@ var MessagingClient = class {
|
|
|
4494
4553
|
async setPresence(channel, member) {
|
|
4495
4554
|
const appId = this.getAppId();
|
|
4496
4555
|
return this.http.post(
|
|
4497
|
-
`/api/messaging/${encodePathParam(appId)}/channels/${encodePathParam(channel)}/presence`,
|
|
4556
|
+
`/api/v3/baas/messaging/${encodePathParam(appId)}/channels/${encodePathParam(channel)}/presence`,
|
|
4498
4557
|
member
|
|
4499
4558
|
);
|
|
4500
4559
|
}
|
|
@@ -4502,7 +4561,7 @@ var MessagingClient = class {
|
|
|
4502
4561
|
* Remove a member's presence from a channel.
|
|
4503
4562
|
*
|
|
4504
4563
|
* BREAKING CHANGE (SDK 3.3.0): server route is
|
|
4505
|
-
* `/api/messaging/:appId/channels/:channel/presence/:clientId`
|
|
4564
|
+
* `/api/v3/baas/messaging/:appId/channels/:channel/presence/:clientId`
|
|
4506
4565
|
* (`messaging.controller.ts:352`). `channel` is now the first arg and
|
|
4507
4566
|
* `clientId` (not `memberId`) the second — they're the same identifier
|
|
4508
4567
|
* but renamed to match the server param.
|
|
@@ -4510,7 +4569,7 @@ var MessagingClient = class {
|
|
|
4510
4569
|
async removePresence(channel, clientId) {
|
|
4511
4570
|
const appId = this.getAppId();
|
|
4512
4571
|
return this.http.delete(
|
|
4513
|
-
`/api/messaging/${encodePathParam(appId)}/channels/${encodePathParam(channel)}/presence/${encodePathParam(clientId)}`
|
|
4572
|
+
`/api/v3/baas/messaging/${encodePathParam(appId)}/channels/${encodePathParam(channel)}/presence/${encodePathParam(clientId)}`
|
|
4514
4573
|
);
|
|
4515
4574
|
}
|
|
4516
4575
|
/**
|
|
@@ -4519,7 +4578,7 @@ var MessagingClient = class {
|
|
|
4519
4578
|
async getPresence(channel) {
|
|
4520
4579
|
const appId = this.getAppId();
|
|
4521
4580
|
return this.http.get(
|
|
4522
|
-
`/api/messaging/${encodePathParam(appId)}/channels/${encodePathParam(channel)}/presence`
|
|
4581
|
+
`/api/v3/baas/messaging/${encodePathParam(appId)}/channels/${encodePathParam(channel)}/presence`
|
|
4523
4582
|
);
|
|
4524
4583
|
}
|
|
4525
4584
|
/**
|
|
@@ -4527,7 +4586,7 @@ var MessagingClient = class {
|
|
|
4527
4586
|
*/
|
|
4528
4587
|
async getStats() {
|
|
4529
4588
|
const appId = this.getAppId();
|
|
4530
|
-
return this.http.get(`/api/messaging/${encodePathParam(appId)}/stats`);
|
|
4589
|
+
return this.http.get(`/api/v3/baas/messaging/${encodePathParam(appId)}/stats`);
|
|
4531
4590
|
}
|
|
4532
4591
|
};
|
|
4533
4592
|
|
|
@@ -4543,21 +4602,21 @@ var CustomerSessionClient = class {
|
|
|
4543
4602
|
* Step 1: ask the host to issue a fresh challenge for the customer to sign.
|
|
4544
4603
|
*/
|
|
4545
4604
|
async challenge(input) {
|
|
4546
|
-
return this.fetch("POST", "/api/customer-session/challenge", input);
|
|
4605
|
+
return this.fetch("POST", "/api/v3/baas/customer-session/challenge", input);
|
|
4547
4606
|
}
|
|
4548
4607
|
/**
|
|
4549
4608
|
* Step 2: submit the customer's signed challenge. On success returns a
|
|
4550
4609
|
* short-lived bearer JWT scoped to {appId, chain, address}.
|
|
4551
4610
|
*/
|
|
4552
4611
|
async verify(req) {
|
|
4553
|
-
return this.fetch("POST", "/api/customer-session/verify", req);
|
|
4612
|
+
return this.fetch("POST", "/api/v3/baas/customer-session/verify", req);
|
|
4554
4613
|
}
|
|
4555
4614
|
/**
|
|
4556
4615
|
* Validate a customer bearer + return the decoded session info. Used by
|
|
4557
4616
|
* smart-app backends to authorise incoming customer requests.
|
|
4558
4617
|
*/
|
|
4559
4618
|
async validate(bearer) {
|
|
4560
|
-
return this.fetch("GET", "/api/customer-session/validate", void 0, bearer);
|
|
4619
|
+
return this.fetch("GET", "/api/v3/baas/customer-session/validate", void 0, bearer);
|
|
4561
4620
|
}
|
|
4562
4621
|
/**
|
|
4563
4622
|
* Revoke a customer session. Idempotent.
|
|
@@ -4565,7 +4624,7 @@ var CustomerSessionClient = class {
|
|
|
4565
4624
|
async end(bearer) {
|
|
4566
4625
|
return this.fetch(
|
|
4567
4626
|
"POST",
|
|
4568
|
-
"/api/customer-session/end",
|
|
4627
|
+
"/api/v3/baas/customer-session/end",
|
|
4569
4628
|
void 0,
|
|
4570
4629
|
bearer
|
|
4571
4630
|
);
|
|
@@ -4611,15 +4670,15 @@ var RulesClient = class {
|
|
|
4611
4670
|
http;
|
|
4612
4671
|
/** Publish a canonical ValidatorRules document to HCS. */
|
|
4613
4672
|
async publish(rule) {
|
|
4614
|
-
return this.http.post("/api/rules/publish", rule);
|
|
4673
|
+
return this.http.post("/api/v3/baas/rules/publish", rule);
|
|
4615
4674
|
}
|
|
4616
4675
|
/** Fetch a published rule by its HCS consensus timestamp. */
|
|
4617
4676
|
async get(consensusTimestamp) {
|
|
4618
|
-
return this.http.get(`/api/rules/${encodePathParam(consensusTimestamp)}`);
|
|
4677
|
+
return this.http.get(`/api/v3/baas/rules/${encodePathParam(consensusTimestamp)}`);
|
|
4619
4678
|
}
|
|
4620
4679
|
/** List rules owned by the authenticated entity, optionally filtered by type. */
|
|
4621
4680
|
async listByOwner(filter) {
|
|
4622
|
-
const path = filter?.type ? `/api/rules?type=${encodeURIComponent(filter.type)}` : "/api/rules";
|
|
4681
|
+
const path = filter?.type ? `/api/v3/baas/rules?type=${encodeURIComponent(filter.type)}` : "/api/v3/baas/rules";
|
|
4623
4682
|
return this.http.get(path);
|
|
4624
4683
|
}
|
|
4625
4684
|
/**
|
|
@@ -4627,44 +4686,332 @@ var RulesClient = class {
|
|
|
4627
4686
|
* `ruleRef` (published) or `rule` (inline) must be supplied by the caller.
|
|
4628
4687
|
*/
|
|
4629
4688
|
async simulate(params) {
|
|
4630
|
-
return this.http.post("/api/rules/simulate", params);
|
|
4689
|
+
return this.http.post("/api/v3/baas/rules/simulate", params);
|
|
4631
4690
|
}
|
|
4632
4691
|
/** Walk the version history of a published rule. */
|
|
4633
4692
|
async getVersionHistory(consensusTimestamp) {
|
|
4634
4693
|
return this.http.get(
|
|
4635
|
-
`/api/rules/${encodePathParam(consensusTimestamp)}/versions`
|
|
4694
|
+
`/api/v3/baas/rules/${encodePathParam(consensusTimestamp)}/versions`
|
|
4636
4695
|
);
|
|
4637
4696
|
}
|
|
4638
4697
|
/** Deprecate a published rule (owner-only). */
|
|
4639
4698
|
async deprecate(consensusTimestamp) {
|
|
4640
4699
|
return this.http.post(
|
|
4641
|
-
`/api/rules/${encodePathParam(consensusTimestamp)}/deprecate`,
|
|
4700
|
+
`/api/v3/baas/rules/${encodePathParam(consensusTimestamp)}/deprecate`,
|
|
4642
4701
|
{}
|
|
4643
4702
|
);
|
|
4644
4703
|
}
|
|
4645
4704
|
};
|
|
4646
4705
|
|
|
4647
4706
|
// src/baas/entities/client.ts
|
|
4648
|
-
var EntitiesClient = class {
|
|
4707
|
+
var EntitiesClient = class _EntitiesClient {
|
|
4649
4708
|
constructor(http) {
|
|
4650
4709
|
this.http = http;
|
|
4651
4710
|
}
|
|
4652
4711
|
http;
|
|
4653
|
-
/**
|
|
4712
|
+
/**
|
|
4713
|
+
* Chains whose token-create routes through the payer-funded 3-step (prepare →
|
|
4714
|
+
* fund → execute), mirroring `createAccount`. Hedera = real HTS TokenCreate
|
|
4715
|
+
* (admin/supply = the per-entity DKG slot-pubkey KeyList; treasury = the
|
|
4716
|
+
* entity's own account; `0.0.X` token id is network-assigned, resolved from the
|
|
4717
|
+
* receipt via the threaded `createTxId`). Cardano/Solana/Polkadot = the
|
|
4718
|
+
* AUTHORITY entity (the entity IS the policy/mint/Assets-admin multisig — same
|
|
4719
|
+
* address as an account; the asset MINT itself is a later operate-tab payer
|
|
4720
|
+
* call). XRPL/Stellar token = an ISSUER ACCOUNT (reuses the account preparer) +
|
|
4721
|
+
* issuer flags set at finalize: XRPL relays the funding Payment then finalizes
|
|
4722
|
+
* (issuer-flag AccountSets + SignerListSet + disable-master); Stellar relays the
|
|
4723
|
+
* CreateAccount then finalizes (SetOptions install incl. issuer setFlags +
|
|
4724
|
+
* master lock). Every OTHER chain (EVM) stays on the legacy synchronous path.
|
|
4725
|
+
*/
|
|
4726
|
+
static PAYER_FUNDED_TOKEN_CHAINS = /* @__PURE__ */ new Set([
|
|
4727
|
+
"hedera",
|
|
4728
|
+
"cardano",
|
|
4729
|
+
"solana",
|
|
4730
|
+
"polkadot",
|
|
4731
|
+
"xrpl",
|
|
4732
|
+
"stellar"
|
|
4733
|
+
]);
|
|
4734
|
+
/**
|
|
4735
|
+
* PREPARE half of the payer-funded token-create flow.
|
|
4736
|
+
*
|
|
4737
|
+
* POSTs `/api/v3/baas/entities/prepare-create` with `entityType: 'token'`. The cluster
|
|
4738
|
+
* runs the per-entity DKG, builds the payer-funded create (Hedera: TokenCreate
|
|
4739
|
+
* keyed by the slot-pubkey KeyList with the entity account as treasury;
|
|
4740
|
+
* Cardano/Solana/Polkadot: funds/provisions the authority multisig), and returns
|
|
4741
|
+
* the prepared blob. The prepared `transactionId` is the `createTxId` for
|
|
4742
|
+
* execute (Hedera).
|
|
4743
|
+
*/
|
|
4744
|
+
async prepareCreateToken(req) {
|
|
4745
|
+
return this.http.post("/api/v3/baas/entities/prepare-create", {
|
|
4746
|
+
entityType: "token",
|
|
4747
|
+
...req
|
|
4748
|
+
});
|
|
4749
|
+
}
|
|
4750
|
+
/**
|
|
4751
|
+
* EXECUTE half of the payer-funded token-create flow.
|
|
4752
|
+
*
|
|
4753
|
+
* POSTs `/api/v3/baas/entities/execute-create` with `entityType: 'token'`. For Hedera,
|
|
4754
|
+
* pass `createTxId` (the prepared create's `transactionId`) so the validator
|
|
4755
|
+
* resolves the network-assigned `0.0.X` token id from the receipt and stamps
|
|
4756
|
+
* `chainAccounts.hedera`. For the authority-entity chains (cardano/solana/
|
|
4757
|
+
* polkadot) execute just verifies the binding and echoes the stamped authority
|
|
4758
|
+
* address (no `createTxId` needed).
|
|
4759
|
+
*/
|
|
4760
|
+
async executeCreateToken(req) {
|
|
4761
|
+
const { createTxId, signedFundingBlob, ...rest } = req;
|
|
4762
|
+
return this.http.post("/api/v3/baas/entities/execute-create", {
|
|
4763
|
+
...rest,
|
|
4764
|
+
...createTxId !== void 0 ? { createTxId } : {},
|
|
4765
|
+
...signedFundingBlob !== void 0 ? { signedFundingBlob } : {},
|
|
4766
|
+
entityType: "token"
|
|
4767
|
+
});
|
|
4768
|
+
}
|
|
4769
|
+
/**
|
|
4770
|
+
* Create a canonical token entity bound to a published rule.
|
|
4771
|
+
*
|
|
4772
|
+
* Dispatches by `chain` (mirrors `createAccount`):
|
|
4773
|
+
* - **Hedera / Cardano / Solana / Polkadot** = payer-funded 3-step (prepare →
|
|
4774
|
+
* caller funds via `fundWith` → execute). Hedera resolves the network-assigned
|
|
4775
|
+
* `0.0.X` token id from the receipt (threads `createTxId`); the authority-
|
|
4776
|
+
* entity chains verify/echo the stamped authority address. `fundWith` is
|
|
4777
|
+
* REQUIRED; to drive the steps manually call `prepareCreateToken` /
|
|
4778
|
+
* `executeCreateToken` directly.
|
|
4779
|
+
* - **XRPL / Stellar** = payer-funded too (account-model issuer): `fundWith`
|
|
4780
|
+
* REQUIRED; the caller's signed funding blob is RELAYED to the validator,
|
|
4781
|
+
* which submits it then finalizes the issuer multisig (master-locked). NO
|
|
4782
|
+
* issuer flags are set at create — issuer auth flags / DefaultRipple / clawback
|
|
4783
|
+
* are an operate-tab, rules-validated concern.
|
|
4784
|
+
* - **EVM / other** = legacy synchronous `POST /api/v3/baas/entities/createToken`
|
|
4785
|
+
* (payer-funded-only fields ignored) until it migrates.
|
|
4786
|
+
*/
|
|
4654
4787
|
async createToken(req) {
|
|
4655
|
-
|
|
4788
|
+
if (_EntitiesClient.PAYER_FUNDED_TOKEN_CHAINS.has(req.chain)) {
|
|
4789
|
+
const { fundWith, ...prepReq } = req;
|
|
4790
|
+
const prep = await this.prepareCreateToken(prepReq);
|
|
4791
|
+
if (!fundWith) {
|
|
4792
|
+
throw new Error(
|
|
4793
|
+
`createToken(${req.chain}): pass fundWith (sign+submit the prepared create tx), or call prepareCreateToken/executeCreateToken directly`
|
|
4794
|
+
);
|
|
4795
|
+
}
|
|
4796
|
+
const funded = await fundWith(prep.prepared, {
|
|
4797
|
+
address: prep.address,
|
|
4798
|
+
reserveRequirement: prep.reserveRequirement
|
|
4799
|
+
});
|
|
4800
|
+
return this.executeCreateToken({
|
|
4801
|
+
entityId: prep.entityId,
|
|
4802
|
+
chain: req.chain,
|
|
4803
|
+
securityMode: req.securityMode,
|
|
4804
|
+
signedFundingBlob: _EntitiesClient.FUNDING_BLOB_RELAY_CHAINS.has(req.chain) ? funded?.signedFundingBlob : void 0,
|
|
4805
|
+
createTxId: req.chain === "hedera" ? prep.prepared?.[0]?.transactionId : void 0
|
|
4806
|
+
});
|
|
4807
|
+
}
|
|
4808
|
+
const {
|
|
4809
|
+
fundWith: _ignoredFundWith,
|
|
4810
|
+
payerAccountId: _ignoredPayer,
|
|
4811
|
+
securityMode: _ignoredSecurityMode,
|
|
4812
|
+
...legacyReq
|
|
4813
|
+
} = req;
|
|
4814
|
+
return this.http.post("/api/v3/baas/entities/createToken", legacyReq);
|
|
4815
|
+
}
|
|
4816
|
+
/**
|
|
4817
|
+
* PREPARE half of the payer-funded account-create flow.
|
|
4818
|
+
*
|
|
4819
|
+
* POSTs `/api/v3/baas/entities/prepare-create`. The cluster runs the per-entity DKG
|
|
4820
|
+
* (persists the binding, submits nothing on-chain) and returns the unsigned
|
|
4821
|
+
* payer-funding `Payment`(s) the caller signs + submits with their own wallet.
|
|
4822
|
+
*/
|
|
4823
|
+
async prepareCreateAccount(req) {
|
|
4824
|
+
return this.http.post("/api/v3/baas/entities/prepare-create", {
|
|
4825
|
+
entityType: "account",
|
|
4826
|
+
...req
|
|
4827
|
+
});
|
|
4656
4828
|
}
|
|
4657
|
-
/**
|
|
4829
|
+
/**
|
|
4830
|
+
* EXECUTE half of the payer-funded account-create flow.
|
|
4831
|
+
*
|
|
4832
|
+
* POSTs `/api/v3/baas/entities/execute-create`. The entity already exists (its DKG
|
|
4833
|
+
* ran during prepare); pass `signedFundingBlob` for the validator to submit
|
|
4834
|
+
* the payer's signed funding `Payment` (XRPL only), or omit it when the caller
|
|
4835
|
+
* already submitted the funding tx themselves (then execute just finalizes /
|
|
4836
|
+
* verifies).
|
|
4837
|
+
*
|
|
4838
|
+
* `createTxId` is the HEDERA thread: a Hedera AccountCreate gets its
|
|
4839
|
+
* network-assigned `0.0.X` id only from the on-chain receipt after the payer
|
|
4840
|
+
* submits. The caller threads the prepared create's `transactionId` (from
|
|
4841
|
+
* `prepared[0].transactionId`) back here so the validator resolves the id from
|
|
4842
|
+
* the receipt server-side. Ignored for non-Hedera chains.
|
|
4843
|
+
*/
|
|
4844
|
+
async executeCreateAccount(req) {
|
|
4845
|
+
const { createTxId, ...rest } = req;
|
|
4846
|
+
return this.http.post("/api/v3/baas/entities/execute-create", {
|
|
4847
|
+
...rest,
|
|
4848
|
+
...createTxId !== void 0 ? { createTxId } : {}
|
|
4849
|
+
});
|
|
4850
|
+
}
|
|
4851
|
+
/**
|
|
4852
|
+
* Chains whose account-create routes through the payer-funded 3-step
|
|
4853
|
+
* (prepare → fund → execute). All are ledgers where the validators never pay:
|
|
4854
|
+
* XRPL funds a reserve; Bitcoin funds a P2WSH UTXO; Cardano funds a
|
|
4855
|
+
* native-script enterprise address above min-UTXO; Polkadot funds a
|
|
4856
|
+
* pallet_multisig SS58 above the existential deposit; Solana funds a Squads
|
|
4857
|
+
* multisig PDA (deterministic from the createKey) via a payer-paid
|
|
4858
|
+
* `multisigCreateV2` — the payer's submission IS the create (no separate
|
|
4859
|
+
* finalizer). Hedera is create-WITH-KEY: the payer submits an AccountCreate
|
|
4860
|
+
* whose controlling key is the per-entity DKG slot-pubkey KeyList, so the
|
|
4861
|
+
* payer's submit IS the create; its `0.0.X` id is network-assigned (resolved
|
|
4862
|
+
* from the receipt at execute-create via the threaded `createTxId`). Stellar is
|
|
4863
|
+
* account-MODEL (like XRPL): the payer funds the entity's slot-0 `G...` master
|
|
4864
|
+
* via a CreateAccount, the validator RELAYS the signed funding blob, then
|
|
4865
|
+
* execute-create finalizes on-chain (threshold-signs a SetOptions installing
|
|
4866
|
+
* the validator chain-key multisig + locking the master). EVM stays on the
|
|
4867
|
+
* legacy synchronous create until it migrates.
|
|
4868
|
+
*/
|
|
4869
|
+
static PAYER_FUNDED_CREATE_CHAINS = /* @__PURE__ */ new Set([
|
|
4870
|
+
"xrpl",
|
|
4871
|
+
"bitcoin",
|
|
4872
|
+
"cardano",
|
|
4873
|
+
"polkadot",
|
|
4874
|
+
"solana",
|
|
4875
|
+
"hedera",
|
|
4876
|
+
"stellar"
|
|
4877
|
+
]);
|
|
4878
|
+
/**
|
|
4879
|
+
* Chains whose execute-create RELAYS the payer's signed funding blob for the
|
|
4880
|
+
* validator to submit (then finalizes on-chain). Both are account-model ledgers
|
|
4881
|
+
* with a validator-side finalize step: XRPL (SignerListSet + disable-master),
|
|
4882
|
+
* Stellar (SetOptions install + master lock). Every OTHER payer-funded chain
|
|
4883
|
+
* has the PAYER submit the funding tx directly with their own wallet — their
|
|
4884
|
+
* execute-create REJECTS a non-undefined `signedFundingBlob` (400), so the blob
|
|
4885
|
+
* is omitted for them.
|
|
4886
|
+
*/
|
|
4887
|
+
static FUNDING_BLOB_RELAY_CHAINS = /* @__PURE__ */ new Set(["xrpl", "stellar"]);
|
|
4888
|
+
/**
|
|
4889
|
+
* Create a canonical account entity bound to a published rule.
|
|
4890
|
+
*
|
|
4891
|
+
* Dispatches by `chain`:
|
|
4892
|
+
* - **XRPL / Stellar / Bitcoin / Cardano / Polkadot / Solana / Hedera** =
|
|
4893
|
+
* payer-funded 3-step (prepare → fund → execute). The cluster runs the
|
|
4894
|
+
* per-entity DKG and returns the unsigned payer-funding tx(s); the
|
|
4895
|
+
* caller-supplied `fundWith` callback signs + submits (or just signs) the
|
|
4896
|
+
* funding tx with their OWN wallet — the SDK never holds the customer's chain
|
|
4897
|
+
* key nor opens a network connection — then `executeCreateAccount` finalizes
|
|
4898
|
+
* (XRPL + Stellar finalize on-chain after relaying the funding blob; the
|
|
4899
|
+
* deterministic ledgers + Solana verify/stamp the binding; Hedera resolves
|
|
4900
|
+
* the network-assigned id from the receipt). `fundWith` is REQUIRED on these
|
|
4901
|
+
* chains; to drive the steps manually call `prepareCreateAccount` /
|
|
4902
|
+
* `executeCreateAccount` directly.
|
|
4903
|
+
* - **other chains** (EVM) = legacy synchronous create — a single
|
|
4904
|
+
* `POST /api/v3/baas/entities/createAccount`, unchanged from pre-3.9.0. These chains
|
|
4905
|
+
* migrate to the payer-funded flow in a later phase; until then the
|
|
4906
|
+
* payer-funded-only fields (`fundWith` / `payerAccountId` / `securityMode`)
|
|
4907
|
+
* are ignored.
|
|
4908
|
+
*/
|
|
4658
4909
|
async createAccount(req) {
|
|
4659
|
-
|
|
4910
|
+
if (_EntitiesClient.PAYER_FUNDED_CREATE_CHAINS.has(req.chain)) {
|
|
4911
|
+
const { fundWith, ...prepReq } = req;
|
|
4912
|
+
const prep = await this.prepareCreateAccount(prepReq);
|
|
4913
|
+
if (!fundWith) {
|
|
4914
|
+
throw new Error(
|
|
4915
|
+
`createAccount(${req.chain}): pass fundWith (sign+submit the prepared funding tx), or call prepareCreateAccount/executeCreateAccount directly`
|
|
4916
|
+
);
|
|
4917
|
+
}
|
|
4918
|
+
const funded = await fundWith(prep.prepared, {
|
|
4919
|
+
address: prep.address,
|
|
4920
|
+
reserveRequirement: prep.reserveRequirement
|
|
4921
|
+
});
|
|
4922
|
+
return this.executeCreateAccount({
|
|
4923
|
+
entityId: prep.entityId,
|
|
4924
|
+
chain: req.chain,
|
|
4925
|
+
securityMode: req.securityMode,
|
|
4926
|
+
signedFundingBlob: _EntitiesClient.FUNDING_BLOB_RELAY_CHAINS.has(req.chain) ? funded?.signedFundingBlob : void 0,
|
|
4927
|
+
createTxId: req.chain === "hedera" ? prep.prepared?.[0]?.transactionId : void 0
|
|
4928
|
+
});
|
|
4929
|
+
}
|
|
4930
|
+
const {
|
|
4931
|
+
fundWith: _ignoredFundWith,
|
|
4932
|
+
payerAccountId: _ignoredPayer,
|
|
4933
|
+
securityMode: _ignoredSecurityMode,
|
|
4934
|
+
...legacyReq
|
|
4935
|
+
} = req;
|
|
4936
|
+
return this.http.post("/api/v3/baas/entities/createAccount", legacyReq);
|
|
4660
4937
|
}
|
|
4661
|
-
/**
|
|
4938
|
+
/**
|
|
4939
|
+
* PREPARE half of the payer-funded topic-create flow (Hedera).
|
|
4940
|
+
*
|
|
4941
|
+
* POSTs `/api/v3/baas/entities/prepare-create` with `entityType: 'topic'`. The cluster
|
|
4942
|
+
* runs the per-entity DKG (persists the binding), builds the payer-funded
|
|
4943
|
+
* TopicCreate keyed by the slot-pubkey KeyList, attaches the validator admin
|
|
4944
|
+
* threshold sig, and returns the prepared blob for the caller to add the fee
|
|
4945
|
+
* sig + submit. The prepared `transactionId` is the `createTxId` for execute.
|
|
4946
|
+
*/
|
|
4947
|
+
async prepareCreateTopic(req) {
|
|
4948
|
+
return this.http.post("/api/v3/baas/entities/prepare-create", {
|
|
4949
|
+
entityType: "topic",
|
|
4950
|
+
...req
|
|
4951
|
+
});
|
|
4952
|
+
}
|
|
4953
|
+
/**
|
|
4954
|
+
* EXECUTE half of the payer-funded topic-create flow (Hedera).
|
|
4955
|
+
*
|
|
4956
|
+
* POSTs `/api/v3/baas/entities/execute-create` with `entityType: 'topic'`. The topic
|
|
4957
|
+
* already exists once the payer submitted the create tx; pass `createTxId` (the
|
|
4958
|
+
* prepared create's `transactionId`) so the validator resolves the network-
|
|
4959
|
+
* assigned `0.0.X` topic id from the receipt and stamps `chainAccounts.hedera`.
|
|
4960
|
+
*/
|
|
4961
|
+
async executeCreateTopic(req) {
|
|
4962
|
+
return this.http.post("/api/v3/baas/entities/execute-create", {
|
|
4963
|
+
...req,
|
|
4964
|
+
entityType: "topic"
|
|
4965
|
+
});
|
|
4966
|
+
}
|
|
4967
|
+
/**
|
|
4968
|
+
* Create a canonical topic entity bound to a published rule.
|
|
4969
|
+
*
|
|
4970
|
+
* Dispatches by `chain`:
|
|
4971
|
+
* - **Hedera** = payer-funded 3-step (prepare → caller submits the TopicCreate
|
|
4972
|
+
* via `fundWith` → execute resolves the `0.0.X` topic id from the receipt).
|
|
4973
|
+
* `fundWith` is REQUIRED; to drive the steps manually call
|
|
4974
|
+
* `prepareCreateTopic` / `executeCreateTopic` directly.
|
|
4975
|
+
* - **other chains** = legacy synchronous `POST /api/v3/baas/entities/createTopic`
|
|
4976
|
+
* (topics are a Hedera primitive; the legacy path is unchanged).
|
|
4977
|
+
*/
|
|
4662
4978
|
async createTopic(req) {
|
|
4663
|
-
|
|
4979
|
+
if (req.chain === "hedera") {
|
|
4980
|
+
const { fundWith, ...prepReq } = req;
|
|
4981
|
+
const prep = await this.prepareCreateTopic(prepReq);
|
|
4982
|
+
if (!fundWith) {
|
|
4983
|
+
throw new Error(
|
|
4984
|
+
"createTopic(hedera): pass fundWith (sign+submit the prepared TopicCreate), or call prepareCreateTopic/executeCreateTopic directly"
|
|
4985
|
+
);
|
|
4986
|
+
}
|
|
4987
|
+
await fundWith(prep.prepared, {
|
|
4988
|
+
address: prep.address,
|
|
4989
|
+
reserveRequirement: prep.reserveRequirement
|
|
4990
|
+
});
|
|
4991
|
+
const createTxId = prep.prepared?.[0]?.transactionId;
|
|
4992
|
+
if (!createTxId) {
|
|
4993
|
+
throw new Error(
|
|
4994
|
+
"createTopic(hedera): prepared TopicCreate carries no transactionId \u2014 cannot resolve the topic id from the receipt"
|
|
4995
|
+
);
|
|
4996
|
+
}
|
|
4997
|
+
return this.executeCreateTopic({
|
|
4998
|
+
entityId: prep.entityId,
|
|
4999
|
+
chain: req.chain,
|
|
5000
|
+
createTxId,
|
|
5001
|
+
securityMode: req.securityMode
|
|
5002
|
+
});
|
|
5003
|
+
}
|
|
5004
|
+
const {
|
|
5005
|
+
fundWith: _ignoredFundWith,
|
|
5006
|
+
payerAccountId: _ignoredPayer,
|
|
5007
|
+
securityMode: _ignoredSecurityMode,
|
|
5008
|
+
...legacyReq
|
|
5009
|
+
} = req;
|
|
5010
|
+
return this.http.post("/api/v3/baas/entities/createTopic", legacyReq);
|
|
4664
5011
|
}
|
|
4665
5012
|
/** Create a canonical agent entity bound to a published rule. */
|
|
4666
5013
|
async createAgent(req) {
|
|
4667
|
-
return this.http.post("/api/entities/createAgent", req);
|
|
5014
|
+
return this.http.post("/api/v3/baas/entities/createAgent", req);
|
|
4668
5015
|
}
|
|
4669
5016
|
/**
|
|
4670
5017
|
* Mega-helper: build a token rule with a launchpad ModuleEntry attached,
|
|
@@ -4672,15 +5019,15 @@ var EntitiesClient = class {
|
|
|
4672
5019
|
* round-trip.
|
|
4673
5020
|
*/
|
|
4674
5021
|
async launchpad(req) {
|
|
4675
|
-
return this.http.post("/api/entities/launchpad", req);
|
|
5022
|
+
return this.http.post("/api/v3/baas/entities/launchpad", req);
|
|
4676
5023
|
}
|
|
4677
5024
|
/** Fetch an entity by its canonical `entityId`. */
|
|
4678
5025
|
async get(entityId) {
|
|
4679
|
-
return this.http.get(`/api/entities/${encodePathParam(entityId)}`);
|
|
5026
|
+
return this.http.get(`/api/v3/baas/entities/${encodePathParam(entityId)}`);
|
|
4680
5027
|
}
|
|
4681
5028
|
/** List entities owned by the authenticated wallet, optionally filtered by type. */
|
|
4682
5029
|
async listByOwner(filter) {
|
|
4683
|
-
const path = filter?.type ? `/api/entities?type=${encodeURIComponent(filter.type)}` : "/api/entities";
|
|
5030
|
+
const path = filter?.type ? `/api/v3/baas/entities?type=${encodeURIComponent(filter.type)}` : "/api/v3/baas/entities";
|
|
4684
5031
|
return this.http.get(path);
|
|
4685
5032
|
}
|
|
4686
5033
|
};
|
|
@@ -4693,6 +5040,13 @@ var BaasClient = class _BaasClient {
|
|
|
4693
5040
|
timeout;
|
|
4694
5041
|
allowInsecure;
|
|
4695
5042
|
http;
|
|
5043
|
+
/**
|
|
5044
|
+
* Validator-routed HTTP client for the `/api/v3/transactions/*` prepare/execute
|
|
5045
|
+
* surface — a SIBLING of `/host`, NOT under the `pathPrefix`. Rooted at the
|
|
5046
|
+
* raw gateway/ingress origin (`hostUrl`) so transactions reach the validator
|
|
5047
|
+
* even when BaaS traffic is gateway-routed at `/host/*`.
|
|
5048
|
+
*/
|
|
5049
|
+
txHttp;
|
|
4696
5050
|
/** Last HTTP error (for getHttpHealth) */
|
|
4697
5051
|
lastHttpError;
|
|
4698
5052
|
/**
|
|
@@ -4721,6 +5075,14 @@ var BaasClient = class _BaasClient {
|
|
|
4721
5075
|
rules;
|
|
4722
5076
|
/** Canonical entity authoring surface (token/account/topic/agent + launchpad). */
|
|
4723
5077
|
entities;
|
|
5078
|
+
/**
|
|
5079
|
+
* Validator-routed transaction prepare/execute (sovereignty model). The
|
|
5080
|
+
* prepare endpoints accept an explicit `payerAccountId` for the session-less
|
|
5081
|
+
* payer path, OR carry the web3-auth session token for the JWT-wallet payer
|
|
5082
|
+
* path (kept in sync with the main client's token — see {@link authenticate}).
|
|
5083
|
+
* Targets `/api/v3/transactions/*`, a sibling of the `/host` BaaS surface.
|
|
5084
|
+
*/
|
|
5085
|
+
transactions;
|
|
4724
5086
|
constructor(config) {
|
|
4725
5087
|
this.allowInsecure = config.allowInsecure ?? false;
|
|
4726
5088
|
this.hostUrl = validateUrl2(config.hostUrl, this.allowInsecure);
|
|
@@ -4734,7 +5096,12 @@ var BaasClient = class _BaasClient {
|
|
|
4734
5096
|
timeout: this.timeout,
|
|
4735
5097
|
// Transparent session refresh: on a 401, re-run the challenge-response
|
|
4736
5098
|
// with the retained signer and retry once. No-op until authenticate() has
|
|
4737
|
-
// been called (authContext set). Excludes /api/auth/* (see http client).
|
|
5099
|
+
// been called (authContext set). Excludes /api/v3/{,baas/}auth/* (see http client).
|
|
5100
|
+
onUnauthorized: () => this.reauthenticate()
|
|
5101
|
+
});
|
|
5102
|
+
this.txHttp = createHttpClient({
|
|
5103
|
+
baseUrl: `${this.hostUrl.replace(/\/$/, "")}/api/v3/transactions`,
|
|
5104
|
+
timeout: this.timeout,
|
|
4738
5105
|
onUnauthorized: () => this.reauthenticate()
|
|
4739
5106
|
});
|
|
4740
5107
|
const getAppId = () => this.requireAppId();
|
|
@@ -4747,6 +5114,7 @@ var BaasClient = class _BaasClient {
|
|
|
4747
5114
|
this.customerSession = new CustomerSessionClient(baseUrlWithPrefix, this.timeout);
|
|
4748
5115
|
this.rules = new RulesClient(this.http);
|
|
4749
5116
|
this.entities = new EntitiesClient(this.http);
|
|
5117
|
+
this.transactions = new TransactionsClient(this.txHttp);
|
|
4750
5118
|
}
|
|
4751
5119
|
/**
|
|
4752
5120
|
* Connect to the Smart Engines BaaS via cluster auto-discovery.
|
|
@@ -4874,7 +5242,7 @@ var BaasClient = class _BaasClient {
|
|
|
4874
5242
|
this.authContext = options;
|
|
4875
5243
|
let challenge;
|
|
4876
5244
|
try {
|
|
4877
|
-
challenge = await this.http.post("/api/auth/challenge", {
|
|
5245
|
+
challenge = await this.http.post("/api/v3/baas/auth/challenge", {
|
|
4878
5246
|
chain,
|
|
4879
5247
|
walletAddress,
|
|
4880
5248
|
appId: this.appId
|
|
@@ -4885,7 +5253,7 @@ var BaasClient = class _BaasClient {
|
|
|
4885
5253
|
const signature = await signFn(challenge.message);
|
|
4886
5254
|
let result;
|
|
4887
5255
|
try {
|
|
4888
|
-
result = await this.http.post("/api/auth/verify", {
|
|
5256
|
+
result = await this.http.post("/api/v3/baas/auth/verify", {
|
|
4889
5257
|
challengeId: challenge.challengeId,
|
|
4890
5258
|
signature,
|
|
4891
5259
|
publicKey
|
|
@@ -4894,6 +5262,7 @@ var BaasClient = class _BaasClient {
|
|
|
4894
5262
|
throw asBaasError(err);
|
|
4895
5263
|
}
|
|
4896
5264
|
this.http.setAuthToken(result.token);
|
|
5265
|
+
this.txHttp.setAuthToken(result.token);
|
|
4897
5266
|
return result;
|
|
4898
5267
|
}
|
|
4899
5268
|
/**
|
|
@@ -4901,30 +5270,31 @@ var BaasClient = class _BaasClient {
|
|
|
4901
5270
|
* session token. Invoked by the http client's `onUnauthorized` hook when a
|
|
4902
5271
|
* request 401s because the token expired — so long-lived clients keep working
|
|
4903
5272
|
* without the caller re-implementing refresh. No-op if {@link authenticate}
|
|
4904
|
-
* was never called. The `/api/auth/*` calls below are excluded from the http
|
|
5273
|
+
* was never called. The `/api/v3/baas/auth/*` calls below are excluded from the http
|
|
4905
5274
|
* client's 401-retry path, so this can never recurse.
|
|
4906
5275
|
*/
|
|
4907
5276
|
async reauthenticate() {
|
|
4908
5277
|
const ctx = this.authContext;
|
|
4909
5278
|
if (!ctx) return;
|
|
4910
|
-
const challenge = await this.http.post("/api/auth/challenge", {
|
|
5279
|
+
const challenge = await this.http.post("/api/v3/baas/auth/challenge", {
|
|
4911
5280
|
chain: ctx.chain,
|
|
4912
5281
|
walletAddress: ctx.walletAddress,
|
|
4913
5282
|
appId: this.appId
|
|
4914
5283
|
});
|
|
4915
5284
|
const signature = await ctx.signFn(challenge.message);
|
|
4916
|
-
const result = await this.http.post("/api/auth/verify", {
|
|
5285
|
+
const result = await this.http.post("/api/v3/baas/auth/verify", {
|
|
4917
5286
|
challengeId: challenge.challengeId,
|
|
4918
5287
|
signature,
|
|
4919
5288
|
publicKey: ctx.publicKey
|
|
4920
5289
|
});
|
|
4921
5290
|
this.http.setAuthToken(result.token);
|
|
5291
|
+
this.txHttp.setAuthToken(result.token);
|
|
4922
5292
|
}
|
|
4923
5293
|
/** Validate the current session */
|
|
4924
5294
|
async validateSession() {
|
|
4925
5295
|
this.requireAuth();
|
|
4926
5296
|
try {
|
|
4927
|
-
return await this.http.get("/api/auth/session");
|
|
5297
|
+
return await this.http.get("/api/v3/baas/auth/session");
|
|
4928
5298
|
} catch (err) {
|
|
4929
5299
|
throw asBaasError(err);
|
|
4930
5300
|
}
|
|
@@ -4933,11 +5303,12 @@ var BaasClient = class _BaasClient {
|
|
|
4933
5303
|
async logout() {
|
|
4934
5304
|
if (this.http.getAuthToken()) {
|
|
4935
5305
|
try {
|
|
4936
|
-
await this.http.post("/api/auth/logout", {});
|
|
5306
|
+
await this.http.post("/api/v3/baas/auth/logout", {});
|
|
4937
5307
|
} catch {
|
|
4938
5308
|
}
|
|
4939
5309
|
}
|
|
4940
5310
|
this.http.setAuthToken(void 0);
|
|
5311
|
+
this.txHttp.setAuthToken(void 0);
|
|
4941
5312
|
}
|
|
4942
5313
|
// ========== HTTP Helpers ==========
|
|
4943
5314
|
requireAuth() {
|