@terminal3/t3n-sdk 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -796
- package/dist/index.d.ts +281 -115
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +10 -60
- package/README.OIDC.md +0 -216
- package/dist/demo.d.ts +0 -25
- package/dist/src/client/actions.d.ts +0 -31
- package/dist/src/client/config.d.ts +0 -33
- package/dist/src/client/contract-response.d.ts +0 -59
- package/dist/src/client/delegation.d.ts +0 -388
- package/dist/src/client/encryption.d.ts +0 -30
- package/dist/src/client/handlers.d.ts +0 -73
- package/dist/src/client/index.d.ts +0 -13
- package/dist/src/client/org-data.d.ts +0 -276
- package/dist/src/client/request-parser.d.ts +0 -48
- package/dist/src/client/t3n-client.d.ts +0 -544
- package/dist/src/client/transport.d.ts +0 -131
- package/dist/src/config/index.d.ts +0 -82
- package/dist/src/config/loader.d.ts +0 -8
- package/dist/src/config/types.d.ts +0 -25
- package/dist/src/index.d.ts +0 -39
- package/dist/src/types/auth.d.ts +0 -66
- package/dist/src/types/index.d.ts +0 -45
- package/dist/src/types/kyc.d.ts +0 -135
- package/dist/src/types/org-data.d.ts +0 -180
- package/dist/src/types/session.d.ts +0 -24
- package/dist/src/types/token.d.ts +0 -102
- package/dist/src/types/user.d.ts +0 -236
- package/dist/src/utils/contract-version.d.ts +0 -5
- package/dist/src/utils/crypto.d.ts +0 -52
- package/dist/src/utils/errors.d.ts +0 -144
- package/dist/src/utils/index.d.ts +0 -10
- package/dist/src/utils/logger.d.ts +0 -102
- package/dist/src/utils/redaction.d.ts +0 -13
- package/dist/src/utils/session.d.ts +0 -37
- package/dist/src/utils/shape.d.ts +0 -30
- package/dist/src/wasm/index.d.ts +0 -5
- package/dist/src/wasm/interface.d.ts +0 -110
- package/dist/src/wasm/loader.d.ts +0 -43
- package/dist/src/wasm/quote-verifier/quote_verifier_bytes.d.ts +0 -1
- package/dist/src/wasm/quote-verifier-loader.d.ts +0 -58
package/dist/index.d.ts
CHANGED
|
@@ -434,18 +434,16 @@ declare function decodeWasmErrorMessage(errorMessage: string): string;
|
|
|
434
434
|
declare function extractWasmError(error: unknown): string;
|
|
435
435
|
|
|
436
436
|
/**
|
|
437
|
-
*
|
|
437
|
+
* Wire types for the explicit `otp-request` /
|
|
438
438
|
* `otp-verify` / slim `user-upsert` exports on `tee:user/contracts`
|
|
439
439
|
* (`tee:user@2.0.0`).
|
|
440
440
|
*
|
|
441
441
|
* Pre-2.0.0 the user contract dispatched OTP request and OTP verify
|
|
442
442
|
* implicitly from the input shape of a single `user-upsert` call.
|
|
443
443
|
* 2.0.0 splits that surface into three explicit functions; the
|
|
444
|
-
* shapes here mirror the
|
|
445
|
-
* `node/tee_contracts/user/src/otp_types.rs` and
|
|
446
|
-
* `node/tee_contracts/user/src/upsert_types.rs`.
|
|
444
|
+
* shapes here mirror the OTP / user-upsert wire contract.
|
|
447
445
|
*
|
|
448
|
-
*
|
|
446
|
+
* Bytes flow directly from the contract
|
|
449
447
|
* through the JSON-RPC envelope into the SDK wrappers
|
|
450
448
|
* (`T3nClient.otpRequest`, `T3nClient.otpVerify`,
|
|
451
449
|
* `T3nClient.submitUserInput`).
|
|
@@ -475,8 +473,7 @@ type OtpRequestInput = {
|
|
|
475
473
|
};
|
|
476
474
|
};
|
|
477
475
|
/**
|
|
478
|
-
* Response returned by `otp-request`. Mirrors
|
|
479
|
-
* `otp_types.rs`.
|
|
476
|
+
* Response returned by `otp-request`. Mirrors the OTP wire response.
|
|
480
477
|
*
|
|
481
478
|
* - `contact` echoes the OTP destination so clients that race
|
|
482
479
|
* multiple channels can correlate replies.
|
|
@@ -520,8 +517,7 @@ interface OtpMergeSuggestion {
|
|
|
520
517
|
channel: OtpChannel;
|
|
521
518
|
}
|
|
522
519
|
/**
|
|
523
|
-
* Response returned by `otp-verify`. Mirrors
|
|
524
|
-
* `OtpVerifyResponse` in `otp_types.rs`.
|
|
520
|
+
* Response returned by `otp-verify`. Mirrors the OTP-verify wire response.
|
|
525
521
|
*
|
|
526
522
|
* - `email` is populated on `channel = "email"` success;
|
|
527
523
|
* `phone` on `channel = "sms"` success. Mutually exclusive on
|
|
@@ -542,18 +538,24 @@ interface OtpVerifyResult {
|
|
|
542
538
|
isNewProfile?: boolean;
|
|
543
539
|
}
|
|
544
540
|
/**
|
|
545
|
-
* Level-1 user-input fields accepted by the slim `user-upsert`.
|
|
546
|
-
*
|
|
547
|
-
*
|
|
548
|
-
*
|
|
541
|
+
* Level-1 user-input fields accepted by the slim `user-upsert`. Field names
|
|
542
|
+
* are the on-the-wire names — `submitUserInput` sends this object verbatim,
|
|
543
|
+
* so keys must match the contract exactly (snake_case). The canonical Level-1
|
|
544
|
+
* set is the six fields below; the shape is intentionally open so callers can
|
|
545
|
+
* add provider-specific fields the contract knows how to merge.
|
|
546
|
+
*
|
|
547
|
+
* `email_address` / `phone_number` are normally bound via the OTP roundtrip
|
|
548
|
+
* before `submitUserInput`, but the contract accepts them directly here too.
|
|
549
549
|
*/
|
|
550
550
|
interface UserInputProfile {
|
|
551
|
-
|
|
552
|
-
|
|
551
|
+
first_name?: string;
|
|
552
|
+
last_name?: string;
|
|
553
|
+
country_of_residence?: string;
|
|
554
|
+
document_issuance_country?: string;
|
|
555
|
+
ssn?: string;
|
|
556
|
+
address?: string;
|
|
553
557
|
email_address?: string;
|
|
554
558
|
phone_number?: string;
|
|
555
|
-
birthdate?: string;
|
|
556
|
-
nationality?: string;
|
|
557
559
|
campaign_code?: string;
|
|
558
560
|
role?: string;
|
|
559
561
|
[key: string]: unknown;
|
|
@@ -571,12 +573,12 @@ interface SubmitUserInputArgs {
|
|
|
571
573
|
/**
|
|
572
574
|
* KYC webhook orphan-attestation flow. When set, the contract
|
|
573
575
|
* skips the email-not-verified gate and only records the
|
|
574
|
-
* attestation if the DID has no profile yet
|
|
576
|
+
* attestation if the DID has no profile yet.
|
|
575
577
|
* Most callers should leave this `undefined`.
|
|
576
578
|
*/
|
|
577
579
|
requireExistingUser?: boolean;
|
|
578
580
|
/**
|
|
579
|
-
*
|
|
581
|
+
* Testnet self-admit. When `true`, the contract additionally
|
|
580
582
|
* runs the self-admit side-effect after the profile commit: writes
|
|
581
583
|
* the caller's DID into `idx:_tenants` + `idx:_tenant_quotas` and
|
|
582
584
|
* mints any operator-configured welcome credits. Inspect the
|
|
@@ -592,7 +594,7 @@ interface SubmitUserInputArgs {
|
|
|
592
594
|
becomeDevTenant?: boolean;
|
|
593
595
|
}
|
|
594
596
|
/**
|
|
595
|
-
*
|
|
597
|
+
* Testnet self-admit projection from `user-upsert`. Present only
|
|
596
598
|
* when the caller set `becomeDevTenant: true` on the request.
|
|
597
599
|
*
|
|
598
600
|
* - `status: "admitted"` — first call for this DID; tenant record
|
|
@@ -613,7 +615,7 @@ interface TenantAdmitProjection {
|
|
|
613
615
|
}
|
|
614
616
|
/**
|
|
615
617
|
* Response shape returned by the slim `user-upsert`. Carries the
|
|
616
|
-
* post-merge tx hash plus the
|
|
618
|
+
* post-merge tx hash plus the Level-1 merge diagnostics
|
|
617
619
|
* (`refusedFields`, `mergeSuggestion`) the pre-2.0.0 omnibus
|
|
618
620
|
* `UpsertResponse` already surfaced.
|
|
619
621
|
*/
|
|
@@ -623,16 +625,15 @@ interface SubmitUserInputResult {
|
|
|
623
625
|
mergeSuggestion?: OtpMergeSuggestion;
|
|
624
626
|
userFound?: boolean;
|
|
625
627
|
/**
|
|
626
|
-
*
|
|
628
|
+
* Testnet self-admit projection. Present only when the caller
|
|
627
629
|
* set `becomeDevTenant: true` on the request.
|
|
628
630
|
*/
|
|
629
631
|
tenantAdmit?: TenantAdmitProjection;
|
|
630
632
|
}
|
|
631
633
|
/**
|
|
632
634
|
* Discriminator for {@link UserUpsertError}. Mirrors the
|
|
633
|
-
* `UserUpsertError`
|
|
634
|
-
* format
|
|
635
|
-
* with a `switch` over `kind`.
|
|
635
|
+
* `UserUpsertError` wire enum and its `<code>:<detail>` wire
|
|
636
|
+
* format. Branch with a `switch` over `kind`.
|
|
636
637
|
*
|
|
637
638
|
* - `EmailNotVerified` — the slim `user-upsert` was called against
|
|
638
639
|
* a DID that has no verified email and no proving authenticator.
|
|
@@ -671,8 +672,7 @@ declare class UserUpsertError extends T3nError {
|
|
|
671
672
|
}
|
|
672
673
|
|
|
673
674
|
/**
|
|
674
|
-
* Org-data wire types mirroring the
|
|
675
|
-
* `tee-contract-org-data` and `org-data-types`.
|
|
675
|
+
* Org-data wire types mirroring the org-data contract wire shapes.
|
|
676
676
|
*
|
|
677
677
|
* Plain TypeScript interfaces (no zod) — the SDK does not use a
|
|
678
678
|
* validation library for domain types; see the existing `types/` files.
|
|
@@ -684,13 +684,12 @@ declare class UserUpsertError extends T3nError {
|
|
|
684
684
|
* (e.g. each `UserGrant` inside `OrgContractGrants.grants`) are not
|
|
685
685
|
* deeply validated — see `utils/shape.ts` for the rationale.
|
|
686
686
|
*
|
|
687
|
-
* Reference:
|
|
688
|
-
* `tee-contract-org-data/src/org_data.rs`.
|
|
687
|
+
* Reference: the org-data wire contract.
|
|
689
688
|
*/
|
|
690
689
|
/**
|
|
691
690
|
* Capability grant stored under `ORG_CONTRACT_GRANTS_MAP`.
|
|
692
691
|
*
|
|
693
|
-
* Mirrors `
|
|
692
|
+
* Mirrors the org-data `UserGrant` wire shape.
|
|
694
693
|
*/
|
|
695
694
|
interface UserGrant {
|
|
696
695
|
/** The user this grant applies to (`did:t3n:<40-hex>`). */
|
|
@@ -710,7 +709,7 @@ interface UserGrant {
|
|
|
710
709
|
/**
|
|
711
710
|
* Policy record for an organisation's data tier.
|
|
712
711
|
*
|
|
713
|
-
* Mirrors
|
|
712
|
+
* Mirrors the org-data policy-meta wire shape.
|
|
714
713
|
*/
|
|
715
714
|
interface OrgPolicyMeta {
|
|
716
715
|
/** DIDs (`did:t3n:<40-hex>`) of users authorised to manage policy and read data. */
|
|
@@ -738,7 +737,7 @@ interface ExpenseClaim {
|
|
|
738
737
|
/**
|
|
739
738
|
* Employee data row stored under `OrgData[org || "payroll/employees" || entry_id]`.
|
|
740
739
|
*
|
|
741
|
-
* Mirrors `
|
|
740
|
+
* Mirrors the payroll `EmployeeRecord` wire shape.
|
|
742
741
|
*/
|
|
743
742
|
interface EmployeeRecord {
|
|
744
743
|
employee_id: string;
|
|
@@ -762,7 +761,7 @@ interface EmployeeRecord {
|
|
|
762
761
|
/**
|
|
763
762
|
* Standard response returned by all policy write and data mutation operations.
|
|
764
763
|
*
|
|
765
|
-
* Mirrors
|
|
764
|
+
* Mirrors the org-data `MutationResponse` wire shape.
|
|
766
765
|
*/
|
|
767
766
|
interface MutationResponse {
|
|
768
767
|
/** `"created"`, `"updated"`, or `"deleted"`. */
|
|
@@ -852,16 +851,16 @@ interface OrgDataActionWire {
|
|
|
852
851
|
}
|
|
853
852
|
|
|
854
853
|
/**
|
|
855
|
-
* Token-metering
|
|
854
|
+
* Token-metering wire shapes.
|
|
856
855
|
*
|
|
857
|
-
* Mirrors
|
|
856
|
+
* Mirrors the token-metering wire contract. `u128` fields land on the
|
|
858
857
|
* wire as JSON numbers (same convention as the existing
|
|
859
858
|
* `token.get-balance` response) — JS clients with histories that
|
|
860
859
|
* exceed 2⁵³ tokens should switch to a streaming JSON parser; the
|
|
861
860
|
* common case fits in `number` losslessly.
|
|
862
861
|
*/
|
|
863
862
|
/**
|
|
864
|
-
* `
|
|
863
|
+
* The token `BalanceRow` wire shape — caller's credit row.
|
|
865
864
|
*
|
|
866
865
|
* `available` and `reserved` are `u128` on the server; the wire
|
|
867
866
|
* format is a JSON number. Callers should not assume bigint until
|
|
@@ -875,7 +874,7 @@ interface BalanceRow {
|
|
|
875
874
|
credit_exhausted: boolean;
|
|
876
875
|
}
|
|
877
876
|
/**
|
|
878
|
-
*
|
|
877
|
+
* The token-tx-kind wire alphabet (snake_case). Every
|
|
879
878
|
* value listed here is accepted by the server-side
|
|
880
879
|
* `token.get-usage` `kinds` filter.
|
|
881
880
|
*/
|
|
@@ -888,7 +887,7 @@ type TokenTxKind = "mint" | "burn" | "charge" | "transfer" | "bridge_mint_attest
|
|
|
888
887
|
*/
|
|
889
888
|
type Direction = "in" | "out";
|
|
890
889
|
/**
|
|
891
|
-
* Discriminated union mirroring
|
|
890
|
+
* Discriminated union mirroring the charge-reason wire union.
|
|
892
891
|
* Present only when the row's `kind === "charge"`.
|
|
893
892
|
*/
|
|
894
893
|
type ChargeReason = {
|
|
@@ -1091,7 +1090,7 @@ declare class MockTransport implements Transport {
|
|
|
1091
1090
|
/**
|
|
1092
1091
|
* Mock response headers for a specific method. Used by tests to
|
|
1093
1092
|
* simulate the server-minted `Session-Id` header the SDK picks up
|
|
1094
|
-
* from the `auth.handshake` response
|
|
1093
|
+
* from the `auth.handshake` response. Unset methods
|
|
1095
1094
|
* default to no headers.
|
|
1096
1095
|
*/
|
|
1097
1096
|
mockResponseHeaders(method: string, headers: Record<string, string>): void;
|
|
@@ -1166,17 +1165,14 @@ interface T3nClientConfig {
|
|
|
1166
1165
|
* Trinity contracts are declared as `result<list<u8>, string>` in WIT and
|
|
1167
1166
|
* return JSON-encoded bytes. The server-side pipeline is:
|
|
1168
1167
|
*
|
|
1169
|
-
* 1. `
|
|
1170
|
-
*
|
|
1171
|
-
* 2.
|
|
1172
|
-
*
|
|
1173
|
-
*
|
|
1174
|
-
* 3.
|
|
1175
|
-
*
|
|
1176
|
-
*
|
|
1177
|
-
* boundary.
|
|
1178
|
-
* 4. `node/service/src/action.rs` serialises that plain `Value` through
|
|
1179
|
-
* the session channel.
|
|
1168
|
+
* 1. The contract's returned bytes are deserialized into a JSON `Value`
|
|
1169
|
+
* (the contract's decoded return value).
|
|
1170
|
+
* 2. The host wraps that value in an internal `ContractResponse` struct
|
|
1171
|
+
* for bookkeeping — it carries an extracted `otp_state` alongside the
|
|
1172
|
+
* response.
|
|
1173
|
+
* 3. The host then unwraps the struct, discarding the `otp_state` field
|
|
1174
|
+
* and returning only the inner `Value` across the executor boundary.
|
|
1175
|
+
* 4. That plain `Value` is serialised through the session channel.
|
|
1180
1176
|
*
|
|
1181
1177
|
* The client therefore receives the contract's **decoded JSON value
|
|
1182
1178
|
* directly** — no `{response, otp_state}` envelope, despite what the
|
|
@@ -1220,10 +1216,10 @@ declare function parseContractResponse<T = unknown>(raw: string, schema?: Contra
|
|
|
1220
1216
|
|
|
1221
1217
|
/**
|
|
1222
1218
|
* KYC types for the `tee:user/contracts::kyc-status` short-poll
|
|
1223
|
-
* function
|
|
1219
|
+
* function.
|
|
1224
1220
|
*
|
|
1225
|
-
* The shape mirrors `
|
|
1226
|
-
*
|
|
1221
|
+
* The shape mirrors the `kyc-status` wire response.
|
|
1222
|
+
* The bytes go straight from the contract
|
|
1227
1223
|
* through the JSON-RPC envelope into [[T3nClient.kycStatus]].
|
|
1228
1224
|
*/
|
|
1229
1225
|
|
|
@@ -1238,7 +1234,7 @@ declare function parseContractResponse<T = unknown>(raw: string, schema?: Contra
|
|
|
1238
1234
|
* expired / the user abandoned the flow. `error` may carry a
|
|
1239
1235
|
* provider-supplied reason.
|
|
1240
1236
|
* - `orphan` — a Veriff webhook arrived with a `vendorData` that
|
|
1241
|
-
* couldn't be matched to any user
|
|
1237
|
+
* couldn't be matched to any user. Should not
|
|
1242
1238
|
* happen in the MetaMask flow but the contract surfaces it for
|
|
1243
1239
|
* completeness.
|
|
1244
1240
|
*/
|
|
@@ -1276,8 +1272,8 @@ interface KycStatus {
|
|
|
1276
1272
|
error?: string;
|
|
1277
1273
|
}
|
|
1278
1274
|
/**
|
|
1279
|
-
* Polling cadence for [[T3nClient.kycStatusPoll]]. Defaults
|
|
1280
|
-
*
|
|
1275
|
+
* Polling cadence for [[T3nClient.kycStatusPoll]]. Defaults:
|
|
1276
|
+
* poll fast for the first 30 seconds, then back
|
|
1281
1277
|
* off, and bail after 5 minutes.
|
|
1282
1278
|
*/
|
|
1283
1279
|
interface KycPollCadence {
|
|
@@ -1295,7 +1291,7 @@ interface KycPollCadence {
|
|
|
1295
1291
|
}
|
|
1296
1292
|
/**
|
|
1297
1293
|
* Optional knobs for [[T3nClient.kycStatusPoll]]. Most callers won't
|
|
1298
|
-
* touch any of these — the
|
|
1294
|
+
* touch any of these — the cadence defaults are baked in.
|
|
1299
1295
|
*/
|
|
1300
1296
|
interface KycPollOptions {
|
|
1301
1297
|
/**
|
|
@@ -1315,7 +1311,7 @@ interface KycPollOptions {
|
|
|
1315
1311
|
onUpdate?: (status: KycStatus) => void;
|
|
1316
1312
|
/**
|
|
1317
1313
|
* Override one or more cadence fields. Anything not specified
|
|
1318
|
-
* uses the
|
|
1314
|
+
* uses the defaults from [[DEFAULT_KYC_POLL_CADENCE]].
|
|
1319
1315
|
*/
|
|
1320
1316
|
cadence?: Partial<KycPollCadence>;
|
|
1321
1317
|
/**
|
|
@@ -1327,7 +1323,7 @@ interface KycPollOptions {
|
|
|
1327
1323
|
}
|
|
1328
1324
|
/**
|
|
1329
1325
|
* Default cadence used by [[T3nClient.kycStatusPoll]] when the caller
|
|
1330
|
-
* doesn't override `cadence.*`.
|
|
1326
|
+
* doesn't override `cadence.*`.
|
|
1331
1327
|
*/
|
|
1332
1328
|
declare const DEFAULT_KYC_POLL_CADENCE: KycPollCadence;
|
|
1333
1329
|
/**
|
|
@@ -1343,12 +1339,12 @@ declare const TERMINAL_KYC_STATUSES: ReadonlySet<KycStatusKind>;
|
|
|
1343
1339
|
* minutes but Veriff is still working" UX.
|
|
1344
1340
|
*/
|
|
1345
1341
|
declare class KycStatusTimeoutError extends T3nError {
|
|
1346
|
-
/** The
|
|
1342
|
+
/** The timeout (ms) the helper exhausted before a terminal status arrived. */
|
|
1347
1343
|
readonly timeoutMs: number;
|
|
1348
1344
|
/** The last `pending` snapshot before timeout, if any. */
|
|
1349
1345
|
readonly lastStatus?: KycStatus | undefined;
|
|
1350
1346
|
constructor(
|
|
1351
|
-
/** The
|
|
1347
|
+
/** The timeout (ms) the helper exhausted before a terminal status arrived. */
|
|
1352
1348
|
timeoutMs: number,
|
|
1353
1349
|
/** The last `pending` snapshot before timeout, if any. */
|
|
1354
1350
|
lastStatus?: KycStatus | undefined);
|
|
@@ -1377,10 +1373,10 @@ declare class T3nClient {
|
|
|
1377
1373
|
private readonly effectiveBaseUrl;
|
|
1378
1374
|
/**
|
|
1379
1375
|
* Server-minted session ID, set by {@link handshake} from the
|
|
1380
|
-
* `Session-Id` response header
|
|
1381
|
-
* until the handshake completes. Client code cannot set it —
|
|
1382
|
-
*
|
|
1383
|
-
*
|
|
1376
|
+
* `Session-Id` response header. `null`
|
|
1377
|
+
* until the handshake completes. Client code cannot set it — a
|
|
1378
|
+
* client-supplied session id is rejected, closing the
|
|
1379
|
+
* session-fixation vector.
|
|
1384
1380
|
*/
|
|
1385
1381
|
private sessionId;
|
|
1386
1382
|
/**
|
|
@@ -1413,7 +1409,7 @@ declare class T3nClient {
|
|
|
1413
1409
|
* Stored in a dedicated field instead of reusing `wasmState`
|
|
1414
1410
|
* because the two meanings — "in-flight state machine" vs
|
|
1415
1411
|
* "finalized payload" — are semantically different and merging
|
|
1416
|
-
* them
|
|
1412
|
+
* them re-introduces the bug-class this guard exists to prevent.
|
|
1417
1413
|
*/
|
|
1418
1414
|
private finalizedPayload;
|
|
1419
1415
|
private did;
|
|
@@ -1477,7 +1473,7 @@ declare class T3nClient {
|
|
|
1477
1473
|
/**
|
|
1478
1474
|
* Fetch the caller's usage feed — balance plus a bounded slice of
|
|
1479
1475
|
* recent token-ledger entries (charges, mints, transfers), newest
|
|
1480
|
-
* first
|
|
1476
|
+
* first (`token.get-usage`).
|
|
1481
1477
|
*
|
|
1482
1478
|
* `limit` defaults to 50 server-side and clamps silently to
|
|
1483
1479
|
* `1..=200`. `afterSeq` is the inclusive upper-bound `seq_no`
|
|
@@ -1497,8 +1493,8 @@ declare class T3nClient {
|
|
|
1497
1493
|
/**
|
|
1498
1494
|
* Execute an action and JSON-decode the response.
|
|
1499
1495
|
*
|
|
1500
|
-
* The server strips its internal `ContractResponse` wrapper
|
|
1501
|
-
*
|
|
1496
|
+
* The server strips its internal `ContractResponse` wrapper
|
|
1497
|
+
* before sending — the string returned
|
|
1502
1498
|
* by {@link execute} is the contract's decoded return value directly
|
|
1503
1499
|
* (no `{response, otp_state}` envelope). This helper is a typed
|
|
1504
1500
|
* `JSON.parse` with optional schema validation so callers stop
|
|
@@ -1513,8 +1509,7 @@ declare class T3nClient {
|
|
|
1513
1509
|
executeAndDecode<T = unknown>(payload: unknown, schema?: ContractResponseSchema<T>): Promise<T>;
|
|
1514
1510
|
/**
|
|
1515
1511
|
* Build the canonical `ExecuteActionRequest` shape the server
|
|
1516
|
-
* expects
|
|
1517
|
-
* (`script_name`, `script_version`, `function_name`, `input`,
|
|
1512
|
+
* expects (`script_name`, `script_version`, `function_name`, `input`,
|
|
1518
1513
|
* optional `pii_did`) and dispatch it through {@link execute}.
|
|
1519
1514
|
*
|
|
1520
1515
|
* Two pieces of glue live here that every typed user-contract
|
|
@@ -1545,7 +1540,7 @@ declare class T3nClient {
|
|
|
1545
1540
|
*
|
|
1546
1541
|
* Backed by the `tee:user/get-self-eth-address` contract function,
|
|
1547
1542
|
* which delegates to the signing host's `get-user-eth-address`
|
|
1548
|
-
* primitive
|
|
1543
|
+
* primitive. The request carries no body; the
|
|
1549
1544
|
* authenticated user's DID is read from session context by the host.
|
|
1550
1545
|
*
|
|
1551
1546
|
* Requires the session to be Authenticated (same precondition as
|
|
@@ -1557,7 +1552,7 @@ declare class T3nClient {
|
|
|
1557
1552
|
getSelfEthAddress(): Promise<string | null>;
|
|
1558
1553
|
/**
|
|
1559
1554
|
* Enumerate every wallet the authenticated user currently controls
|
|
1560
|
-
* under
|
|
1555
|
+
* under multi-wallet custody.
|
|
1561
1556
|
*
|
|
1562
1557
|
* `primary` is the identity-bearing wallet — same address
|
|
1563
1558
|
* {@link getSelfEthAddress} returns, same address the host signs
|
|
@@ -1567,7 +1562,7 @@ declare class T3nClient {
|
|
|
1567
1562
|
* only via an explicit sign-with-wallet flow — never ambient.
|
|
1568
1563
|
*
|
|
1569
1564
|
* Backed by `tee:user/list-user-wallets` which delegates to the
|
|
1570
|
-
* signing host's `list-user-wallets` primitive.
|
|
1565
|
+
* signing host's `list-user-wallets` primitive.
|
|
1571
1566
|
*
|
|
1572
1567
|
* @throws if unauthenticated, if the node rejects the action, or if
|
|
1573
1568
|
* the response shape is unexpected.
|
|
@@ -1585,7 +1580,7 @@ declare class T3nClient {
|
|
|
1585
1580
|
* this wallet onto a new owner, `Abandoned` if
|
|
1586
1581
|
* {@link removeUserWithWalletAbandonment} was called on the last
|
|
1587
1582
|
* owner. Public-safe data: DIDs + timestamps + reason codes only,
|
|
1588
|
-
* no key material or PII.
|
|
1583
|
+
* no key material or PII.
|
|
1589
1584
|
*
|
|
1590
1585
|
* @param walletAddress 0x-prefixed 40-char hex Ethereum address.
|
|
1591
1586
|
* @throws if the node rejects the action or if the response is not
|
|
@@ -1603,7 +1598,7 @@ declare class T3nClient {
|
|
|
1603
1598
|
* exists as an opt-in alternative to {@link removeUser}, which
|
|
1604
1599
|
* refuses when the DID owns wallets. Callers must sweep funds
|
|
1605
1600
|
* off-chain BEFORE calling this if they want to retain access —
|
|
1606
|
-
* the host does not reconcile balances.
|
|
1601
|
+
* the host does not reconcile balances.
|
|
1607
1602
|
*
|
|
1608
1603
|
* Requires the session to be Authenticated (SelfOnly delegation).
|
|
1609
1604
|
*
|
|
@@ -1617,7 +1612,7 @@ declare class T3nClient {
|
|
|
1617
1612
|
* Returns the current snapshot of the authenticated user's Level 2
|
|
1618
1613
|
* KYC state — see [[KycStatus]] for the four possible terminal /
|
|
1619
1614
|
* non-terminal values. The caller usually wants
|
|
1620
|
-
* [[kycStatusPoll]] (which loops with
|
|
1615
|
+
* [[kycStatusPoll]] (which loops with backoff cadence until a
|
|
1621
1616
|
* terminal status arrives), but the bare snapshot is useful for
|
|
1622
1617
|
* pages that need to render the user's standing without waiting
|
|
1623
1618
|
* (e.g. account-status views, "did the user finish KYC last time
|
|
@@ -1696,7 +1691,7 @@ declare class T3nClient {
|
|
|
1696
1691
|
* `t3n.user-input.kyc.1` once every Level-1 field is present, and
|
|
1697
1692
|
* commits the write.
|
|
1698
1693
|
*
|
|
1699
|
-
* **Pre-condition
|
|
1694
|
+
* **Pre-condition**: the DID must already have a
|
|
1700
1695
|
* verified email — either because {@link otpVerify} bound one or
|
|
1701
1696
|
* because the session carries a proving authenticator (OIDC /
|
|
1702
1697
|
* Email auth). Calls without proof are rejected with
|
|
@@ -1743,7 +1738,7 @@ declare class T3nClient {
|
|
|
1743
1738
|
attestations?: unknown;
|
|
1744
1739
|
keys?: Record<string, unknown>;
|
|
1745
1740
|
/**
|
|
1746
|
-
*
|
|
1741
|
+
* Testnet self-admit, propagated to the inner
|
|
1747
1742
|
* {@link submitUserInput} call. Inspect `result.tenantAdmit` for
|
|
1748
1743
|
* the outcome.
|
|
1749
1744
|
*/
|
|
@@ -1754,7 +1749,7 @@ declare class T3nClient {
|
|
|
1754
1749
|
* Poll `kyc-status` until a terminal status arrives or the
|
|
1755
1750
|
* configured timeout elapses.
|
|
1756
1751
|
*
|
|
1757
|
-
* Cadence defaults to
|
|
1752
|
+
* Cadence defaults to: 2-second interval for the
|
|
1758
1753
|
* first 30 seconds, then 5 seconds, with a 5-minute hard cap.
|
|
1759
1754
|
* Override via `opts.cadence` if you need different numbers
|
|
1760
1755
|
* (e.g. tests that don't want to wait the full 30 seconds before
|
|
@@ -1780,7 +1775,7 @@ declare class T3nClient {
|
|
|
1780
1775
|
kycStatusPoll(opts?: KycPollOptions): Promise<KycStatus>;
|
|
1781
1776
|
/**
|
|
1782
1777
|
* The server-minted session ID once handshake has completed, or
|
|
1783
|
-
* `null` beforehand
|
|
1778
|
+
* `null` beforehand.
|
|
1784
1779
|
*/
|
|
1785
1780
|
getSessionId(): SessionId | null;
|
|
1786
1781
|
getStatus(): SessionStatus;
|
|
@@ -1862,23 +1857,20 @@ declare class T3nClient {
|
|
|
1862
1857
|
*
|
|
1863
1858
|
* JSON-RPC `error.message` is the generic category string
|
|
1864
1859
|
* ("Invalid params", "Internal error", …). The node attaches the
|
|
1865
|
-
* actionable text and per-request correlation id in `error.data
|
|
1866
|
-
* — see `node/api/src/responses/rpc.rs::from_service_error`.
|
|
1860
|
+
* actionable text and per-request correlation id in `error.data`.
|
|
1867
1861
|
* Extract both so callers (and toasts that only render `.message`)
|
|
1868
|
-
* get the real reason plus an id an operator can grep in
|
|
1869
|
-
* `api::error` logs.
|
|
1862
|
+
* get the real reason plus an id an operator can grep in the logs.
|
|
1870
1863
|
*
|
|
1871
|
-
*
|
|
1864
|
+
* Chargepoint denials surface as a typed
|
|
1872
1865
|
* `InsufficientCreditError` so frontends can branch on
|
|
1873
1866
|
* `instanceof` to render an "out of credit" UI without
|
|
1874
|
-
* prefix-matching the message themselves.
|
|
1875
|
-
* by `api/src/error.rs::service_insufficient_credit_wire_format_is_stable`.
|
|
1867
|
+
* prefix-matching the message themselves. The wire format is stable.
|
|
1876
1868
|
*/
|
|
1877
1869
|
private throwIfRpcError;
|
|
1878
1870
|
private sendMultipartRpcRequest;
|
|
1879
1871
|
/**
|
|
1880
1872
|
* Capture the server-minted `Session-Id` from the last handshake
|
|
1881
|
-
* response headers
|
|
1873
|
+
* response headers. Validates shape so a
|
|
1882
1874
|
* broken or MITM'd response fails loudly instead of leaving a
|
|
1883
1875
|
* garbage value in the client. Idempotent: only the first valid
|
|
1884
1876
|
* mint per session is honoured — subsequent handshake RPC legs
|
|
@@ -1959,10 +1951,10 @@ declare function createRandomHandler(): GuestToHostHandler;
|
|
|
1959
1951
|
declare function createDefaultHandlers(baseUrl: string): GuestToHostHandlers;
|
|
1960
1952
|
|
|
1961
1953
|
/**
|
|
1962
|
-
* User-to-Agent Delegation
|
|
1954
|
+
* User-to-Agent Delegation.
|
|
1963
1955
|
*
|
|
1964
1956
|
* TypeScript reference implementation of the delegation credential and
|
|
1965
|
-
* envelope shapes defined
|
|
1957
|
+
* envelope shapes defined by the delegation wire contract.
|
|
1966
1958
|
*
|
|
1967
1959
|
* The wire shape is byte-for-byte identical to the Rust source — pinned
|
|
1968
1960
|
* by the KAT fixtures under `tests/kat/`. Specifically:
|
|
@@ -2049,11 +2041,11 @@ interface PayrollRunRequest {
|
|
|
2049
2041
|
/** `employee_id` → previous-cycle baseline net disbursement, cents (decimal string). */
|
|
2050
2042
|
historical_baselines: Record<string, string>;
|
|
2051
2043
|
/**
|
|
2052
|
-
* Per-employee disbursement flag threshold, in cents. Mirrors
|
|
2053
|
-
*
|
|
2054
|
-
*
|
|
2055
|
-
*
|
|
2056
|
-
*
|
|
2044
|
+
* Per-employee disbursement flag threshold, in cents. Mirrors the
|
|
2045
|
+
* payroll request's individual-disbursement threshold field.
|
|
2046
|
+
* When absent the contract applies its own default (SGD 15,000). When
|
|
2047
|
+
* present, the value is included in the wire shape and participates in
|
|
2048
|
+
* the request hash.
|
|
2057
2049
|
*/
|
|
2058
2050
|
individual_disbursement_threshold_cents?: bigint;
|
|
2059
2051
|
}
|
|
@@ -2091,7 +2083,7 @@ interface SignDelegationResponse {
|
|
|
2091
2083
|
declare function b64uEncode(input: Uint8Array): string;
|
|
2092
2084
|
/**
|
|
2093
2085
|
* Encode raw bytes to base64url-no-pad (RFC 4648 §5 with padding
|
|
2094
|
-
* dropped). The same encoding
|
|
2086
|
+
* dropped). The same encoding the wire-shape uses for binary
|
|
2095
2087
|
* fields (`agent_pubkey`, `vc_id`, `nonce`, `agent_sig`, `user_sig`,
|
|
2096
2088
|
* `request_hash`, `credential_jcs`).
|
|
2097
2089
|
*
|
|
@@ -2154,7 +2146,7 @@ interface BuildDelegationCredentialOpts {
|
|
|
2154
2146
|
*/
|
|
2155
2147
|
declare function buildDelegationCredential(opts: BuildDelegationCredentialOpts): DelegationCredential;
|
|
2156
2148
|
/**
|
|
2157
|
-
* Body-level validation matching
|
|
2149
|
+
* Body-level validation matching the delegation credential-body validation,
|
|
2158
2150
|
* minus the `now`/`max_validity_secs` checks (which are caller-supplied).
|
|
2159
2151
|
* Throws with a message identifying the offending invariant.
|
|
2160
2152
|
*/
|
|
@@ -2172,7 +2164,7 @@ declare function signCredential(jcs: Uint8Array, secret: Uint8Array): {
|
|
|
2172
2164
|
};
|
|
2173
2165
|
/**
|
|
2174
2166
|
* Recover the 20-byte ETH address that signed `msg` under EIP-191.
|
|
2175
|
-
* Mirrors
|
|
2167
|
+
* Mirrors the delegation contract's EIP-191 address recovery.
|
|
2176
2168
|
*
|
|
2177
2169
|
* **Signature malleability — accepted by design.** This routine does
|
|
2178
2170
|
* not enforce low-s. EIP-2 mandates low-s for *transaction* signatures,
|
|
@@ -2185,8 +2177,8 @@ declare function signCredential(jcs: Uint8Array, secret: Uint8Array): {
|
|
|
2185
2177
|
declare function ethRecoverEip191(msg: Uint8Array, sig: Uint8Array): Uint8Array;
|
|
2186
2178
|
/**
|
|
2187
2179
|
* Sign the agent-side invocation pre-image. The signature is raw
|
|
2188
|
-
* compact ECDSA (64 bytes) over `sha256(preimage)` —
|
|
2189
|
-
*
|
|
2180
|
+
* compact ECDSA (64 bytes) over `sha256(preimage)` — the 64-byte form
|
|
2181
|
+
* the delegation contract accepts.
|
|
2190
2182
|
*/
|
|
2191
2183
|
declare function signAgentInvocation(preimage: Uint8Array, secret: Uint8Array): Uint8Array;
|
|
2192
2184
|
/**
|
|
@@ -2221,9 +2213,6 @@ interface SignCustodialResult {
|
|
|
2221
2213
|
* The client must be constructed with an authenticated {@link T3nClient}
|
|
2222
2214
|
* instance and the node's base URL; `signCustodial` sends the credential
|
|
2223
2215
|
* body to the TEE and returns the signed bytes.
|
|
2224
|
-
*
|
|
2225
|
-
* Reference: `node/tests/harness/src/payroll_seed.rs` (the
|
|
2226
|
-
* `tee:delegation.sign` invocation at line 550).
|
|
2227
2216
|
*/
|
|
2228
2217
|
declare class DelegationCustodialClient {
|
|
2229
2218
|
private readonly t3n;
|
|
@@ -2687,13 +2676,13 @@ declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
|
2687
2676
|
*/
|
|
2688
2677
|
declare function assertShape<T>(value: unknown, guard: (v: unknown) => v is T, where: string): T;
|
|
2689
2678
|
|
|
2679
|
+
type Environment = "testnet" | "production";
|
|
2680
|
+
declare const NODE_URLS: Record<Environment, string>;
|
|
2681
|
+
|
|
2690
2682
|
/**
|
|
2691
2683
|
* Configuration types for T3n SDK
|
|
2692
2684
|
*/
|
|
2693
|
-
|
|
2694
|
-
* Environment type for SDK configuration
|
|
2695
|
-
*/
|
|
2696
|
-
type Environment = "local" | "staging" | "testnet" | "production" | "test";
|
|
2685
|
+
|
|
2697
2686
|
/**
|
|
2698
2687
|
* SDK configuration structure
|
|
2699
2688
|
*/
|
|
@@ -2790,11 +2779,6 @@ declare function validateConfig(config: unknown): ConfigValidationResult;
|
|
|
2790
2779
|
* `${nodeUrl}/status` (`encaps_key` field) and cached per-URL.
|
|
2791
2780
|
*/
|
|
2792
2781
|
|
|
2793
|
-
/**
|
|
2794
|
-
* Default node URLs per environment. Override at runtime via `setNodeUrl()`
|
|
2795
|
-
* or by passing `baseUrl` to `T3nClient`.
|
|
2796
|
-
*/
|
|
2797
|
-
declare const NODE_URLS: Record<Environment, string>;
|
|
2798
2782
|
/** DKG attestation bundle from the cluster. */
|
|
2799
2783
|
interface DkgAttestation {
|
|
2800
2784
|
/** Sorted base58 peer IDs that participated in DKG. */
|
|
@@ -2860,5 +2844,187 @@ declare function clearKeyCache(): void;
|
|
|
2860
2844
|
*/
|
|
2861
2845
|
declare function loadConfig(baseUrl?: string): SdkConfig;
|
|
2862
2846
|
|
|
2863
|
-
|
|
2864
|
-
|
|
2847
|
+
type TenantSdkEnvironment = "testnet" | "production";
|
|
2848
|
+
|
|
2849
|
+
/**
|
|
2850
|
+
* Minimal structural seam for the authenticated base client a TenantClient
|
|
2851
|
+
* dispatches through. Kept as an interface (rather than the concrete
|
|
2852
|
+
* `T3nClient` class) so tests can inject mocks and so a control-plane-only
|
|
2853
|
+
* client — which lacks `getUsage` — also satisfies it.
|
|
2854
|
+
*/
|
|
2855
|
+
interface TenantBaseClient {
|
|
2856
|
+
execute(payload: unknown): Promise<string>;
|
|
2857
|
+
executeWithBlob(payload: unknown, blob: Uint8Array | Blob): Promise<string>;
|
|
2858
|
+
executeAndDecode?<T = unknown>(payload: unknown): Promise<T>;
|
|
2859
|
+
/**
|
|
2860
|
+
* Token usage feed (`token.get-usage`). Present on the full
|
|
2861
|
+
* authenticated base `T3nClient`; absent on a control-plane-only client.
|
|
2862
|
+
*/
|
|
2863
|
+
getUsage?(opts?: GetUsageOptions): Promise<UsagePage>;
|
|
2864
|
+
}
|
|
2865
|
+
interface TenantClientConfig {
|
|
2866
|
+
environment?: TenantSdkEnvironment;
|
|
2867
|
+
/** Node URL for `getScriptVersion` during business contract execution. Falls back to `baseUrl`. */
|
|
2868
|
+
endpoint?: string;
|
|
2869
|
+
t3n?: TenantBaseClient;
|
|
2870
|
+
baseUrl?: string;
|
|
2871
|
+
tenantDid?: string;
|
|
2872
|
+
tenantScriptName?: string;
|
|
2873
|
+
}
|
|
2874
|
+
type TenantStatus = "pending" | "active" | "suspended";
|
|
2875
|
+
interface TenantMeResponse {
|
|
2876
|
+
tenant: string;
|
|
2877
|
+
eth_address: string;
|
|
2878
|
+
label: string;
|
|
2879
|
+
status: TenantStatus;
|
|
2880
|
+
quotas: unknown;
|
|
2881
|
+
created_at: string;
|
|
2882
|
+
}
|
|
2883
|
+
/**
|
|
2884
|
+
* Response shape for the testnet self-admit path. `granted_credits`
|
|
2885
|
+
* is `null` on the idempotent `already-admitted` retry.
|
|
2886
|
+
*/
|
|
2887
|
+
interface TenantSelfAdmitResult {
|
|
2888
|
+
status: "admitted" | "already-admitted";
|
|
2889
|
+
tenant: string;
|
|
2890
|
+
granted_credits: number | null;
|
|
2891
|
+
}
|
|
2892
|
+
type MapVisibility = string;
|
|
2893
|
+
type WriterSet = "all" | "All" | {
|
|
2894
|
+
only: number[];
|
|
2895
|
+
} | {
|
|
2896
|
+
Only: number[];
|
|
2897
|
+
};
|
|
2898
|
+
type ReaderSet = "all" | "All" | {
|
|
2899
|
+
only: number[];
|
|
2900
|
+
} | {
|
|
2901
|
+
Only: number[];
|
|
2902
|
+
};
|
|
2903
|
+
interface MapCreateInput {
|
|
2904
|
+
tail: string;
|
|
2905
|
+
visibility: MapVisibility;
|
|
2906
|
+
writers: WriterSet;
|
|
2907
|
+
readers?: ReaderSet;
|
|
2908
|
+
keyValidator?: unknown;
|
|
2909
|
+
}
|
|
2910
|
+
interface MapUpdateInput {
|
|
2911
|
+
visibility?: MapVisibility;
|
|
2912
|
+
writers?: WriterSet;
|
|
2913
|
+
readers?: ReaderSet;
|
|
2914
|
+
keyValidator?: unknown;
|
|
2915
|
+
adminReadable?: boolean;
|
|
2916
|
+
extraReadGrants?: string[];
|
|
2917
|
+
extraWriteGrants?: string[];
|
|
2918
|
+
}
|
|
2919
|
+
interface MapResponse {
|
|
2920
|
+
name: string;
|
|
2921
|
+
tail: string;
|
|
2922
|
+
visibility: MapVisibility;
|
|
2923
|
+
writers: WriterSet;
|
|
2924
|
+
readers: ReaderSet;
|
|
2925
|
+
metadata?: Record<string, unknown>;
|
|
2926
|
+
}
|
|
2927
|
+
interface ContractPublishInput {
|
|
2928
|
+
tail: string;
|
|
2929
|
+
version: string;
|
|
2930
|
+
wasm: Uint8Array | Blob;
|
|
2931
|
+
/**
|
|
2932
|
+
* Optional hex SHA-256 of the source bundle this WASM was built from, for the
|
|
2933
|
+
* WASM scanner's source-to-bytecode attestation. Use the
|
|
2934
|
+
* same algorithm as the scanner / `tee-contract-source-hash`. Stored verbatim
|
|
2935
|
+
* on chain; never gates execution. Omit if you are not publishing source.
|
|
2936
|
+
*/
|
|
2937
|
+
source_hash?: string;
|
|
2938
|
+
}
|
|
2939
|
+
interface ContractExecuteInput {
|
|
2940
|
+
version: string;
|
|
2941
|
+
functionName: string;
|
|
2942
|
+
input?: unknown;
|
|
2943
|
+
}
|
|
2944
|
+
|
|
2945
|
+
type JsonObject = Record<string, unknown>;
|
|
2946
|
+
interface TenantExecutionSession {
|
|
2947
|
+
executeAndDecode<T = unknown>(payload: unknown, schema?: ContractResponseSchema<T>): Promise<T>;
|
|
2948
|
+
}
|
|
2949
|
+
interface ExecuteBusinessContractOptions<T = unknown> {
|
|
2950
|
+
tenant: string;
|
|
2951
|
+
contract: string;
|
|
2952
|
+
functionName: string;
|
|
2953
|
+
input: Record<string, unknown>;
|
|
2954
|
+
schema?: ContractResponseSchema<T>;
|
|
2955
|
+
}
|
|
2956
|
+
type TenantMapCreateInput = MapCreateInput;
|
|
2957
|
+
type TenantMapUpdatePatch = MapUpdateInput;
|
|
2958
|
+
type TenantContractPublishInput = ContractPublishInput;
|
|
2959
|
+
type TenantContractExecuteInput = ContractExecuteInput;
|
|
2960
|
+
declare class TenantNamespace {
|
|
2961
|
+
private readonly client;
|
|
2962
|
+
constructor(client: TenantClient);
|
|
2963
|
+
claim(): Promise<unknown>;
|
|
2964
|
+
me(): Promise<unknown>;
|
|
2965
|
+
}
|
|
2966
|
+
declare class TenantMapsNamespace {
|
|
2967
|
+
private readonly client;
|
|
2968
|
+
constructor(client: TenantClient);
|
|
2969
|
+
create(input: MapCreateInput): Promise<unknown>;
|
|
2970
|
+
update(tail: string, patch: MapUpdateInput): Promise<unknown>;
|
|
2971
|
+
delete(tail: string): Promise<unknown>;
|
|
2972
|
+
}
|
|
2973
|
+
declare class TenantContractsNamespace {
|
|
2974
|
+
private readonly client;
|
|
2975
|
+
constructor(client: TenantClient);
|
|
2976
|
+
publish(input: ContractPublishInput): Promise<unknown>;
|
|
2977
|
+
register(input: ContractPublishInput): Promise<unknown>;
|
|
2978
|
+
disable(tail: string): Promise<unknown>;
|
|
2979
|
+
enable(tail: string): Promise<unknown>;
|
|
2980
|
+
unregister(tail: string): Promise<unknown>;
|
|
2981
|
+
execute(tail: string, input: ContractExecuteInput): Promise<unknown>;
|
|
2982
|
+
private contractStateChange;
|
|
2983
|
+
}
|
|
2984
|
+
declare class TenantTokenNamespace {
|
|
2985
|
+
private readonly client;
|
|
2986
|
+
constructor(client: TenantClient);
|
|
2987
|
+
/**
|
|
2988
|
+
* Fetch the caller's token usage feed (current balance + a paginated
|
|
2989
|
+
* slice of recent ledger entries — charges, mints, transfers).
|
|
2990
|
+
*
|
|
2991
|
+
* Thin pass-through to the authenticated base `T3nClient`'s
|
|
2992
|
+
* `token.get-usage` RPC. Requires `config.t3n` to be a full
|
|
2993
|
+
* authenticated `T3nClient` that exposes `getUsage`; the narrow control
|
|
2994
|
+
* client used for control-plane-only flows does not.
|
|
2995
|
+
*/
|
|
2996
|
+
getUsage(opts?: GetUsageOptions): Promise<UsagePage>;
|
|
2997
|
+
}
|
|
2998
|
+
/**
|
|
2999
|
+
* TenantClient exposes tenant SDK client-side capabilities.
|
|
3000
|
+
*
|
|
3001
|
+
* Supports tenant control-plane helpers, direct tenant-local business contract
|
|
3002
|
+
* execution, and config inspection.
|
|
3003
|
+
*/
|
|
3004
|
+
declare class TenantClient {
|
|
3005
|
+
readonly config: Readonly<TenantClientConfig>;
|
|
3006
|
+
readonly tenant: TenantNamespace;
|
|
3007
|
+
readonly maps: TenantMapsNamespace;
|
|
3008
|
+
readonly contracts: TenantContractsNamespace;
|
|
3009
|
+
readonly token: TenantTokenNamespace;
|
|
3010
|
+
constructor(config: TenantClientConfig);
|
|
3011
|
+
getEnvironment(): TenantClientConfig["environment"];
|
|
3012
|
+
canonicalName(tail: string): string;
|
|
3013
|
+
controlPayload(functionName: string, input: unknown): Promise<JsonObject>;
|
|
3014
|
+
executeControl(functionName: string, input: unknown): Promise<unknown>;
|
|
3015
|
+
executeBusinessContract<T = unknown>(session: TenantExecutionSession, options: ExecuteBusinessContractOptions<T>): Promise<T>;
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
declare class TenantSdkValidationError extends Error {
|
|
3019
|
+
constructor(message: string);
|
|
3020
|
+
}
|
|
3021
|
+
declare class UnsupportedTenantSdkOperationError extends Error {
|
|
3022
|
+
constructor(message: string);
|
|
3023
|
+
}
|
|
3024
|
+
|
|
3025
|
+
declare function tenantDidHex(tenantDid: string): string;
|
|
3026
|
+
declare function validateTail(tail: string): string;
|
|
3027
|
+
declare function canonicalTenantName(tenantDid: string, tail: string): string;
|
|
3028
|
+
|
|
3029
|
+
export { AGENT_PUBKEY_LEN, AuthMethod, AuthenticationError, ContractResponseError, DEFAULT_INDIVIDUAL_THRESHOLD_CENTS, DEFAULT_KYC_POLL_CADENCE, DELEGATION_CREDENTIAL_DOMAIN, DELEGATION_INVOCATION_DOMAIN, DelegationCustodialClient, ETH_SIG_LEN, HandshakeError, HttpTransport, KycStatusTimeoutError, LogLevel, MAX_FUNCTIONS_PER_CREDENTIAL, MockTransport, NODE_URLS, NONCE_LEN, OrgDataClient, PAYROLL_FUNCTIONS_V1, REQUEST_HASH_LEN, RpcError, SessionExpiredError, SessionOrgDataClient, SessionStateError, SessionStatus, T3nClient, T3nError, TERMINAL_KYC_STATUSES, TenantClient, TenantContractsNamespace, TenantMapsNamespace, TenantNamespace, TenantSdkValidationError, TenantTokenNamespace, UnsupportedTenantSdkOperationError, UserUpsertError, VC_ID_LEN, WasmError, _b64uEncode, assertShape, b64uDecodeStrict, b64uEncodeBytes, buildDelegationCredential, buildInvocationPreimage, buildPayrollDirectInvocation, buildPayrollInvocation, bytesToString, canonicalTenantName, canonicaliseCredential, canonicaliseRequest, clearKeyCache, compactDidFromBytes, createDefaultHandlers, createEthAuthInput, createLogger, createMlKemPublicKeyHandler, createOidcAuthInput, createOrgDataClientFromSession, createRandomHandler, decodeWasmErrorMessage, eip191Digest, ethRecoverEip191, eth_get_address, extractWasmError, fetchDkgAttestation, fetchMlKemPublicKey, generateRandomString, generateUUID, getEnvironment, getEnvironmentName, getGlobalLogLevel, getLogger, getNodeUrl, getScriptVersion, isDataGetResponse, isDataListResponse, isMutationResponse, isObject, isOrgContractGrants, isOrgPolicyMeta, isOrgWriters, loadConfig, loadWasmComponent, metamask_get_address, metamask_sign, parseContractResponse, redactSecrets, redactSecretsFromJson, requestHash, revokeDelegation, setEnvironment, setGlobalLogLevel, setNodeUrl, signAgentInvocation, signCredential, stringToBytes, tenantDidHex, validateConfig, validateCredentialBody, validateTail, verifyDkgAttestation, verifyTdxQuote };
|
|
3030
|
+
export type { AgeBand, AuthInput, BalanceRow, BuildDelegationCredentialOpts, BuildPayrollDirectInvocationOpts, BuildPayrollInvocationOpts, ChargeReason, ClientAuth, ClientHandshake, ConfigValidationResult, ContractExecuteInput, ContractPublishInput, ContractResponseSchema, CreatePolicyInput, DataGetInput, DataGetResponse, DataListInput, DataListResponse, DelegationCredential, DelegationCustodialClientOpts, DelegationEnvelope, DeleteDataInput, DeleteGrantsInput, DeleteScopeInput, Did, Direction, DkgAttestation, DkgVerifyResult, EmployeeRecord, EmploymentStatus, Environment, EthAuthInput, ExecuteBusinessContractOptions, ExecuteOrgDataActionOptions, ExpenseClaim, GetUsageOptions, GrantsGetInput, GuestToHostHandler, GuestToHostHandlers, HandshakeResult, JsonRpcRequest, JsonRpcResponse, KycPollCadence, KycPollOptions, KycStatus, KycStatusKind, Logger, MapCreateInput, MapResponse, MapUpdateInput, MapVisibility, MutationResponse, OidcAuthInput, OidcCredentials, OrgContractGrants, OrgDataActionWire, OrgDataClientOptions, OrgPolicyMeta, OrgWriters, OtpChannel, OtpMergeSuggestion, OtpRequestInput, OtpRequestResult, OtpVerifyInput, OtpVerifyResult, PayrollInvocation, PayrollInvocationDelegated, PayrollInvocationDirect, PayrollRunRequest, PeerQuoteResult, PolicyGetInput, QuoteVerifyResult, ReaderSet, ResidencyCategory, RevokeDelegationOpts, RevokeDelegationResult, SdkConfig, SessionCrypto, SessionId, SetGrantsInput, SetWritersInput, SignCustodialResult, SignDelegationResponse, SubmitUserInputArgs, SubmitUserInputResult, T3nClientConfig, TenantAdmitProjection, TenantAdmitStatus, TenantBaseClient, TenantClientConfig, TenantContractExecuteInput, TenantContractPublishInput, TenantExecutionSession, TenantMapCreateInput, TenantMapUpdatePatch, TenantMeResponse, TenantSdkEnvironment, TenantSelfAdmitResult, TenantStatus, TokenTxKind, Transport, UpdateMetaInput, UsageEntry, UsagePage, UserGrant, UserInputProfile, UserUpsertErrorKind, WasmComponent, WasmNextResult, WriteDataInput, WriterSet, WritersGetInput };
|