pay-lobster 1.0.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 +401 -0
- package/README.md.bak +401 -0
- package/dist/agent.d.ts +132 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +224 -0
- package/dist/agent.js.map +1 -0
- package/dist/analytics.d.ts +120 -0
- package/dist/analytics.d.ts.map +1 -0
- package/dist/analytics.js +345 -0
- package/dist/analytics.js.map +1 -0
- package/dist/approvals.d.ts +168 -0
- package/dist/approvals.d.ts.map +1 -0
- package/dist/approvals.js +406 -0
- package/dist/approvals.js.map +1 -0
- package/dist/circle-client.d.ts +152 -0
- package/dist/circle-client.d.ts.map +1 -0
- package/dist/circle-client.js +266 -0
- package/dist/circle-client.js.map +1 -0
- package/dist/commission.d.ts +191 -0
- package/dist/commission.d.ts.map +1 -0
- package/dist/commission.js +475 -0
- package/dist/commission.js.map +1 -0
- package/dist/condition-builder.d.ts +98 -0
- package/dist/condition-builder.d.ts.map +1 -0
- package/dist/condition-builder.js +193 -0
- package/dist/condition-builder.js.map +1 -0
- package/dist/contacts.d.ts +179 -0
- package/dist/contacts.d.ts.map +1 -0
- package/dist/contacts.js +445 -0
- package/dist/contacts.js.map +1 -0
- package/dist/easy.d.ts +22 -0
- package/dist/easy.d.ts.map +1 -0
- package/dist/easy.js +40 -0
- package/dist/easy.js.map +1 -0
- package/dist/erc8004/constants.d.ts +152 -0
- package/dist/erc8004/constants.d.ts.map +1 -0
- package/dist/erc8004/constants.js +114 -0
- package/dist/erc8004/constants.js.map +1 -0
- package/dist/erc8004/discovery.d.ts +84 -0
- package/dist/erc8004/discovery.d.ts.map +1 -0
- package/dist/erc8004/discovery.js +217 -0
- package/dist/erc8004/discovery.js.map +1 -0
- package/dist/erc8004/identity.d.ts +91 -0
- package/dist/erc8004/identity.d.ts.map +1 -0
- package/dist/erc8004/identity.js +250 -0
- package/dist/erc8004/identity.js.map +1 -0
- package/dist/erc8004/index.d.ts +147 -0
- package/dist/erc8004/index.d.ts.map +1 -0
- package/dist/erc8004/index.js +225 -0
- package/dist/erc8004/index.js.map +1 -0
- package/dist/erc8004/reputation.d.ts +133 -0
- package/dist/erc8004/reputation.d.ts.map +1 -0
- package/dist/erc8004/reputation.js +277 -0
- package/dist/erc8004/reputation.js.map +1 -0
- package/dist/escrow-templates.d.ts +38 -0
- package/dist/escrow-templates.d.ts.map +1 -0
- package/dist/escrow-templates.js +419 -0
- package/dist/escrow-templates.js.map +1 -0
- package/dist/escrow.d.ts +320 -0
- package/dist/escrow.d.ts.map +1 -0
- package/dist/escrow.js +854 -0
- package/dist/escrow.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/invoices.d.ts +212 -0
- package/dist/invoices.d.ts.map +1 -0
- package/dist/invoices.js +393 -0
- package/dist/invoices.js.map +1 -0
- package/dist/notifications.d.ts +141 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +350 -0
- package/dist/notifications.js.map +1 -0
- package/dist/tips.d.ts +171 -0
- package/dist/tips.d.ts.map +1 -0
- package/dist/tips.js +390 -0
- package/dist/tips.js.map +1 -0
- package/dist/types.d.ts +100 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/x402-client.d.ts +127 -0
- package/dist/x402-client.d.ts.map +1 -0
- package/dist/x402-client.js +350 -0
- package/dist/x402-client.js.map +1 -0
- package/dist/x402-server.d.ts +133 -0
- package/dist/x402-server.d.ts.map +1 -0
- package/dist/x402-server.js +330 -0
- package/dist/x402-server.js.map +1 -0
- package/lib/agent.ts +273 -0
- package/lib/analytics.ts +474 -0
- package/lib/analytics.ts.bak +474 -0
- package/lib/approvals.ts +585 -0
- package/lib/approvals.ts.bak +585 -0
- package/lib/circle-client.ts +376 -0
- package/lib/circle-client.ts.bak +376 -0
- package/lib/commission.ts +680 -0
- package/lib/commission.ts.bak +680 -0
- package/lib/condition-builder.ts +223 -0
- package/lib/condition-builder.ts.bak +223 -0
- package/lib/contacts.ts +615 -0
- package/lib/contacts.ts.bak +615 -0
- package/lib/easy.ts +46 -0
- package/lib/easy.ts.bak +352 -0
- package/lib/erc8004/constants.ts +175 -0
- package/lib/erc8004/discovery.ts +299 -0
- package/lib/erc8004/identity.ts +327 -0
- package/lib/erc8004/index.ts +285 -0
- package/lib/erc8004/reputation.ts +368 -0
- package/lib/escrow-templates.ts +462 -0
- package/lib/escrow.ts +1216 -0
- package/lib/index.ts +13 -0
- package/lib/invoices.ts +588 -0
- package/lib/notifications.ts +484 -0
- package/lib/tips.ts +570 -0
- package/lib/types.ts +108 -0
- package/lib/x402-client.ts +471 -0
- package/lib/x402-server.ts +462 -0
- package/package.json +58 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ERC-8004 Identity Registry Client
|
|
3
|
+
*
|
|
4
|
+
* Register agents, manage identities, and resolve agent information.
|
|
5
|
+
*/
|
|
6
|
+
import { ethers } from 'ethers';
|
|
7
|
+
import { SupportedChain, AgentRegistration } from './constants';
|
|
8
|
+
export interface IdentityClientConfig {
|
|
9
|
+
chain: SupportedChain;
|
|
10
|
+
privateKey?: string;
|
|
11
|
+
provider?: ethers.Provider;
|
|
12
|
+
}
|
|
13
|
+
export interface RegisteredAgent {
|
|
14
|
+
agentId: number;
|
|
15
|
+
owner: string;
|
|
16
|
+
uri: string;
|
|
17
|
+
registration?: AgentRegistration;
|
|
18
|
+
agentRegistry: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class IdentityClient {
|
|
21
|
+
private chain;
|
|
22
|
+
private provider;
|
|
23
|
+
private signer?;
|
|
24
|
+
private contract;
|
|
25
|
+
private readOnlyContract;
|
|
26
|
+
constructor(config: IdentityClientConfig);
|
|
27
|
+
/**
|
|
28
|
+
* Get the full agent registry identifier (namespace:chainId:address)
|
|
29
|
+
*/
|
|
30
|
+
getAgentRegistry(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Register a new agent with the Identity Registry
|
|
33
|
+
*
|
|
34
|
+
* @param registration Agent registration data
|
|
35
|
+
* @returns The newly assigned agentId
|
|
36
|
+
*/
|
|
37
|
+
register(registration: AgentRegistration): Promise<number>;
|
|
38
|
+
/**
|
|
39
|
+
* Update an agent's registration URI
|
|
40
|
+
*/
|
|
41
|
+
updateRegistration(agentId: number, registration: AgentRegistration): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Get agent information by ID
|
|
44
|
+
*/
|
|
45
|
+
getAgent(agentId: number): Promise<RegisteredAgent | null>;
|
|
46
|
+
/**
|
|
47
|
+
* Get all agents owned by an address
|
|
48
|
+
*/
|
|
49
|
+
getAgentsByOwner(owner: string): Promise<RegisteredAgent[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Get total number of registered agents
|
|
52
|
+
*/
|
|
53
|
+
getTotalAgents(): Promise<number>;
|
|
54
|
+
/**
|
|
55
|
+
* Search for agents by capability (searches registration files)
|
|
56
|
+
*/
|
|
57
|
+
searchAgents(options: {
|
|
58
|
+
capability?: string;
|
|
59
|
+
service?: string;
|
|
60
|
+
x402Support?: boolean;
|
|
61
|
+
limit?: number;
|
|
62
|
+
}): Promise<RegisteredAgent[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Host a registration file and return its URI
|
|
65
|
+
*
|
|
66
|
+
* For simplicity, we use data: URIs (fully on-chain)
|
|
67
|
+
* In production, you might use IPFS or HTTPS
|
|
68
|
+
*/
|
|
69
|
+
private hostRegistrationFile;
|
|
70
|
+
/**
|
|
71
|
+
* Fetch and parse a registration file from its URI
|
|
72
|
+
*/
|
|
73
|
+
private fetchRegistrationFile;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Create a standard Pay Lobster registration file
|
|
77
|
+
*/
|
|
78
|
+
export declare function createLobsterAgentRegistration(options: {
|
|
79
|
+
name: string;
|
|
80
|
+
description: string;
|
|
81
|
+
image?: string;
|
|
82
|
+
agentId?: number;
|
|
83
|
+
chain: SupportedChain;
|
|
84
|
+
capabilities: string[];
|
|
85
|
+
paymentAddress?: string;
|
|
86
|
+
x402Endpoint?: string;
|
|
87
|
+
escrowSupport?: boolean;
|
|
88
|
+
mcpEndpoint?: string;
|
|
89
|
+
a2aEndpoint?: string;
|
|
90
|
+
}): AgentRegistration;
|
|
91
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../lib/erc8004/identity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAGL,cAAc,EACd,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAAiB;IAC9B,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,MAAM,CAAC,CAAgB;IAC/B,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,gBAAgB,CAAkB;gBAE9B,MAAM,EAAE,oBAAoB;IAsBxC;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAK1B;;;;;OAKG;IACG,QAAQ,CAAC,YAAY,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAsChE;;OAEG;IACG,kBAAkB,CA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/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.IdentityClient = void 0;
|
|
9
|
+
exports.createLobsterAgentRegistration = createLobsterAgentRegistration;
|
|
10
|
+
const ethers_1 = require("ethers");
|
|
11
|
+
const constants_1 = require("./constants");
|
|
12
|
+
class IdentityClient {
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.chain = config.chain;
|
|
15
|
+
const chainConfig = constants_1.CHAIN_CONFIG[config.chain];
|
|
16
|
+
this.provider = config.provider || new ethers_1.ethers.JsonRpcProvider(chainConfig.rpcUrl);
|
|
17
|
+
if (config.privateKey) {
|
|
18
|
+
this.signer = new ethers_1.ethers.Wallet(config.privateKey, this.provider);
|
|
19
|
+
this.contract = new ethers_1.ethers.Contract(chainConfig.contracts.identityRegistry, constants_1.IDENTITY_REGISTRY_ABI, this.signer);
|
|
20
|
+
}
|
|
21
|
+
this.readOnlyContract = new ethers_1.ethers.Contract(chainConfig.contracts.identityRegistry, constants_1.IDENTITY_REGISTRY_ABI, this.provider);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get the full agent registry identifier (namespace:chainId:address)
|
|
25
|
+
*/
|
|
26
|
+
getAgentRegistry() {
|
|
27
|
+
const chainConfig = constants_1.CHAIN_CONFIG[this.chain];
|
|
28
|
+
return `${chainConfig.namespace}:${chainConfig.chainId}:${chainConfig.contracts.identityRegistry}`;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Register a new agent with the Identity Registry
|
|
32
|
+
*
|
|
33
|
+
* @param registration Agent registration data
|
|
34
|
+
* @returns The newly assigned agentId
|
|
35
|
+
*/
|
|
36
|
+
async register(registration) {
|
|
37
|
+
if (!this.contract || !this.signer) {
|
|
38
|
+
throw new Error('Signer required for registration');
|
|
39
|
+
}
|
|
40
|
+
// Ensure registration includes this chain's registry
|
|
41
|
+
const agentRegistry = this.getAgentRegistry();
|
|
42
|
+
// Host registration file (could be IPFS, HTTPS, or data: URI)
|
|
43
|
+
const uri = await this.hostRegistrationFile(registration);
|
|
44
|
+
console.log(`Registering agent with URI: ${uri}`);
|
|
45
|
+
const tx = await this.contract.register(uri);
|
|
46
|
+
const receipt = await tx.wait();
|
|
47
|
+
// Extract agentId from AgentRegistered event
|
|
48
|
+
const event = receipt.logs.find((log) => {
|
|
49
|
+
try {
|
|
50
|
+
const parsed = this.contract.interface.parseLog(log);
|
|
51
|
+
return parsed?.name === 'AgentRegistered';
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
if (!event) {
|
|
58
|
+
throw new Error('AgentRegistered event not found in transaction');
|
|
59
|
+
}
|
|
60
|
+
const parsed = this.contract.interface.parseLog(event);
|
|
61
|
+
const agentId = Number(parsed?.args?.agentId);
|
|
62
|
+
console.log(`Agent registered with ID: ${agentId}`);
|
|
63
|
+
return agentId;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Update an agent's registration URI
|
|
67
|
+
*/
|
|
68
|
+
async updateRegistration(agentId, registration) {
|
|
69
|
+
if (!this.contract) {
|
|
70
|
+
throw new Error('Signer required for update');
|
|
71
|
+
}
|
|
72
|
+
const uri = await this.hostRegistrationFile(registration);
|
|
73
|
+
const tx = await this.contract.setAgentURI(agentId, uri);
|
|
74
|
+
await tx.wait();
|
|
75
|
+
console.log(`Agent ${agentId} registration updated`);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get agent information by ID
|
|
79
|
+
*/
|
|
80
|
+
async getAgent(agentId) {
|
|
81
|
+
try {
|
|
82
|
+
const [owner, uri] = await Promise.all([
|
|
83
|
+
this.readOnlyContract.getAgentOwner(agentId),
|
|
84
|
+
this.readOnlyContract.getAgentURI(agentId),
|
|
85
|
+
]);
|
|
86
|
+
let registration;
|
|
87
|
+
try {
|
|
88
|
+
registration = await this.fetchRegistrationFile(uri);
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
console.warn(`Failed to fetch registration for agent ${agentId}:`, e);
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
agentId,
|
|
95
|
+
owner,
|
|
96
|
+
uri,
|
|
97
|
+
registration,
|
|
98
|
+
agentRegistry: this.getAgentRegistry(),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get all agents owned by an address
|
|
107
|
+
*/
|
|
108
|
+
async getAgentsByOwner(owner) {
|
|
109
|
+
const agentIds = await this.readOnlyContract.getAgentsByOwner(owner);
|
|
110
|
+
const agents = await Promise.all(agentIds.map(id => this.getAgent(Number(id))));
|
|
111
|
+
return agents.filter((a) => a !== null);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Get total number of registered agents
|
|
115
|
+
*/
|
|
116
|
+
async getTotalAgents() {
|
|
117
|
+
const total = await this.readOnlyContract.totalSupply();
|
|
118
|
+
return Number(total);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Search for agents by capability (searches registration files)
|
|
122
|
+
*/
|
|
123
|
+
async searchAgents(options) {
|
|
124
|
+
const total = await this.getTotalAgents();
|
|
125
|
+
const limit = options.limit || 50;
|
|
126
|
+
const results = [];
|
|
127
|
+
// Note: In production, you'd want an indexer for this
|
|
128
|
+
// For demo purposes, we iterate through recent registrations
|
|
129
|
+
for (let i = total; i > 0 && results.length < limit; i--) {
|
|
130
|
+
try {
|
|
131
|
+
const agent = await this.getAgent(i);
|
|
132
|
+
if (!agent || !agent.registration)
|
|
133
|
+
continue;
|
|
134
|
+
const reg = agent.registration;
|
|
135
|
+
// Filter by x402 support
|
|
136
|
+
if (options.x402Support !== undefined && reg.x402Support !== options.x402Support) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
// Filter by capability
|
|
140
|
+
if (options.capability) {
|
|
141
|
+
const hasCapability = reg.usdcAgent?.capabilities?.includes(options.capability);
|
|
142
|
+
if (!hasCapability)
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
// Filter by service type
|
|
146
|
+
if (options.service) {
|
|
147
|
+
const hasService = reg.services.some(s => s.name === options.service);
|
|
148
|
+
if (!hasService)
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
results.push(agent);
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return results;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Host a registration file and return its URI
|
|
161
|
+
*
|
|
162
|
+
* For simplicity, we use data: URIs (fully on-chain)
|
|
163
|
+
* In production, you might use IPFS or HTTPS
|
|
164
|
+
*/
|
|
165
|
+
async hostRegistrationFile(registration) {
|
|
166
|
+
const json = JSON.stringify(registration);
|
|
167
|
+
const base64 = Buffer.from(json).toString('base64');
|
|
168
|
+
return `data:application/json;base64,${base64}`;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Fetch and parse a registration file from its URI
|
|
172
|
+
*/
|
|
173
|
+
async fetchRegistrationFile(uri) {
|
|
174
|
+
if (uri.startsWith('data:')) {
|
|
175
|
+
// Parse data: URI
|
|
176
|
+
const match = uri.match(/^data:application\/json;base64,(.+)$/);
|
|
177
|
+
if (!match)
|
|
178
|
+
throw new Error('Invalid data URI format');
|
|
179
|
+
const json = Buffer.from(match[1], 'base64').toString('utf-8');
|
|
180
|
+
return JSON.parse(json);
|
|
181
|
+
}
|
|
182
|
+
else if (uri.startsWith('ipfs://')) {
|
|
183
|
+
// Fetch from IPFS gateway
|
|
184
|
+
const cid = uri.replace('ipfs://', '');
|
|
185
|
+
const response = await fetch(`https://ipfs.io/ipfs/${cid}`);
|
|
186
|
+
return response.json();
|
|
187
|
+
}
|
|
188
|
+
else if (uri.startsWith('https://')) {
|
|
189
|
+
// Fetch from HTTPS
|
|
190
|
+
const response = await fetch(uri);
|
|
191
|
+
return response.json();
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
throw new Error(`Unsupported URI scheme: ${uri}`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
exports.IdentityClient = IdentityClient;
|
|
199
|
+
/**
|
|
200
|
+
* Create a standard Pay Lobster registration file
|
|
201
|
+
*/
|
|
202
|
+
function createLobsterAgentRegistration(options) {
|
|
203
|
+
const chainConfig = constants_1.CHAIN_CONFIG[options.chain];
|
|
204
|
+
const agentRegistry = `${chainConfig.namespace}:${chainConfig.chainId}:${chainConfig.contracts.identityRegistry}`;
|
|
205
|
+
const services = [];
|
|
206
|
+
if (options.mcpEndpoint) {
|
|
207
|
+
services.push({
|
|
208
|
+
name: 'MCP',
|
|
209
|
+
endpoint: options.mcpEndpoint,
|
|
210
|
+
version: '2025-06-18',
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
if (options.a2aEndpoint) {
|
|
214
|
+
services.push({
|
|
215
|
+
name: 'A2A',
|
|
216
|
+
endpoint: options.a2aEndpoint,
|
|
217
|
+
version: '0.3.0',
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
if (options.x402Endpoint) {
|
|
221
|
+
services.push({
|
|
222
|
+
name: 'x402',
|
|
223
|
+
endpoint: options.x402Endpoint,
|
|
224
|
+
version: '1.0',
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
return {
|
|
228
|
+
type: 'https://eips.ethereum.org/EIPS/eip-8004#registration-v1',
|
|
229
|
+
name: options.name,
|
|
230
|
+
description: options.description,
|
|
231
|
+
image: options.image,
|
|
232
|
+
services,
|
|
233
|
+
x402Support: !!options.x402Endpoint || !!options.paymentAddress,
|
|
234
|
+
active: true,
|
|
235
|
+
registrations: options.agentId !== undefined ? [{
|
|
236
|
+
agentId: options.agentId,
|
|
237
|
+
agentRegistry,
|
|
238
|
+
}] : [],
|
|
239
|
+
supportedTrust: ['reputation'],
|
|
240
|
+
usdcAgent: {
|
|
241
|
+
version: '1.0.0',
|
|
242
|
+
capabilities: options.capabilities,
|
|
243
|
+
supportedChains: [options.chain],
|
|
244
|
+
paymentAddress: options.paymentAddress,
|
|
245
|
+
escrowSupport: options.escrowSupport ?? true,
|
|
246
|
+
x402Endpoint: options.x402Endpoint,
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../lib/erc8004/identity.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAkQH,wEAgEC;AAhUD,mCAAgC;AAChC,2CAKqB;AAgBrB,MAAa,cAAc;IAOzB,YAAY,MAA4B;QACtC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,MAAM,WAAW,GAAG,wBAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAE/C,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,IAAI,eAAM,CAAC,eAAe,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAElF,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YAClE,IAAI,CAAC,QAAQ,GAAG,IAAI,eAAM,CAAC,QAAQ,CACjC,WAAW,CAAC,SAAS,CAAC,gBAAgB,EACtC,iCAAqB,EACrB,IAAI,CAAC,MAAM,CACZ,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,gBAAgB,GAAG,IAAI,eAAM,CAAC,QAAQ,CACzC,WAAW,CAAC,SAAS,CAAC,gBAAgB,EACtC,iCAAqB,EACrB,IAAI,CAAC,QAAQ,CACd,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,MAA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AAE,OAAO,CAAC,aAAa,IAAI,IAAI;YAC5C,YAAY,EAAE,OAAO,CAAC,YAAY;SACnC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ERC-8004 Trustless Agents - Main Export
|
|
3
|
+
*
|
|
4
|
+
* Complete integration for agent identity, reputation, and discovery.
|
|
5
|
+
* Designed for seamless integration with USDC payments and x402 protocol.
|
|
6
|
+
*/
|
|
7
|
+
export * from './constants';
|
|
8
|
+
export * from './identity';
|
|
9
|
+
export * from './reputation';
|
|
10
|
+
export * from './discovery';
|
|
11
|
+
import { SupportedChain } from './constants';
|
|
12
|
+
import { IdentityClient } from './identity';
|
|
13
|
+
import { ReputationClient, ReputationSummary } from './reputation';
|
|
14
|
+
import { DiscoveryService, DiscoveredAgent } from './discovery';
|
|
15
|
+
export interface ERC8004ClientConfig {
|
|
16
|
+
chain: SupportedChain;
|
|
17
|
+
privateKey?: string;
|
|
18
|
+
paymentAddress?: string;
|
|
19
|
+
x402Endpoint?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Unified ERC-8004 Client
|
|
23
|
+
*
|
|
24
|
+
* Provides high-level API for agent registration, discovery, and trust management.
|
|
25
|
+
*/
|
|
26
|
+
export declare class ERC8004Client {
|
|
27
|
+
readonly chain: SupportedChain;
|
|
28
|
+
readonly identity: IdentityClient;
|
|
29
|
+
readonly reputation: ReputationClient;
|
|
30
|
+
readonly discovery: DiscoveryService;
|
|
31
|
+
private config;
|
|
32
|
+
private myAgentId?;
|
|
33
|
+
constructor(config: ERC8004ClientConfig);
|
|
34
|
+
/**
|
|
35
|
+
* Register this agent with the ERC-8004 Identity Registry
|
|
36
|
+
*/
|
|
37
|
+
registerAgent(options: {
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
image?: string;
|
|
41
|
+
capabilities: string[];
|
|
42
|
+
mcpEndpoint?: string;
|
|
43
|
+
a2aEndpoint?: string;
|
|
44
|
+
}): Promise<number>;
|
|
45
|
+
/**
|
|
46
|
+
* Get my agent ID (if registered)
|
|
47
|
+
*/
|
|
48
|
+
getMyAgentId(): number | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Set agent ID (if already registered)
|
|
51
|
+
*/
|
|
52
|
+
setMyAgentId(agentId: number): void;
|
|
53
|
+
/**
|
|
54
|
+
* Verify an agent before transacting
|
|
55
|
+
*/
|
|
56
|
+
verifyAgent(agentId: number): Promise<{
|
|
57
|
+
verified: boolean;
|
|
58
|
+
trustScore: number;
|
|
59
|
+
reputation: ReputationSummary;
|
|
60
|
+
recommendation: "safe" | "caution" | "risky" | "avoid";
|
|
61
|
+
reasons: string[];
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* Check if payment is safe for an agent
|
|
65
|
+
*/
|
|
66
|
+
isPaymentSafe(agentId: number, amountUsdc: number): Promise<{
|
|
67
|
+
safe: boolean;
|
|
68
|
+
trustScore: number;
|
|
69
|
+
maxRecommendedAmount: number;
|
|
70
|
+
reason: string;
|
|
71
|
+
}>;
|
|
72
|
+
/**
|
|
73
|
+
* Post feedback after a transaction
|
|
74
|
+
*/
|
|
75
|
+
postFeedback(options: {
|
|
76
|
+
agentId: number;
|
|
77
|
+
score: number;
|
|
78
|
+
context: string;
|
|
79
|
+
txHash?: string;
|
|
80
|
+
}): Promise<number>;
|
|
81
|
+
/**
|
|
82
|
+
* Post positive feedback after successful payment
|
|
83
|
+
*/
|
|
84
|
+
postPaymentSuccess(agentId: number, txHash: string, amount: string): Promise<number>;
|
|
85
|
+
/**
|
|
86
|
+
* Post negative feedback after failed payment
|
|
87
|
+
*/
|
|
88
|
+
postPaymentFailure(agentId: number, reason: string): Promise<number>;
|
|
89
|
+
/**
|
|
90
|
+
* Post feedback after escrow completion
|
|
91
|
+
*/
|
|
92
|
+
postEscrowFeedback(agentId: number, escrowId: string, outcome: 'released' | 'refunded' | 'disputed', reason?: string): Promise<number>;
|
|
93
|
+
/**
|
|
94
|
+
* Find agents for payment
|
|
95
|
+
*/
|
|
96
|
+
findPaymentAgents(minTrustScore?: number): Promise<DiscoveredAgent[]>;
|
|
97
|
+
/**
|
|
98
|
+
* Find agents with escrow capability
|
|
99
|
+
*/
|
|
100
|
+
findEscrowAgents(minTrustLevel?: ReputationSummary['trustLevel']): Promise<DiscoveredAgent[]>;
|
|
101
|
+
/**
|
|
102
|
+
* Get my reputation summary
|
|
103
|
+
*/
|
|
104
|
+
getMyReputation(): Promise<ReputationSummary | null>;
|
|
105
|
+
/**
|
|
106
|
+
* Get contract addresses for this chain
|
|
107
|
+
*/
|
|
108
|
+
getContractAddresses(): {
|
|
109
|
+
readonly identityRegistry: "0x8004A818BFB912233c491871b3d84c89A494BD9e";
|
|
110
|
+
readonly reputationRegistry: "0x8004B663056A597Dffe9eCcC1965A193B7388713";
|
|
111
|
+
} | {
|
|
112
|
+
readonly identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432";
|
|
113
|
+
readonly reputationRegistry: "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63";
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Get the agent registry identifier
|
|
117
|
+
*/
|
|
118
|
+
getAgentRegistry(): string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Integration helper: Wrap x402 payment with trust verification
|
|
122
|
+
*/
|
|
123
|
+
export declare function createTrustedX402Payment(options: {
|
|
124
|
+
erc8004: ERC8004Client;
|
|
125
|
+
targetAgentId: number;
|
|
126
|
+
amountUsdc: number;
|
|
127
|
+
endpoint: string;
|
|
128
|
+
paymentFn: () => Promise<{
|
|
129
|
+
success: boolean;
|
|
130
|
+
txHash?: string;
|
|
131
|
+
error?: string;
|
|
132
|
+
}>;
|
|
133
|
+
}): Promise<{
|
|
134
|
+
success: boolean;
|
|
135
|
+
txHash?: string;
|
|
136
|
+
trustScore: number;
|
|
137
|
+
feedbackPosted: boolean;
|
|
138
|
+
error?: string;
|
|
139
|
+
}>;
|
|
140
|
+
/**
|
|
141
|
+
* Quick setup helper
|
|
142
|
+
*/
|
|
143
|
+
export declare function createERC8004Client(chain: SupportedChain, privateKey?: string, options?: {
|
|
144
|
+
paymentAddress?: string;
|
|
145
|
+
x402Endpoint?: string;
|
|
146
|
+
}): ERC8004Client;
|
|
147
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/erc8004/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAG5B,OAAO,EACL,cAAc,EAGf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAmD,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAqB,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,qBAAa,aAAa;IACxB,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IAErC,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,SAAS,CAAC,CAAS;gBAEf,MAAM,EAAE,mBAAmB;IAoBvC;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE;QAC3B,IAAI,EAAE,M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