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/auth.js
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthClient = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Client for OAuth 2.1 + DPoP onboarding RPCs.
|
|
6
|
+
*
|
|
7
|
+
* Onboarding uses OAuth 2.1 (RFC 6749 successor) + DPoP-bound JWTs
|
|
8
|
+
* (RFC 9449) + Rich Authorization Requests (RFC 9396). Participants —
|
|
9
|
+
* humans, delegated agents under a human controller, and fully autonomous
|
|
10
|
+
* agents — onboard via the three RPCs exposed here. Each call provisions
|
|
11
|
+
* a TDIP identity (+ MPC wallet) and returns a JWT bound to a
|
|
12
|
+
* holder-supplied DPoP `jkt` (RFC 7638 thumbprint of the holder's
|
|
13
|
+
* Ed25519 public key).
|
|
14
|
+
*
|
|
15
|
+
* Subsequent privileged calls (sign + send transaction, escrow create,
|
|
16
|
+
* release/refund, etc.) authenticate by sending the JWT in the
|
|
17
|
+
* `Authorization: DPoP <jwt>` header alongside a per-request DPoP proof
|
|
18
|
+
* in the `DPoP` header. The SDK forwards both headers automatically when
|
|
19
|
+
* the `TENZRO_BEARER_JWT` and `TENZRO_DPOP_PROOF` environment variables
|
|
20
|
+
* are set in Node — see {@link RpcClient} for the transport-level wiring.
|
|
21
|
+
*/
|
|
22
|
+
class AuthClient {
|
|
23
|
+
rpc;
|
|
24
|
+
constructor(rpc) {
|
|
25
|
+
this.rpc = rpc;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Onboard a new **human** participant — provisions a TDIP `did:tenzro:human:*`
|
|
29
|
+
* identity, a fresh MPC wallet, and returns an OAuth 2.1 access token.
|
|
30
|
+
*
|
|
31
|
+
* @param displayName - human-readable label surfaced in approver UIs
|
|
32
|
+
* @param dpopJkt - optional RFC 7638 JWK thumbprint of the holder's
|
|
33
|
+
* Ed25519 public key. If supplied, the issued JWT is DPoP-bound to
|
|
34
|
+
* that key and every subsequent privileged call must accompany the
|
|
35
|
+
* bearer with a fresh DPoP proof signed by the same key. Strongly
|
|
36
|
+
* recommended.
|
|
37
|
+
*/
|
|
38
|
+
async onboardHuman(displayName, dpopJkt) {
|
|
39
|
+
const params = { display_name: displayName };
|
|
40
|
+
if (dpopJkt)
|
|
41
|
+
params.dpop_jkt = dpopJkt;
|
|
42
|
+
return this.rpc.call("tenzro_onboardHuman", params);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Onboard a **delegated agent** that acts on behalf of an existing
|
|
46
|
+
* `controllerDid` (typically a human). The agent inherits the
|
|
47
|
+
* controller's act-chain and is bounded by `delegationScope`.
|
|
48
|
+
*
|
|
49
|
+
* Revoking the controller DID via {@link revokeDid} cascades and
|
|
50
|
+
* invalidates this agent's token automatically.
|
|
51
|
+
*/
|
|
52
|
+
async onboardDelegatedAgent(controllerDid, capabilities, delegationScope, dpopJkt) {
|
|
53
|
+
const params = {
|
|
54
|
+
controller_did: controllerDid,
|
|
55
|
+
capabilities,
|
|
56
|
+
delegation_scope: delegationScope,
|
|
57
|
+
};
|
|
58
|
+
if (dpopJkt)
|
|
59
|
+
params.dpop_jkt = dpopJkt;
|
|
60
|
+
return this.rpc.call("tenzro_onboardDelegatedAgent", params);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Onboard a **fully autonomous agent**. Unlike a delegated agent, this
|
|
64
|
+
* has no human controller — instead the agent must post a TNZO bond
|
|
65
|
+
* (slashable on misbehaviour) at `bondFundingAddress` before
|
|
66
|
+
* onboarding succeeds.
|
|
67
|
+
*/
|
|
68
|
+
async onboardAutonomousAgent(bondFundingAddress, dpopJkt) {
|
|
69
|
+
const params = {
|
|
70
|
+
bond_funding_address: bondFundingAddress,
|
|
71
|
+
};
|
|
72
|
+
if (dpopJkt)
|
|
73
|
+
params.dpop_jkt = dpopJkt;
|
|
74
|
+
return this.rpc.call("tenzro_onboardAutonomousAgent", params);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Exchange a long-lived refresh token for a fresh access token. Mirrors
|
|
78
|
+
* OAuth 2.1 `grant_type=refresh_token`. Refresh tokens are opaque UUIDs
|
|
79
|
+
* with a 30-day TTL; access tokens are HS256 JWTs with a 1-hour TTL.
|
|
80
|
+
*
|
|
81
|
+
* If `dpopJkt` is supplied, the new access token is DPoP-bound to that
|
|
82
|
+
* thumbprint. The refresh token itself is **not** rotated in V1.
|
|
83
|
+
*/
|
|
84
|
+
async refreshToken(refreshToken, dpopJkt) {
|
|
85
|
+
const params = { refresh_token: refreshToken };
|
|
86
|
+
if (dpopJkt)
|
|
87
|
+
params.dpop_jkt = dpopJkt;
|
|
88
|
+
return this.rpc.call("tenzro_refreshToken", params);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Mint a fresh access + refresh token pair against an existing MPC
|
|
92
|
+
* wallet. Useful when the holder already provisioned a wallet via
|
|
93
|
+
* `tenzro_createWallet` and now wants OAuth-style auth credentials
|
|
94
|
+
* without re-running the full onboarding flow.
|
|
95
|
+
*
|
|
96
|
+
* Returns the same shape as the three onboard variants —
|
|
97
|
+
* {@link OnboardSession} — so it slots into existing session-management
|
|
98
|
+
* code.
|
|
99
|
+
*/
|
|
100
|
+
async linkWalletForAuth(walletId, options) {
|
|
101
|
+
const params = { wallet_id: walletId };
|
|
102
|
+
if (options?.dpopJkt)
|
|
103
|
+
params.dpop_jkt = options.dpopJkt;
|
|
104
|
+
if (options?.displayName)
|
|
105
|
+
params.display_name = options.displayName;
|
|
106
|
+
if (options?.ttlSecs)
|
|
107
|
+
params.ttl_secs = options.ttlSecs;
|
|
108
|
+
return this.rpc.call("tenzro_linkWalletForAuth", params);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Revoke a single JWT by its `jti` claim. The token is added to the
|
|
112
|
+
* engine's revocation set and any subsequent validation fails.
|
|
113
|
+
*/
|
|
114
|
+
async revokeJwt(jti, reason) {
|
|
115
|
+
return this.rpc.call("tenzro_revokeJwt", {
|
|
116
|
+
jti,
|
|
117
|
+
reason: reason ?? "revoked via SDK",
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Revoke an entire identity by DID. Every JWT minted under this DID
|
|
122
|
+
* (and every descendant DID in the act-chain) is invalidated
|
|
123
|
+
* transitively.
|
|
124
|
+
*/
|
|
125
|
+
async revokeDid(did, reason) {
|
|
126
|
+
return this.rpc.call("tenzro_revokeDid", {
|
|
127
|
+
did,
|
|
128
|
+
reason: reason ?? "revoked via SDK",
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* TDIP/GDPR Article 17 right-to-erasure. Hard-deletes a previously
|
|
133
|
+
* revoked identity from the registry and persistent storage.
|
|
134
|
+
*
|
|
135
|
+
* The identity MUST already be `Revoked` — call {@link revokeDid} first,
|
|
136
|
+
* allow the cascading revocation broadcaster to propagate, and then
|
|
137
|
+
* call this. Distinct from `revokeDid` which is a logical delete.
|
|
138
|
+
*/
|
|
139
|
+
async forgetIdentity(did) {
|
|
140
|
+
return this.rpc.call("tenzro_forgetIdentity", { did });
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* List approvals in `Pending` status for the given approver DID.
|
|
144
|
+
* Returns the records the approver should review and decide on.
|
|
145
|
+
*/
|
|
146
|
+
async listPendingApprovals(approverDid) {
|
|
147
|
+
return this.rpc.call("tenzro_listPendingApprovals", {
|
|
148
|
+
approver_did: approverDid,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Decide a pending approval — either `"approved"` or `"denied"`. Only
|
|
153
|
+
* the recorded approver DID may decide; mismatched approvers are
|
|
154
|
+
* rejected with JSON-RPC error code `-32001` (forbidden).
|
|
155
|
+
*/
|
|
156
|
+
async decideApproval(approvalId, decision, approverDid) {
|
|
157
|
+
return this.rpc.call("tenzro_decideApproval", {
|
|
158
|
+
approval_id: approvalId,
|
|
159
|
+
decision,
|
|
160
|
+
approver_did: approverDid,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* **RFC 8693 OAuth 2.0 Token Exchange.** Exchange a parent JWT for a
|
|
165
|
+
* narrower child JWT bound to a different DPoP key, with a strictly
|
|
166
|
+
* subset of the parent's RAR grants and AAP capabilities. The child
|
|
167
|
+
* token's `controller_did` is set to the parent's `sub`, extending the
|
|
168
|
+
* act-chain by one hop.
|
|
169
|
+
*
|
|
170
|
+
* Subset enforcement is performed by the AS — `requestedRar` and
|
|
171
|
+
* `requestedAapCapabilities` must be a strict subset of what the parent
|
|
172
|
+
* already holds. Anything outside the parent's authority is rejected
|
|
173
|
+
* with JSON-RPC error code `-32002`.
|
|
174
|
+
*
|
|
175
|
+
* @param subjectToken - the parent JWT (validated for signature, exp,
|
|
176
|
+
* and revocation by the AS)
|
|
177
|
+
* @param childBearerDid - DID that will be the `sub` of the child JWT
|
|
178
|
+
* @param childDpopJkt - RFC 7638 JWK thumbprint of the child holder's
|
|
179
|
+
* Ed25519 public key. The child token will be DPoP-bound to it.
|
|
180
|
+
* @param requestedRar - typed scope envelope (RFC 9396) the child should
|
|
181
|
+
* carry. Must be a subset of the parent's `authorization_details`.
|
|
182
|
+
* @param requestedAapCapabilities - AAP `aap_capabilities` claim list.
|
|
183
|
+
* Must be a subset of the parent's capabilities.
|
|
184
|
+
* @param requestedTtlSecs - optional override; clamped to the engine's
|
|
185
|
+
* `max_ttl_secs` and parent's remaining lifetime.
|
|
186
|
+
*/
|
|
187
|
+
async exchangeToken(subjectToken, childBearerDid, childDpopJkt, requestedRar, requestedAapCapabilities, requestedTtlSecs) {
|
|
188
|
+
const params = {
|
|
189
|
+
subject_token: subjectToken,
|
|
190
|
+
child_bearer_did: childBearerDid,
|
|
191
|
+
child_dpop_jkt: childDpopJkt,
|
|
192
|
+
requested_rar: requestedRar,
|
|
193
|
+
requested_aap_capabilities: requestedAapCapabilities,
|
|
194
|
+
};
|
|
195
|
+
if (requestedTtlSecs !== undefined) {
|
|
196
|
+
params.requested_ttl_secs = requestedTtlSecs;
|
|
197
|
+
}
|
|
198
|
+
return this.rpc.call("tenzro_exchangeToken", params);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* **RFC 7662 OAuth 2.0 Token Introspection.** Ask the AS whether a
|
|
202
|
+
* token is currently active and, if so, return its full claim set
|
|
203
|
+
* (RAR, AAP, cnf, controller_did, etc.). Per RFC 7662 §2.2 a failed
|
|
204
|
+
* validation returns `{ active: false }` with no other fields — the AS
|
|
205
|
+
* deliberately does not leak why the token is inactive.
|
|
206
|
+
*
|
|
207
|
+
* Use this from a downstream resource server that wants to validate a
|
|
208
|
+
* bearer token without re-implementing JWT signature checking.
|
|
209
|
+
*/
|
|
210
|
+
async introspectToken(token) {
|
|
211
|
+
return this.rpc.call("tenzro_introspectToken", {
|
|
212
|
+
token,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* **RFC 8414 / RFC 9728 OAuth Authorization Server / Protected Resource
|
|
217
|
+
* Metadata.** Returns the same metadata document the AS publishes at
|
|
218
|
+
* `GET /.well-known/openid-configuration`. Useful for JSON-RPC-only
|
|
219
|
+
* clients (CLI, agents) that don't want to also speak HTTP discovery.
|
|
220
|
+
*/
|
|
221
|
+
async oauthDiscovery() {
|
|
222
|
+
return this.rpc.call("tenzro_oauthDiscovery", []);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
exports.AuthClient = AuthClient;
|
|
226
|
+
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
ADDED
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wPC"}
|
package/dist/bond.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { RpcClient } from "./rpc";
|
|
2
|
+
/**
|
|
3
|
+
* Client for AgentBond operations (Agent-Swarm Spec 9).
|
|
4
|
+
*
|
|
5
|
+
* Bonds are TNZO-denominated stakes posted by a controller against a
|
|
6
|
+
* specific agent DID. While Active and ≥ `bond_min_for_promotion`, the
|
|
7
|
+
* bonded agent is promoted to the Delegated admission lane. Bonds are
|
|
8
|
+
* locked at a deterministic vault address derived from the agent DID:
|
|
9
|
+
* `Address(SHA-256("tenzro/agent-bond/vault" || agent_did))`.
|
|
10
|
+
*
|
|
11
|
+
* Read methods query node state directly. Write methods build typed
|
|
12
|
+
* `PostAgentBond` / `IncreaseAgentBond` / `WithdrawAgentBond`
|
|
13
|
+
* transactions and submit them through `tenzro_signAndSendTransaction`,
|
|
14
|
+
* matching the {@link SettlementClient.createEscrow} pattern.
|
|
15
|
+
*/
|
|
16
|
+
export declare class BondClient {
|
|
17
|
+
private rpc;
|
|
18
|
+
constructor(rpc: RpcClient);
|
|
19
|
+
/**
|
|
20
|
+
* Fetch a single AgentBond record by its 32-byte bond id.
|
|
21
|
+
* @param bondId - 32-byte bond identifier (hex with or without 0x)
|
|
22
|
+
* @returns Bond record or null if not found
|
|
23
|
+
*/
|
|
24
|
+
getAgentBond(bondId: string): Promise<any>;
|
|
25
|
+
/**
|
|
26
|
+
* List all AgentBonds posted by a given controller DID.
|
|
27
|
+
* @param controllerDid - The controller DID (e.g. `did:tenzro:human:...`)
|
|
28
|
+
* @returns Array of bond records (empty if controller has none)
|
|
29
|
+
*/
|
|
30
|
+
listAgentBondsByController(controllerDid: string): Promise<any[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Post a fresh AgentBond for `agentDid` from `controller` (the controller
|
|
33
|
+
* wallet address, used as `tx.from`). Locks `amount` TNZO into the bond
|
|
34
|
+
* vault and promotes the agent to Delegated lane while ≥
|
|
35
|
+
* `bond_min_for_promotion`.
|
|
36
|
+
*
|
|
37
|
+
* Authentication is ambient (DPoP-bound bearer JWT). Signing happens
|
|
38
|
+
* server-side against the holder's MPC wallet.
|
|
39
|
+
*
|
|
40
|
+
* @param controller - Controller wallet address (signer / `tx.from`)
|
|
41
|
+
* @param agentDid - DID of the agent being bonded
|
|
42
|
+
* @param controllerDid - DID of the controller posting the bond
|
|
43
|
+
* @param amount - TNZO base units to lock
|
|
44
|
+
* @returns Transaction hash
|
|
45
|
+
*/
|
|
46
|
+
postAgentBond(controller: string, agentDid: string, controllerDid: string, amount: bigint): Promise<string>;
|
|
47
|
+
/**
|
|
48
|
+
* Top up an existing Active AgentBond by `amount`. `tx.from` MUST equal
|
|
49
|
+
* the original poster (the bond's controller).
|
|
50
|
+
*
|
|
51
|
+
* @param controller - Controller wallet address (signer / `tx.from`)
|
|
52
|
+
* @param agentDid - DID of the bonded agent
|
|
53
|
+
* @param amount - Additional TNZO base units to lock
|
|
54
|
+
* @returns Transaction hash
|
|
55
|
+
*/
|
|
56
|
+
increaseAgentBond(controller: string, agentDid: string, amount: bigint): Promise<string>;
|
|
57
|
+
/**
|
|
58
|
+
* Initiate the cooldown timer on an Active AgentBond. Funds are not
|
|
59
|
+
* released by the VM — finalisation happens off-VM via the node-side
|
|
60
|
+
* `BondManager` once `cooldown_ms` has elapsed. `tx.from` MUST equal
|
|
61
|
+
* the bond's controller.
|
|
62
|
+
*
|
|
63
|
+
* @param controller - Controller wallet address (signer / `tx.from`)
|
|
64
|
+
* @param agentDid - DID of the bonded agent
|
|
65
|
+
* @returns Transaction hash
|
|
66
|
+
*/
|
|
67
|
+
withdrawAgentBond(controller: string, agentDid: string): Promise<string>;
|
|
68
|
+
private fetchNonceAndChainId;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=bond.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bond.d.ts","sourceRoot":"","sources":["../src/bond.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC;;;;;;;;;;;;;GAaG;AACH,qBAAa,UAAU;IACT,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAElC;;;;OAIG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIhD;;;;OAIG;IACG,0BAA0B,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAMvE;;;;;;;;;;;;;;OAcG;IACG,aAAa,CACjB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC;IA6BlB;;;;;;;;OAQG;IACG,iBAAiB,CACrB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC;IA4BlB;;;;;;;;;OASG;IACG,iBAAiB,CACrB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC;YAyBJ,oBAAoB;CAsBnC"}
|
package/dist/bond.js
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BondClient = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Client for AgentBond operations (Agent-Swarm Spec 9).
|
|
6
|
+
*
|
|
7
|
+
* Bonds are TNZO-denominated stakes posted by a controller against a
|
|
8
|
+
* specific agent DID. While Active and ≥ `bond_min_for_promotion`, the
|
|
9
|
+
* bonded agent is promoted to the Delegated admission lane. Bonds are
|
|
10
|
+
* locked at a deterministic vault address derived from the agent DID:
|
|
11
|
+
* `Address(SHA-256("tenzro/agent-bond/vault" || agent_did))`.
|
|
12
|
+
*
|
|
13
|
+
* Read methods query node state directly. Write methods build typed
|
|
14
|
+
* `PostAgentBond` / `IncreaseAgentBond` / `WithdrawAgentBond`
|
|
15
|
+
* transactions and submit them through `tenzro_signAndSendTransaction`,
|
|
16
|
+
* matching the {@link SettlementClient.createEscrow} pattern.
|
|
17
|
+
*/
|
|
18
|
+
class BondClient {
|
|
19
|
+
rpc;
|
|
20
|
+
constructor(rpc) {
|
|
21
|
+
this.rpc = rpc;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Fetch a single AgentBond record by its 32-byte bond id.
|
|
25
|
+
* @param bondId - 32-byte bond identifier (hex with or without 0x)
|
|
26
|
+
* @returns Bond record or null if not found
|
|
27
|
+
*/
|
|
28
|
+
async getAgentBond(bondId) {
|
|
29
|
+
return this.rpc.call("tenzro_getAgentBond", [bondId]);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* List all AgentBonds posted by a given controller DID.
|
|
33
|
+
* @param controllerDid - The controller DID (e.g. `did:tenzro:human:...`)
|
|
34
|
+
* @returns Array of bond records (empty if controller has none)
|
|
35
|
+
*/
|
|
36
|
+
async listAgentBondsByController(controllerDid) {
|
|
37
|
+
return this.rpc.call("tenzro_listAgentBondsByController", [
|
|
38
|
+
controllerDid,
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Post a fresh AgentBond for `agentDid` from `controller` (the controller
|
|
43
|
+
* wallet address, used as `tx.from`). Locks `amount` TNZO into the bond
|
|
44
|
+
* vault and promotes the agent to Delegated lane while ≥
|
|
45
|
+
* `bond_min_for_promotion`.
|
|
46
|
+
*
|
|
47
|
+
* Authentication is ambient (DPoP-bound bearer JWT). Signing happens
|
|
48
|
+
* server-side against the holder's MPC wallet.
|
|
49
|
+
*
|
|
50
|
+
* @param controller - Controller wallet address (signer / `tx.from`)
|
|
51
|
+
* @param agentDid - DID of the agent being bonded
|
|
52
|
+
* @param controllerDid - DID of the controller posting the bond
|
|
53
|
+
* @param amount - TNZO base units to lock
|
|
54
|
+
* @returns Transaction hash
|
|
55
|
+
*/
|
|
56
|
+
async postAgentBond(controller, agentDid, controllerDid, amount) {
|
|
57
|
+
const { nonce, chainId } = await this.fetchNonceAndChainId(controller);
|
|
58
|
+
const txType = {
|
|
59
|
+
type: "PostAgentBond",
|
|
60
|
+
data: {
|
|
61
|
+
agent_did: agentDid,
|
|
62
|
+
controller_did: controllerDid,
|
|
63
|
+
amount: amount.toString(),
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
const result = await this.rpc.call("tenzro_signAndSendTransaction", [
|
|
67
|
+
{
|
|
68
|
+
from: controller,
|
|
69
|
+
to: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
70
|
+
value: 0,
|
|
71
|
+
gas_limit: 75_000,
|
|
72
|
+
gas_price: 1_000_000_000,
|
|
73
|
+
nonce,
|
|
74
|
+
chain_id: chainId,
|
|
75
|
+
tx_type: txType,
|
|
76
|
+
},
|
|
77
|
+
]);
|
|
78
|
+
return typeof result === "string"
|
|
79
|
+
? result
|
|
80
|
+
: result?.tx_hash || result?.transaction_hash || "";
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Top up an existing Active AgentBond by `amount`. `tx.from` MUST equal
|
|
84
|
+
* the original poster (the bond's controller).
|
|
85
|
+
*
|
|
86
|
+
* @param controller - Controller wallet address (signer / `tx.from`)
|
|
87
|
+
* @param agentDid - DID of the bonded agent
|
|
88
|
+
* @param amount - Additional TNZO base units to lock
|
|
89
|
+
* @returns Transaction hash
|
|
90
|
+
*/
|
|
91
|
+
async increaseAgentBond(controller, agentDid, amount) {
|
|
92
|
+
const { nonce, chainId } = await this.fetchNonceAndChainId(controller);
|
|
93
|
+
const txType = {
|
|
94
|
+
type: "IncreaseAgentBond",
|
|
95
|
+
data: {
|
|
96
|
+
agent_did: agentDid,
|
|
97
|
+
amount: amount.toString(),
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
const result = await this.rpc.call("tenzro_signAndSendTransaction", [
|
|
101
|
+
{
|
|
102
|
+
from: controller,
|
|
103
|
+
to: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
104
|
+
value: 0,
|
|
105
|
+
gas_limit: 60_000,
|
|
106
|
+
gas_price: 1_000_000_000,
|
|
107
|
+
nonce,
|
|
108
|
+
chain_id: chainId,
|
|
109
|
+
tx_type: txType,
|
|
110
|
+
},
|
|
111
|
+
]);
|
|
112
|
+
return typeof result === "string"
|
|
113
|
+
? result
|
|
114
|
+
: result?.tx_hash || result?.transaction_hash || "";
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Initiate the cooldown timer on an Active AgentBond. Funds are not
|
|
118
|
+
* released by the VM — finalisation happens off-VM via the node-side
|
|
119
|
+
* `BondManager` once `cooldown_ms` has elapsed. `tx.from` MUST equal
|
|
120
|
+
* the bond's controller.
|
|
121
|
+
*
|
|
122
|
+
* @param controller - Controller wallet address (signer / `tx.from`)
|
|
123
|
+
* @param agentDid - DID of the bonded agent
|
|
124
|
+
* @returns Transaction hash
|
|
125
|
+
*/
|
|
126
|
+
async withdrawAgentBond(controller, agentDid) {
|
|
127
|
+
const { nonce, chainId } = await this.fetchNonceAndChainId(controller);
|
|
128
|
+
const txType = {
|
|
129
|
+
type: "WithdrawAgentBond",
|
|
130
|
+
data: { agent_did: agentDid },
|
|
131
|
+
};
|
|
132
|
+
const result = await this.rpc.call("tenzro_signAndSendTransaction", [
|
|
133
|
+
{
|
|
134
|
+
from: controller,
|
|
135
|
+
to: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
136
|
+
value: 0,
|
|
137
|
+
gas_limit: 50_000,
|
|
138
|
+
gas_price: 1_000_000_000,
|
|
139
|
+
nonce,
|
|
140
|
+
chain_id: chainId,
|
|
141
|
+
tx_type: txType,
|
|
142
|
+
},
|
|
143
|
+
]);
|
|
144
|
+
return typeof result === "string"
|
|
145
|
+
? result
|
|
146
|
+
: result?.tx_hash || result?.transaction_hash || "";
|
|
147
|
+
}
|
|
148
|
+
async fetchNonceAndChainId(address) {
|
|
149
|
+
let nonce = 0;
|
|
150
|
+
let chainId = 1337;
|
|
151
|
+
try {
|
|
152
|
+
const nonceHex = await this.rpc.call("eth_getTransactionCount", [
|
|
153
|
+
address,
|
|
154
|
+
"latest",
|
|
155
|
+
]);
|
|
156
|
+
nonce = parseInt(nonceHex.replace(/^0x/, ""), 16) || 0;
|
|
157
|
+
}
|
|
158
|
+
catch (_) {
|
|
159
|
+
// ignore — default to 0
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
const chainIdHex = await this.rpc.call("eth_chainId", []);
|
|
163
|
+
chainId = parseInt(chainIdHex.replace(/^0x/, ""), 16) || 1337;
|
|
164
|
+
}
|
|
165
|
+
catch (_) {
|
|
166
|
+
// ignore — default to 1337
|
|
167
|
+
}
|
|
168
|
+
return { nonce, chainId };
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
exports.BondClient = BondClient;
|
|
172
|
+
//# sourceMappingURL=bond.js.map
|
package/dist/bond.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bond.js","sourceRoot":"","sources":["../src/bond.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;GAaG;AACH,MAAa,UAAU;IACD;IAApB,YAAoB,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAEtC;;;;OAIG;IACH,KAAK,CAAC,YAAY,CAAC,MAAc;QAC/B,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IACxD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,0BAA0B,CAAC,aAAqB;QACpD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAQ,mCAAmC,EAAE;YAC/D,aAAa;SACd,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,aAAa,CACjB,UAAkB,EAClB,QAAgB,EAChB,aA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,CAAS,yBAAyB,EAAE;gBACtE,OAAO;gBACP,QAAQ;aACT,CAAC,CAAC;YACH,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,wBAAwB;QAC1B,CAAC;QACD,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAS,aAAa,EAAE,EAAE,CAAC,CAAC;YAClE,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC;QAChE,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,2BAA2B;QAC7B,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IAC5B,CAAC;CACF;AA7KD,gCA6KC"}
|
package/dist/cct.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { RpcClient } from './rpc';
|
|
2
|
+
/**
|
|
3
|
+
* Metadata for a single TNZO CCT pool on one chain.
|
|
4
|
+
*/
|
|
5
|
+
export interface CctPool {
|
|
6
|
+
/** CAIP-2 or Chainlink chain id. */
|
|
7
|
+
chain_id: string;
|
|
8
|
+
/** Chainlink CCIP chain selector. */
|
|
9
|
+
chain_selector: string;
|
|
10
|
+
/** Deployed pool contract address. */
|
|
11
|
+
pool_address: string;
|
|
12
|
+
/** Underlying TNZO token contract address on the chain. */
|
|
13
|
+
token_address: string;
|
|
14
|
+
/** Pool type ("LockRelease" on Ethereum; "BurnMint" elsewhere). */
|
|
15
|
+
pool_type: string;
|
|
16
|
+
/** Contract name (e.g. "LockReleaseTokenPool"). */
|
|
17
|
+
contract_name: string;
|
|
18
|
+
/** Outbound rate-limiter capacity (decimal string). */
|
|
19
|
+
outbound_capacity: string;
|
|
20
|
+
/** Inbound rate-limiter capacity (decimal string). */
|
|
21
|
+
inbound_capacity: string;
|
|
22
|
+
/** Rate-limiter refill rate (decimal string). */
|
|
23
|
+
refill_rate: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* List of TNZO CCT pools.
|
|
27
|
+
*/
|
|
28
|
+
export interface CctPoolList {
|
|
29
|
+
/** Number of registered pools. */
|
|
30
|
+
count: number;
|
|
31
|
+
/** Per-chain pool entries. */
|
|
32
|
+
pools: CctPool[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Client for the TNZO CCT (Chainlink Cross-Chain Token) pool registry.
|
|
36
|
+
*
|
|
37
|
+
* Ethereum uses a LockRelease pool; Base, Arbitrum, Optimism, and Solana
|
|
38
|
+
* use BurnMint pools.
|
|
39
|
+
*/
|
|
40
|
+
export declare class CctClient {
|
|
41
|
+
private readonly rpc;
|
|
42
|
+
constructor(rpc: RpcClient);
|
|
43
|
+
/**
|
|
44
|
+
* List all registered TNZO CCT pools.
|
|
45
|
+
*/
|
|
46
|
+
listPools(): Promise<CctPoolList>;
|
|
47
|
+
/**
|
|
48
|
+
* Get a single TNZO CCT pool by chain name
|
|
49
|
+
* (e.g. `ethereum`, `base`, `arbitrum`, `optimism`, `solana`).
|
|
50
|
+
*/
|
|
51
|
+
getPool(chain: string): Promise<CctPool>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=cct.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cct.d.ts","sourceRoot":"","sources":["../src/cct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sDAAsD;IACtD,gBAAgB,EAAE,MAAM,CAAC;IACzB,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB;AAED;;;;;GAKG;AACH,qBAAa,SAAS;IACR,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAE3C;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC;IAIvC;;;OAGG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAG/C"}
|
package/dist/cct.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CctClient = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Client for the TNZO CCT (Chainlink Cross-Chain Token) pool registry.
|
|
6
|
+
*
|
|
7
|
+
* Ethereum uses a LockRelease pool; Base, Arbitrum, Optimism, and Solana
|
|
8
|
+
* use BurnMint pools.
|
|
9
|
+
*/
|
|
10
|
+
class CctClient {
|
|
11
|
+
rpc;
|
|
12
|
+
constructor(rpc) {
|
|
13
|
+
this.rpc = rpc;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* List all registered TNZO CCT pools.
|
|
17
|
+
*/
|
|
18
|
+
async listPools() {
|
|
19
|
+
return this.rpc.call('tenzro_cctListPools', [{}]);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get a single TNZO CCT pool by chain name
|
|
23
|
+
* (e.g. `ethereum`, `base`, `arbitrum`, `optimism`, `solana`).
|
|
24
|
+
*/
|
|
25
|
+
async getPool(chain) {
|
|
26
|
+
return this.rpc.call('tenzro_cctGetPool', [{ chain }]);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.CctClient = CctClient;
|
|
30
|
+
//# sourceMappingURL=cct.js.map
|
package/dist/cct.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cct.js","sourceRoot":"","sources":["../src/cct.ts"],"names":[],"mappings":";;;AAoCA;;;;;GAKG;AACH,MAAa,SAAS;IACS;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;OAEG;IACH,KAAK,CAAC,SAAS;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAc,qBAAqB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACjE,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,KAAa;QACzB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAU,mBAAmB,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC;CACF;AAjBD,8BAiBC"}
|