@openserv-labs/client 2.0.2 → 2.1.1
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 +142 -2
- package/dist/client.d.ts +3 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +4 -0
- package/dist/erc8004-abi.d.ts +113 -0
- package/dist/erc8004-abi.d.ts.map +1 -0
- package/dist/erc8004-abi.js +123 -0
- package/dist/erc8004-api.d.ts +318 -0
- package/dist/erc8004-api.d.ts.map +1 -0
- package/dist/erc8004-api.js +558 -0
- package/dist/erc8004-contracts.d.ts +92 -0
- package/dist/erc8004-contracts.d.ts.map +1 -0
- package/dist/erc8004-contracts.js +250 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/triggers-api.d.ts +4 -4
- package/dist/triggers-api.js +4 -4
- package/dist/types.d.ts +101 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -307,6 +307,137 @@ console.log(`Pay to: ${preflight.x402WalletAddress}`)
|
|
|
307
307
|
console.log(`Input schema: ${JSON.stringify(preflight.jsonSchema)}`)
|
|
308
308
|
```
|
|
309
309
|
|
|
310
|
+
### ERC-8004 (Agent Identity)
|
|
311
|
+
|
|
312
|
+
ERC-8004 is an on-chain agent identity standard. The `registerOnChain` method handles the entire flow in a single call -- building the agent card, uploading to IPFS, and registering on-chain.
|
|
313
|
+
|
|
314
|
+
> **Note**: The wallet used for `registerOnChain` must have ETH for gas on the target chain (Base mainnet by default).
|
|
315
|
+
|
|
316
|
+
```typescript
|
|
317
|
+
// Register an agent on-chain in one call
|
|
318
|
+
const result = await client.erc8004.registerOnChain({
|
|
319
|
+
workflowId: 123,
|
|
320
|
+
privateKey: process.env.WALLET_PRIVATE_KEY!,
|
|
321
|
+
name: 'My AI Agent',
|
|
322
|
+
description: 'An agent that does amazing things',
|
|
323
|
+
})
|
|
324
|
+
|
|
325
|
+
console.log(result.agentId) // "8453:42"
|
|
326
|
+
console.log(result.txHash) // "0xabc..."
|
|
327
|
+
console.log(result.ipfsCid) // "bafkrei..."
|
|
328
|
+
console.log(result.agentCardUrl) // "https://gateway.pinata.cloud/ipfs/bafkrei..."
|
|
329
|
+
console.log(result.blockExplorerUrl) // "https://basescan.org/tx/0xabc..."
|
|
330
|
+
console.log(result.scanUrl) // "https://www.8004scan.io/agents/base/42"
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Under the hood, `registerOnChain` does the following:
|
|
334
|
+
|
|
335
|
+
1. Reads the workspace wallet and callable triggers
|
|
336
|
+
2. Builds the ERC-8004 agent card JSON (with services and wallet info)
|
|
337
|
+
3. Uploads the agent card to IPFS via a presigned Pinata URL
|
|
338
|
+
4. Registers on-chain (first deploy) or updates the URI (re-deploy)
|
|
339
|
+
5. Saves the deployment state back to the platform
|
|
340
|
+
|
|
341
|
+
Re-deploying (updating an existing registration) uses the same call -- it automatically detects whether the workspace already has an `erc8004AgentId` and uploads a fresh agent card with the latest name, description, services, and wallet info, then updates the on-chain URI to point to it. No new token is minted; only the metadata changes.
|
|
342
|
+
|
|
343
|
+
#### Supported Chains
|
|
344
|
+
|
|
345
|
+
`registerOnChain` defaults to Base mainnet (`chainId: 8453`). You can target any supported chain:
|
|
346
|
+
|
|
347
|
+
```typescript
|
|
348
|
+
// Deploy on a different chain
|
|
349
|
+
const result = await client.erc8004.registerOnChain({
|
|
350
|
+
workflowId: 123,
|
|
351
|
+
privateKey: process.env.WALLET_PRIVATE_KEY!,
|
|
352
|
+
chainId: 42161, // Arbitrum One
|
|
353
|
+
rpcUrl: 'https://arb1.arbitrum.io/rpc',
|
|
354
|
+
name: 'My Agent',
|
|
355
|
+
})
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**Mainnets:** Ethereum (1), Base (8453), Polygon (137), Arbitrum One (42161), Celo (42220), Gnosis (100), Scroll (534352), Taiko (167000), BNB Smart Chain (56)
|
|
359
|
+
|
|
360
|
+
**Testnets:** Ethereum Sepolia (11155111), Base Sepolia (84532), Polygon Amoy (80002), Arbitrum Sepolia (421614), Celo Alfajores (44787), Scroll Sepolia (534351), BNB Testnet (97)
|
|
361
|
+
|
|
362
|
+
You can also query supported chains programmatically:
|
|
363
|
+
|
|
364
|
+
```typescript
|
|
365
|
+
import { listErc8004ChainIds, getErc8004Chain } from '@openserv-labs/client'
|
|
366
|
+
|
|
367
|
+
const mainnets = listErc8004ChainIds('mainnet') // [1, 8453, 137, ...]
|
|
368
|
+
const testnets = listErc8004ChainIds('testnet') // [11155111, 84532, ...]
|
|
369
|
+
|
|
370
|
+
const baseConfig = getErc8004Chain(8453)
|
|
371
|
+
console.log(baseConfig?.contracts.IDENTITY_REGISTRY)
|
|
372
|
+
// "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432"
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
#### Low-level ERC-8004 Operations
|
|
376
|
+
|
|
377
|
+
For more control over individual steps, use the lower-level methods directly:
|
|
378
|
+
|
|
379
|
+
```typescript
|
|
380
|
+
// Generate a web3 wallet for the workspace
|
|
381
|
+
const wallet = await client.erc8004.generateWallet({ workflowId: 123 })
|
|
382
|
+
console.log('Wallet address:', wallet.address)
|
|
383
|
+
|
|
384
|
+
// Import an existing wallet
|
|
385
|
+
const imported = await client.erc8004.importWallet({
|
|
386
|
+
workflowId: 123,
|
|
387
|
+
address: '0x...',
|
|
388
|
+
network: 'base',
|
|
389
|
+
chainId: 8453,
|
|
390
|
+
privateKey: '0x...'
|
|
391
|
+
})
|
|
392
|
+
|
|
393
|
+
// Get the workspace wallet
|
|
394
|
+
const existing = await client.erc8004.getWallet({ workflowId: 123 })
|
|
395
|
+
console.log(existing.deployed, existing.erc8004AgentId)
|
|
396
|
+
|
|
397
|
+
// Delete the workspace wallet
|
|
398
|
+
await client.erc8004.deleteWallet({ workflowId: 123 })
|
|
399
|
+
|
|
400
|
+
// Get a presigned IPFS URL for uploading the agent card
|
|
401
|
+
const { url } = await client.erc8004.presignIpfsUrl({ workflowId: 123 })
|
|
402
|
+
// Upload agent card to IPFS within 60 seconds using the signed URL
|
|
403
|
+
|
|
404
|
+
// Deploy to ERC-8004 (before on-chain registration)
|
|
405
|
+
await client.erc8004.deploy({
|
|
406
|
+
workflowId: 123,
|
|
407
|
+
erc8004AgentId: '',
|
|
408
|
+
stringifiedAgentCard: JSON.stringify(registrationFile),
|
|
409
|
+
walletAddress: '0x...',
|
|
410
|
+
network: 'base',
|
|
411
|
+
chainId: 8453,
|
|
412
|
+
rpcUrl: 'https://mainnet.base.org'
|
|
413
|
+
})
|
|
414
|
+
|
|
415
|
+
// Deploy to ERC-8004 (after on-chain registration, with tx hash)
|
|
416
|
+
await client.erc8004.deploy({
|
|
417
|
+
workflowId: 123,
|
|
418
|
+
erc8004AgentId: '8453:42',
|
|
419
|
+
stringifiedAgentCard: JSON.stringify(updatedRegistrationFile),
|
|
420
|
+
latestDeploymentTransactionHash: '0xabc...',
|
|
421
|
+
latestDeploymentTimestamp: new Date(),
|
|
422
|
+
walletAddress: '0x...',
|
|
423
|
+
network: 'base',
|
|
424
|
+
chainId: 8453,
|
|
425
|
+
rpcUrl: 'https://mainnet.base.org'
|
|
426
|
+
})
|
|
427
|
+
|
|
428
|
+
// Get callable triggers for on-chain service registration
|
|
429
|
+
const callableTriggers = await client.erc8004.getCallableTriggers({ workflowId: 123 })
|
|
430
|
+
for (const trigger of callableTriggers) {
|
|
431
|
+
console.log(trigger.name, trigger.webEndpoint)
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// Sign feedback auth for the reputation system
|
|
435
|
+
const { signature } = await client.erc8004.signFeedbackAuth({
|
|
436
|
+
workflowId: 123,
|
|
437
|
+
buyerAddress: '0xBuyer...'
|
|
438
|
+
})
|
|
439
|
+
```
|
|
440
|
+
|
|
310
441
|
### Integrations
|
|
311
442
|
|
|
312
443
|
Manage integration connections for triggers and external services.
|
|
@@ -556,9 +687,9 @@ triggers.webhook({
|
|
|
556
687
|
description: 'Receives data from external systems for processing',
|
|
557
688
|
input: { message: { type: 'string' } },
|
|
558
689
|
waitForCompletion: true,
|
|
559
|
-
timeout:
|
|
690
|
+
timeout: 600
|
|
560
691
|
})
|
|
561
|
-
// { type: 'webhook', name: '...', waitForCompletion: true, timeout:
|
|
692
|
+
// { type: 'webhook', name: '...', waitForCompletion: true, timeout: 600, inputSchema: {...} }
|
|
562
693
|
|
|
563
694
|
// Cron trigger
|
|
564
695
|
triggers.cron({
|
|
@@ -647,6 +778,15 @@ import type {
|
|
|
647
778
|
// x402 Payment types
|
|
648
779
|
X402PaymentRequest,
|
|
649
780
|
X402PaymentResult,
|
|
781
|
+
// ERC-8004 types
|
|
782
|
+
Erc8004DeployRequest,
|
|
783
|
+
RegisterOnChainResult,
|
|
784
|
+
Erc8004ChainConfig,
|
|
785
|
+
Web3Wallet,
|
|
786
|
+
ImportWeb3WalletRequest,
|
|
787
|
+
CallableTrigger,
|
|
788
|
+
PresignIpfsUrlResponse,
|
|
789
|
+
SignFeedbackAuthResponse,
|
|
650
790
|
// Provision types
|
|
651
791
|
ProvisionConfig,
|
|
652
792
|
ProvisionResult,
|
package/dist/client.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { TasksAPI } from "./tasks-api";
|
|
|
6
6
|
import { WorkflowsAPI } from "./workflows-api";
|
|
7
7
|
import { Web3API } from "./web3-api";
|
|
8
8
|
import { PaymentsAPI } from "./payments-api";
|
|
9
|
+
import { Erc8004API } from "./erc8004-api";
|
|
9
10
|
/**
|
|
10
11
|
* Client for interacting with the OpenServ Platform API.
|
|
11
12
|
*
|
|
@@ -40,6 +41,8 @@ export declare class PlatformClient {
|
|
|
40
41
|
readonly web3: Web3API;
|
|
41
42
|
/** API for x402 payments to access paid workflows */
|
|
42
43
|
readonly payments: PaymentsAPI;
|
|
44
|
+
/** API for ERC-8004 agent identity (deployment, wallets, IPFS, reputation) */
|
|
45
|
+
readonly erc8004: Erc8004API;
|
|
43
46
|
/**
|
|
44
47
|
* Get the raw axios client for advanced use cases.
|
|
45
48
|
* @returns The underlying axios instance
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAE3E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAE3E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,UAAU,CAAgB;IAElC,gHAAgH;IAChH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,8BAA8B;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,+CAA+C;IAC/C,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;IACvC,yCAAyC;IACzC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,sCAAsC;IACtC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,iCAAiC;IACjC,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,qDAAqD;IACrD,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAE7B;;;OAGG;IACH,IAAI,SAAS,IAAI,aAAa,CAE7B;IAED;;;;;OAKG;IACG,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAKnE;;;;;;OAMG;IACG,IAAI,CAAC,CAAC,EACV,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,CAAC,CAAC;IAKb;;;;;;OAMG;IACG,GAAG,CAAC,CAAC,EACT,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,CAAC,CAAC;IAKb;;;;;OAKG;IACG,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAKtE;;;;;;OAMG;gBACS,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAsB3D;;;;;;;;;;;;;;;;;OAiBG;IACG,YAAY,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmExD;;;;;;;;OAQG;IACH,oBAAoB,IAAI,MAAM,GAAG,SAAS;CAO3C"}
|
package/dist/client.js
CHANGED
|
@@ -13,6 +13,7 @@ const tasks_api_1 = require("./tasks-api");
|
|
|
13
13
|
const workflows_api_1 = require("./workflows-api");
|
|
14
14
|
const web3_api_1 = require("./web3-api");
|
|
15
15
|
const payments_api_1 = require("./payments-api");
|
|
16
|
+
const erc8004_api_1 = require("./erc8004-api");
|
|
16
17
|
const PLATFORM_URL = process.env.OPENSERV_API_URL || "https://api.openserv.ai";
|
|
17
18
|
/**
|
|
18
19
|
* Client for interacting with the OpenServ Platform API.
|
|
@@ -48,6 +49,8 @@ class PlatformClient {
|
|
|
48
49
|
web3;
|
|
49
50
|
/** API for x402 payments to access paid workflows */
|
|
50
51
|
payments;
|
|
52
|
+
/** API for ERC-8004 agent identity (deployment, wallets, IPFS, reputation) */
|
|
53
|
+
erc8004;
|
|
51
54
|
/**
|
|
52
55
|
* Get the raw axios client for advanced use cases.
|
|
53
56
|
* @returns The underlying axios instance
|
|
@@ -121,6 +124,7 @@ class PlatformClient {
|
|
|
121
124
|
this.workflows = new workflows_api_1.WorkflowsAPI(this);
|
|
122
125
|
this.web3 = new web3_api_1.Web3API(this);
|
|
123
126
|
this.payments = new payments_api_1.PaymentsAPI(this);
|
|
127
|
+
this.erc8004 = new erc8004_api_1.Erc8004API(this);
|
|
124
128
|
}
|
|
125
129
|
/**
|
|
126
130
|
* Authenticate using an Ethereum wallet (SIWE - EIP-4361).
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal IdentityRegistry ABI for ERC-8004 on-chain operations.
|
|
3
|
+
*
|
|
4
|
+
* Contains only the functions needed for agent registration:
|
|
5
|
+
* - register() — mint a new agent NFT
|
|
6
|
+
* - setAgentURI() — set/update the IPFS URI for an agent
|
|
7
|
+
* - tokenURI() — read the current URI (for verification)
|
|
8
|
+
* - Registered event — extract agentId from registration receipt
|
|
9
|
+
* - Transfer event — fallback for extracting agentId
|
|
10
|
+
*
|
|
11
|
+
* Sourced from the full ABI in the OpenServ monorepo:
|
|
12
|
+
* packages/ai/agent0/core/contracts.ts
|
|
13
|
+
*/
|
|
14
|
+
export declare const IDENTITY_REGISTRY_ABI: readonly [{
|
|
15
|
+
readonly inputs: readonly [];
|
|
16
|
+
readonly name: "register";
|
|
17
|
+
readonly outputs: readonly [{
|
|
18
|
+
readonly internalType: "uint256";
|
|
19
|
+
readonly name: "agentId";
|
|
20
|
+
readonly type: "uint256";
|
|
21
|
+
}];
|
|
22
|
+
readonly stateMutability: "nonpayable";
|
|
23
|
+
readonly type: "function";
|
|
24
|
+
}, {
|
|
25
|
+
readonly inputs: readonly [{
|
|
26
|
+
readonly internalType: "uint256";
|
|
27
|
+
readonly name: "agentId";
|
|
28
|
+
readonly type: "uint256";
|
|
29
|
+
}, {
|
|
30
|
+
readonly internalType: "string";
|
|
31
|
+
readonly name: "newURI";
|
|
32
|
+
readonly type: "string";
|
|
33
|
+
}];
|
|
34
|
+
readonly name: "setAgentURI";
|
|
35
|
+
readonly outputs: readonly [];
|
|
36
|
+
readonly stateMutability: "nonpayable";
|
|
37
|
+
readonly type: "function";
|
|
38
|
+
}, {
|
|
39
|
+
readonly inputs: readonly [{
|
|
40
|
+
readonly internalType: "uint256";
|
|
41
|
+
readonly name: "tokenId";
|
|
42
|
+
readonly type: "uint256";
|
|
43
|
+
}];
|
|
44
|
+
readonly name: "tokenURI";
|
|
45
|
+
readonly outputs: readonly [{
|
|
46
|
+
readonly internalType: "string";
|
|
47
|
+
readonly name: "";
|
|
48
|
+
readonly type: "string";
|
|
49
|
+
}];
|
|
50
|
+
readonly stateMutability: "view";
|
|
51
|
+
readonly type: "function";
|
|
52
|
+
}, {
|
|
53
|
+
readonly anonymous: false;
|
|
54
|
+
readonly inputs: readonly [{
|
|
55
|
+
readonly indexed: true;
|
|
56
|
+
readonly internalType: "uint256";
|
|
57
|
+
readonly name: "agentId";
|
|
58
|
+
readonly type: "uint256";
|
|
59
|
+
}, {
|
|
60
|
+
readonly indexed: false;
|
|
61
|
+
readonly internalType: "string";
|
|
62
|
+
readonly name: "agentURI";
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
}, {
|
|
65
|
+
readonly indexed: true;
|
|
66
|
+
readonly internalType: "address";
|
|
67
|
+
readonly name: "owner";
|
|
68
|
+
readonly type: "address";
|
|
69
|
+
}];
|
|
70
|
+
readonly name: "Registered";
|
|
71
|
+
readonly type: "event";
|
|
72
|
+
}, {
|
|
73
|
+
readonly anonymous: false;
|
|
74
|
+
readonly inputs: readonly [{
|
|
75
|
+
readonly indexed: true;
|
|
76
|
+
readonly internalType: "uint256";
|
|
77
|
+
readonly name: "agentId";
|
|
78
|
+
readonly type: "uint256";
|
|
79
|
+
}, {
|
|
80
|
+
readonly indexed: false;
|
|
81
|
+
readonly internalType: "string";
|
|
82
|
+
readonly name: "newURI";
|
|
83
|
+
readonly type: "string";
|
|
84
|
+
}, {
|
|
85
|
+
readonly indexed: true;
|
|
86
|
+
readonly internalType: "address";
|
|
87
|
+
readonly name: "updatedBy";
|
|
88
|
+
readonly type: "address";
|
|
89
|
+
}];
|
|
90
|
+
readonly name: "URIUpdated";
|
|
91
|
+
readonly type: "event";
|
|
92
|
+
}, {
|
|
93
|
+
readonly anonymous: false;
|
|
94
|
+
readonly inputs: readonly [{
|
|
95
|
+
readonly indexed: true;
|
|
96
|
+
readonly internalType: "address";
|
|
97
|
+
readonly name: "from";
|
|
98
|
+
readonly type: "address";
|
|
99
|
+
}, {
|
|
100
|
+
readonly indexed: true;
|
|
101
|
+
readonly internalType: "address";
|
|
102
|
+
readonly name: "to";
|
|
103
|
+
readonly type: "address";
|
|
104
|
+
}, {
|
|
105
|
+
readonly indexed: true;
|
|
106
|
+
readonly internalType: "uint256";
|
|
107
|
+
readonly name: "tokenId";
|
|
108
|
+
readonly type: "uint256";
|
|
109
|
+
}];
|
|
110
|
+
readonly name: "Transfer";
|
|
111
|
+
readonly type: "event";
|
|
112
|
+
}];
|
|
113
|
+
//# sourceMappingURL=erc8004-abi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc8004-abi.d.ts","sourceRoot":"","sources":["../src/erc8004-abi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0GxB,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IDENTITY_REGISTRY_ABI = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Minimal IdentityRegistry ABI for ERC-8004 on-chain operations.
|
|
6
|
+
*
|
|
7
|
+
* Contains only the functions needed for agent registration:
|
|
8
|
+
* - register() — mint a new agent NFT
|
|
9
|
+
* - setAgentURI() — set/update the IPFS URI for an agent
|
|
10
|
+
* - tokenURI() — read the current URI (for verification)
|
|
11
|
+
* - Registered event — extract agentId from registration receipt
|
|
12
|
+
* - Transfer event — fallback for extracting agentId
|
|
13
|
+
*
|
|
14
|
+
* Sourced from the full ABI in the OpenServ monorepo:
|
|
15
|
+
* packages/ai/agent0/core/contracts.ts
|
|
16
|
+
*/
|
|
17
|
+
exports.IDENTITY_REGISTRY_ABI = [
|
|
18
|
+
// register() — no-args overload, mints a new agent ID
|
|
19
|
+
{
|
|
20
|
+
inputs: [],
|
|
21
|
+
name: "register",
|
|
22
|
+
outputs: [{ internalType: "uint256", name: "agentId", type: "uint256" }],
|
|
23
|
+
stateMutability: "nonpayable",
|
|
24
|
+
type: "function",
|
|
25
|
+
},
|
|
26
|
+
// setAgentURI(uint256 agentId, string newURI)
|
|
27
|
+
{
|
|
28
|
+
inputs: [
|
|
29
|
+
{ internalType: "uint256", name: "agentId", type: "uint256" },
|
|
30
|
+
{ internalType: "string", name: "newURI", type: "string" },
|
|
31
|
+
],
|
|
32
|
+
name: "setAgentURI",
|
|
33
|
+
outputs: [],
|
|
34
|
+
stateMutability: "nonpayable",
|
|
35
|
+
type: "function",
|
|
36
|
+
},
|
|
37
|
+
// tokenURI(uint256 tokenId) — read the IPFS URI for verification
|
|
38
|
+
{
|
|
39
|
+
inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
|
|
40
|
+
name: "tokenURI",
|
|
41
|
+
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
42
|
+
stateMutability: "view",
|
|
43
|
+
type: "function",
|
|
44
|
+
},
|
|
45
|
+
// Registered event — emitted on register()
|
|
46
|
+
{
|
|
47
|
+
anonymous: false,
|
|
48
|
+
inputs: [
|
|
49
|
+
{
|
|
50
|
+
indexed: true,
|
|
51
|
+
internalType: "uint256",
|
|
52
|
+
name: "agentId",
|
|
53
|
+
type: "uint256",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
indexed: false,
|
|
57
|
+
internalType: "string",
|
|
58
|
+
name: "agentURI",
|
|
59
|
+
type: "string",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
indexed: true,
|
|
63
|
+
internalType: "address",
|
|
64
|
+
name: "owner",
|
|
65
|
+
type: "address",
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
name: "Registered",
|
|
69
|
+
type: "event",
|
|
70
|
+
},
|
|
71
|
+
// URIUpdated event — emitted on setAgentURI()
|
|
72
|
+
{
|
|
73
|
+
anonymous: false,
|
|
74
|
+
inputs: [
|
|
75
|
+
{
|
|
76
|
+
indexed: true,
|
|
77
|
+
internalType: "uint256",
|
|
78
|
+
name: "agentId",
|
|
79
|
+
type: "uint256",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
indexed: false,
|
|
83
|
+
internalType: "string",
|
|
84
|
+
name: "newURI",
|
|
85
|
+
type: "string",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
indexed: true,
|
|
89
|
+
internalType: "address",
|
|
90
|
+
name: "updatedBy",
|
|
91
|
+
type: "address",
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
name: "URIUpdated",
|
|
95
|
+
type: "event",
|
|
96
|
+
},
|
|
97
|
+
// Transfer event (ERC-721) — fallback for extracting agentId
|
|
98
|
+
{
|
|
99
|
+
anonymous: false,
|
|
100
|
+
inputs: [
|
|
101
|
+
{
|
|
102
|
+
indexed: true,
|
|
103
|
+
internalType: "address",
|
|
104
|
+
name: "from",
|
|
105
|
+
type: "address",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
indexed: true,
|
|
109
|
+
internalType: "address",
|
|
110
|
+
name: "to",
|
|
111
|
+
type: "address",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
indexed: true,
|
|
115
|
+
internalType: "uint256",
|
|
116
|
+
name: "tokenId",
|
|
117
|
+
type: "uint256",
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
name: "Transfer",
|
|
121
|
+
type: "event",
|
|
122
|
+
},
|
|
123
|
+
];
|