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.
Files changed (120) hide show
  1. package/README.md +401 -0
  2. package/README.md.bak +401 -0
  3. package/dist/agent.d.ts +132 -0
  4. package/dist/agent.d.ts.map +1 -0
  5. package/dist/agent.js +224 -0
  6. package/dist/agent.js.map +1 -0
  7. package/dist/analytics.d.ts +120 -0
  8. package/dist/analytics.d.ts.map +1 -0
  9. package/dist/analytics.js +345 -0
  10. package/dist/analytics.js.map +1 -0
  11. package/dist/approvals.d.ts +168 -0
  12. package/dist/approvals.d.ts.map +1 -0
  13. package/dist/approvals.js +406 -0
  14. package/dist/approvals.js.map +1 -0
  15. package/dist/circle-client.d.ts +152 -0
  16. package/dist/circle-client.d.ts.map +1 -0
  17. package/dist/circle-client.js +266 -0
  18. package/dist/circle-client.js.map +1 -0
  19. package/dist/commission.d.ts +191 -0
  20. package/dist/commission.d.ts.map +1 -0
  21. package/dist/commission.js +475 -0
  22. package/dist/commission.js.map +1 -0
  23. package/dist/condition-builder.d.ts +98 -0
  24. package/dist/condition-builder.d.ts.map +1 -0
  25. package/dist/condition-builder.js +193 -0
  26. package/dist/condition-builder.js.map +1 -0
  27. package/dist/contacts.d.ts +179 -0
  28. package/dist/contacts.d.ts.map +1 -0
  29. package/dist/contacts.js +445 -0
  30. package/dist/contacts.js.map +1 -0
  31. package/dist/easy.d.ts +22 -0
  32. package/dist/easy.d.ts.map +1 -0
  33. package/dist/easy.js +40 -0
  34. package/dist/easy.js.map +1 -0
  35. package/dist/erc8004/constants.d.ts +152 -0
  36. package/dist/erc8004/constants.d.ts.map +1 -0
  37. package/dist/erc8004/constants.js +114 -0
  38. package/dist/erc8004/constants.js.map +1 -0
  39. package/dist/erc8004/discovery.d.ts +84 -0
  40. package/dist/erc8004/discovery.d.ts.map +1 -0
  41. package/dist/erc8004/discovery.js +217 -0
  42. package/dist/erc8004/discovery.js.map +1 -0
  43. package/dist/erc8004/identity.d.ts +91 -0
  44. package/dist/erc8004/identity.d.ts.map +1 -0
  45. package/dist/erc8004/identity.js +250 -0
  46. package/dist/erc8004/identity.js.map +1 -0
  47. package/dist/erc8004/index.d.ts +147 -0
  48. package/dist/erc8004/index.d.ts.map +1 -0
  49. package/dist/erc8004/index.js +225 -0
  50. package/dist/erc8004/index.js.map +1 -0
  51. package/dist/erc8004/reputation.d.ts +133 -0
  52. package/dist/erc8004/reputation.d.ts.map +1 -0
  53. package/dist/erc8004/reputation.js +277 -0
  54. package/dist/erc8004/reputation.js.map +1 -0
  55. package/dist/escrow-templates.d.ts +38 -0
  56. package/dist/escrow-templates.d.ts.map +1 -0
  57. package/dist/escrow-templates.js +419 -0
  58. package/dist/escrow-templates.js.map +1 -0
  59. package/dist/escrow.d.ts +320 -0
  60. package/dist/escrow.d.ts.map +1 -0
  61. package/dist/escrow.js +854 -0
  62. package/dist/escrow.js.map +1 -0
  63. package/dist/index.d.ts +11 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +33 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/invoices.d.ts +212 -0
  68. package/dist/invoices.d.ts.map +1 -0
  69. package/dist/invoices.js +393 -0
  70. package/dist/invoices.js.map +1 -0
  71. package/dist/notifications.d.ts +141 -0
  72. package/dist/notifications.d.ts.map +1 -0
  73. package/dist/notifications.js +350 -0
  74. package/dist/notifications.js.map +1 -0
  75. package/dist/tips.d.ts +171 -0
  76. package/dist/tips.d.ts.map +1 -0
  77. package/dist/tips.js +390 -0
  78. package/dist/tips.js.map +1 -0
  79. package/dist/types.d.ts +100 -0
  80. package/dist/types.d.ts.map +1 -0
  81. package/dist/types.js +6 -0
  82. package/dist/types.js.map +1 -0
  83. package/dist/x402-client.d.ts +127 -0
  84. package/dist/x402-client.d.ts.map +1 -0
  85. package/dist/x402-client.js +350 -0
  86. package/dist/x402-client.js.map +1 -0
  87. package/dist/x402-server.d.ts +133 -0
  88. package/dist/x402-server.d.ts.map +1 -0
  89. package/dist/x402-server.js +330 -0
  90. package/dist/x402-server.js.map +1 -0
  91. package/lib/agent.ts +273 -0
  92. package/lib/analytics.ts +474 -0
  93. package/lib/analytics.ts.bak +474 -0
  94. package/lib/approvals.ts +585 -0
  95. package/lib/approvals.ts.bak +585 -0
  96. package/lib/circle-client.ts +376 -0
  97. package/lib/circle-client.ts.bak +376 -0
  98. package/lib/commission.ts +680 -0
  99. package/lib/commission.ts.bak +680 -0
  100. package/lib/condition-builder.ts +223 -0
  101. package/lib/condition-builder.ts.bak +223 -0
  102. package/lib/contacts.ts +615 -0
  103. package/lib/contacts.ts.bak +615 -0
  104. package/lib/easy.ts +46 -0
  105. package/lib/easy.ts.bak +352 -0
  106. package/lib/erc8004/constants.ts +175 -0
  107. package/lib/erc8004/discovery.ts +299 -0
  108. package/lib/erc8004/identity.ts +327 -0
  109. package/lib/erc8004/index.ts +285 -0
  110. package/lib/erc8004/reputation.ts +368 -0
  111. package/lib/escrow-templates.ts +462 -0
  112. package/lib/escrow.ts +1216 -0
  113. package/lib/index.ts +13 -0
  114. package/lib/invoices.ts +588 -0
  115. package/lib/notifications.ts +484 -0
  116. package/lib/tips.ts +570 -0
  117. package/lib/types.ts +108 -0
  118. package/lib/x402-client.ts +471 -0
  119. package/lib/x402-server.ts +462 -0
  120. package/package.json +58 -0
@@ -0,0 +1,152 @@
1
+ /**
2
+ * ERC-8004 Constants & Contract Addresses
3
+ *
4
+ * Official registry deployments from https://github.com/erc-8004/erc-8004-contracts
5
+ */
6
+ export declare const ERC8004_CONTRACTS: {
7
+ readonly testnet: {
8
+ readonly identityRegistry: "0x8004A818BFB912233c491871b3d84c89A494BD9e";
9
+ readonly reputationRegistry: "0x8004B663056A597Dffe9eCcC1965A193B7388713";
10
+ };
11
+ readonly mainnet: {
12
+ readonly identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432";
13
+ readonly reputationRegistry: "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63";
14
+ };
15
+ };
16
+ export declare const CHAIN_CONFIG: {
17
+ readonly 'ETH-SEPOLIA': {
18
+ readonly chainId: 11155111;
19
+ readonly namespace: "eip155";
20
+ readonly rpcUrl: "https://rpc.sepolia.org";
21
+ readonly explorer: "https://sepolia.etherscan.io";
22
+ readonly contracts: {
23
+ readonly identityRegistry: "0x8004A818BFB912233c491871b3d84c89A494BD9e";
24
+ readonly reputationRegistry: "0x8004B663056A597Dffe9eCcC1965A193B7388713";
25
+ };
26
+ };
27
+ readonly 'BASE-SEPOLIA': {
28
+ readonly chainId: 84532;
29
+ readonly namespace: "eip155";
30
+ readonly rpcUrl: "https://sepolia.base.org";
31
+ readonly explorer: "https://sepolia.basescan.org";
32
+ readonly contracts: {
33
+ readonly identityRegistry: "0x8004A818BFB912233c491871b3d84c89A494BD9e";
34
+ readonly reputationRegistry: "0x8004B663056A597Dffe9eCcC1965A193B7388713";
35
+ };
36
+ };
37
+ readonly 'MATIC-AMOY': {
38
+ readonly chainId: 80002;
39
+ readonly namespace: "eip155";
40
+ readonly rpcUrl: "https://rpc-amoy.polygon.technology";
41
+ readonly explorer: "https://amoy.polygonscan.com";
42
+ readonly contracts: {
43
+ readonly identityRegistry: "0x8004A818BFB912233c491871b3d84c89A494BD9e";
44
+ readonly reputationRegistry: "0x8004B663056A597Dffe9eCcC1965A193B7388713";
45
+ };
46
+ };
47
+ readonly 'ARB-SEPOLIA': {
48
+ readonly chainId: 421614;
49
+ readonly namespace: "eip155";
50
+ readonly rpcUrl: "https://sepolia-rollup.arbitrum.io/rpc";
51
+ readonly explorer: "https://sepolia.arbiscan.io";
52
+ readonly contracts: {
53
+ readonly identityRegistry: "0x8004A818BFB912233c491871b3d84c89A494BD9e";
54
+ readonly reputationRegistry: "0x8004B663056A597Dffe9eCcC1965A193B7388713";
55
+ };
56
+ };
57
+ readonly 'ETH-MAINNET': {
58
+ readonly chainId: 1;
59
+ readonly namespace: "eip155";
60
+ readonly rpcUrl: "https://eth.llamarpc.com";
61
+ readonly explorer: "https://etherscan.io";
62
+ readonly contracts: {
63
+ readonly identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432";
64
+ readonly reputationRegistry: "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63";
65
+ };
66
+ };
67
+ readonly 'BASE-MAINNET': {
68
+ readonly chainId: 8453;
69
+ readonly namespace: "eip155";
70
+ readonly rpcUrl: "https://mainnet.base.org";
71
+ readonly explorer: "https://basescan.org";
72
+ readonly contracts: {
73
+ readonly identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432";
74
+ readonly reputationRegistry: "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63";
75
+ };
76
+ };
77
+ };
78
+ export type SupportedChain = keyof typeof CHAIN_CONFIG;
79
+ export declare const IDENTITY_REGISTRY_ABI: readonly ["function balanceOf(address owner) view returns (uint256)", "function ownerOf(uint256 tokenId) view returns (address)", "function tokenURI(uint256 tokenId) view returns (string)", "function totalSupply() view returns (uint256)", "function tokenByIndex(uint256 index) view returns (uint256)", "function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)", "function register(string uri) returns (uint256 agentId)", "function setAgentURI(uint256 agentId, string uri)", "function getAgentURI(uint256 agentId) view returns (string)", "function getAgentOwner(uint256 agentId) view returns (address)", "function getAgentsByOwner(address owner) view returns (uint256[])", "event AgentRegistered(uint256 indexed agentId, address indexed owner, string uri)", "event AgentURIUpdated(uint256 indexed agentId, string uri)", "event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)"];
80
+ export declare const REPUTATION_REGISTRY_ABI: readonly ["function postFeedback(uint256 agentId, int8 score, string context, bytes32 taskHash) returns (uint256 feedbackId)", "function postFeedbackWithProof(uint256 agentId, int8 score, string context, bytes32 taskHash, bytes proof) returns (uint256 feedbackId)", "function getFeedback(uint256 feedbackId) view returns (tuple(uint256 agentId, address author, int8 score, string context, bytes32 taskHash, uint256 timestamp))", "function getFeedbackCount(uint256 agentId) view returns (uint256)", "function getFeedbackByAgent(uint256 agentId, uint256 offset, uint256 limit) view returns (uint256[])", "function getAverageScore(uint256 agentId) view returns (int256 average, uint256 count)", "function authorizeFeedback(uint256 agentId, address author)", "function revokeFeedbackAuthorization(uint256 agentId, address author)", "function isAuthorizedFeedbackAuthor(uint256 agentId, address author) view returns (bool)", "event FeedbackPosted(uint256 indexed feedbackId, uint256 indexed agentId, address indexed author, int8 score)", "event FeedbackAuthorizationGranted(uint256 indexed agentId, address indexed author)", "event FeedbackAuthorizationRevoked(uint256 indexed agentId, address indexed author)"];
81
+ export interface AgentRegistration {
82
+ type: 'https://eips.ethereum.org/EIPS/eip-8004#registration-v1';
83
+ name: string;
84
+ description: string;
85
+ image?: string;
86
+ services: AgentService[];
87
+ x402Support: boolean;
88
+ active: boolean;
89
+ registrations: {
90
+ agentId: number;
91
+ agentRegistry: string;
92
+ }[];
93
+ supportedTrust: ('reputation' | 'crypto-economic' | 'tee-attestation' | 'zkml')[];
94
+ usdcAgent?: {
95
+ version: string;
96
+ capabilities: string[];
97
+ supportedChains: string[];
98
+ paymentAddress?: string;
99
+ escrowSupport: boolean;
100
+ x402Endpoint?: string;
101
+ };
102
+ }
103
+ export interface AgentService {
104
+ name: string;
105
+ endpoint: string;
106
+ version?: string;
107
+ skills?: string[];
108
+ domains?: string[];
109
+ }
110
+ export interface Feedback {
111
+ feedbackId: number;
112
+ agentId: number;
113
+ author: string;
114
+ score: number;
115
+ context: string;
116
+ taskHash: string;
117
+ timestamp: number;
118
+ }
119
+ export interface ReputationSummary {
120
+ agentId: number;
121
+ averageScore: number;
122
+ totalFeedback: number;
123
+ recentFeedback: Feedback[];
124
+ trustLevel: 'untrusted' | 'new' | 'emerging' | 'established' | 'trusted' | 'verified';
125
+ }
126
+ export declare const TRUST_LEVELS: {
127
+ readonly untrusted: {
128
+ readonly minScore: -100;
129
+ readonly minFeedback: 0;
130
+ };
131
+ readonly new: {
132
+ readonly minScore: 0;
133
+ readonly minFeedback: 1;
134
+ };
135
+ readonly emerging: {
136
+ readonly minScore: 25;
137
+ readonly minFeedback: 5;
138
+ };
139
+ readonly established: {
140
+ readonly minScore: 50;
141
+ readonly minFeedback: 20;
142
+ };
143
+ readonly trusted: {
144
+ readonly minScore: 75;
145
+ readonly minFeedback: 50;
146
+ };
147
+ readonly verified: {
148
+ readonly minScore: 90;
149
+ readonly minFeedback: 100;
150
+ };
151
+ };
152
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../lib/erc8004/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;CAWpB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Cf,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,YAAY,CAAC;AAGvD,eAAO,MAAM,qBAAqB,k6BAoBxB,CAAC;AAGX,eAAO,MAAM,uBAAuB,wrCAoB1B,CAAC;AAGX,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,yDAAyD,CAAC;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;KACvB,EAAE,CAAC;IACJ,cAAc,EAAE,CAAC,YAAY,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,MAAM,CAAC,EAAE,CAAC;IAGlF,SAAS,CAAC,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,aAAa,EAAE,OAAO,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAGD,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,QAAQ,EAAE,CAAC;IAC3B,UAAU,EAAE,WAAW,GAAG,KAAK,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,UAAU,CAAC;CACvF;AAGD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;CAOf,CAAC"}
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ /**
3
+ * ERC-8004 Constants & Contract Addresses
4
+ *
5
+ * Official registry deployments from https://github.com/erc-8004/erc-8004-contracts
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.TRUST_LEVELS = exports.REPUTATION_REGISTRY_ABI = exports.IDENTITY_REGISTRY_ABI = exports.CHAIN_CONFIG = exports.ERC8004_CONTRACTS = void 0;
9
+ exports.ERC8004_CONTRACTS = {
10
+ // Testnets (same addresses across all testnets)
11
+ testnet: {
12
+ identityRegistry: '0x8004A818BFB912233c491871b3d84c89A494BD9e',
13
+ reputationRegistry: '0x8004B663056A597Dffe9eCcC1965A193B7388713',
14
+ },
15
+ // Mainnets (same addresses across all mainnets)
16
+ mainnet: {
17
+ identityRegistry: '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432',
18
+ reputationRegistry: '0x8004BAa17C55a88189AE136b182e5fdA19dE9b63',
19
+ },
20
+ };
21
+ exports.CHAIN_CONFIG = {
22
+ 'ETH-SEPOLIA': {
23
+ chainId: 11155111,
24
+ namespace: 'eip155',
25
+ rpcUrl: 'https://rpc.sepolia.org',
26
+ explorer: 'https://sepolia.etherscan.io',
27
+ contracts: exports.ERC8004_CONTRACTS.testnet,
28
+ },
29
+ 'BASE-SEPOLIA': {
30
+ chainId: 84532,
31
+ namespace: 'eip155',
32
+ rpcUrl: 'https://sepolia.base.org',
33
+ explorer: 'https://sepolia.basescan.org',
34
+ contracts: exports.ERC8004_CONTRACTS.testnet,
35
+ },
36
+ 'MATIC-AMOY': {
37
+ chainId: 80002,
38
+ namespace: 'eip155',
39
+ rpcUrl: 'https://rpc-amoy.polygon.technology',
40
+ explorer: 'https://amoy.polygonscan.com',
41
+ contracts: exports.ERC8004_CONTRACTS.testnet,
42
+ },
43
+ 'ARB-SEPOLIA': {
44
+ chainId: 421614,
45
+ namespace: 'eip155',
46
+ rpcUrl: 'https://sepolia-rollup.arbitrum.io/rpc',
47
+ explorer: 'https://sepolia.arbiscan.io',
48
+ contracts: exports.ERC8004_CONTRACTS.testnet,
49
+ },
50
+ // Mainnets
51
+ 'ETH-MAINNET': {
52
+ chainId: 1,
53
+ namespace: 'eip155',
54
+ rpcUrl: 'https://eth.llamarpc.com',
55
+ explorer: 'https://etherscan.io',
56
+ contracts: exports.ERC8004_CONTRACTS.mainnet,
57
+ },
58
+ 'BASE-MAINNET': {
59
+ chainId: 8453,
60
+ namespace: 'eip155',
61
+ rpcUrl: 'https://mainnet.base.org',
62
+ explorer: 'https://basescan.org',
63
+ contracts: exports.ERC8004_CONTRACTS.mainnet,
64
+ },
65
+ };
66
+ // Identity Registry ABI (ERC-721 + URIStorage extension)
67
+ exports.IDENTITY_REGISTRY_ABI = [
68
+ // ERC-721 standard
69
+ 'function balanceOf(address owner) view returns (uint256)',
70
+ 'function ownerOf(uint256 tokenId) view returns (address)',
71
+ 'function tokenURI(uint256 tokenId) view returns (string)',
72
+ 'function totalSupply() view returns (uint256)',
73
+ 'function tokenByIndex(uint256 index) view returns (uint256)',
74
+ 'function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)',
75
+ // ERC-8004 Identity Registry
76
+ 'function register(string uri) returns (uint256 agentId)',
77
+ 'function setAgentURI(uint256 agentId, string uri)',
78
+ 'function getAgentURI(uint256 agentId) view returns (string)',
79
+ 'function getAgentOwner(uint256 agentId) view returns (address)',
80
+ 'function getAgentsByOwner(address owner) view returns (uint256[])',
81
+ // Events
82
+ 'event AgentRegistered(uint256 indexed agentId, address indexed owner, string uri)',
83
+ 'event AgentURIUpdated(uint256 indexed agentId, string uri)',
84
+ 'event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)',
85
+ ];
86
+ // Reputation Registry ABI
87
+ exports.REPUTATION_REGISTRY_ABI = [
88
+ // Post feedback
89
+ 'function postFeedback(uint256 agentId, int8 score, string context, bytes32 taskHash) returns (uint256 feedbackId)',
90
+ 'function postFeedbackWithProof(uint256 agentId, int8 score, string context, bytes32 taskHash, bytes proof) returns (uint256 feedbackId)',
91
+ // Query feedback
92
+ 'function getFeedback(uint256 feedbackId) view returns (tuple(uint256 agentId, address author, int8 score, string context, bytes32 taskHash, uint256 timestamp))',
93
+ 'function getFeedbackCount(uint256 agentId) view returns (uint256)',
94
+ 'function getFeedbackByAgent(uint256 agentId, uint256 offset, uint256 limit) view returns (uint256[])',
95
+ 'function getAverageScore(uint256 agentId) view returns (int256 average, uint256 count)',
96
+ // Authorization
97
+ 'function authorizeFeedback(uint256 agentId, address author)',
98
+ 'function revokeFeedbackAuthorization(uint256 agentId, address author)',
99
+ 'function isAuthorizedFeedbackAuthor(uint256 agentId, address author) view returns (bool)',
100
+ // Events
101
+ 'event FeedbackPosted(uint256 indexed feedbackId, uint256 indexed agentId, address indexed author, int8 score)',
102
+ 'event FeedbackAuthorizationGranted(uint256 indexed agentId, address indexed author)',
103
+ 'event FeedbackAuthorizationRevoked(uint256 indexed agentId, address indexed author)',
104
+ ];
105
+ // Trust level thresholds
106
+ exports.TRUST_LEVELS = {
107
+ untrusted: { minScore: -100, minFeedback: 0 },
108
+ new: { minScore: 0, minFeedback: 1 },
109
+ emerging: { minScore: 25, minFeedback: 5 },
110
+ established: { minScore: 50, minFeedback: 20 },
111
+ trusted: { minScore: 75, minFeedback: 50 },
112
+ verified: { minScore: 90, minFeedback: 100 },
113
+ };
114
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../lib/erc8004/constants.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEU,QAAA,iBAAiB,GAAG;IAC/B,gDAAgD;IAChD,OAAO,EAAE;QACP,gBAAgB,EAAE,4CAA4C;QAC9D,kBAAkB,EAAE,4CAA4C;KACjE;IACD,gDAAgD;IAChD,OAAO,EAAE;QACP,gBAAgB,EAAE,4CAA4C;QAC9D,kBAAkB,EAAE,4CAA4C;KACjE;CACO,CAAC;AAEE,QAAA,YAAY,GAAG;IAC1B,aAAa,EAAE;QACb,OAAO,EAAE,QAAQ;QACjB,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE,yBAAyB;QACjC,QAAQ,EAAE,8BAA8B;QACxC,SAAS,EAAE,yBAAiB,CAAC,OAAO;KACrC;IACD,cAAc,EAAE;QACd,OAAO,EAAE,KAAK;QACd,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE,0BAA0B;QAClC,QAAQ,EAAE,8BAA8B;QACxC,SAAS,EAAE,yBAAiB,CAAC,OAAO;KACrC;IACD,YAAY,EAAE;QACZ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;CAC7E,CAAC;AAuDX,yBAAyB;AACZ,QAAA,YAAY,GAAG;IAC1B,SAAS,EAAE,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE;IAC7C,GAAG,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE;IACpC,QAAQ,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE;IAC1C,WAAW,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;IAC9C,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;IAC1C,QAAQ,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE;CACpC,CAAC"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * ERC-8004 Agent Discovery Service
3
+ *
4
+ * Find and verify agents for trustless interactions.
5
+ */
6
+ import { IdentityClient, RegisteredAgent } from './identity';
7
+ import { ReputationClient, ReputationSummary } from './reputation';
8
+ import { SupportedChain } from './constants';
9
+ export interface DiscoveryConfig {
10
+ chain: SupportedChain;
11
+ privateKey?: string;
12
+ }
13
+ export interface AgentSearchOptions {
14
+ capabilities?: string[];
15
+ serviceType?: string;
16
+ x402Support?: boolean;
17
+ escrowSupport?: boolean;
18
+ minTrustLevel?: ReputationSummary['trustLevel'];
19
+ minTrustScore?: number;
20
+ limit?: number;
21
+ }
22
+ export interface DiscoveredAgent {
23
+ agent: RegisteredAgent;
24
+ reputation: ReputationSummary;
25
+ trustScore: number;
26
+ paymentAddress?: string;
27
+ x402Endpoint?: string;
28
+ }
29
+ export declare class DiscoveryService {
30
+ private identityClient;
31
+ private reputationClient;
32
+ private chain;
33
+ constructor(config: DiscoveryConfig);
34
+ /**
35
+ * Search for agents matching criteria with reputation data
36
+ */
37
+ searchAgents(options?: AgentSearchOptions): Promise<DiscoveredAgent[]>;
38
+ /**
39
+ * Find agents that can receive USDC payments
40
+ */
41
+ findPaymentAgents(options?: {
42
+ minTrustScore?: number;
43
+ limit?: number;
44
+ }): Promise<DiscoveredAgent[]>;
45
+ /**
46
+ * Find agents with escrow capability
47
+ */
48
+ findEscrowAgents(options?: {
49
+ minTrustLevel?: ReputationSummary['trustLevel'];
50
+ limit?: number;
51
+ }): Promise<DiscoveredAgent[]>;
52
+ /**
53
+ * Verify an agent before transacting
54
+ *
55
+ * Returns verification result with recommendation
56
+ */
57
+ verifyAgent(agentId: number): Promise<{
58
+ verified: boolean;
59
+ trustScore: number;
60
+ reputation: ReputationSummary;
61
+ recommendation: 'safe' | 'caution' | 'risky' | 'avoid';
62
+ reasons: string[];
63
+ }>;
64
+ /**
65
+ * Check if it's safe to pay an agent a certain amount
66
+ *
67
+ * Higher amounts require higher trust
68
+ */
69
+ checkPaymentSafety(agentId: number, amountUsdc: number): Promise<{
70
+ safe: boolean;
71
+ trustScore: number;
72
+ maxRecommendedAmount: number;
73
+ reason: string;
74
+ }>;
75
+ /**
76
+ * Get the identity client for direct access
77
+ */
78
+ getIdentityClient(): IdentityClient;
79
+ /**
80
+ * Get the reputation client for direct access
81
+ */
82
+ getReputationClient(): ReputationClient;
83
+ }
84
+ //# sourceMappingURL=discovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../lib/erc8004/discovery.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,cAAc,EAAqB,MAAM,aAAa,CAAC;AAEhE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IAEjC,YAAY,CAAC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AM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;QACvD,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;IA2EF;;;;OAIG;IACG,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;QACrE,IAAI,EAAE,OAAO,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IAiCF;;OAEG;IACH,iBAAiB,IAAI,cAAc;IAInC;;OAEG;IACH,mBAAmB,IAAI,gBAAgB;CAGxC"}
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+ /**
3
+ * ERC-8004 Agent Discovery Service
4
+ *
5
+ * Find and verify agents for trustless interactions.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.DiscoveryService = void 0;
9
+ const identity_1 = require("./identity");
10
+ const reputation_1 = require("./reputation");
11
+ class DiscoveryService {
12
+ constructor(config) {
13
+ this.chain = config.chain;
14
+ this.identityClient = new identity_1.IdentityClient({
15
+ chain: config.chain,
16
+ privateKey: config.privateKey,
17
+ });
18
+ this.reputationClient = new reputation_1.ReputationClient({
19
+ chain: config.chain,
20
+ privateKey: config.privateKey,
21
+ });
22
+ }
23
+ /**
24
+ * Search for agents matching criteria with reputation data
25
+ */
26
+ async searchAgents(options = {}) {
27
+ // First, get agents from identity registry
28
+ const agents = await this.identityClient.searchAgents({
29
+ capability: options.capabilities?.[0], // Simple single capability for now
30
+ service: options.serviceType,
31
+ x402Support: options.x402Support,
32
+ limit: (options.limit || 20) * 2, // Fetch extra to account for filtering
33
+ });
34
+ // Enrich with reputation data and filter
35
+ const enrichedAgents = [];
36
+ for (const agent of agents) {
37
+ if (enrichedAgents.length >= (options.limit || 20))
38
+ break;
39
+ const [reputation, trustScore] = await Promise.all([
40
+ this.reputationClient.getReputationSummary(agent.agentId),
41
+ this.reputationClient.calculateTrustScore(agent.agentId),
42
+ ]);
43
+ // Filter by trust level
44
+ if (options.minTrustLevel) {
45
+ const meetsMinTrust = await this.reputationClient.meetsMinimumTrust(agent.agentId, options.minTrustLevel);
46
+ if (!meetsMinTrust)
47
+ continue;
48
+ }
49
+ // Filter by trust score
50
+ if (options.minTrustScore && trustScore < options.minTrustScore) {
51
+ continue;
52
+ }
53
+ // Filter by escrow support
54
+ if (options.escrowSupport !== undefined) {
55
+ const hasEscrow = agent.registration?.usdcAgent?.escrowSupport;
56
+ if (hasEscrow !== options.escrowSupport)
57
+ continue;
58
+ }
59
+ // Filter by all capabilities (not just first)
60
+ if (options.capabilities && options.capabilities.length > 1) {
61
+ const agentCaps = agent.registration?.usdcAgent?.capabilities || [];
62
+ const hasAllCaps = options.capabilities.every(cap => agentCaps.includes(cap));
63
+ if (!hasAllCaps)
64
+ continue;
65
+ }
66
+ enrichedAgents.push({
67
+ agent,
68
+ reputation,
69
+ trustScore,
70
+ paymentAddress: agent.registration?.usdcAgent?.paymentAddress,
71
+ x402Endpoint: agent.registration?.usdcAgent?.x402Endpoint,
72
+ });
73
+ }
74
+ // Sort by trust score (highest first)
75
+ return enrichedAgents.sort((a, b) => b.trustScore - a.trustScore);
76
+ }
77
+ /**
78
+ * Find agents that can receive USDC payments
79
+ */
80
+ async findPaymentAgents(options = {}) {
81
+ return this.searchAgents({
82
+ x402Support: true,
83
+ minTrustScore: options.minTrustScore || 50, // Default to requiring some trust
84
+ limit: options.limit,
85
+ });
86
+ }
87
+ /**
88
+ * Find agents with escrow capability
89
+ */
90
+ async findEscrowAgents(options = {}) {
91
+ return this.searchAgents({
92
+ escrowSupport: true,
93
+ minTrustLevel: options.minTrustLevel || 'emerging',
94
+ limit: options.limit,
95
+ });
96
+ }
97
+ /**
98
+ * Verify an agent before transacting
99
+ *
100
+ * Returns verification result with recommendation
101
+ */
102
+ async verifyAgent(agentId) {
103
+ const [agent, reputation, trustScore] = await Promise.all([
104
+ this.identityClient.getAgent(agentId),
105
+ this.reputationClient.getReputationSummary(agentId),
106
+ this.reputationClient.calculateTrustScore(agentId),
107
+ ]);
108
+ const reasons = [];
109
+ let recommendation = 'safe';
110
+ // Check if agent exists
111
+ if (!agent) {
112
+ return {
113
+ verified: false,
114
+ trustScore: 0,
115
+ reputation: {
116
+ agentId,
117
+ averageScore: 0,
118
+ totalFeedback: 0,
119
+ recentFeedback: [],
120
+ trustLevel: 'untrusted',
121
+ },
122
+ recommendation: 'avoid',
123
+ reasons: ['Agent not found in registry'],
124
+ };
125
+ }
126
+ // Check registration status
127
+ if (!agent.registration?.active) {
128
+ reasons.push('Agent registration is not active');
129
+ recommendation = 'avoid';
130
+ }
131
+ // Check reputation
132
+ if (reputation.totalFeedback === 0) {
133
+ reasons.push('No feedback history - new agent');
134
+ recommendation = recommendation === 'safe' ? 'caution' : recommendation;
135
+ }
136
+ else if (reputation.averageScore < 0) {
137
+ reasons.push(`Negative average score: ${reputation.averageScore}`);
138
+ recommendation = 'risky';
139
+ }
140
+ else if (reputation.averageScore < 50) {
141
+ reasons.push(`Low average score: ${reputation.averageScore}`);
142
+ recommendation = recommendation === 'safe' ? 'caution' : recommendation;
143
+ }
144
+ // Check trust level
145
+ if (reputation.trustLevel === 'untrusted') {
146
+ reasons.push('Trust level: untrusted');
147
+ recommendation = 'avoid';
148
+ }
149
+ // Check recent feedback
150
+ const recentNegative = reputation.recentFeedback.filter(f => f.score < 0);
151
+ if (recentNegative.length >= 3) {
152
+ reasons.push(`${recentNegative.length} negative reviews in recent feedback`);
153
+ recommendation = 'risky';
154
+ }
155
+ // Positive signals
156
+ if (trustScore >= 80) {
157
+ reasons.push(`High trust score: ${trustScore}`);
158
+ }
159
+ if (reputation.trustLevel === 'verified' || reputation.trustLevel === 'trusted') {
160
+ reasons.push(`Strong trust level: ${reputation.trustLevel}`);
161
+ }
162
+ return {
163
+ verified: recommendation !== 'avoid',
164
+ trustScore,
165
+ reputation,
166
+ recommendation,
167
+ reasons,
168
+ };
169
+ }
170
+ /**
171
+ * Check if it's safe to pay an agent a certain amount
172
+ *
173
+ * Higher amounts require higher trust
174
+ */
175
+ async checkPaymentSafety(agentId, amountUsdc) {
176
+ const trustScore = await this.reputationClient.calculateTrustScore(agentId);
177
+ // Payment tiers based on trust score
178
+ const maxAmounts = [
179
+ [90, 10000], // Trust 90+ = up to $10,000
180
+ [80, 1000], // Trust 80+ = up to $1,000
181
+ [70, 500], // Trust 70+ = up to $500
182
+ [50, 100], // Trust 50+ = up to $100
183
+ [30, 25], // Trust 30+ = up to $25
184
+ [0, 5], // Any trust = up to $5
185
+ ];
186
+ let maxRecommendedAmount = 5;
187
+ for (const [minTrust, amount] of maxAmounts) {
188
+ if (trustScore >= minTrust) {
189
+ maxRecommendedAmount = amount;
190
+ break;
191
+ }
192
+ }
193
+ const safe = amountUsdc <= maxRecommendedAmount;
194
+ return {
195
+ safe,
196
+ trustScore,
197
+ maxRecommendedAmount,
198
+ reason: safe
199
+ ? `Payment amount within safe limit for trust score ${trustScore}`
200
+ : `Payment amount $${amountUsdc} exceeds recommended limit of $${maxRecommendedAmount} for trust score ${trustScore}`,
201
+ };
202
+ }
203
+ /**
204
+ * Get the identity client for direct access
205
+ */
206
+ getIdentityClient() {
207
+ return this.identityClient;
208
+ }
209
+ /**
210
+ * Get the reputation client for direct access
211
+ */
212
+ getReputationClient() {
213
+ return this.reputationClient;
214
+ }
215
+ }
216
+ exports.DiscoveryService = DiscoveryService;
217
+ //# sourceMappingURL=discovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../lib/erc8004/discovery.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,yCAA6D;AAC7D,6CAAmE;AAuCnE,MAAa,gBAAgB;IAK3B,YAAY,MAAuB;QACjC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAE1B,IAAI,CAAC,cAAc,GAAG,IAAI,yBAAc,CAAC;YACvC,KAAK,EAAE,MA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