tenzro-sdk 0.2.0 → 0.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 +11 -1
- package/dist/adaptive-burn.js +4 -4
- package/dist/adaptive-burn.js.map +1 -1
- package/dist/agent.d.ts +119 -11
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +162 -13
- package/dist/agent.js.map +1 -1
- package/dist/api-key.d.ts +128 -0
- package/dist/api-key.d.ts.map +1 -0
- package/dist/api-key.js +94 -0
- package/dist/api-key.js.map +1 -0
- package/dist/app.js +1 -1
- package/dist/app.js.map +1 -1
- package/dist/auth.d.ts +37 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +11 -0
- package/dist/auth.js.map +1 -1
- package/dist/axelar.d.ts +54 -0
- package/dist/axelar.d.ts.map +1 -0
- package/dist/axelar.js +30 -0
- package/dist/axelar.js.map +1 -0
- package/dist/babylon.d.ts +46 -0
- package/dist/babylon.d.ts.map +1 -0
- package/dist/babylon.js +37 -0
- package/dist/babylon.js.map +1 -0
- package/dist/caip.d.ts +43 -0
- package/dist/caip.d.ts.map +1 -0
- package/dist/caip.js +29 -0
- package/dist/caip.js.map +1 -0
- package/dist/canton.d.ts +16 -18
- package/dist/canton.d.ts.map +1 -1
- package/dist/canton.js +16 -18
- package/dist/canton.js.map +1 -1
- package/dist/capital.d.ts +167 -0
- package/dist/capital.d.ts.map +1 -0
- package/dist/capital.js +117 -0
- package/dist/capital.js.map +1 -0
- package/dist/client.d.ts +108 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +136 -0
- package/dist/client.js.map +1 -1
- package/dist/eip7702.d.ts +110 -0
- package/dist/eip7702.d.ts.map +1 -0
- package/dist/eip7702.js +73 -0
- package/dist/eip7702.js.map +1 -0
- package/dist/erc7683.d.ts +79 -0
- package/dist/erc7683.d.ts.map +1 -0
- package/dist/erc7683.js +82 -0
- package/dist/erc7683.js.map +1 -0
- package/dist/events.d.ts +45 -15
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +38 -8
- package/dist/events.js.map +1 -1
- package/dist/hyperlane.d.ts +47 -0
- package/dist/hyperlane.d.ts.map +1 -0
- package/dist/hyperlane.js +27 -0
- package/dist/hyperlane.js.map +1 -0
- package/dist/identity.d.ts +1 -1
- package/dist/identity.js +1 -1
- package/dist/index.d.ts +44 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +55 -2
- package/dist/index.js.map +1 -1
- package/dist/iroh.d.ts +104 -0
- package/dist/iroh.d.ts.map +1 -0
- package/dist/iroh.js +102 -0
- package/dist/iroh.js.map +1 -0
- package/dist/marketplace.d.ts +2 -2
- package/dist/marketplace.js +2 -2
- package/dist/memory.d.ts +78 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +60 -0
- package/dist/memory.js.map +1 -0
- package/dist/multimodal.d.ts +294 -0
- package/dist/multimodal.d.ts.map +1 -0
- package/dist/multimodal.js +160 -0
- package/dist/multimodal.js.map +1 -0
- package/dist/passkey.d.ts +193 -0
- package/dist/passkey.d.ts.map +1 -0
- package/dist/passkey.js +481 -0
- package/dist/passkey.js.map +1 -0
- package/dist/permit2.d.ts +49 -0
- package/dist/permit2.d.ts.map +1 -0
- package/dist/permit2.js +30 -0
- package/dist/permit2.js.map +1 -0
- package/dist/provider.d.ts +5 -4
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +8 -5
- package/dist/provider.js.map +1 -1
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +16 -0
- package/dist/rpc.js.map +1 -1
- package/dist/secure-mint.d.ts +39 -0
- package/dist/secure-mint.d.ts.map +1 -0
- package/dist/secure-mint.js +44 -0
- package/dist/secure-mint.js.map +1 -0
- package/dist/seed-agent.js +7 -7
- package/dist/seed-agent.js.map +1 -1
- package/dist/settlement.d.ts +23 -6
- package/dist/settlement.d.ts.map +1 -1
- package/dist/settlement.js +30 -7
- package/dist/settlement.js.map +1 -1
- package/dist/signer.d.ts +181 -0
- package/dist/signer.d.ts.map +1 -0
- package/dist/signer.js +69 -0
- package/dist/signer.js.map +1 -0
- package/dist/sla.d.ts +95 -0
- package/dist/sla.d.ts.map +1 -0
- package/dist/sla.js +70 -0
- package/dist/sla.js.map +1 -0
- package/dist/snapshot.d.ts +122 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +80 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/staking.d.ts +5 -5
- package/dist/staking.d.ts.map +1 -1
- package/dist/staking.js +8 -6
- package/dist/staking.js.map +1 -1
- package/dist/task.d.ts +56 -22
- package/dist/task.d.ts.map +1 -1
- package/dist/task.js +65 -31
- package/dist/task.js.map +1 -1
- package/dist/token.d.ts +41 -11
- package/dist/token.d.ts.map +1 -1
- package/dist/token.js.map +1 -1
- package/dist/training.d.ts +108 -0
- package/dist/training.d.ts.map +1 -0
- package/dist/training.js +53 -0
- package/dist/training.js.map +1 -0
- package/dist/types.d.ts +165 -38
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/validator.d.ts +76 -0
- package/dist/validator.d.ts.map +1 -0
- package/dist/validator.js +47 -0
- package/dist/validator.js.map +1 -0
- package/dist/workflow.d.ts +98 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +131 -0
- package/dist/workflow.js.map +1 -0
- package/package.json +2 -1
package/dist/signer.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Pluggable signing surface for custom wallet developers — the
|
|
4
|
+
* TypeScript mirror of `tenzro-sdk::signer` (Rust). See
|
|
5
|
+
* `docs/SPECIFICATION.md` §15.10.2 for the full contract.
|
|
6
|
+
*
|
|
7
|
+
* The high-level surface (`createPasskeyWallet` / `signWithPasskey`)
|
|
8
|
+
* is built on these interfaces; there is no internal-only API.
|
|
9
|
+
*
|
|
10
|
+
* Why interfaces, not classes:
|
|
11
|
+
* - Custom MPC topologies, custom HSM integrations, air-gapped flows,
|
|
12
|
+
* and social-recovery topologies need to extend the surface without
|
|
13
|
+
* forking the SDK.
|
|
14
|
+
* - The SDK's defaults consume the same surface, so any feature that
|
|
15
|
+
* works for the SDK's `PasskeyWallet` works for a third-party
|
|
16
|
+
* wallet.
|
|
17
|
+
*
|
|
18
|
+
* Why this lives in the SDK and not in `tenzro-vm`:
|
|
19
|
+
* - `tenzro-vm` owns the on-chain validator modules; the SDK owns
|
|
20
|
+
* how an off-chain wallet produces the signature and the
|
|
21
|
+
* `validatorData` blob the user op carries.
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.RecoveryError = exports.StorageError = exports.ValidatorError = exports.SignerError = exports.Erc7579ModuleType = void 0;
|
|
25
|
+
/** ERC-7579 module type. Numeric values match the on-chain enum. */
|
|
26
|
+
var Erc7579ModuleType;
|
|
27
|
+
(function (Erc7579ModuleType) {
|
|
28
|
+
Erc7579ModuleType[Erc7579ModuleType["Validator"] = 1] = "Validator";
|
|
29
|
+
Erc7579ModuleType[Erc7579ModuleType["Executor"] = 2] = "Executor";
|
|
30
|
+
Erc7579ModuleType[Erc7579ModuleType["Fallback"] = 3] = "Fallback";
|
|
31
|
+
Erc7579ModuleType[Erc7579ModuleType["Hook"] = 4] = "Hook";
|
|
32
|
+
})(Erc7579ModuleType || (exports.Erc7579ModuleType = Erc7579ModuleType = {}));
|
|
33
|
+
class SignerError extends Error {
|
|
34
|
+
kind;
|
|
35
|
+
constructor(kind, message) {
|
|
36
|
+
super(message);
|
|
37
|
+
this.kind = kind;
|
|
38
|
+
this.name = "SignerError";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.SignerError = SignerError;
|
|
42
|
+
class ValidatorError extends Error {
|
|
43
|
+
kind;
|
|
44
|
+
constructor(kind, message) {
|
|
45
|
+
super(message);
|
|
46
|
+
this.kind = kind;
|
|
47
|
+
this.name = "ValidatorError";
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.ValidatorError = ValidatorError;
|
|
51
|
+
class StorageError extends Error {
|
|
52
|
+
kind;
|
|
53
|
+
constructor(kind, message) {
|
|
54
|
+
super(message);
|
|
55
|
+
this.kind = kind;
|
|
56
|
+
this.name = "StorageError";
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.StorageError = StorageError;
|
|
60
|
+
class RecoveryError extends Error {
|
|
61
|
+
kind;
|
|
62
|
+
constructor(kind, message) {
|
|
63
|
+
super(message);
|
|
64
|
+
this.kind = kind;
|
|
65
|
+
this.name = "RecoveryError";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.RecoveryError = RecoveryError;
|
|
69
|
+
//# sourceMappingURL=signer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAwBH,oEAAoE;AACpE,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,mEAAa,CAAA;IACb,iEAAY,CAAA;IACZ,iEAAY,CAAA;IACZ,yDAAQ,CAAA;AACV,CAAC,EALW,iBAAiB,iCAAjB,iBAAiB,QAK5B;AAwCD,MAAa,WAAY,SAAQ,KAAK;IACR;IAA5B,YAA4B,IAAqB,EAAE,OAAe;QAChE,KAAK,CAAC,OAAO,CAAC,CAAC;QADW,SAAI,GAAJ,IAAI,CAAiB;QAE/C,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AALD,kCAKC;AAUD,MAAa,cAAe,SAAQ,KAAK;IACX;IAA5B,YAA4B,IAAwB,EAAE,OAAe;QACnE,KAAK,CAAC,OAAO,CAAC,CAAC;QADW,SAAI,GAAJ,IAAI,CAAoB;QAElD,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AALD,wCAKC;AA4BD,MAAa,YAAa,SAAQ,KAAK;IACT;IAA5B,YAA4B,IAAsB,EAAE,OAAe;QACjE,KAAK,CAAC,OAAO,CAAC,CAAC;QADW,SAAI,GAAJ,IAAI,CAAkB;QAEhD,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AALD,oCAKC;AAyDD,MAAa,aAAc,SAAQ,KAAK;IACV;IAA5B,YAA4B,IAAuB,EAAE,OAAe;QAClE,KAAK,CAAC,OAAO,CAAC,CAAC;QADW,SAAI,GAAJ,IAAI,CAAmB;QAEjD,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AALD,sCAKC"}
|
package/dist/sla.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { RpcClient } from './rpc';
|
|
2
|
+
/**
|
|
3
|
+
* Probe issued by `tenzro_slaIssueProbe`. The `challenge_nonce` is the
|
|
4
|
+
* 32-byte VRF output used to address the probe through its lifecycle.
|
|
5
|
+
*/
|
|
6
|
+
export interface SlaProbeIssued {
|
|
7
|
+
/** 0x-prefixed hex of the issuing validator's address (32 bytes). */
|
|
8
|
+
issuer: string;
|
|
9
|
+
/** DID of the provider being probed. */
|
|
10
|
+
provider_did: string;
|
|
11
|
+
/** Validator epoch the probe was issued in. */
|
|
12
|
+
epoch: number;
|
|
13
|
+
/** Probe round within the epoch. */
|
|
14
|
+
round: number;
|
|
15
|
+
/** 0x-prefixed hex of the 32-byte VRF output addressing this probe. */
|
|
16
|
+
challenge_nonce: string;
|
|
17
|
+
/** Unix-millisecond deadline by which the provider must respond. */
|
|
18
|
+
deadline_ms: number;
|
|
19
|
+
/** 0x-prefixed hex of the issuing validator's VRF public key. */
|
|
20
|
+
vrf_pubkey: string;
|
|
21
|
+
}
|
|
22
|
+
/** A single entry in the outstanding-probes reflector. */
|
|
23
|
+
export interface SlaOutstandingProbe {
|
|
24
|
+
challenge_nonce: string;
|
|
25
|
+
provider_did: string;
|
|
26
|
+
epoch: number;
|
|
27
|
+
round: number;
|
|
28
|
+
deadline_ms: number;
|
|
29
|
+
/** 0x-prefixed hex of the issuing validator's address. */
|
|
30
|
+
issuer: string;
|
|
31
|
+
}
|
|
32
|
+
/** Result of `tenzro_slaListOutstandingProbes`. */
|
|
33
|
+
export interface SlaOutstandingProbes {
|
|
34
|
+
count: number;
|
|
35
|
+
probes: SlaOutstandingProbe[];
|
|
36
|
+
}
|
|
37
|
+
/** Result of `tenzro_slaGetParams`. */
|
|
38
|
+
export interface SlaParams {
|
|
39
|
+
/** Number of missed probes before slashing fires for a provider. */
|
|
40
|
+
slash_threshold: number;
|
|
41
|
+
/** Per-crossing slash amount in wei, as a decimal string. */
|
|
42
|
+
slash_amount_wei: string;
|
|
43
|
+
/** 0x-prefixed hex of this validator's VRF public key. */
|
|
44
|
+
vrf_pubkey: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Validator-side SLA fault-detector inspection client.
|
|
48
|
+
*
|
|
49
|
+
* Wraps:
|
|
50
|
+
* - `tenzro_slaIssueProbe` — issue a VRF-bound liveness probe to a
|
|
51
|
+
* ModelProvider / TeeProvider DID and broadcast it on the
|
|
52
|
+
* `tenzro/sla` gossipsub topic. **Validator-only** — non-validator
|
|
53
|
+
* nodes return `-32000 SlaManager not initialized`.
|
|
54
|
+
* - `tenzro_slaListOutstandingProbes` — list every in-flight probe
|
|
55
|
+
* awaiting a response, regardless of who issued it. Used by
|
|
56
|
+
* operators to spot stuck probes whose deadline has already
|
|
57
|
+
* elapsed without a response.
|
|
58
|
+
* - `tenzro_slaGetParams` — read-only surface for the fault-detector
|
|
59
|
+
* parameters (`slash_threshold`, `slash_amount_wei`, this
|
|
60
|
+
* validator's VRF public key).
|
|
61
|
+
*/
|
|
62
|
+
export declare class SlaClient {
|
|
63
|
+
private readonly rpc;
|
|
64
|
+
constructor(rpc: RpcClient);
|
|
65
|
+
/**
|
|
66
|
+
* Issue a VRF-bound liveness probe to `providerDid`. Validator-only.
|
|
67
|
+
*
|
|
68
|
+
* The issuing node computes the VRF output over
|
|
69
|
+
* `(provider_did, epoch, round)`, registers the probe in its
|
|
70
|
+
* in-memory outstanding-probe map (so a fast response cannot race
|
|
71
|
+
* the insertion), and broadcasts it on the `tenzro/sla` gossipsub
|
|
72
|
+
* topic.
|
|
73
|
+
*
|
|
74
|
+
* @param providerDid - DID of the provider being probed
|
|
75
|
+
* @param epoch - Validator epoch the probe is issued in
|
|
76
|
+
* @param round - Probe round within the epoch
|
|
77
|
+
* @param deadlineMs - Unix-millisecond timestamp by which the
|
|
78
|
+
* provider must respond before the probe is considered missed
|
|
79
|
+
*/
|
|
80
|
+
issueProbe(providerDid: string, epoch: number, round: number, deadlineMs: number): Promise<SlaProbeIssued>;
|
|
81
|
+
/**
|
|
82
|
+
* List every in-flight probe awaiting a response from any provider,
|
|
83
|
+
* regardless of issuer. Used by operators to spot probes whose
|
|
84
|
+
* `deadline_ms` has already elapsed without a matching response.
|
|
85
|
+
*/
|
|
86
|
+
listOutstandingProbes(): Promise<SlaOutstandingProbes>;
|
|
87
|
+
/**
|
|
88
|
+
* Read the fault-detector parameters this validator is using.
|
|
89
|
+
* Returns the slash threshold (missed probes before slashing
|
|
90
|
+
* fires), the per-crossing slash amount in wei, and this
|
|
91
|
+
* validator's VRF public key.
|
|
92
|
+
*/
|
|
93
|
+
getParams(): Promise<SlaParams>;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=sla.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sla.d.ts","sourceRoot":"","sources":["../src/sla.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,eAAe,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,WAAW,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,0DAA0D;AAC1D,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,mDAAmD;AACnD,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,mBAAmB,EAAE,CAAC;CAC/B;AAED,uCAAuC;AACvC,MAAM,WAAW,SAAS;IACxB,oEAAoE;IACpE,eAAe,EAAE,MAAM,CAAC;IACxB,6DAA6D;IAC7D,gBAAgB,EAAE,MAAM,CAAC;IACzB,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAC;CACpB;AAID;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,SAAS;IACR,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAE3C;;;;;;;;;;;;;;OAcG;IACG,UAAU,CACd,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC;IAW1B;;;;OAIG;IACG,qBAAqB,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAO5D;;;;;OAKG;IACG,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC;CAGtC"}
|
package/dist/sla.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SlaClient = void 0;
|
|
4
|
+
// ── Client ──
|
|
5
|
+
/**
|
|
6
|
+
* Validator-side SLA fault-detector inspection client.
|
|
7
|
+
*
|
|
8
|
+
* Wraps:
|
|
9
|
+
* - `tenzro_slaIssueProbe` — issue a VRF-bound liveness probe to a
|
|
10
|
+
* ModelProvider / TeeProvider DID and broadcast it on the
|
|
11
|
+
* `tenzro/sla` gossipsub topic. **Validator-only** — non-validator
|
|
12
|
+
* nodes return `-32000 SlaManager not initialized`.
|
|
13
|
+
* - `tenzro_slaListOutstandingProbes` — list every in-flight probe
|
|
14
|
+
* awaiting a response, regardless of who issued it. Used by
|
|
15
|
+
* operators to spot stuck probes whose deadline has already
|
|
16
|
+
* elapsed without a response.
|
|
17
|
+
* - `tenzro_slaGetParams` — read-only surface for the fault-detector
|
|
18
|
+
* parameters (`slash_threshold`, `slash_amount_wei`, this
|
|
19
|
+
* validator's VRF public key).
|
|
20
|
+
*/
|
|
21
|
+
class SlaClient {
|
|
22
|
+
rpc;
|
|
23
|
+
constructor(rpc) {
|
|
24
|
+
this.rpc = rpc;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Issue a VRF-bound liveness probe to `providerDid`. Validator-only.
|
|
28
|
+
*
|
|
29
|
+
* The issuing node computes the VRF output over
|
|
30
|
+
* `(provider_did, epoch, round)`, registers the probe in its
|
|
31
|
+
* in-memory outstanding-probe map (so a fast response cannot race
|
|
32
|
+
* the insertion), and broadcasts it on the `tenzro/sla` gossipsub
|
|
33
|
+
* topic.
|
|
34
|
+
*
|
|
35
|
+
* @param providerDid - DID of the provider being probed
|
|
36
|
+
* @param epoch - Validator epoch the probe is issued in
|
|
37
|
+
* @param round - Probe round within the epoch
|
|
38
|
+
* @param deadlineMs - Unix-millisecond timestamp by which the
|
|
39
|
+
* provider must respond before the probe is considered missed
|
|
40
|
+
*/
|
|
41
|
+
async issueProbe(providerDid, epoch, round, deadlineMs) {
|
|
42
|
+
return this.rpc.call('tenzro_slaIssueProbe', [
|
|
43
|
+
{
|
|
44
|
+
provider_did: providerDid,
|
|
45
|
+
epoch,
|
|
46
|
+
round,
|
|
47
|
+
deadline_ms: deadlineMs,
|
|
48
|
+
},
|
|
49
|
+
]);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* List every in-flight probe awaiting a response from any provider,
|
|
53
|
+
* regardless of issuer. Used by operators to spot probes whose
|
|
54
|
+
* `deadline_ms` has already elapsed without a matching response.
|
|
55
|
+
*/
|
|
56
|
+
async listOutstandingProbes() {
|
|
57
|
+
return this.rpc.call('tenzro_slaListOutstandingProbes', []);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Read the fault-detector parameters this validator is using.
|
|
61
|
+
* Returns the slash threshold (missed probes before slashing
|
|
62
|
+
* fires), the per-crossing slash amount in wei, and this
|
|
63
|
+
* validator's VRF public key.
|
|
64
|
+
*/
|
|
65
|
+
async getParams() {
|
|
66
|
+
return this.rpc.call('tenzro_slaGetParams', []);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.SlaClient = SlaClient;
|
|
70
|
+
//# sourceMappingURL=sla.js.map
|
package/dist/sla.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sla.js","sourceRoot":"","sources":["../src/sla.ts"],"names":[],"mappings":";;;AAoDA,eAAe;AAEf;;;;;;;;;;;;;;;GAeG;AACH,MAAa,SAAS;IACS;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,UAAU,CACd,WAAmB,EACnB,KAAa,EACb,KAAa,EACb,UAAkB;QAElB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAiB,sBAAsB,EAAE;YAC3D;gBACE,YAAY,EAAE,WAAW;gBACzB,KAAK;gBACL,KAAK;gBACL,WAAW,EAAE,UAAU;aACxB;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,qBAAqB;QACzB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAClB,iCAAiC,EACjC,EAAE,CACH,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,SAAS;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAY,qBAAqB,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC;CACF;AAvDD,8BAuDC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { RpcClient } from './rpc';
|
|
2
|
+
/**
|
|
3
|
+
* Compact summary returned by `tenzro_listSnapshots`. Per-chunk hashes
|
|
4
|
+
* are elided here — fetch the full manifest with
|
|
5
|
+
* `getSnapshotManifest(height)` to verify chunks.
|
|
6
|
+
*/
|
|
7
|
+
export interface SnapshotSummary {
|
|
8
|
+
height: number;
|
|
9
|
+
state_root_hex: string;
|
|
10
|
+
num_chunks: number;
|
|
11
|
+
created_at: string;
|
|
12
|
+
format: number;
|
|
13
|
+
}
|
|
14
|
+
/** Result of `tenzro_listSnapshots`. */
|
|
15
|
+
export interface SnapshotList {
|
|
16
|
+
snapshots: SnapshotSummary[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Full snapshot manifest with per-chunk SHA-256 hashes. Returned by
|
|
20
|
+
* `tenzro_getSnapshotManifest` and consumed by `tenzro_offerSnapshot`.
|
|
21
|
+
*/
|
|
22
|
+
export interface SnapshotManifest {
|
|
23
|
+
/** Block height at which this snapshot was taken. */
|
|
24
|
+
height: number;
|
|
25
|
+
/**
|
|
26
|
+
* State root committed at `height`. The caller MUST verify this
|
|
27
|
+
* against a trusted QC at the same height before offering or
|
|
28
|
+
* applying this snapshot.
|
|
29
|
+
*/
|
|
30
|
+
state_root_hex: string;
|
|
31
|
+
/** Number of chunks. Chunk indices are `0..num_chunks`. */
|
|
32
|
+
num_chunks: number;
|
|
33
|
+
/**
|
|
34
|
+
* Per-chunk SHA-256 hash (hex), indexed by chunk number. Used by the
|
|
35
|
+
* receiver to verify chunks before disk write.
|
|
36
|
+
*/
|
|
37
|
+
chunk_hashes_hex: string[];
|
|
38
|
+
/** Wall-clock time the snapshot was produced (ISO 8601, UTC). */
|
|
39
|
+
created_at: string;
|
|
40
|
+
/** Manifest format version. */
|
|
41
|
+
format: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Result of `tenzro_getSnapshotChunk`. `data_b64` is the base64-encoded
|
|
45
|
+
* chunk bytes.
|
|
46
|
+
*/
|
|
47
|
+
export interface SnapshotChunk {
|
|
48
|
+
height: number;
|
|
49
|
+
chunk_index: number;
|
|
50
|
+
data_b64: string;
|
|
51
|
+
}
|
|
52
|
+
/** Result of `tenzro_offerSnapshot`. */
|
|
53
|
+
export interface SnapshotOfferAccepted {
|
|
54
|
+
accepted: boolean;
|
|
55
|
+
height: number;
|
|
56
|
+
num_chunks: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Result of `tenzro_applySnapshotChunk`. `complete` flips to `true` on
|
|
60
|
+
* the final chunk, after which the snapshot has been atomically
|
|
61
|
+
* committed via `write_batch_sync`.
|
|
62
|
+
*/
|
|
63
|
+
export interface SnapshotChunkApplied {
|
|
64
|
+
complete: boolean;
|
|
65
|
+
height: number;
|
|
66
|
+
chunk_index: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* State-sync snapshot client.
|
|
70
|
+
*
|
|
71
|
+
* Wraps the five snapshot RPCs that drive state-sync between nodes:
|
|
72
|
+
* - `tenzro_listSnapshots` — enumerate local snapshots
|
|
73
|
+
* - `tenzro_getSnapshotManifest` — full manifest including per-chunk hashes
|
|
74
|
+
* - `tenzro_getSnapshotChunk` — fetch a single chunk by index
|
|
75
|
+
* - `tenzro_offerSnapshot` — register an inbound manifest from a peer
|
|
76
|
+
* - `tenzro_applySnapshotChunk` — write one inbound chunk
|
|
77
|
+
*
|
|
78
|
+
* **Trust model:** Callers MUST verify `manifest.state_root_hex` against
|
|
79
|
+
* a trusted QC at the same height before calling `offerSnapshot` /
|
|
80
|
+
* `applySnapshotChunk`. The node verifies per-chunk SHA-256 against
|
|
81
|
+
* the manifest before any disk write, and atomically commits on the
|
|
82
|
+
* final chunk via `write_batch_sync`.
|
|
83
|
+
*/
|
|
84
|
+
export declare class SnapshotClient {
|
|
85
|
+
private readonly rpc;
|
|
86
|
+
constructor(rpc: RpcClient);
|
|
87
|
+
/**
|
|
88
|
+
* Enumerate local snapshots. Per-chunk hashes are elided for
|
|
89
|
+
* compactness — use `getSnapshotManifest(height)` to retrieve the
|
|
90
|
+
* full manifest.
|
|
91
|
+
*/
|
|
92
|
+
listSnapshots(): Promise<SnapshotList>;
|
|
93
|
+
/**
|
|
94
|
+
* Fetch the full manifest for the snapshot at `height`, including
|
|
95
|
+
* per-chunk SHA-256 hashes. Returns the node's `-32004 no snapshot
|
|
96
|
+
* at height` error if no snapshot is taken at that height.
|
|
97
|
+
*/
|
|
98
|
+
getSnapshotManifest(height: number): Promise<SnapshotManifest>;
|
|
99
|
+
/**
|
|
100
|
+
* Fetch one chunk by `(height, chunkIndex)`. The returned `data_b64`
|
|
101
|
+
* is the base64-encoded chunk bytes; verify against
|
|
102
|
+
* `manifest.chunk_hashes_hex[chunkIndex]` before applying.
|
|
103
|
+
*/
|
|
104
|
+
getSnapshotChunk(height: number, chunkIndex: number): Promise<SnapshotChunk>;
|
|
105
|
+
/**
|
|
106
|
+
* Register an inbound manifest from a peer.
|
|
107
|
+
*
|
|
108
|
+
* **Caller MUST verify `manifest.state_root_hex` against a trusted QC
|
|
109
|
+
* at the same height before invoking.** This RPC only registers the
|
|
110
|
+
* offer and provisions the spool directory; it does not itself
|
|
111
|
+
* validate the manifest against chain state.
|
|
112
|
+
*/
|
|
113
|
+
offerSnapshot(manifest: SnapshotManifest): Promise<SnapshotOfferAccepted>;
|
|
114
|
+
/**
|
|
115
|
+
* Write one inbound chunk. The chunk's SHA-256 is verified against
|
|
116
|
+
* `manifest.chunk_hashes_hex[chunkIndex]` before any disk write. On
|
|
117
|
+
* the final chunk, all chunks are decoded and atomically committed
|
|
118
|
+
* via `write_batch_sync`; `complete` will be `true` on that call.
|
|
119
|
+
*/
|
|
120
|
+
applySnapshotChunk(height: number, chunkIndex: number, dataB64: string): Promise<SnapshotChunkApplied>;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../src/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wCAAwC;AACxC,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,eAAe,EAAE,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wCAAwC;AACxC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAID;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAE3C;;;;OAIG;IACG,aAAa,IAAI,OAAO,CAAC,YAAY,CAAC;IAI5C;;;;OAIG;IACG,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAMpE;;;;OAIG;IACG,gBAAgB,CACpB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,aAAa,CAAC;IAMzB;;;;;;;OAOG;IACG,aAAa,CACjB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,qBAAqB,CAAC;IAMjC;;;;;OAKG;IACG,kBAAkB,CACtB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,oBAAoB,CAAC;CAKjC"}
|
package/dist/snapshot.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SnapshotClient = void 0;
|
|
4
|
+
// ── Client ──
|
|
5
|
+
/**
|
|
6
|
+
* State-sync snapshot client.
|
|
7
|
+
*
|
|
8
|
+
* Wraps the five snapshot RPCs that drive state-sync between nodes:
|
|
9
|
+
* - `tenzro_listSnapshots` — enumerate local snapshots
|
|
10
|
+
* - `tenzro_getSnapshotManifest` — full manifest including per-chunk hashes
|
|
11
|
+
* - `tenzro_getSnapshotChunk` — fetch a single chunk by index
|
|
12
|
+
* - `tenzro_offerSnapshot` — register an inbound manifest from a peer
|
|
13
|
+
* - `tenzro_applySnapshotChunk` — write one inbound chunk
|
|
14
|
+
*
|
|
15
|
+
* **Trust model:** Callers MUST verify `manifest.state_root_hex` against
|
|
16
|
+
* a trusted QC at the same height before calling `offerSnapshot` /
|
|
17
|
+
* `applySnapshotChunk`. The node verifies per-chunk SHA-256 against
|
|
18
|
+
* the manifest before any disk write, and atomically commits on the
|
|
19
|
+
* final chunk via `write_batch_sync`.
|
|
20
|
+
*/
|
|
21
|
+
class SnapshotClient {
|
|
22
|
+
rpc;
|
|
23
|
+
constructor(rpc) {
|
|
24
|
+
this.rpc = rpc;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Enumerate local snapshots. Per-chunk hashes are elided for
|
|
28
|
+
* compactness — use `getSnapshotManifest(height)` to retrieve the
|
|
29
|
+
* full manifest.
|
|
30
|
+
*/
|
|
31
|
+
async listSnapshots() {
|
|
32
|
+
return this.rpc.call('tenzro_listSnapshots', []);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Fetch the full manifest for the snapshot at `height`, including
|
|
36
|
+
* per-chunk SHA-256 hashes. Returns the node's `-32004 no snapshot
|
|
37
|
+
* at height` error if no snapshot is taken at that height.
|
|
38
|
+
*/
|
|
39
|
+
async getSnapshotManifest(height) {
|
|
40
|
+
return this.rpc.call('tenzro_getSnapshotManifest', [
|
|
41
|
+
{ height },
|
|
42
|
+
]);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Fetch one chunk by `(height, chunkIndex)`. The returned `data_b64`
|
|
46
|
+
* is the base64-encoded chunk bytes; verify against
|
|
47
|
+
* `manifest.chunk_hashes_hex[chunkIndex]` before applying.
|
|
48
|
+
*/
|
|
49
|
+
async getSnapshotChunk(height, chunkIndex) {
|
|
50
|
+
return this.rpc.call('tenzro_getSnapshotChunk', [
|
|
51
|
+
{ height, chunk_index: chunkIndex },
|
|
52
|
+
]);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Register an inbound manifest from a peer.
|
|
56
|
+
*
|
|
57
|
+
* **Caller MUST verify `manifest.state_root_hex` against a trusted QC
|
|
58
|
+
* at the same height before invoking.** This RPC only registers the
|
|
59
|
+
* offer and provisions the spool directory; it does not itself
|
|
60
|
+
* validate the manifest against chain state.
|
|
61
|
+
*/
|
|
62
|
+
async offerSnapshot(manifest) {
|
|
63
|
+
return this.rpc.call('tenzro_offerSnapshot', [
|
|
64
|
+
manifest,
|
|
65
|
+
]);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Write one inbound chunk. The chunk's SHA-256 is verified against
|
|
69
|
+
* `manifest.chunk_hashes_hex[chunkIndex]` before any disk write. On
|
|
70
|
+
* the final chunk, all chunks are decoded and atomically committed
|
|
71
|
+
* via `write_batch_sync`; `complete` will be `true` on that call.
|
|
72
|
+
*/
|
|
73
|
+
async applySnapshotChunk(height, chunkIndex, dataB64) {
|
|
74
|
+
return this.rpc.call('tenzro_applySnapshotChunk', [
|
|
75
|
+
{ height, chunk_index: chunkIndex, data_b64: dataB64 },
|
|
76
|
+
]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.SnapshotClient = SnapshotClient;
|
|
80
|
+
//# sourceMappingURL=snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../src/snapshot.ts"],"names":[],"mappings":";;;AA4EA,eAAe;AAEf;;;;;;;;;;;;;;;GAeG;AACH,MAAa,cAAc;IACI;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;;;OAIG;IACH,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAe,sBAAsB,EAAE,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,mBAAmB,CAAC,MAAc;QACtC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAmB,4BAA4B,EAAE;YACnE,EAAE,MAAM,EAAE;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,gBAAgB,CACpB,MAAc,EACd,UAAkB;QAElB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAgB,yBAAyB,EAAE;YAC7D,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,aAAa,CACjB,QAA0B;QAE1B,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAwB,sBAAsB,EAAE;YAClE,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,kBAAkB,CACtB,MAAc,EACd,UAAkB,EAClB,OAAe;QAEf,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAuB,2BAA2B,EAAE;YACtE,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE;SACvD,CAAC,CAAC;IACL,CAAC;CACF;AApED,wCAoEC"}
|
package/dist/staking.d.ts
CHANGED
|
@@ -8,15 +8,15 @@ export declare class StakingClient {
|
|
|
8
8
|
private readonly rpc;
|
|
9
9
|
constructor(rpc: RpcClient);
|
|
10
10
|
/**
|
|
11
|
-
* Stake TNZO tokens for a given
|
|
12
|
-
* @param amount - Amount
|
|
13
|
-
* @param
|
|
11
|
+
* Stake TNZO tokens for a given provider type.
|
|
12
|
+
* @param amount - Amount in wei (10^-18 TNZO) as decimal string, e.g. "1000000000000000000000" for 1000 TNZO
|
|
13
|
+
* @param providerType - Provider type: "validator", "model_provider", "tee_provider", or "storage_provider"
|
|
14
14
|
* @returns Stake result with transaction hash and status
|
|
15
15
|
*/
|
|
16
|
-
stake(amount: string,
|
|
16
|
+
stake(amount: string, providerType: StakingRole): Promise<StakeResult>;
|
|
17
17
|
/**
|
|
18
18
|
* Unstake TNZO tokens (initiates the unbonding period).
|
|
19
|
-
* @param amount - Amount
|
|
19
|
+
* @param amount - Amount in wei (10^-18 TNZO) as decimal string
|
|
20
20
|
* @returns Unstake result with transaction hash, status, and unbonding end time
|
|
21
21
|
*/
|
|
22
22
|
unstake(amount: string): Promise<UnstakeResult>;
|
package/dist/staking.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staking.d.ts","sourceRoot":"","sources":["../src/staking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAE3C;;;;;OAKG;IACG,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"staking.d.ts","sourceRoot":"","sources":["../src/staking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAE3C;;;;;OAKG;IACG,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAM5E;;;;OAIG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIrD;;;;OAIG;IACG,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAMjE;;;;OAIG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAM1D;;;;OAIG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CAK/D"}
|
package/dist/staking.js
CHANGED
|
@@ -11,17 +11,19 @@ class StakingClient {
|
|
|
11
11
|
this.rpc = rpc;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Stake TNZO tokens for a given
|
|
15
|
-
* @param amount - Amount
|
|
16
|
-
* @param
|
|
14
|
+
* Stake TNZO tokens for a given provider type.
|
|
15
|
+
* @param amount - Amount in wei (10^-18 TNZO) as decimal string, e.g. "1000000000000000000000" for 1000 TNZO
|
|
16
|
+
* @param providerType - Provider type: "validator", "model_provider", "tee_provider", or "storage_provider"
|
|
17
17
|
* @returns Stake result with transaction hash and status
|
|
18
18
|
*/
|
|
19
|
-
async stake(amount,
|
|
20
|
-
return this.rpc.call('tenzro_stake', [
|
|
19
|
+
async stake(amount, providerType) {
|
|
20
|
+
return this.rpc.call('tenzro_stake', [
|
|
21
|
+
{ amount, provider_type: providerType },
|
|
22
|
+
]);
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* Unstake TNZO tokens (initiates the unbonding period).
|
|
24
|
-
* @param amount - Amount
|
|
26
|
+
* @param amount - Amount in wei (10^-18 TNZO) as decimal string
|
|
25
27
|
* @returns Unstake result with transaction hash, status, and unbonding end time
|
|
26
28
|
*/
|
|
27
29
|
async unstake(amount) {
|
package/dist/staking.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staking.js","sourceRoot":"","sources":["../src/staking.ts"],"names":[],"mappings":";;;AAUA;;;GAGG;AACH,MAAa,aAAa;IACK;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;;;;OAKG;IACH,KAAK,CAAC,KAAK,CAAC,MAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"staking.js","sourceRoot":"","sources":["../src/staking.ts"],"names":[],"mappings":";;;AAUA;;;GAGG;AACH,MAAa,aAAa;IACK;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;;;;OAKG;IACH,KAAK,CAAC,KAAK,CAAC,MAAc,EAAE,YAAyB;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAc,cAAc,EAAE;YAChD,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE;SACxC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,MAAc;QAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAgB,gBAAgB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IACtE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,iBAAiB,CAAC,OAAe;QACrC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAiB,0BAA0B,EAAE;YAC/D,EAAE,OAAO,EAAE;SACZ,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,UAAU,CAAC,OAAe;QAC9B,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAiB,0BAA0B,EAAE;YAC/D,EAAE,OAAO,EAAE;SACZ,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,YAAY,CAAC,OAAe;QAChC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAmB,qBAAqB,EAAE;YAC5D,EAAE,OAAO,EAAE;SACZ,CAAC,CAAC;IACL,CAAC;CACF;AAxDD,sCAwDC"}
|
package/dist/task.d.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import type { RpcClient } from './rpc';
|
|
2
2
|
import type { TaskInfo, TaskQuote, TaskFilter, PostTaskParams, AssignTaskResult, CompleteTaskResult } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Task-marketplace client.
|
|
5
|
+
*
|
|
6
|
+
* Full settlement cycle on the live testnet:
|
|
7
|
+
*
|
|
8
|
+
* await client.task.postTask({ title, poster, max_price, task_type, input })
|
|
9
|
+
* await client.task.quoteTask(taskId, providerAddress, price, { model_id, ... })
|
|
10
|
+
* await client.task.assignTask(taskId, providerAddress, quotedPrice)
|
|
11
|
+
* await client.task.completeTask(taskId, output) // <- triggers TNZO transfer
|
|
12
|
+
*
|
|
13
|
+
* `completeTask` performs the on-chain settlement: `tenzro-token`
|
|
14
|
+
* transfers `final_price` (the quoted price, or `max_price` if unquoted)
|
|
15
|
+
* from poster to assignee through the unified token registry.
|
|
16
|
+
*/
|
|
3
17
|
export declare class TaskClient {
|
|
4
18
|
private readonly rpc;
|
|
5
19
|
constructor(rpc: RpcClient);
|
|
@@ -7,40 +21,60 @@ export declare class TaskClient {
|
|
|
7
21
|
listTasks(filter?: TaskFilter): Promise<TaskInfo[]>;
|
|
8
22
|
getTask(taskId: string): Promise<TaskInfo>;
|
|
9
23
|
cancelTask(taskId: string): Promise<boolean>;
|
|
10
|
-
submitQuote(taskId: string, price: string, modelId: string, estimatedDurationSecs: number): Promise<TaskQuote>;
|
|
11
24
|
/**
|
|
12
|
-
* Submit a quote for a task
|
|
13
|
-
*
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
16
|
-
*
|
|
25
|
+
* Submit a quote for a task.
|
|
26
|
+
*
|
|
27
|
+
* @param taskId - The task to quote.
|
|
28
|
+
* @param provider - Provider address (hex). Required — the live RPC
|
|
29
|
+
* rejects quotes that lack a provider address.
|
|
30
|
+
* @param price - Quoted price in TNZO wei (u128 as decimal string).
|
|
31
|
+
* @param opts.modelId - Optional model identifier (default: `"any"`).
|
|
32
|
+
* @param opts.confidence - Quote confidence 0–100 (default: 80).
|
|
33
|
+
* @param opts.estimatedDurationSecs - Estimated runtime in seconds (default: 60).
|
|
34
|
+
* @param opts.notes - Optional free-form notes.
|
|
17
35
|
*/
|
|
18
|
-
quoteTask(taskId: string,
|
|
36
|
+
quoteTask(taskId: string, provider: string, price: string, opts?: {
|
|
37
|
+
modelId?: string;
|
|
38
|
+
confidence?: number;
|
|
39
|
+
estimatedDurationSecs?: number;
|
|
40
|
+
notes?: string;
|
|
41
|
+
}): Promise<TaskQuote>;
|
|
19
42
|
/**
|
|
20
|
-
* Assign a task to a specific
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
43
|
+
* Assign a task to a specific provider address.
|
|
44
|
+
*
|
|
45
|
+
* The live RPC handler keys assignment on the provider's wallet
|
|
46
|
+
* address, not an agent_id — the task's `assignee` field is set to
|
|
47
|
+
* `provider`, and `quoted_price` is stored on the task so that
|
|
48
|
+
* `completeTask` can settle to it.
|
|
49
|
+
*
|
|
50
|
+
* @param taskId - The task to assign.
|
|
51
|
+
* @param provider - Provider wallet address (hex).
|
|
52
|
+
* @param quotedPrice - Optional locked-in price in TNZO wei
|
|
53
|
+
* (u128 as decimal string). If omitted, the task's `max_price`
|
|
54
|
+
* is used at settlement time.
|
|
24
55
|
*/
|
|
25
|
-
assignTask(taskId: string,
|
|
56
|
+
assignTask(taskId: string, provider: string, quotedPrice?: string): Promise<AssignTaskResult>;
|
|
26
57
|
/**
|
|
27
|
-
* Mark a task as completed
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
58
|
+
* Mark a task as completed and trigger on-chain TNZO settlement.
|
|
59
|
+
*
|
|
60
|
+
* The live RPC handler:
|
|
61
|
+
* 1. transfers `final_price` from poster to assignee via the token registry,
|
|
62
|
+
* 2. sets `task.status = Completed`,
|
|
63
|
+
* 3. stores `output` on the task,
|
|
64
|
+
* 4. returns the new poster/assignee balances under `settlement`.
|
|
65
|
+
*
|
|
66
|
+
* @param taskId - The task to complete.
|
|
67
|
+
* @param output - The result / output text to attach to the task.
|
|
31
68
|
*/
|
|
32
|
-
completeTask(taskId: string,
|
|
69
|
+
completeTask(taskId: string, output: string): Promise<CompleteTaskResult>;
|
|
33
70
|
/**
|
|
34
|
-
* Update an existing task.
|
|
35
|
-
* @param taskId - The task to update
|
|
36
|
-
* @param options - Fields to update (partial)
|
|
37
|
-
* @returns Updated task information
|
|
71
|
+
* Update an existing task (creator only).
|
|
38
72
|
*/
|
|
39
73
|
updateTask(taskId: string, options?: {
|
|
40
74
|
title?: string;
|
|
41
75
|
description?: string;
|
|
42
76
|
status?: string;
|
|
43
77
|
output?: string;
|
|
44
|
-
}): Promise<
|
|
78
|
+
}): Promise<TaskInfo>;
|
|
45
79
|
}
|
|
46
80
|
//# sourceMappingURL=task.d.ts.map
|
package/dist/task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../src/task.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../src/task.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;GAaG;AACH,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAErC,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IAInD,SAAS,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAInD,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI1C,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIlD;;;;;;;;;;;OAWG;IACG,SAAS,CACb,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE;QACL,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GACA,OAAO,CAAC,SAAS,CAAC;IAcrB;;;;;;;;;;;;;OAaG;IACG,UAAU,CACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,gBAAgB,CAAC;IAU5B;;;;;;;;;;;OAWG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAM/E;;OAEG;IACG,UAAU,CACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GACA,OAAO,CAAC,QAAQ,CAAC;CAKrB"}
|