@hsuite/smart-engines-sdk 3.13.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6478,9 +6478,11 @@ var ClusterDiscoveryClient = class {
6478
6478
  }
6479
6479
  /**
6480
6480
  * Convenience wrapper returning just the gateway URL of a random
6481
- * active cluster. The single most-used SDK entry pointmost
6482
- * downstream callers want `new SmartEngineClient({ baseUrl: ... })`
6483
- * and don't care about the rest of the metadata.
6481
+ * active cluster. Feed this to `BaasClient` (the host BaaS tier) e.g.
6482
+ * `new BaasClient({ hostUrl, pathPrefix: '/host' })` or
6483
+ * `BaasClient.connectToCluster({ network })`. Do NOT feed it to
6484
+ * `SmartEngineClient`: that client's raw `/api/v3/*` tier is un-ingressed at
6485
+ * the gateway and will 404 (it requires an explicit `validatorBaseUrl`).
6484
6486
  */
6485
6487
  async getRandomGatewayUrl(forceRefresh = false) {
6486
6488
  const cluster = await this.getRandomCluster(forceRefresh);
@@ -6606,6 +6608,13 @@ var SdkHttpError = class extends Error {
6606
6608
  }
6607
6609
  statusCode;
6608
6610
  details;
6611
+ /**
6612
+ * True for transient failures worth retrying: a 5xx, a 429 (rate limit), a 408
6613
+ * (timeout), or a 0 (network/abort). Deterministic 4xx client errors are not.
6614
+ */
6615
+ get isRetryable() {
6616
+ return this.statusCode === 0 || this.statusCode === 408 || this.statusCode === 429 || this.statusCode >= 500;
6617
+ }
6609
6618
  };
6610
6619
  function createHttpClient(config) {
6611
6620
  const timeout = config.timeout ?? 3e4;
@@ -6623,6 +6632,10 @@ function createHttpClient(config) {
6623
6632
  if (opts?.customerToken) {
6624
6633
  headers["X-Customer-Session-Token"] = opts.customerToken;
6625
6634
  }
6635
+ if (opts?.onBehalfOf) {
6636
+ headers["Authorization"] = `Bearer ${opts.onBehalfOf}`;
6637
+ headers["X-Customer-Session-Claim"] = opts.onBehalfOf;
6638
+ }
6626
6639
  if (opts?.headers) {
6627
6640
  Object.assign(headers, opts.headers);
6628
6641
  }
@@ -6730,6 +6743,41 @@ function createHttpClient(config) {
6730
6743
  throw new SdkHttpError(`Network error: ${err.message}`, 0, error);
6731
6744
  }
6732
6745
  }
6746
+ async function getBinaryWithMeta(path, opts) {
6747
+ const url = `${config.baseUrl}${path}`;
6748
+ const controller = new AbortController();
6749
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
6750
+ try {
6751
+ const response = await fetch(url, {
6752
+ method: "GET",
6753
+ headers: getHeaders(void 0, opts),
6754
+ signal: controller.signal
6755
+ });
6756
+ clearTimeout(timeoutId);
6757
+ if (!response.ok) {
6758
+ const errBody = await response.json().catch(() => ({}));
6759
+ throw new SdkHttpError(
6760
+ errBody.message || `API error: ${response.status} ${response.statusText}`,
6761
+ response.status,
6762
+ errBody
6763
+ );
6764
+ }
6765
+ const bytes = new Uint8Array(await response.arrayBuffer());
6766
+ const contentType = response.headers.get("content-type") ?? void 0;
6767
+ const disposition = response.headers.get("content-disposition") ?? "";
6768
+ const match = /filename\*?=(?:UTF-8'')?"?([^"\n;]+)"?/i.exec(disposition);
6769
+ const filename = match ? decodeURIComponent(match[1].trim()) : void 0;
6770
+ return { bytes, contentType, filename };
6771
+ } catch (error) {
6772
+ clearTimeout(timeoutId);
6773
+ if (error instanceof SdkHttpError) throw error;
6774
+ const err = error;
6775
+ if (err.name === "AbortError") {
6776
+ throw new SdkHttpError("Request timeout", 408);
6777
+ }
6778
+ throw new SdkHttpError(`Network error: ${err.message}`, 0, error);
6779
+ }
6780
+ }
6733
6781
  async function upload(path, file, filename, metadata, fieldName = "file", opts) {
6734
6782
  const url = `${config.baseUrl}${path}`;
6735
6783
  const controller = new AbortController();
@@ -6753,6 +6801,10 @@ function createHttpClient(config) {
6753
6801
  if (opts?.customerToken) {
6754
6802
  headers["X-Customer-Session-Token"] = opts.customerToken;
6755
6803
  }
6804
+ if (opts?.onBehalfOf) {
6805
+ headers["Authorization"] = `Bearer ${opts.onBehalfOf}`;
6806
+ headers["X-Customer-Session-Claim"] = opts.onBehalfOf;
6807
+ }
6756
6808
  if (opts?.headers) {
6757
6809
  Object.assign(headers, opts.headers);
6758
6810
  }
@@ -6810,6 +6862,7 @@ function createHttpClient(config) {
6810
6862
  delete: (path, opts) => withAuthRetry(path, () => request("DELETE", path, void 0, opts)),
6811
6863
  getText: (path, opts) => withAuthRetry(path, () => getText(path, opts)),
6812
6864
  getBinary: (path, opts) => withAuthRetry(path, () => getBinary(path, opts)),
6865
+ getBinaryWithMeta: (path, opts) => withAuthRetry(path, () => getBinaryWithMeta(path, opts)),
6813
6866
  upload: ((path, file, filename, metadata, fieldName, opts) => withAuthRetry(path, () => upload(path, file, filename, metadata, fieldName, opts))),
6814
6867
  setAuthToken,
6815
6868
  getAuthToken
@@ -6830,6 +6883,22 @@ function isRuleRejected(err) {
6830
6883
  if (!Array.isArray(obj.ruleAtoms)) return false;
6831
6884
  return obj.ruleAtoms.every((a) => typeof a === "string");
6832
6885
  }
6886
+ function isSmartEngineSdkError(err) {
6887
+ return err instanceof SdkHttpError;
6888
+ }
6889
+ function toHttpError(err) {
6890
+ if (isSmartEngineSdkError(err)) {
6891
+ return {
6892
+ statusCode: err.statusCode >= 400 ? err.statusCode : 502,
6893
+ code: "SDK_HTTP_ERROR",
6894
+ message: err.message,
6895
+ isRetryable: err.isRetryable,
6896
+ details: err.details
6897
+ };
6898
+ }
6899
+ const message = err instanceof Error ? err.message : "Unknown error";
6900
+ return { statusCode: 500, code: "INTERNAL_ERROR", message, isRetryable: false };
6901
+ }
6833
6902
 
6834
6903
  // src/discovery/discovery-client.ts
6835
6904
  var DiscoveryClient = class {
@@ -8567,6 +8636,9 @@ function isPositiveDecimalString(value) {
8567
8636
  }
8568
8637
 
8569
8638
  // src/baas/agents/index.ts
8639
+ function isAgentFundPending(r) {
8640
+ return "pendingOpId" in r;
8641
+ }
8570
8642
  var AgentsClient = class {
8571
8643
  constructor(http) {
8572
8644
  this.http = http;
@@ -8585,9 +8657,12 @@ var AgentsClient = class {
8585
8657
  return this.http.get("/api/v3/baas/agents", opts);
8586
8658
  }
8587
8659
  /**
8588
- * Fund agent treasury (owner-only). Returns a
8660
+ * Fund agent treasury (owner-only). Normally returns a
8589
8661
  * `PreparedTransactionResponse` wrapped in a `success: true` envelope —
8590
- * the caller is expected to sign and submit the prepared bytes.
8662
+ * the caller is expected to sign and submit the prepared bytes. When the
8663
+ * amount trips an approval-required rule the host instead returns an
8664
+ * {@link AgentPendingApprovalResponse}; discriminate with
8665
+ * {@link isAgentFundPending}.
8591
8666
  */
8592
8667
  async fund(agentId, request, opts) {
8593
8668
  return this.http.post(`/api/v3/baas/agents/${encodePathParam(agentId)}/fund`, request, opts);
@@ -8626,6 +8701,14 @@ var AgentsClient = class {
8626
8701
  async revoke(agentId, opts) {
8627
8702
  return this.http.post(`/api/v3/baas/agents/${encodePathParam(agentId)}/revoke`, {}, opts);
8628
8703
  }
8704
+ /**
8705
+ * Get an agent's certification snapshot (identity, rule refs, BLS group key,
8706
+ * and recent on-chain activity). A 404 throws `SdkHttpError` via `http.get`
8707
+ * — parity with {@link get}.
8708
+ */
8709
+ async certification(agentId, opts) {
8710
+ return this.http.get(`/api/v3/baas/agents/${encodePathParam(agentId)}/certification`, opts);
8711
+ }
8629
8712
  /**
8630
8713
  * Update agent rules.
8631
8714
  *
@@ -9164,7 +9247,7 @@ var SmartEngineClient = class _SmartEngineClient {
9164
9247
  discovery;
9165
9248
  constructor(config) {
9166
9249
  this.allowInsecure = config.allowInsecure ?? false;
9167
- this.baseUrl = validateClientUrl(config.baseUrl, this.allowInsecure);
9250
+ this.baseUrl = validateClientUrl(config.validatorBaseUrl, this.allowInsecure);
9168
9251
  this.http = createHttpClient({
9169
9252
  baseUrl: `${this.baseUrl}/api/v3`,
9170
9253
  apiKey: config.apiKey,
@@ -9226,7 +9309,7 @@ var SmartEngineClient = class _SmartEngineClient {
9226
9309
  const timeoutRaw = env["REQUEST_TIMEOUT"];
9227
9310
  const timeout = timeoutRaw ? Number.parseInt(timeoutRaw, 10) : void 0;
9228
9311
  return new _SmartEngineClient({
9229
- baseUrl,
9312
+ validatorBaseUrl: baseUrl,
9230
9313
  apiKey: env["VALIDATOR_API_KEY"],
9231
9314
  authToken: env["APP_TOKEN"],
9232
9315
  allowInsecure: env["ALLOW_INSECURE"] === "true",
@@ -9274,90 +9357,21 @@ var SmartEngineClient = class _SmartEngineClient {
9274
9357
  config.metadata
9275
9358
  );
9276
9359
  const client = new _SmartEngineClient({
9277
- baseUrl: validatorUrl,
9360
+ validatorBaseUrl: validatorUrl,
9278
9361
  authToken: session.token,
9279
9362
  allowInsecure
9280
9363
  });
9281
9364
  return { client, validator, session };
9282
9365
  }
9283
- /**
9284
- * Connect to the smart-engines network via the **service-registry**.
9285
- * Preferred over {@link connectToNetwork} once the validator pods in the
9286
- * target network have published their cluster endpoints the SDK
9287
- * auto-balances across the active cluster set and rides permissionless
9288
- * cluster join/leave without code edits.
9289
- *
9290
- * Resolution ladder:
9291
- * 1. HTTP fetch `/api/v3/discovery/clusters` from each bootstrap seed.
9292
- * 2. (Optional) HCS trust-anchor membership cross-check.
9293
- * 3. Random-pick over the verified set.
9294
- *
9295
- * @param config - Seed + auth config. See {@link ClusterConnectionConfig}.
9296
- * @returns The configured client, the selected cluster, and the auth session.
9297
- * @throws SmartEngineError 400 if neither `bootstrap` nor `network` is given.
9298
- * @throws SmartEngineError 503 if no active cluster can be reached.
9299
- *
9300
- * @example Zero-config (recommended for smart-app callers)
9301
- * ```ts
9302
- * const { client, cluster, session } = await SmartEngineClient.connectToCluster({
9303
- * network: 'testnet', // resolves canonical gateway entrypoint
9304
- * chain: 'xrpl',
9305
- * address: '...',
9306
- * publicKey: '...',
9307
- * signFn: async (challenge) => sign(challenge),
9308
- * });
9309
- * ```
9310
- *
9311
- * @example Custom seeds (private deployments / local dev)
9312
- * ```ts
9313
- * const { client, cluster, session } = await SmartEngineClient.connectToCluster({
9314
- * bootstrap: ['https://sn1.testnet.hsuite.network', 'https://sn2.testnet.hsuite.network'],
9315
- * chain: 'xrpl',
9316
- * address: '...',
9317
- * publicKey: '...',
9318
- * signFn: async (challenge) => sign(challenge),
9319
- * });
9320
- * ```
9321
- */
9322
- static async connectToCluster(config) {
9323
- const allowInsecure = config.allowInsecure ?? false;
9324
- const resolved = await resolveClusterEndpoint({
9325
- bootstrap: config.bootstrap,
9326
- network: config.network,
9327
- allowInsecure,
9328
- trustAnchor: config.trustAnchor
9329
- });
9330
- if (!resolved.ok) {
9331
- if (resolved.reason === "no-seeds") {
9332
- throw new SmartEngineError2(
9333
- "connectToCluster requires either a non-empty `bootstrap` list or a known `network` name.",
9334
- 400
9335
- );
9336
- }
9337
- throw new SmartEngineError2(
9338
- "No active clusters available via bootstrap seeds. Check bootstrap URLs and network reachability.",
9339
- 503
9340
- );
9341
- }
9342
- const cluster = resolved.cluster;
9343
- const gatewayUrl = cluster.endpoints.gatewayUrl;
9344
- validateClientUrl(gatewayUrl, allowInsecure);
9345
- const auth = new ValidatorAuthClient({ security: { allowInsecure } });
9346
- const session = await auth.authenticateWithSigner(
9347
- gatewayUrl,
9348
- config.chain,
9349
- config.address,
9350
- config.publicKey,
9351
- config.signFn,
9352
- config.metadata
9353
- );
9354
- const client = new _SmartEngineClient({
9355
- baseUrl: gatewayUrl,
9356
- authToken: session.token,
9357
- allowInsecure
9358
- });
9359
- return { client, cluster, session };
9360
- }
9366
+ // NOTE (SDK 4.0 type-fence): the former `SmartEngineClient.connectToCluster`
9367
+ // was REMOVED. It resolved a cluster's `gatewayUrl` and fed it into
9368
+ // `new SmartEngineClient({ baseUrl: gatewayUrl })` a gateway-pointed
9369
+ // validator-direct client whose raw `/api/v3/*` calls 404 (the raw tier is
9370
+ // un-ingressed at the gateway). That was the footgun. To reach web3 through a
9371
+ // cluster use `BaasClient.connectToCluster({ network })` (the host BaaS tier);
9372
+ // for an explicit in-cluster validator origin use `new SmartEngineClient({
9373
+ // validatorBaseUrl })` or `connectToNetwork` (which resolves a real validator
9374
+ // `apiEndpoint` from the HCS registry, never a gateway URL).
9361
9375
  /** Get the current validator URL */
9362
9376
  getBaseUrl() {
9363
9377
  return this.baseUrl;
@@ -10743,6 +10757,7 @@ __export(baas_exports, {
10743
10757
  MessagingClient: () => MessagingClient,
10744
10758
  RulesClient: () => RulesClient,
10745
10759
  StorageClient: () => StorageClient,
10760
+ isAgentFundPending: () => isAgentFundPending,
10746
10761
  validateAgentRules: () => validateAgentRules
10747
10762
  });
10748
10763
 
@@ -10896,6 +10911,20 @@ var StorageClient = class {
10896
10911
  const appId = this.getAppId();
10897
10912
  return this.http.getBinary(`/api/v3/baas/storage/${encodePathParam(appId)}/download/${encodePathParam(cid)}`, opts);
10898
10913
  }
10914
+ /**
10915
+ * Download a file by CID WITH its response metadata — the raw bytes plus the
10916
+ * host-supplied `contentType` (derived from the stored file's metadata) and,
10917
+ * when present, the `filename`. Use this instead of {@link download} when the
10918
+ * caller must echo the content-type back to its own client; a bytes-only
10919
+ * download cannot recover it.
10920
+ */
10921
+ async downloadWithMeta(cid, opts) {
10922
+ const appId = this.getAppId();
10923
+ return this.http.getBinaryWithMeta(
10924
+ `/api/v3/baas/storage/${encodePathParam(appId)}/download/${encodePathParam(cid)}`,
10925
+ opts
10926
+ );
10927
+ }
10899
10928
  /**
10900
10929
  * Get file metadata
10901
10930
  */
@@ -11018,6 +11047,16 @@ var FunctionsClient = class {
11018
11047
  opts
11019
11048
  );
11020
11049
  }
11050
+ /**
11051
+ * Get a function's source code
11052
+ */
11053
+ async getCode(functionId, opts) {
11054
+ const appId = this.getAppId();
11055
+ return this.http.get(
11056
+ `/api/v3/baas/functions/${encodePathParam(appId)}/${encodePathParam(functionId)}/code`,
11057
+ opts
11058
+ );
11059
+ }
11021
11060
  /**
11022
11061
  * Update a function
11023
11062
  */
@@ -11599,6 +11638,44 @@ var EntitiesClient = class _EntitiesClient {
11599
11638
  async createAgent(req) {
11600
11639
  return this.http.post("/api/v3/baas/entities/createAgent", req);
11601
11640
  }
11641
+ /**
11642
+ * PREPARE half of the payer-funded agent-create flow.
11643
+ *
11644
+ * POSTs `/api/v3/baas/entities/prepare-create` with `entityType: 'agent'`. The cluster
11645
+ * runs the per-entity DKG (persists the binding, submits nothing on-chain) and
11646
+ * returns the unsigned payer-funding `Payment`(s) the caller signs + submits with
11647
+ * their own wallet — mirroring `prepareCreateAccount`. The agent's primary chain
11648
+ * is relayed as `chain` (the generic prepare/execute DTO key) so the host's
11649
+ * chain-bound preparer runs; `name` / `agentType` / `ruleRef` ride along.
11650
+ */
11651
+ async prepareCreateAgent(req) {
11652
+ const { primaryChain, ...rest } = req;
11653
+ return this.http.post("/api/v3/baas/entities/prepare-create", {
11654
+ entityType: "agent",
11655
+ chain: primaryChain,
11656
+ ...rest
11657
+ });
11658
+ }
11659
+ /**
11660
+ * EXECUTE half of the payer-funded agent-create flow.
11661
+ *
11662
+ * POSTs `/api/v3/baas/entities/execute-create` with `entityType: 'agent'`. The entity
11663
+ * already exists (its DKG ran during prepare); pass `signedFundingBlob` for the
11664
+ * validator to submit the payer's signed funding tx (XRPL/Stellar account-model
11665
+ * relay), or omit it when the caller already submitted the funding tx themselves.
11666
+ * `createTxId` is the Hedera receipt thread (the prepared create's
11667
+ * `transactionId`); ignored for non-Hedera chains. Mirrors
11668
+ * `executeCreateAccount` but tags `entityType: 'agent'`.
11669
+ */
11670
+ async executeCreateAgent(req) {
11671
+ const { createTxId, signedFundingBlob, ...rest } = req;
11672
+ return this.http.post("/api/v3/baas/entities/execute-create", {
11673
+ ...rest,
11674
+ ...createTxId !== void 0 ? { createTxId } : {},
11675
+ ...signedFundingBlob !== void 0 ? { signedFundingBlob } : {},
11676
+ entityType: "agent"
11677
+ });
11678
+ }
11602
11679
  /**
11603
11680
  * Mega-helper: build a token rule with a launchpad ModuleEntry attached,
11604
11681
  * publish it, create the token, and return the combined result in one HTTP
@@ -11616,6 +11693,96 @@ var EntitiesClient = class _EntitiesClient {
11616
11693
  const path = filter?.type ? `/api/v3/baas/entities?type=${encodeURIComponent(filter.type)}` : "/api/v3/baas/entities";
11617
11694
  return this.http.get(path);
11618
11695
  }
11696
+ // ─── Value-movement (prepare-bytes only) ──────────────────────────────────
11697
+ //
11698
+ // Each method POSTs the host's entity-scoped value-movement route. The entity
11699
+ // is the source / treasury / authority + fee-payer (resolved server-side from
11700
+ // the entity record — never the body), so a caller can never name a foreign
11701
+ // payer or drain another account. The host authorises the call (session
11702
+ // caller identity + `loadOwnedEntity` ownership), delegates to the validator
11703
+ // preparer, and returns prepared bytes for the caller to sign + submit; the
11704
+ // host never submits and never pays. A rule-deny surfaces as an HTTP 403
11705
+ // `rule_rejected` (use `isRuleRejected`), never as signed bytes.
11706
+ //
11707
+ // `opts` threads {@link HttpCallOptions} (`onBehalfOf` / `customerToken` /
11708
+ // `headers`) so an app-as-proxy can act on behalf of an owner — the owner's
11709
+ // Mode-1 customer-session JWT rides as both `Authorization: Bearer` and
11710
+ // `X-Customer-Session-Claim`, exactly as `agents.execute` does.
11711
+ /**
11712
+ * Prepare a native or token transfer FROM an account entity.
11713
+ *
11714
+ * `POST /api/v3/baas/entities/:entityId/transfer`.
11715
+ */
11716
+ async transfer(entityId, body, opts) {
11717
+ return this.http.post(
11718
+ `/api/v3/baas/entities/${encodePathParam(entityId)}/transfer`,
11719
+ body,
11720
+ opts
11721
+ );
11722
+ }
11723
+ /**
11724
+ * Prepare a withdrawal FROM an account entity to a destination.
11725
+ *
11726
+ * `POST /api/v3/baas/entities/:entityId/withdraw`.
11727
+ */
11728
+ async withdraw(entityId, body, opts) {
11729
+ return this.http.post(
11730
+ `/api/v3/baas/entities/${encodePathParam(entityId)}/withdraw`,
11731
+ body,
11732
+ opts
11733
+ );
11734
+ }
11735
+ /**
11736
+ * Prepare a token/NFT mint whose supply authority is the account entity.
11737
+ *
11738
+ * `POST /api/v3/baas/entities/:entityId/mint`.
11739
+ */
11740
+ async mint(entityId, body, opts) {
11741
+ return this.http.post(
11742
+ `/api/v3/baas/entities/${encodePathParam(entityId)}/mint`,
11743
+ body,
11744
+ opts
11745
+ );
11746
+ }
11747
+ /**
11748
+ * Prepare a token/NFT burn from the account entity's treasury.
11749
+ *
11750
+ * `POST /api/v3/baas/entities/:entityId/burn`.
11751
+ */
11752
+ async burn(entityId, body, opts) {
11753
+ return this.http.post(
11754
+ `/api/v3/baas/entities/${encodePathParam(entityId)}/burn`,
11755
+ body,
11756
+ opts
11757
+ );
11758
+ }
11759
+ /**
11760
+ * Prepare a compliance action (pause / restrict / wipe) on a token whose
11761
+ * compliance authority is the account entity. The body `account` is the
11762
+ * per-account subject for restrict/wipe — never the payer.
11763
+ *
11764
+ * `POST /api/v3/baas/entities/:entityId/compliance`.
11765
+ */
11766
+ async compliance(entityId, body, opts) {
11767
+ return this.http.post(
11768
+ `/api/v3/baas/entities/${encodePathParam(entityId)}/compliance`,
11769
+ body,
11770
+ opts
11771
+ );
11772
+ }
11773
+ /**
11774
+ * Prepare an XRPL TrustSet authorising the account entity to hold a currency
11775
+ * from an issuer.
11776
+ *
11777
+ * `POST /api/v3/baas/entities/:entityId/trustline`.
11778
+ */
11779
+ async trustline(entityId, body, opts) {
11780
+ return this.http.post(
11781
+ `/api/v3/baas/entities/${encodePathParam(entityId)}/trustline`,
11782
+ body,
11783
+ opts
11784
+ );
11785
+ }
11619
11786
  };
11620
11787
 
11621
11788
  // src/baas/client.ts
@@ -11626,13 +11793,6 @@ var BaasClient = class _BaasClient {
11626
11793
  timeout;
11627
11794
  allowInsecure;
11628
11795
  http;
11629
- /**
11630
- * Validator-routed HTTP client for the `/api/v3/transactions/*` prepare/execute
11631
- * surface — a SIBLING of `/host`, NOT under the `pathPrefix`. Rooted at the
11632
- * raw gateway/ingress origin (`hostUrl`) so transactions reach the validator
11633
- * even when BaaS traffic is gateway-routed at `/host/*`.
11634
- */
11635
- txHttp;
11636
11796
  /** Last HTTP error (for getHttpHealth) */
11637
11797
  lastHttpError;
11638
11798
  /**
@@ -11661,14 +11821,6 @@ var BaasClient = class _BaasClient {
11661
11821
  rules;
11662
11822
  /** Canonical entity authoring surface (token/account/topic/agent + launchpad). */
11663
11823
  entities;
11664
- /**
11665
- * Validator-routed transaction prepare/execute (sovereignty model). The
11666
- * prepare endpoints accept an explicit `payerAccountId` for the session-less
11667
- * payer path, OR carry the web3-auth session token for the JWT-wallet payer
11668
- * path (kept in sync with the main client's token — see {@link authenticate}).
11669
- * Targets `/api/v3/transactions/*`, a sibling of the `/host` BaaS surface.
11670
- */
11671
- transactions;
11672
11824
  constructor(config) {
11673
11825
  this.allowInsecure = config.allowInsecure ?? false;
11674
11826
  this.hostUrl = validateUrl2(config.hostUrl, this.allowInsecure);
@@ -11685,11 +11837,6 @@ var BaasClient = class _BaasClient {
11685
11837
  // been called (authContext set). Excludes /api/v3/{,baas/}auth/* (see http client).
11686
11838
  onUnauthorized: () => this.reauthenticate()
11687
11839
  });
11688
- this.txHttp = createHttpClient({
11689
- baseUrl: `${this.hostUrl.replace(/\/$/, "")}/api/v3/transactions`,
11690
- timeout: this.timeout,
11691
- onUnauthorized: () => this.reauthenticate()
11692
- });
11693
11840
  const getAppId = () => this.requireAppId();
11694
11841
  this.db = new DatabaseClient(this.http, getAppId);
11695
11842
  this.storage = new StorageClient(this.http, getAppId);
@@ -11700,7 +11847,6 @@ var BaasClient = class _BaasClient {
11700
11847
  this.customerSession = new CustomerSessionClient(baseUrlWithPrefix, this.timeout);
11701
11848
  this.rules = new RulesClient(this.http);
11702
11849
  this.entities = new EntitiesClient(this.http);
11703
- this.transactions = new TransactionsClient(this.txHttp);
11704
11850
  }
11705
11851
  /**
11706
11852
  * Connect to the Smart Engines BaaS via cluster auto-discovery.
@@ -11848,7 +11994,6 @@ var BaasClient = class _BaasClient {
11848
11994
  throw asBaasError(err);
11849
11995
  }
11850
11996
  this.http.setAuthToken(result.token);
11851
- this.txHttp.setAuthToken(result.token);
11852
11997
  return result;
11853
11998
  }
11854
11999
  /**
@@ -11874,7 +12019,6 @@ var BaasClient = class _BaasClient {
11874
12019
  publicKey: ctx.publicKey
11875
12020
  });
11876
12021
  this.http.setAuthToken(result.token);
11877
- this.txHttp.setAuthToken(result.token);
11878
12022
  }
11879
12023
  /** Validate the current session */
11880
12024
  async validateSession() {
@@ -11894,7 +12038,6 @@ var BaasClient = class _BaasClient {
11894
12038
  }
11895
12039
  }
11896
12040
  this.http.setAuthToken(void 0);
11897
- this.txHttp.setAuthToken(void 0);
11898
12041
  }
11899
12042
  // ========== HTTP Helpers ==========
11900
12043
  requireAuth() {
@@ -13886,9 +14029,11 @@ exports.forToken = forToken;
13886
14029
  exports.forTopic = forTopic;
13887
14030
  exports.governance = governance_exports;
13888
14031
  exports.inferJson = inferJson;
14032
+ exports.isAgentFundPending = isAgentFundPending;
13889
14033
  exports.isKnownNetwork = isKnownNetwork;
13890
14034
  exports.isPersonhoodVerifierNotConfigured = isPersonhoodVerifierNotConfigured;
13891
14035
  exports.isRuleRejected = isRuleRejected;
14036
+ exports.isSmartEngineSdkError = isSmartEngineSdkError;
13892
14037
  exports.managedAccount = managedAccount;
13893
14038
  exports.membershipNft = membershipNft;
13894
14039
  exports.module_ = module_;
@@ -13912,6 +14057,7 @@ exports.subscriptionNft = subscriptionNft;
13912
14057
  exports.systemTopic = systemTopic;
13913
14058
  exports.template = template;
13914
14059
  exports.tieredIDO = tieredIDO;
14060
+ exports.toHttpError = toHttpError;
13915
14061
  exports.tokenDAO = tokenDAO;
13916
14062
  exports.tokens = tokens_exports;
13917
14063
  exports.tradingAgent = tradingAgent;