agentwallet-sdk 3.1.1 → 3.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/dist/identity/agent-identity.d.ts +276 -0
- package/dist/identity/agent-identity.d.ts.map +1 -0
- package/dist/identity/agent-identity.js +300 -0
- package/dist/identity/agent-identity.js.map +1 -0
- package/dist/identity/erc6551.d.ts +441 -0
- package/dist/identity/erc6551.d.ts.map +1 -0
- package/dist/identity/erc6551.js +517 -0
- package/dist/identity/erc6551.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/x402/client.d.ts.map +1 -1
- package/dist/x402/client.js +2 -1
- package/dist/x402/client.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2026 AgentNexus / agentwallet-sdk contributors
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* AgentIdentity — Unified ERC-8004 + ERC-6551 Identity Facade
|
|
26
|
+
*
|
|
27
|
+
* Combines the ERC-8004 Identity Registry (on-chain agent registration / NFT)
|
|
28
|
+
* with the ERC-6551 Token Bound Account (TBA) system into a single, ergonomic
|
|
29
|
+
* class. One call to register your agent, one call to deploy its autonomous wallet,
|
|
30
|
+
* and a single execute() for on-chain actions.
|
|
31
|
+
*
|
|
32
|
+
* Architecture:
|
|
33
|
+
* AgentIdentity
|
|
34
|
+
* ├── ERC8004Client → registers agent NFT, manages off-chain metadata
|
|
35
|
+
* └── ERC6551Client → deploys TBA, executes calls from NFT-owned wallet
|
|
36
|
+
*
|
|
37
|
+
* @module identity/agent-identity
|
|
38
|
+
*/
|
|
39
|
+
import type { WalletClient, Address, Hex } from 'viem';
|
|
40
|
+
import { ERC8004Client, type AgentRegistrationFile, type RegistrationResult } from './erc8004.js';
|
|
41
|
+
import { ERC6551Client, type TBAAccount, type TBAExecuteParams, type TBAExecuteResult } from './erc6551.js';
|
|
42
|
+
/**
|
|
43
|
+
* Supported chain names for AgentIdentity.
|
|
44
|
+
*/
|
|
45
|
+
export type AgentIdentityChain = 'base' | 'base-sepolia' | 'ethereum' | 'arbitrum' | 'polygon';
|
|
46
|
+
/**
|
|
47
|
+
* Configuration for AgentIdentity.
|
|
48
|
+
*/
|
|
49
|
+
export interface AgentIdentityConfig {
|
|
50
|
+
/**
|
|
51
|
+
* The agent's signing WalletClient (controls the NFT and TBA).
|
|
52
|
+
* Keys never leave the device — all signing is local.
|
|
53
|
+
*/
|
|
54
|
+
wallet: WalletClient;
|
|
55
|
+
/**
|
|
56
|
+
* Target chain. Defaults to 'base' (Base mainnet).
|
|
57
|
+
*/
|
|
58
|
+
chain?: AgentIdentityChain;
|
|
59
|
+
/**
|
|
60
|
+
* ERC-8004 Identity Registry contract address.
|
|
61
|
+
* Required for ERC-8004 registration. Omit if only using ERC-6551.
|
|
62
|
+
*/
|
|
63
|
+
registryAddress?: Address;
|
|
64
|
+
/**
|
|
65
|
+
* ERC-6551 registry override. Defaults to canonical registry.
|
|
66
|
+
* You almost never need to change this.
|
|
67
|
+
*/
|
|
68
|
+
tbaRegistryAddress?: Address;
|
|
69
|
+
/**
|
|
70
|
+
* ERC-6551 account implementation override.
|
|
71
|
+
* Defaults to Tokenbound reference implementation on Base.
|
|
72
|
+
*/
|
|
73
|
+
tbaImplementationAddress?: Address;
|
|
74
|
+
/**
|
|
75
|
+
* RPC URL override for both ERC-8004 and ERC-6551 clients.
|
|
76
|
+
*/
|
|
77
|
+
rpcUrl?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Salt for TBA derivation. Defaults to 0x000...0.
|
|
80
|
+
* Change this to create multiple TBAs for the same NFT.
|
|
81
|
+
*/
|
|
82
|
+
tbaSalt?: Hex;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Full resolved agent identity state.
|
|
86
|
+
*/
|
|
87
|
+
export interface AgentIdentityState {
|
|
88
|
+
/** On-chain ERC-721 agent token ID (null before registration). */
|
|
89
|
+
agentId: bigint | null;
|
|
90
|
+
/** TBA address (null before deployTBA()). */
|
|
91
|
+
tbaAddress: Address | null;
|
|
92
|
+
/** Whether the ERC-8004 NFT is registered on-chain. */
|
|
93
|
+
isRegistered: boolean;
|
|
94
|
+
/** Whether the ERC-6551 TBA is deployed on-chain. */
|
|
95
|
+
isTBADeployed: boolean;
|
|
96
|
+
/** NFT owner address (= wallet account address). */
|
|
97
|
+
owner: Address | null;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* AgentIdentity — unified ERC-8004 + ERC-6551 identity manager.
|
|
101
|
+
*
|
|
102
|
+
* Provides a single interface to manage an agent's complete on-chain identity:
|
|
103
|
+
* - ERC-8004: NFT registration with metadata and service endpoints
|
|
104
|
+
* - ERC-6551: Token Bound Account (TBA) — the agent's autonomous wallet
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* import { AgentIdentity } from 'agentwallet-sdk';
|
|
109
|
+
* import { createWalletClient, http } from 'viem';
|
|
110
|
+
* import { privateKeyToAccount } from 'viem/accounts';
|
|
111
|
+
* import { base } from 'viem/chains';
|
|
112
|
+
*
|
|
113
|
+
* const wallet = createWalletClient({
|
|
114
|
+
* account: privateKeyToAccount('0xYOUR_PRIVATE_KEY'),
|
|
115
|
+
* chain: base,
|
|
116
|
+
* transport: http(),
|
|
117
|
+
* });
|
|
118
|
+
*
|
|
119
|
+
* const identity = new AgentIdentity({
|
|
120
|
+
* wallet,
|
|
121
|
+
* chain: 'base',
|
|
122
|
+
* registryAddress: '0xYOUR_ERC8004_REGISTRY',
|
|
123
|
+
* });
|
|
124
|
+
*
|
|
125
|
+
* // 1. Register agent NFT (ERC-8004)
|
|
126
|
+
* const { agentId } = await identity.register({
|
|
127
|
+
* name: 'MyTradingAgent',
|
|
128
|
+
* description: 'Autonomous DeFi trading agent',
|
|
129
|
+
* x402Support: true,
|
|
130
|
+
* });
|
|
131
|
+
*
|
|
132
|
+
* // 2. Deploy TBA (ERC-6551) — NFT now owns an autonomous wallet
|
|
133
|
+
* await identity.deployTBA();
|
|
134
|
+
* console.log('Agent TBA:', identity.tbaAddress);
|
|
135
|
+
*
|
|
136
|
+
* // 3. Execute from TBA (agent acts on-chain)
|
|
137
|
+
* await identity.execute({
|
|
138
|
+
* to: TASKBRIDGE_CONTRACT,
|
|
139
|
+
* value: parseEther('0.01'),
|
|
140
|
+
* data: encodedCalldata,
|
|
141
|
+
* });
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
export declare class AgentIdentity {
|
|
145
|
+
private readonly wallet;
|
|
146
|
+
private readonly chain;
|
|
147
|
+
private readonly tbaSalt;
|
|
148
|
+
private readonly erc8004;
|
|
149
|
+
private readonly erc6551;
|
|
150
|
+
private _agentId;
|
|
151
|
+
private _nftContract;
|
|
152
|
+
private _tbaAccount;
|
|
153
|
+
constructor(config: AgentIdentityConfig);
|
|
154
|
+
/**
|
|
155
|
+
* Register this agent as an ERC-8004 identity NFT on-chain.
|
|
156
|
+
*
|
|
157
|
+
* Builds a spec-compliant agent registration file and mints an ERC-721 NFT
|
|
158
|
+
* via the ERC-8004 Identity Registry. After registration, the NFT represents
|
|
159
|
+
* the agent's permanent, portable on-chain identity.
|
|
160
|
+
*
|
|
161
|
+
* Non-custodial: the wallet signs the registration transaction locally.
|
|
162
|
+
*
|
|
163
|
+
* @param metadata - Agent metadata for the registration file
|
|
164
|
+
* @param agentURI - Optional external URI (IPFS/HTTPS). Auto-builds data URI if omitted.
|
|
165
|
+
* @returns Registration result with txHash and agentId
|
|
166
|
+
* @throws Error if no registryAddress was provided in config
|
|
167
|
+
*/
|
|
168
|
+
register(metadata: Omit<AgentRegistrationFile, 'type'>, agentURI?: string): Promise<RegistrationResult>;
|
|
169
|
+
/**
|
|
170
|
+
* Restore a previously registered agent identity.
|
|
171
|
+
*
|
|
172
|
+
* Use this when you already have an agentId from a prior session.
|
|
173
|
+
* Sets the internal agentId so deployTBA() and execute() work correctly.
|
|
174
|
+
*
|
|
175
|
+
* @param agentId - Previously registered ERC-8004 token ID
|
|
176
|
+
* @param nftContract - The ERC-8004 registry contract (= registryAddress in config)
|
|
177
|
+
*/
|
|
178
|
+
setAgentId(agentId: bigint, nftContract?: Address): void;
|
|
179
|
+
/**
|
|
180
|
+
* Deploy the Token Bound Account for this agent's NFT.
|
|
181
|
+
*
|
|
182
|
+
* The TBA address is deterministic — you can compute it before deployment
|
|
183
|
+
* via `computeTBAAddress()`. This call deploys the actual smart contract at
|
|
184
|
+
* that address, enabling the agent to act autonomously on-chain.
|
|
185
|
+
*
|
|
186
|
+
* Idempotent: calling deployTBA() on an already-deployed TBA is safe.
|
|
187
|
+
*
|
|
188
|
+
* @param nftContract - Override: NFT contract to bind the TBA to.
|
|
189
|
+
* Defaults to the registryAddress (ERC-8004 registry is also the NFT contract).
|
|
190
|
+
* @param tokenId - Override: token ID. Defaults to the registered agentId.
|
|
191
|
+
* @returns Deployed TBAAccount
|
|
192
|
+
* @throws Error if agentId not set (call register() first or use setAgentId())
|
|
193
|
+
*/
|
|
194
|
+
deployTBA(nftContract?: Address, tokenId?: bigint): Promise<TBAAccount>;
|
|
195
|
+
/**
|
|
196
|
+
* Compute the deterministic TBA address without deploying.
|
|
197
|
+
*
|
|
198
|
+
* Useful for pre-computing the address to fund it before deployment,
|
|
199
|
+
* or to check if a TBA already exists.
|
|
200
|
+
*
|
|
201
|
+
* @param nftContract - NFT contract (defaults to registryAddress)
|
|
202
|
+
* @param tokenId - Token ID (defaults to agentId)
|
|
203
|
+
* @returns Deterministic TBA address
|
|
204
|
+
*/
|
|
205
|
+
computeTBAAddress(nftContract?: Address, tokenId?: bigint): Address;
|
|
206
|
+
/**
|
|
207
|
+
* Load TBA state without deploying — useful for resuming a session.
|
|
208
|
+
* Sets internal TBA state so execute() works without re-deploying.
|
|
209
|
+
*
|
|
210
|
+
* @param nftContract - NFT contract (defaults to registryAddress)
|
|
211
|
+
* @param tokenId - Token ID (defaults to agentId)
|
|
212
|
+
*/
|
|
213
|
+
loadTBA(nftContract?: Address, tokenId?: bigint): Promise<TBAAccount>;
|
|
214
|
+
/**
|
|
215
|
+
* Execute a call from the agent's TBA (the agent acts autonomously).
|
|
216
|
+
*
|
|
217
|
+
* Routes the call through the TBA's `execute()` function, which verifies
|
|
218
|
+
* the caller owns the NFT before dispatching to the target contract.
|
|
219
|
+
*
|
|
220
|
+
* @param params - Call parameters (to, value, data, operation)
|
|
221
|
+
* @returns Transaction hash and return data
|
|
222
|
+
* @throws Error if TBA not deployed (call deployTBA() first)
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```typescript
|
|
226
|
+
* // Agent bids on a TaskBridge task
|
|
227
|
+
* await identity.execute({
|
|
228
|
+
* to: TASKBRIDGE_ADDRESS,
|
|
229
|
+
* value: 0n,
|
|
230
|
+
* data: encodeFunctionData({
|
|
231
|
+
* abi: TaskBridgeAbi,
|
|
232
|
+
* functionName: 'bid',
|
|
233
|
+
* args: [taskId, bidAmount],
|
|
234
|
+
* }),
|
|
235
|
+
* });
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
execute(params: TBAExecuteParams): Promise<TBAExecuteResult>;
|
|
239
|
+
/**
|
|
240
|
+
* The agent's ERC-8004 token ID (null before registration).
|
|
241
|
+
*/
|
|
242
|
+
get agentId(): bigint | null;
|
|
243
|
+
/**
|
|
244
|
+
* The agent's TBA address (null before deployTBA() or loadTBA()).
|
|
245
|
+
*/
|
|
246
|
+
get tbaAddress(): Address | null;
|
|
247
|
+
/**
|
|
248
|
+
* Full TBA account details (null before deployTBA() or loadTBA()).
|
|
249
|
+
*/
|
|
250
|
+
get tbaAccount(): TBAAccount | null;
|
|
251
|
+
/**
|
|
252
|
+
* Whether the agent's ERC-8004 NFT is registered.
|
|
253
|
+
*/
|
|
254
|
+
get isRegistered(): boolean;
|
|
255
|
+
/**
|
|
256
|
+
* Whether the agent's TBA is deployed on-chain.
|
|
257
|
+
*/
|
|
258
|
+
get isTBADeployed(): boolean;
|
|
259
|
+
/**
|
|
260
|
+
* The wallet account address (human principal / NFT owner).
|
|
261
|
+
*/
|
|
262
|
+
get ownerAddress(): Address | null;
|
|
263
|
+
/**
|
|
264
|
+
* Full identity state snapshot.
|
|
265
|
+
*/
|
|
266
|
+
get state(): AgentIdentityState;
|
|
267
|
+
/**
|
|
268
|
+
* Direct access to the underlying ERC6551Client for advanced usage.
|
|
269
|
+
*/
|
|
270
|
+
get erc6551Client(): ERC6551Client;
|
|
271
|
+
/**
|
|
272
|
+
* Direct access to the underlying ERC8004Client (null if no registryAddress provided).
|
|
273
|
+
*/
|
|
274
|
+
get erc8004Client(): ERC8004Client | null;
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=agent-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-identity.d.ts","sourceRoot":"","sources":["../../src/identity/agent-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAQ,GAAG,EAAE,MAAM,MAAM,CAAC;AAE7D,OAAO,EACL,aAAa,EAEb,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,aAAa,EAGb,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AAItB;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;AAE/F;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,MAAM,EAAE,YAAY,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAE3B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,kEAAkE;IAClE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,6CAA6C;IAC7C,UAAU,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IAmB3E;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,OAAO,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAalE;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAE3B;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,OAAO,GAAG,IAAI,CAE/B;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,UAAU,GAAG,IAAI,CAElC;IAED;;OAEG;IACH,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED;;OAEG;IACH,IAAI,YAAY,IAAI,OAAO,GAAG,IAAI,CAEjC;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,kBAAkB,CAQ9B;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,aAAa,CAEjC;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,aAAa,GAAG,IAAI,CAExC;CACF"}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2026 AgentNexus / agentwallet-sdk contributors
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import { ERC8004Client, } from './erc8004.js';
|
|
25
|
+
import { ERC6551Client, DEFAULT_SALT, } from './erc6551.js';
|
|
26
|
+
// ─── AgentIdentity ────────────────────────────────────────────────────────────
|
|
27
|
+
/**
|
|
28
|
+
* AgentIdentity — unified ERC-8004 + ERC-6551 identity manager.
|
|
29
|
+
*
|
|
30
|
+
* Provides a single interface to manage an agent's complete on-chain identity:
|
|
31
|
+
* - ERC-8004: NFT registration with metadata and service endpoints
|
|
32
|
+
* - ERC-6551: Token Bound Account (TBA) — the agent's autonomous wallet
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { AgentIdentity } from 'agentwallet-sdk';
|
|
37
|
+
* import { createWalletClient, http } from 'viem';
|
|
38
|
+
* import { privateKeyToAccount } from 'viem/accounts';
|
|
39
|
+
* import { base } from 'viem/chains';
|
|
40
|
+
*
|
|
41
|
+
* const wallet = createWalletClient({
|
|
42
|
+
* account: privateKeyToAccount('0xYOUR_PRIVATE_KEY'),
|
|
43
|
+
* chain: base,
|
|
44
|
+
* transport: http(),
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* const identity = new AgentIdentity({
|
|
48
|
+
* wallet,
|
|
49
|
+
* chain: 'base',
|
|
50
|
+
* registryAddress: '0xYOUR_ERC8004_REGISTRY',
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* // 1. Register agent NFT (ERC-8004)
|
|
54
|
+
* const { agentId } = await identity.register({
|
|
55
|
+
* name: 'MyTradingAgent',
|
|
56
|
+
* description: 'Autonomous DeFi trading agent',
|
|
57
|
+
* x402Support: true,
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* // 2. Deploy TBA (ERC-6551) — NFT now owns an autonomous wallet
|
|
61
|
+
* await identity.deployTBA();
|
|
62
|
+
* console.log('Agent TBA:', identity.tbaAddress);
|
|
63
|
+
*
|
|
64
|
+
* // 3. Execute from TBA (agent acts on-chain)
|
|
65
|
+
* await identity.execute({
|
|
66
|
+
* to: TASKBRIDGE_CONTRACT,
|
|
67
|
+
* value: parseEther('0.01'),
|
|
68
|
+
* data: encodedCalldata,
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export class AgentIdentity {
|
|
73
|
+
constructor(config) {
|
|
74
|
+
this._agentId = null;
|
|
75
|
+
this._nftContract = null;
|
|
76
|
+
this._tbaAccount = null;
|
|
77
|
+
this.wallet = config.wallet;
|
|
78
|
+
this.chain = config.chain ?? 'base';
|
|
79
|
+
this.tbaSalt = config.tbaSalt ?? DEFAULT_SALT;
|
|
80
|
+
// ERC-8004 client — optional (some agents may only use ERC-6551)
|
|
81
|
+
if (config.registryAddress) {
|
|
82
|
+
this.erc8004 = new ERC8004Client({
|
|
83
|
+
registryAddress: config.registryAddress,
|
|
84
|
+
chain: this.chain,
|
|
85
|
+
rpcUrl: config.rpcUrl,
|
|
86
|
+
});
|
|
87
|
+
this._nftContract = config.registryAddress;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
this.erc8004 = null;
|
|
91
|
+
}
|
|
92
|
+
// ERC-6551 client — always initialized
|
|
93
|
+
this.erc6551 = new ERC6551Client({
|
|
94
|
+
chain: this.chain,
|
|
95
|
+
registryAddress: config.tbaRegistryAddress,
|
|
96
|
+
implementationAddress: config.tbaImplementationAddress,
|
|
97
|
+
rpcUrl: config.rpcUrl,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
// ─── ERC-8004: Registration ───────────────────────────────────────────────
|
|
101
|
+
/**
|
|
102
|
+
* Register this agent as an ERC-8004 identity NFT on-chain.
|
|
103
|
+
*
|
|
104
|
+
* Builds a spec-compliant agent registration file and mints an ERC-721 NFT
|
|
105
|
+
* via the ERC-8004 Identity Registry. After registration, the NFT represents
|
|
106
|
+
* the agent's permanent, portable on-chain identity.
|
|
107
|
+
*
|
|
108
|
+
* Non-custodial: the wallet signs the registration transaction locally.
|
|
109
|
+
*
|
|
110
|
+
* @param metadata - Agent metadata for the registration file
|
|
111
|
+
* @param agentURI - Optional external URI (IPFS/HTTPS). Auto-builds data URI if omitted.
|
|
112
|
+
* @returns Registration result with txHash and agentId
|
|
113
|
+
* @throws Error if no registryAddress was provided in config
|
|
114
|
+
*/
|
|
115
|
+
async register(metadata, agentURI) {
|
|
116
|
+
if (!this.erc8004) {
|
|
117
|
+
throw new Error('AgentIdentity: registryAddress is required for ERC-8004 registration. ' +
|
|
118
|
+
'Provide it in the constructor config.');
|
|
119
|
+
}
|
|
120
|
+
const result = await this.erc8004.registerAgent(this.wallet, metadata, agentURI);
|
|
121
|
+
if (result.agentId !== null) {
|
|
122
|
+
this._agentId = result.agentId;
|
|
123
|
+
}
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Restore a previously registered agent identity.
|
|
128
|
+
*
|
|
129
|
+
* Use this when you already have an agentId from a prior session.
|
|
130
|
+
* Sets the internal agentId so deployTBA() and execute() work correctly.
|
|
131
|
+
*
|
|
132
|
+
* @param agentId - Previously registered ERC-8004 token ID
|
|
133
|
+
* @param nftContract - The ERC-8004 registry contract (= registryAddress in config)
|
|
134
|
+
*/
|
|
135
|
+
setAgentId(agentId, nftContract) {
|
|
136
|
+
this._agentId = agentId;
|
|
137
|
+
if (nftContract)
|
|
138
|
+
this._nftContract = nftContract;
|
|
139
|
+
}
|
|
140
|
+
// ─── ERC-6551: TBA Deployment ─────────────────────────────────────────────
|
|
141
|
+
/**
|
|
142
|
+
* Deploy the Token Bound Account for this agent's NFT.
|
|
143
|
+
*
|
|
144
|
+
* The TBA address is deterministic — you can compute it before deployment
|
|
145
|
+
* via `computeTBAAddress()`. This call deploys the actual smart contract at
|
|
146
|
+
* that address, enabling the agent to act autonomously on-chain.
|
|
147
|
+
*
|
|
148
|
+
* Idempotent: calling deployTBA() on an already-deployed TBA is safe.
|
|
149
|
+
*
|
|
150
|
+
* @param nftContract - Override: NFT contract to bind the TBA to.
|
|
151
|
+
* Defaults to the registryAddress (ERC-8004 registry is also the NFT contract).
|
|
152
|
+
* @param tokenId - Override: token ID. Defaults to the registered agentId.
|
|
153
|
+
* @returns Deployed TBAAccount
|
|
154
|
+
* @throws Error if agentId not set (call register() first or use setAgentId())
|
|
155
|
+
*/
|
|
156
|
+
async deployTBA(nftContract, tokenId) {
|
|
157
|
+
const resolvedContract = nftContract ?? this._nftContract;
|
|
158
|
+
const resolvedTokenId = tokenId ?? this._agentId;
|
|
159
|
+
if (!resolvedContract) {
|
|
160
|
+
throw new Error('AgentIdentity: NFT contract address unknown. ' +
|
|
161
|
+
'Provide registryAddress in config or pass nftContract to deployTBA().');
|
|
162
|
+
}
|
|
163
|
+
if (resolvedTokenId === null) {
|
|
164
|
+
throw new Error('AgentIdentity: agentId not set. ' +
|
|
165
|
+
'Call register() first or use setAgentId() to restore a prior identity.');
|
|
166
|
+
}
|
|
167
|
+
const tbaAccount = await this.erc6551.createTBA(this.wallet, resolvedContract, resolvedTokenId, this.tbaSalt);
|
|
168
|
+
this._tbaAccount = tbaAccount;
|
|
169
|
+
return tbaAccount;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Compute the deterministic TBA address without deploying.
|
|
173
|
+
*
|
|
174
|
+
* Useful for pre-computing the address to fund it before deployment,
|
|
175
|
+
* or to check if a TBA already exists.
|
|
176
|
+
*
|
|
177
|
+
* @param nftContract - NFT contract (defaults to registryAddress)
|
|
178
|
+
* @param tokenId - Token ID (defaults to agentId)
|
|
179
|
+
* @returns Deterministic TBA address
|
|
180
|
+
*/
|
|
181
|
+
computeTBAAddress(nftContract, tokenId) {
|
|
182
|
+
const resolvedContract = nftContract ?? this._nftContract;
|
|
183
|
+
const resolvedTokenId = tokenId ?? this._agentId;
|
|
184
|
+
if (!resolvedContract || resolvedTokenId === null) {
|
|
185
|
+
throw new Error('AgentIdentity: nftContract and tokenId required to compute TBA address.');
|
|
186
|
+
}
|
|
187
|
+
return this.erc6551.computeTBAAddress(resolvedContract, resolvedTokenId, this.tbaSalt);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Load TBA state without deploying — useful for resuming a session.
|
|
191
|
+
* Sets internal TBA state so execute() works without re-deploying.
|
|
192
|
+
*
|
|
193
|
+
* @param nftContract - NFT contract (defaults to registryAddress)
|
|
194
|
+
* @param tokenId - Token ID (defaults to agentId)
|
|
195
|
+
*/
|
|
196
|
+
async loadTBA(nftContract, tokenId) {
|
|
197
|
+
const resolvedContract = nftContract ?? this._nftContract;
|
|
198
|
+
const resolvedTokenId = tokenId ?? this._agentId;
|
|
199
|
+
if (!resolvedContract || resolvedTokenId === null) {
|
|
200
|
+
throw new Error('AgentIdentity: nftContract and tokenId required to load TBA.');
|
|
201
|
+
}
|
|
202
|
+
const tbaAccount = await this.erc6551.getTBAAccount(resolvedContract, resolvedTokenId, this.tbaSalt);
|
|
203
|
+
this._tbaAccount = tbaAccount;
|
|
204
|
+
return tbaAccount;
|
|
205
|
+
}
|
|
206
|
+
// ─── ERC-6551: Execution ──────────────────────────────────────────────────
|
|
207
|
+
/**
|
|
208
|
+
* Execute a call from the agent's TBA (the agent acts autonomously).
|
|
209
|
+
*
|
|
210
|
+
* Routes the call through the TBA's `execute()` function, which verifies
|
|
211
|
+
* the caller owns the NFT before dispatching to the target contract.
|
|
212
|
+
*
|
|
213
|
+
* @param params - Call parameters (to, value, data, operation)
|
|
214
|
+
* @returns Transaction hash and return data
|
|
215
|
+
* @throws Error if TBA not deployed (call deployTBA() first)
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* // Agent bids on a TaskBridge task
|
|
220
|
+
* await identity.execute({
|
|
221
|
+
* to: TASKBRIDGE_ADDRESS,
|
|
222
|
+
* value: 0n,
|
|
223
|
+
* data: encodeFunctionData({
|
|
224
|
+
* abi: TaskBridgeAbi,
|
|
225
|
+
* functionName: 'bid',
|
|
226
|
+
* args: [taskId, bidAmount],
|
|
227
|
+
* }),
|
|
228
|
+
* });
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
async execute(params) {
|
|
232
|
+
const tbaAddress = this.tbaAddress;
|
|
233
|
+
if (!tbaAddress) {
|
|
234
|
+
throw new Error('AgentIdentity: TBA not deployed. Call deployTBA() first or loadTBA() to restore.');
|
|
235
|
+
}
|
|
236
|
+
return this.erc6551.executeTBA(this.wallet, tbaAddress, params);
|
|
237
|
+
}
|
|
238
|
+
// ─── State accessors ──────────────────────────────────────────────────────
|
|
239
|
+
/**
|
|
240
|
+
* The agent's ERC-8004 token ID (null before registration).
|
|
241
|
+
*/
|
|
242
|
+
get agentId() {
|
|
243
|
+
return this._agentId;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* The agent's TBA address (null before deployTBA() or loadTBA()).
|
|
247
|
+
*/
|
|
248
|
+
get tbaAddress() {
|
|
249
|
+
return this._tbaAccount?.address ?? null;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Full TBA account details (null before deployTBA() or loadTBA()).
|
|
253
|
+
*/
|
|
254
|
+
get tbaAccount() {
|
|
255
|
+
return this._tbaAccount;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Whether the agent's ERC-8004 NFT is registered.
|
|
259
|
+
*/
|
|
260
|
+
get isRegistered() {
|
|
261
|
+
return this._agentId !== null;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Whether the agent's TBA is deployed on-chain.
|
|
265
|
+
*/
|
|
266
|
+
get isTBADeployed() {
|
|
267
|
+
return this._tbaAccount?.isDeployed === true;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* The wallet account address (human principal / NFT owner).
|
|
271
|
+
*/
|
|
272
|
+
get ownerAddress() {
|
|
273
|
+
return this.wallet.account?.address ?? null;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Full identity state snapshot.
|
|
277
|
+
*/
|
|
278
|
+
get state() {
|
|
279
|
+
return {
|
|
280
|
+
agentId: this._agentId,
|
|
281
|
+
tbaAddress: this.tbaAddress,
|
|
282
|
+
isRegistered: this.isRegistered,
|
|
283
|
+
isTBADeployed: this.isTBADeployed,
|
|
284
|
+
owner: this.ownerAddress,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Direct access to the underlying ERC6551Client for advanced usage.
|
|
289
|
+
*/
|
|
290
|
+
get erc6551Client() {
|
|
291
|
+
return this.erc6551;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Direct access to the underlying ERC8004Client (null if no registryAddress provided).
|
|
295
|
+
*/
|
|
296
|
+
get erc8004Client() {
|
|
297
|
+
return this.erc8004;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
//# sourceMappingURL=agent-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-identity.js","sourceRoot":"","sources":["../../src/identity/agent-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAoBH,OAAO,EACL,aAAa,GAId,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,aAAa,EACb,YAAY,GAKb,MAAM,cAAc,CAAC;AAsEtB,iFAAiF;AAEjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,OAAO,aAAa;IAYxB,YAAY,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