tenzro-sdk 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +4 -15
- package/README.md +196 -3
- package/dist/adaptive-burn.d.ts +40 -0
- package/dist/adaptive-burn.d.ts.map +1 -0
- package/dist/adaptive-burn.js +53 -0
- package/dist/adaptive-burn.js.map +1 -0
- package/dist/agent.d.ts +8 -1
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +14 -2
- package/dist/agent.js.map +1 -1
- package/dist/ap2.d.ts +96 -0
- package/dist/ap2.d.ts.map +1 -1
- package/dist/ap2.js +65 -0
- package/dist/ap2.js.map +1 -1
- package/dist/app.js +4 -4
- package/dist/app.js.map +1 -1
- package/dist/auth.d.ts +357 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +226 -0
- package/dist/auth.js.map +1 -0
- package/dist/bond.d.ts +70 -0
- package/dist/bond.d.ts.map +1 -0
- package/dist/bond.js +172 -0
- package/dist/bond.js.map +1 -0
- package/dist/cct.d.ts +53 -0
- package/dist/cct.d.ts.map +1 -0
- package/dist/cct.js +30 -0
- package/dist/cct.js.map +1 -0
- package/dist/client.d.ts +134 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +196 -12
- package/dist/client.js.map +1 -1
- package/dist/cortex.d.ts +227 -0
- package/dist/cortex.d.ts.map +1 -0
- package/dist/cortex.js +137 -0
- package/dist/cortex.js.map +1 -0
- package/dist/custody.d.ts +251 -0
- package/dist/custody.d.ts.map +1 -1
- package/dist/custody.js +216 -0
- package/dist/custody.js.map +1 -1
- package/dist/eip6963.d.ts +63 -0
- package/dist/eip6963.d.ts.map +1 -0
- package/dist/eip6963.js +67 -0
- package/dist/eip6963.js.map +1 -0
- package/dist/erc8004.d.ts +97 -0
- package/dist/erc8004.d.ts.map +1 -0
- package/dist/erc8004.js +182 -0
- package/dist/erc8004.js.map +1 -0
- package/dist/identity.d.ts +15 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +18 -0
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +28 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +49 -1
- package/dist/index.js.map +1 -1
- package/dist/insurance.d.ts +38 -0
- package/dist/insurance.d.ts.map +1 -0
- package/dist/insurance.js +51 -0
- package/dist/insurance.js.map +1 -0
- package/dist/lifecycle.d.ts +41 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +56 -0
- package/dist/lifecycle.js.map +1 -0
- package/dist/marketplace.d.ts +30 -2
- package/dist/marketplace.d.ts.map +1 -1
- package/dist/marketplace.js +36 -2
- package/dist/marketplace.js.map +1 -1
- package/dist/payment.d.ts +14 -1
- package/dist/payment.d.ts.map +1 -1
- package/dist/payment.js +15 -0
- package/dist/payment.js.map +1 -1
- package/dist/principal-chain.d.ts +41 -0
- package/dist/principal-chain.d.ts.map +1 -0
- package/dist/principal-chain.js +56 -0
- package/dist/principal-chain.js.map +1 -0
- package/dist/provider.d.ts +2 -2
- package/dist/provider.js +1 -1
- package/dist/quota.d.ts +54 -0
- package/dist/quota.d.ts.map +1 -0
- package/dist/quota.js +71 -0
- package/dist/quota.js.map +1 -0
- package/dist/rpc.d.ts +43 -4
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +110 -3
- package/dist/rpc.js.map +1 -1
- package/dist/seed-agent.d.ts +52 -0
- package/dist/seed-agent.d.ts.map +1 -0
- package/dist/seed-agent.js +69 -0
- package/dist/seed-agent.js.map +1 -0
- package/dist/settlement.d.ts +52 -10
- package/dist/settlement.d.ts.map +1 -1
- package/dist/settlement.js +197 -16
- package/dist/settlement.js.map +1 -1
- package/dist/streaming.js.map +1 -1
- package/dist/svm-cross-vm.d.ts +109 -0
- package/dist/svm-cross-vm.d.ts.map +1 -0
- package/dist/svm-cross-vm.js +215 -0
- package/dist/svm-cross-vm.js.map +1 -0
- package/dist/types.d.ts +175 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/wallet.d.ts +26 -9
- package/dist/wallet.d.ts.map +1 -1
- package/dist/wallet.js +34 -19
- package/dist/wallet.js.map +1 -1
- package/dist/wormhole.d.ts +76 -0
- package/dist/wormhole.d.ts.map +1 -0
- package/dist/wormhole.js +56 -0
- package/dist/wormhole.js.map +1 -0
- package/package.json +2 -2
package/dist/rpc.js
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RpcCallError = exports.RpcClient = void 0;
|
|
3
|
+
exports.RpcCallError = exports.RpcClient = exports.Eip1193Transport = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Adapter that turns an EIP-1193 provider into an `RpcTransport`. Used
|
|
6
|
+
* by `TenzroClient.fromInjected()` and any direct consumer that wants
|
|
7
|
+
* to route SDK calls through `window.tenzro` rather than a network
|
|
8
|
+
* endpoint.
|
|
9
|
+
*/
|
|
10
|
+
class Eip1193Transport {
|
|
11
|
+
provider;
|
|
12
|
+
constructor(provider) {
|
|
13
|
+
this.provider = provider;
|
|
14
|
+
}
|
|
15
|
+
async call(method, params = []) {
|
|
16
|
+
return this.provider.request({ method, params });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.Eip1193Transport = Eip1193Transport;
|
|
4
20
|
class RpcClient {
|
|
5
21
|
endpoint;
|
|
6
22
|
apiEndpoint;
|
|
7
23
|
timeout;
|
|
8
24
|
requestId = 0;
|
|
9
|
-
|
|
25
|
+
transport;
|
|
26
|
+
constructor(endpoint, apiEndpoint, timeout = 30000, transport) {
|
|
10
27
|
this.endpoint = endpoint;
|
|
11
28
|
this.timeout = timeout;
|
|
29
|
+
this.transport = transport;
|
|
12
30
|
// Derive API endpoint from RPC endpoint if not provided
|
|
13
31
|
if (apiEndpoint) {
|
|
14
32
|
this.apiEndpoint = apiEndpoint;
|
|
@@ -25,15 +43,38 @@ class RpcClient {
|
|
|
25
43
|
}
|
|
26
44
|
}
|
|
27
45
|
async call(method, params = []) {
|
|
46
|
+
// Injected-provider path: the extension owns auth + routing.
|
|
47
|
+
if (this.transport) {
|
|
48
|
+
return this.transport.call(method, params);
|
|
49
|
+
}
|
|
28
50
|
// Use modular arithmetic to prevent overflow beyond Number.MAX_SAFE_INTEGER
|
|
29
51
|
this.requestId = (this.requestId + 1) % Number.MAX_SAFE_INTEGER;
|
|
30
52
|
const id = this.requestId;
|
|
31
53
|
const controller = new AbortController();
|
|
32
54
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
55
|
+
// Ambient auth: forward `Authorization: DPoP <jwt>` and `DPoP: <proof>`
|
|
56
|
+
// headers from environment variables when set (Node only). This mirrors
|
|
57
|
+
// the Rust SDK's RpcClient and keeps SDK callsites free of private-key
|
|
58
|
+
// handling — the holder mints the JWT once during onboarding via
|
|
59
|
+
// AuthClient, then exports the token + per-call DPoP proof through
|
|
60
|
+
// TENZRO_BEARER_JWT / TENZRO_DPOP_PROOF.
|
|
61
|
+
const headers = { "Content-Type": "application/json" };
|
|
62
|
+
const proc = globalThis.process;
|
|
63
|
+
const env = proc && proc.env ? proc.env : undefined;
|
|
64
|
+
if (env) {
|
|
65
|
+
const bearer = env.TENZRO_BEARER_JWT;
|
|
66
|
+
if (bearer && bearer.length > 0) {
|
|
67
|
+
headers["Authorization"] = `DPoP ${bearer}`;
|
|
68
|
+
}
|
|
69
|
+
const dpop = env.TENZRO_DPOP_PROOF;
|
|
70
|
+
if (dpop && dpop.length > 0) {
|
|
71
|
+
headers["DPoP"] = dpop;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
33
74
|
try {
|
|
34
75
|
const response = await fetch(this.endpoint, {
|
|
35
76
|
method: "POST",
|
|
36
|
-
headers
|
|
77
|
+
headers,
|
|
37
78
|
body: JSON.stringify({ jsonrpc: "2.0", method, params, id }),
|
|
38
79
|
signal: controller.signal,
|
|
39
80
|
});
|
|
@@ -105,6 +146,72 @@ class RpcClient {
|
|
|
105
146
|
clearTimeout(timeoutId);
|
|
106
147
|
}
|
|
107
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Authenticated POST to the Web API. The `/wallet/*` endpoints
|
|
151
|
+
* require a fresh DPoP proof per request that signs over the exact
|
|
152
|
+
* `(method, htu)` pair — only the wallet kernel can produce that
|
|
153
|
+
* proof, so the SDK accepts both the bearer JWT and the proof as
|
|
154
|
+
* explicit arguments instead of reading them from ambient env.
|
|
155
|
+
*/
|
|
156
|
+
async postWithAuth(path, body, bearerJwt, dpopProof) {
|
|
157
|
+
const controller = new AbortController();
|
|
158
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
159
|
+
try {
|
|
160
|
+
const response = await fetch(`${this.apiEndpoint}${path}`, {
|
|
161
|
+
method: "POST",
|
|
162
|
+
headers: {
|
|
163
|
+
"Content-Type": "application/json",
|
|
164
|
+
Accept: "application/json",
|
|
165
|
+
Authorization: `DPoP ${bearerJwt}`,
|
|
166
|
+
DPoP: dpopProof,
|
|
167
|
+
},
|
|
168
|
+
body: JSON.stringify(body),
|
|
169
|
+
signal: controller.signal,
|
|
170
|
+
});
|
|
171
|
+
if (!response.ok) {
|
|
172
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
173
|
+
}
|
|
174
|
+
return (await response.json());
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
178
|
+
throw new Error(`Request timed out after ${this.timeout}ms`);
|
|
179
|
+
}
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
182
|
+
finally {
|
|
183
|
+
clearTimeout(timeoutId);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/** Authenticated GET counterpart to {@link postWithAuth}. */
|
|
187
|
+
async getWithAuth(path, bearerJwt, dpopProof) {
|
|
188
|
+
const controller = new AbortController();
|
|
189
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
190
|
+
try {
|
|
191
|
+
const response = await fetch(`${this.apiEndpoint}${path}`, {
|
|
192
|
+
method: "GET",
|
|
193
|
+
headers: {
|
|
194
|
+
Accept: "application/json",
|
|
195
|
+
Authorization: `DPoP ${bearerJwt}`,
|
|
196
|
+
DPoP: dpopProof,
|
|
197
|
+
},
|
|
198
|
+
signal: controller.signal,
|
|
199
|
+
});
|
|
200
|
+
if (!response.ok) {
|
|
201
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
202
|
+
}
|
|
203
|
+
return (await response.json());
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
207
|
+
throw new Error(`Request timed out after ${this.timeout}ms`);
|
|
208
|
+
}
|
|
209
|
+
throw error;
|
|
210
|
+
}
|
|
211
|
+
finally {
|
|
212
|
+
clearTimeout(timeoutId);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
108
215
|
getEndpoint() {
|
|
109
216
|
return this.endpoint;
|
|
110
217
|
}
|
package/dist/rpc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.js","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"rpc.js","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":";;;AAiCA;;;;;GAKG;AACH,MAAa,gBAAgB;IAER;IADnB,YACmB,QAKhB;QALgB,aAAQ,GAAR,QAAQ,CAKxB;IACA,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAI,MAAc,EAAE,SAA8C,EAAE;QAC5E,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACtD,CAAC;CACF;AAbD,4CAaC;AAED,MAAa,SAAS;IACZ,QAAQ,CAAS;IACjB,WAAW,CAAS;IACpB,OAAO,CAAS;IAChB,SAAS,GAAW,CAAC,C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AAY,CAAC,SAAS,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF;AAzOD,8BAyOC;AAED,MAAa,YAAa,SAAQ,KAAK;IAClB;IAAsC;IAAzD,YAAmB,IAAY,EAAE,OAAe,EAAS,IAAc;QACrE,KAAK,CAAC,aAAa,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QADtB,SAAI,GAAJ,IAAI,CAAQ;QAA0B,SAAI,GAAJ,IAAI,CAAU;QAErE,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AALD,oCAKC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { RpcClient } from "./rpc";
|
|
2
|
+
/**
|
|
3
|
+
* Client for the SeedAgent treasury earmark and protocol-owned bootstrap
|
|
4
|
+
* agent registry (Spec 10).
|
|
5
|
+
*
|
|
6
|
+
* The SeedAgent earmark is a genesis-funded TNZO allocation governed by
|
|
7
|
+
* a decay schedule and `Charter`s that enumerate which `OperationKind`s
|
|
8
|
+
* a seed agent may exercise (inference, task marketplace, bridge, etc.)
|
|
9
|
+
* with per-charter spend caps, target throughput, and counterparty
|
|
10
|
+
* filters.
|
|
11
|
+
*
|
|
12
|
+
* All endpoints here are read-only — provisioning, monthly decay, and
|
|
13
|
+
* sunset wind-down land in a later wave with the off-chain provisioning
|
|
14
|
+
* daemon and governance-executor mutation paths.
|
|
15
|
+
*/
|
|
16
|
+
export declare class SeedAgentClient {
|
|
17
|
+
private rpc;
|
|
18
|
+
constructor(rpc: RpcClient);
|
|
19
|
+
/**
|
|
20
|
+
* Returns the singleton `TreasuryEarmark` — genesis allocation,
|
|
21
|
+
* decay schedule, master enabled flag, and surplus-burn disposition.
|
|
22
|
+
* @returns Current `TreasuryEarmark`
|
|
23
|
+
*/
|
|
24
|
+
getTreasuryEarmark(): Promise<any>;
|
|
25
|
+
/**
|
|
26
|
+
* Fetch a single `Charter` by its identifier.
|
|
27
|
+
* @param charterId - Charter identifier
|
|
28
|
+
* @returns Charter record or null if not found
|
|
29
|
+
*/
|
|
30
|
+
getSeedAgentCharter(charterId: string): Promise<any>;
|
|
31
|
+
/**
|
|
32
|
+
* List every registered `Charter` (active and sunset).
|
|
33
|
+
* @returns Array of charter records
|
|
34
|
+
*/
|
|
35
|
+
listSeedAgentCharters(): Promise<any[]>;
|
|
36
|
+
/**
|
|
37
|
+
* List provisioned `SeedAgentRecord`s, optionally filtered by charter.
|
|
38
|
+
* @param charterId - Optional charter filter
|
|
39
|
+
* @returns Array of seed agent records
|
|
40
|
+
*/
|
|
41
|
+
listSeedAgents(charterId?: string): Promise<any[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Returns network activity metrics over the requested window. Used by
|
|
44
|
+
* the SeedAgent counterparty filter and the organic-activity dashboards
|
|
45
|
+
* to exclude protocol-owned bootstrap traffic during the 12-month
|
|
46
|
+
* earmark window.
|
|
47
|
+
* @param windowBlocks - Optional rolling window (in blocks)
|
|
48
|
+
* @returns Activity metrics snapshot
|
|
49
|
+
*/
|
|
50
|
+
getNetworkActivity(windowBlocks?: number): Promise<any>;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=seed-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed-agent.d.ts","sourceRoot":"","sources":["../src/seed-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC;;;;;;;;;;;;;GAaG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAElC;;;;OAIG;IACG,kBAAkB,IAAI,OAAO,CAAC,GAAG,CAAC;IAIxC;;;;OAIG;IACG,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAI1D;;;OAGG;IACG,qBAAqB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAI7C;;;;OAIG;IACG,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAKxD;;;;;;;OAOG;IACG,kBAAkB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAI9D"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SeedAgentClient = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Client for the SeedAgent treasury earmark and protocol-owned bootstrap
|
|
6
|
+
* agent registry (Spec 10).
|
|
7
|
+
*
|
|
8
|
+
* The SeedAgent earmark is a genesis-funded TNZO allocation governed by
|
|
9
|
+
* a decay schedule and `Charter`s that enumerate which `OperationKind`s
|
|
10
|
+
* a seed agent may exercise (inference, task marketplace, bridge, etc.)
|
|
11
|
+
* with per-charter spend caps, target throughput, and counterparty
|
|
12
|
+
* filters.
|
|
13
|
+
*
|
|
14
|
+
* All endpoints here are read-only — provisioning, monthly decay, and
|
|
15
|
+
* sunset wind-down land in a later wave with the off-chain provisioning
|
|
16
|
+
* daemon and governance-executor mutation paths.
|
|
17
|
+
*/
|
|
18
|
+
class SeedAgentClient {
|
|
19
|
+
rpc;
|
|
20
|
+
constructor(rpc) {
|
|
21
|
+
this.rpc = rpc;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Returns the singleton `TreasuryEarmark` — genesis allocation,
|
|
25
|
+
* decay schedule, master enabled flag, and surplus-burn disposition.
|
|
26
|
+
* @returns Current `TreasuryEarmark`
|
|
27
|
+
*/
|
|
28
|
+
async getTreasuryEarmark() {
|
|
29
|
+
return this.rpc.call("tenzro_getTreasuryEarmark", []);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Fetch a single `Charter` by its identifier.
|
|
33
|
+
* @param charterId - Charter identifier
|
|
34
|
+
* @returns Charter record or null if not found
|
|
35
|
+
*/
|
|
36
|
+
async getSeedAgentCharter(charterId) {
|
|
37
|
+
return this.rpc.call("tenzro_getSeedAgentCharter", [charterId]);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* List every registered `Charter` (active and sunset).
|
|
41
|
+
* @returns Array of charter records
|
|
42
|
+
*/
|
|
43
|
+
async listSeedAgentCharters() {
|
|
44
|
+
return this.rpc.call("tenzro_listSeedAgentCharters", []);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* List provisioned `SeedAgentRecord`s, optionally filtered by charter.
|
|
48
|
+
* @param charterId - Optional charter filter
|
|
49
|
+
* @returns Array of seed agent records
|
|
50
|
+
*/
|
|
51
|
+
async listSeedAgents(charterId) {
|
|
52
|
+
const params = charterId === undefined ? [] : [charterId];
|
|
53
|
+
return this.rpc.call("tenzro_listSeedAgents", params);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Returns network activity metrics over the requested window. Used by
|
|
57
|
+
* the SeedAgent counterparty filter and the organic-activity dashboards
|
|
58
|
+
* to exclude protocol-owned bootstrap traffic during the 12-month
|
|
59
|
+
* earmark window.
|
|
60
|
+
* @param windowBlocks - Optional rolling window (in blocks)
|
|
61
|
+
* @returns Activity metrics snapshot
|
|
62
|
+
*/
|
|
63
|
+
async getNetworkActivity(windowBlocks) {
|
|
64
|
+
const params = windowBlocks === undefined ? [] : [windowBlocks];
|
|
65
|
+
return this.rpc.call("tenzro_getNetworkActivity", params);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.SeedAgentClient = SeedAgentClient;
|
|
69
|
+
//# sourceMappingURL=seed-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed-agent.js","sourceRoot":"","sources":["../src/seed-agent.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;GAaG;AACH,MAAa,eAAe;IACN;IAApB,YAAoB,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAEtC;;;;OAIG;IACH,KAAK,CAAC,kBAAkB;QACtB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAC;IACxD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,mBAAmB,CAAC,SAAiB;QACzC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,4BAA4B,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAClE,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,qBAAqB;QACzB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAQ,8BAA8B,EAAE,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,cAAc,CAAC,SAAkB;QACrC,MAAM,MAAM,GAAc,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAQ,uBAAuB,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,kBAAkB,CAAC,YAAqB;QAC5C,MAAM,MAAM,GAAc,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;QAC3E,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC;CACF;AAnDD,0CAmDC"}
|
package/dist/settlement.d.ts
CHANGED
|
@@ -20,21 +20,63 @@ export declare class SettlementClient {
|
|
|
20
20
|
*/
|
|
21
21
|
getSettlement(receiptId: string): Promise<SettlementReceipt | null>;
|
|
22
22
|
/**
|
|
23
|
-
* Create an escrow
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* Create an on-chain escrow via a signed `CreateEscrow` transaction.
|
|
24
|
+
*
|
|
25
|
+
* The escrow_id is derived deterministically by the VM as
|
|
26
|
+
* `SHA-256("tenzro/escrow/id" || payer || nonce_le)` and the funds are
|
|
27
|
+
* locked at a vault address derived from that escrow_id. Only the signing
|
|
28
|
+
* payer can later release or refund.
|
|
29
|
+
*
|
|
30
|
+
* Authentication is ambient: the underlying RPC call carries the OAuth
|
|
31
|
+
* 2.1 bearer JWT and per-request DPoP proof from `TENZRO_BEARER_JWT` /
|
|
32
|
+
* `TENZRO_DPOP_PROOF` (set after onboarding via {@link AuthClient}). This
|
|
33
|
+
* SDK no longer takes raw private keys — signing happens server-side
|
|
34
|
+
* against the holder's MPC wallet, gated by the DPoP-bound bearer.
|
|
35
|
+
*
|
|
36
|
+
* @param payer - Payer address (the holder's MPC wallet address)
|
|
37
|
+
* @param payee - Recipient address upon successful release
|
|
38
|
+
* @param amount - Amount to lock in escrow (in wei, smallest unit)
|
|
26
39
|
* @param asset - Asset identifier (e.g., "TNZO")
|
|
27
|
-
* @param
|
|
28
|
-
* @
|
|
40
|
+
* @param expiresAt - Unix timestamp in milliseconds when the escrow expires
|
|
41
|
+
* @param releaseConditions - One of: "timeout" | "provider" | "consumer" |
|
|
42
|
+
* "both" | "verifier" | "custom"
|
|
43
|
+
* @returns Transaction hash
|
|
29
44
|
*/
|
|
30
|
-
createEscrow(payee: string, amount: bigint, asset: string,
|
|
45
|
+
createEscrow(payer: string, payee: string, amount: bigint, asset: string, expiresAt: bigint, releaseConditions: string): Promise<string>;
|
|
31
46
|
/**
|
|
32
|
-
* Release funds
|
|
33
|
-
*
|
|
34
|
-
*
|
|
47
|
+
* Release escrowed funds to the payee via a signed `ReleaseEscrow` transaction.
|
|
48
|
+
* Only the original payer can submit this — the VM rejects releases from any
|
|
49
|
+
* other address. Authentication is ambient (see {@link createEscrow}).
|
|
50
|
+
*
|
|
51
|
+
* @param payer - Payer address (the holder's MPC wallet address)
|
|
52
|
+
* @param escrowId - 32-byte escrow id (hex with or without 0x)
|
|
53
|
+
* @param proof - Optional proof bytes (hex with or without 0x)
|
|
35
54
|
* @returns Transaction hash
|
|
36
55
|
*/
|
|
37
|
-
releaseEscrow(escrowId: string, proof?: string): Promise<string>;
|
|
56
|
+
releaseEscrow(payer: string, escrowId: string, proof?: string): Promise<string>;
|
|
57
|
+
/**
|
|
58
|
+
* Refund escrowed funds back to the payer via a signed `RefundEscrow` transaction.
|
|
59
|
+
* Only the original payer can submit this, AND the escrow must be expired
|
|
60
|
+
* (or use Timeout/Custom release conditions). Authentication is ambient
|
|
61
|
+
* (see {@link createEscrow}).
|
|
62
|
+
*/
|
|
63
|
+
refundEscrow(payer: string, escrowId: string): Promise<string>;
|
|
64
|
+
/** Inspect an escrow record by its 32-byte id. */
|
|
65
|
+
getEscrow(escrowId: string): Promise<any>;
|
|
66
|
+
/**
|
|
67
|
+
* List every escrow whose `payer` matches the given address.
|
|
68
|
+
* @param payer - Payer address (the wallet that created the escrow)
|
|
69
|
+
* @returns Array of escrow records (empty if payer has none)
|
|
70
|
+
*/
|
|
71
|
+
listEscrowsByPayer(payer: string): Promise<any[]>;
|
|
72
|
+
/**
|
|
73
|
+
* List every escrow whose `payee` matches the given address.
|
|
74
|
+
* @param payee - Payee address (the recipient on successful release)
|
|
75
|
+
* @returns Array of escrow records (empty if payee has none)
|
|
76
|
+
*/
|
|
77
|
+
listEscrowsByPayee(payee: string): Promise<any[]>;
|
|
78
|
+
/** Internal helper: fetch nonce + chain_id with safe defaults. */
|
|
79
|
+
private fetchNonceAndChainId;
|
|
38
80
|
/**
|
|
39
81
|
* Open a micropayment channel for streaming payments.
|
|
40
82
|
* @param payee - Address receiving payments
|
package/dist/settlement.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settlement.d.ts","sourceRoot":"","sources":["../src/settlement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CA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AM,GACf,OAAO,CAAC,MAAM,CAAC;IA2BlB,kDAAkD;IAC5C,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAM/C;;;;OAIG;IACG,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAIvD;;;;OAIG;IACG,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAIvD,kEAAkE;YACpD,oBAAoB;IAuBlC;;;;;OAKG;IACG,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IASzE;;;;OAIG;IACG,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAK3D"}
|
package/dist/settlement.js
CHANGED
|
@@ -29,33 +29,191 @@ class SettlementClient {
|
|
|
29
29
|
]);
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* Create an escrow
|
|
33
|
-
*
|
|
34
|
-
*
|
|
32
|
+
* Create an on-chain escrow via a signed `CreateEscrow` transaction.
|
|
33
|
+
*
|
|
34
|
+
* The escrow_id is derived deterministically by the VM as
|
|
35
|
+
* `SHA-256("tenzro/escrow/id" || payer || nonce_le)` and the funds are
|
|
36
|
+
* locked at a vault address derived from that escrow_id. Only the signing
|
|
37
|
+
* payer can later release or refund.
|
|
38
|
+
*
|
|
39
|
+
* Authentication is ambient: the underlying RPC call carries the OAuth
|
|
40
|
+
* 2.1 bearer JWT and per-request DPoP proof from `TENZRO_BEARER_JWT` /
|
|
41
|
+
* `TENZRO_DPOP_PROOF` (set after onboarding via {@link AuthClient}). This
|
|
42
|
+
* SDK no longer takes raw private keys — signing happens server-side
|
|
43
|
+
* against the holder's MPC wallet, gated by the DPoP-bound bearer.
|
|
44
|
+
*
|
|
45
|
+
* @param payer - Payer address (the holder's MPC wallet address)
|
|
46
|
+
* @param payee - Recipient address upon successful release
|
|
47
|
+
* @param amount - Amount to lock in escrow (in wei, smallest unit)
|
|
35
48
|
* @param asset - Asset identifier (e.g., "TNZO")
|
|
36
|
-
* @param
|
|
37
|
-
* @
|
|
49
|
+
* @param expiresAt - Unix timestamp in milliseconds when the escrow expires
|
|
50
|
+
* @param releaseConditions - One of: "timeout" | "provider" | "consumer" |
|
|
51
|
+
* "both" | "verifier" | "custom"
|
|
52
|
+
* @returns Transaction hash
|
|
38
53
|
*/
|
|
39
|
-
async createEscrow(payee, amount, asset,
|
|
40
|
-
|
|
41
|
-
{
|
|
54
|
+
async createEscrow(payer, payee, amount, asset, expiresAt, releaseConditions) {
|
|
55
|
+
const conditionsJson = (() => {
|
|
56
|
+
switch (releaseConditions.toLowerCase()) {
|
|
57
|
+
case "timeout":
|
|
58
|
+
return { type: "Timeout" };
|
|
59
|
+
case "provider":
|
|
60
|
+
case "provider_signature":
|
|
61
|
+
return { type: "ProviderSignature" };
|
|
62
|
+
case "consumer":
|
|
63
|
+
case "consumer_signature":
|
|
64
|
+
return { type: "ConsumerSignature" };
|
|
65
|
+
case "both":
|
|
66
|
+
case "both_signatures":
|
|
67
|
+
return { type: "BothSignatures" };
|
|
68
|
+
case "verifier":
|
|
69
|
+
case "verifier_signature":
|
|
70
|
+
return { type: "VerifierSignature" };
|
|
71
|
+
case "custom":
|
|
72
|
+
return { type: "Custom", data: "" };
|
|
73
|
+
default:
|
|
74
|
+
throw new Error(`unsupported release condition '${releaseConditions}': use timeout|provider|consumer|both|verifier|custom`);
|
|
75
|
+
}
|
|
76
|
+
})();
|
|
77
|
+
const { nonce, chainId } = await this.fetchNonceAndChainId(payer);
|
|
78
|
+
const txType = {
|
|
79
|
+
type: "CreateEscrow",
|
|
80
|
+
data: {
|
|
42
81
|
payee,
|
|
43
82
|
amount: amount.toString(),
|
|
44
|
-
asset,
|
|
45
|
-
|
|
83
|
+
asset_id: asset,
|
|
84
|
+
expires_at: Number(expiresAt),
|
|
85
|
+
release_conditions: conditionsJson,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
const result = await this.rpc.call("tenzro_signAndSendTransaction", [
|
|
89
|
+
{
|
|
90
|
+
from: payer,
|
|
91
|
+
to: payee,
|
|
92
|
+
value: 0,
|
|
93
|
+
gas_limit: 75_000,
|
|
94
|
+
gas_price: 1_000_000_000,
|
|
95
|
+
nonce,
|
|
96
|
+
chain_id: chainId,
|
|
97
|
+
tx_type: txType,
|
|
46
98
|
},
|
|
47
99
|
]);
|
|
100
|
+
return typeof result === "string"
|
|
101
|
+
? result
|
|
102
|
+
: result?.tx_hash || result?.transaction_hash || "";
|
|
48
103
|
}
|
|
49
104
|
/**
|
|
50
|
-
* Release funds
|
|
51
|
-
*
|
|
52
|
-
*
|
|
105
|
+
* Release escrowed funds to the payee via a signed `ReleaseEscrow` transaction.
|
|
106
|
+
* Only the original payer can submit this — the VM rejects releases from any
|
|
107
|
+
* other address. Authentication is ambient (see {@link createEscrow}).
|
|
108
|
+
*
|
|
109
|
+
* @param payer - Payer address (the holder's MPC wallet address)
|
|
110
|
+
* @param escrowId - 32-byte escrow id (hex with or without 0x)
|
|
111
|
+
* @param proof - Optional proof bytes (hex with or without 0x)
|
|
53
112
|
* @returns Transaction hash
|
|
54
113
|
*/
|
|
55
|
-
async releaseEscrow(escrowId, proof) {
|
|
56
|
-
|
|
57
|
-
|
|
114
|
+
async releaseEscrow(payer, escrowId, proof) {
|
|
115
|
+
const escrowIdBytes = parseEscrowId(escrowId);
|
|
116
|
+
const proofBytes = proof
|
|
117
|
+
? Array.from(hexToBytes(proof))
|
|
118
|
+
: [];
|
|
119
|
+
const { nonce, chainId } = await this.fetchNonceAndChainId(payer);
|
|
120
|
+
const txType = {
|
|
121
|
+
type: "ReleaseEscrow",
|
|
122
|
+
data: {
|
|
123
|
+
escrow_id: Array.from(escrowIdBytes),
|
|
124
|
+
proof: {
|
|
125
|
+
proof_type: "Timeout",
|
|
126
|
+
proof_data: proofBytes,
|
|
127
|
+
signatures: [],
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
const result = await this.rpc.call("tenzro_signAndSendTransaction", [
|
|
132
|
+
{
|
|
133
|
+
from: payer,
|
|
134
|
+
to: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
135
|
+
value: 0,
|
|
136
|
+
gas_limit: 60_000,
|
|
137
|
+
gas_price: 1_000_000_000,
|
|
138
|
+
nonce,
|
|
139
|
+
chain_id: chainId,
|
|
140
|
+
tx_type: txType,
|
|
141
|
+
},
|
|
142
|
+
]);
|
|
143
|
+
return typeof result === "string"
|
|
144
|
+
? result
|
|
145
|
+
: result?.tx_hash || result?.transaction_hash || "";
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Refund escrowed funds back to the payer via a signed `RefundEscrow` transaction.
|
|
149
|
+
* Only the original payer can submit this, AND the escrow must be expired
|
|
150
|
+
* (or use Timeout/Custom release conditions). Authentication is ambient
|
|
151
|
+
* (see {@link createEscrow}).
|
|
152
|
+
*/
|
|
153
|
+
async refundEscrow(payer, escrowId) {
|
|
154
|
+
const escrowIdBytes = parseEscrowId(escrowId);
|
|
155
|
+
const { nonce, chainId } = await this.fetchNonceAndChainId(payer);
|
|
156
|
+
const txType = {
|
|
157
|
+
type: "RefundEscrow",
|
|
158
|
+
data: { escrow_id: Array.from(escrowIdBytes) },
|
|
159
|
+
};
|
|
160
|
+
const result = await this.rpc.call("tenzro_signAndSendTransaction", [
|
|
161
|
+
{
|
|
162
|
+
from: payer,
|
|
163
|
+
to: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
164
|
+
value: 0,
|
|
165
|
+
gas_limit: 50_000,
|
|
166
|
+
gas_price: 1_000_000_000,
|
|
167
|
+
nonce,
|
|
168
|
+
chain_id: chainId,
|
|
169
|
+
tx_type: txType,
|
|
170
|
+
},
|
|
58
171
|
]);
|
|
172
|
+
return typeof result === "string"
|
|
173
|
+
? result
|
|
174
|
+
: result?.tx_hash || result?.transaction_hash || "";
|
|
175
|
+
}
|
|
176
|
+
/** Inspect an escrow record by its 32-byte id. */
|
|
177
|
+
async getEscrow(escrowId) {
|
|
178
|
+
const escrowIdBytes = parseEscrowId(escrowId);
|
|
179
|
+
const escrowIdHex = "0x" + bytesToHex(escrowIdBytes);
|
|
180
|
+
return this.rpc.call("tenzro_getEscrow", [{ escrow_id: escrowIdHex }]);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* List every escrow whose `payer` matches the given address.
|
|
184
|
+
* @param payer - Payer address (the wallet that created the escrow)
|
|
185
|
+
* @returns Array of escrow records (empty if payer has none)
|
|
186
|
+
*/
|
|
187
|
+
async listEscrowsByPayer(payer) {
|
|
188
|
+
return this.rpc.call("tenzro_listEscrowsByPayer", [payer]);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* List every escrow whose `payee` matches the given address.
|
|
192
|
+
* @param payee - Payee address (the recipient on successful release)
|
|
193
|
+
* @returns Array of escrow records (empty if payee has none)
|
|
194
|
+
*/
|
|
195
|
+
async listEscrowsByPayee(payee) {
|
|
196
|
+
return this.rpc.call("tenzro_listEscrowsByPayee", [payee]);
|
|
197
|
+
}
|
|
198
|
+
/** Internal helper: fetch nonce + chain_id with safe defaults. */
|
|
199
|
+
async fetchNonceAndChainId(address) {
|
|
200
|
+
let nonce = 0;
|
|
201
|
+
let chainId = 1337;
|
|
202
|
+
try {
|
|
203
|
+
const nonceHex = await this.rpc.call("eth_getTransactionCount", [address, "latest"]);
|
|
204
|
+
nonce = parseInt(nonceHex.replace(/^0x/, ""), 16) || 0;
|
|
205
|
+
}
|
|
206
|
+
catch (_) {
|
|
207
|
+
// ignore — default to 0
|
|
208
|
+
}
|
|
209
|
+
try {
|
|
210
|
+
const chainIdHex = await this.rpc.call("eth_chainId", []);
|
|
211
|
+
chainId = parseInt(chainIdHex.replace(/^0x/, ""), 16) || 1337;
|
|
212
|
+
}
|
|
213
|
+
catch (_) {
|
|
214
|
+
// ignore — default to 1337
|
|
215
|
+
}
|
|
216
|
+
return { nonce, chainId };
|
|
59
217
|
}
|
|
60
218
|
/**
|
|
61
219
|
* Open a micropayment channel for streaming payments.
|
|
@@ -83,4 +241,27 @@ class SettlementClient {
|
|
|
83
241
|
}
|
|
84
242
|
}
|
|
85
243
|
exports.SettlementClient = SettlementClient;
|
|
244
|
+
function hexToBytes(hex) {
|
|
245
|
+
const clean = hex.replace(/^0x/, "");
|
|
246
|
+
if (clean.length % 2 !== 0) {
|
|
247
|
+
throw new Error(`invalid hex string (odd length): ${hex}`);
|
|
248
|
+
}
|
|
249
|
+
const bytes = new Uint8Array(clean.length / 2);
|
|
250
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
251
|
+
bytes[i] = parseInt(clean.substring(i * 2, i * 2 + 2), 16);
|
|
252
|
+
}
|
|
253
|
+
return bytes;
|
|
254
|
+
}
|
|
255
|
+
function bytesToHex(bytes) {
|
|
256
|
+
return Array.from(bytes)
|
|
257
|
+
.map((b) => b.toString(16).padStart(2, "0"))
|
|
258
|
+
.join("");
|
|
259
|
+
}
|
|
260
|
+
function parseEscrowId(s) {
|
|
261
|
+
const bytes = hexToBytes(s);
|
|
262
|
+
if (bytes.length !== 32) {
|
|
263
|
+
throw new Error(`escrow_id must be 32 bytes, got ${bytes.length}`);
|
|
264
|
+
}
|
|
265
|
+
return bytes;
|
|
266
|
+
}
|
|
86
267
|
//# sourceMappingURL=settlement.js.map
|
package/dist/settlement.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settlement.js","sourceRoot":"","sources":["../src/settlement.ts"],"names":[],"mappings":";;;AAGA;;;GAGG;AACH,MAAa,gBAAgB;IACP;IAApB,YAAoB,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAEtC;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,OAAyB;QACpC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAoB,eAAe,EAAE,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