@terminal3/t3n-sdk 1.3.1 → 1.3.2
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 +122 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/src/client/t3n-client.d.ts +34 -0
- package/package.json +1 -1
|
@@ -14,6 +14,14 @@ import { KycPollOptions, KycStatus } from "../types/kyc";
|
|
|
14
14
|
export declare class T3nClient {
|
|
15
15
|
private readonly config;
|
|
16
16
|
private readonly transport;
|
|
17
|
+
/**
|
|
18
|
+
* Resolved node base URL. Snapshotted in the constructor so the
|
|
19
|
+
* typed contract wrappers (`kycStatus`, `getSelfEthAddress`, …)
|
|
20
|
+
* can call `getScriptVersion()` against the same host the
|
|
21
|
+
* transport talks to. Used only by the `script_version: "latest"`
|
|
22
|
+
* resolution path in {@link executeUserContract}.
|
|
23
|
+
*/
|
|
24
|
+
private readonly effectiveBaseUrl;
|
|
17
25
|
/**
|
|
18
26
|
* Server-minted session ID, set by {@link handshake} from the
|
|
19
27
|
* `Session-Id` response header (pentest M-1 / MAT-983). `null`
|
|
@@ -109,6 +117,32 @@ export declare class T3nClient {
|
|
|
109
117
|
* @throws {ContractResponseError} when the response is not valid JSON
|
|
110
118
|
*/
|
|
111
119
|
executeAndDecode<T = unknown>(payload: unknown, schema?: ContractResponseSchema<T>): Promise<T>;
|
|
120
|
+
/**
|
|
121
|
+
* Build the canonical `ExecuteActionRequest` shape the server
|
|
122
|
+
* expects in `node/primitives/src/action.rs::ExecuteActionRequest`
|
|
123
|
+
* (`script_name`, `script_version`, `function_name`, `input`,
|
|
124
|
+
* optional `pii_did`) and dispatch it through {@link execute}.
|
|
125
|
+
*
|
|
126
|
+
* Two pieces of glue live here that every typed user-contract
|
|
127
|
+
* wrapper would otherwise duplicate:
|
|
128
|
+
*
|
|
129
|
+
* 1. **Field naming.** The server deserialises strictly into
|
|
130
|
+
* `script_name` / `script_version` / `function_name` —
|
|
131
|
+
* sending `contract` / `version` / `function` produces
|
|
132
|
+
* `Invalid action request: missing field …` 400s. Centralising
|
|
133
|
+
* the names here means every wrapper agrees with the server.
|
|
134
|
+
* 2. **`"latest"` resolution.** `script_version` is `SemVer` on
|
|
135
|
+
* the server, so a literal `"latest"` cannot be parsed. We
|
|
136
|
+
* fetch the registered current version via
|
|
137
|
+
* `GET /api/contracts/current?name=…` (cached per script name
|
|
138
|
+
* in `getScriptVersion`) and forward the resolved
|
|
139
|
+
* `MAJOR.MINOR.PATCH` string.
|
|
140
|
+
*
|
|
141
|
+
* Wrappers that need PII delegation can extend this helper
|
|
142
|
+
* later — current call sites are all SelfOnly so `pii_did` stays
|
|
143
|
+
* implicit.
|
|
144
|
+
*/
|
|
145
|
+
private executeUserContract;
|
|
112
146
|
/**
|
|
113
147
|
* Return the authenticated user's Ethereum address from their
|
|
114
148
|
* T3N-hosted per-user wallet, as a 0x-prefixed lowercase hex string.
|