@nullclear/shared 0.0.0-stage → 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.
@@ -0,0 +1,378 @@
1
+ interface ChainConfig {
2
+ name: string;
3
+ chainId: number;
4
+ caip2: `eip155:${number}`;
5
+ erc8004Identity: `0x${string}`;
6
+ erc8004Reputation: `0x${string}`;
7
+ usdc: `0x${string}`;
8
+ usdcDomain: {
9
+ name: string;
10
+ version: string;
11
+ chainId: number;
12
+ verifyingContract: `0x${string}`;
13
+ };
14
+ rpcUrl: string;
15
+ blockExplorer: string;
16
+ }
17
+ declare const BASE_MAINNET: ChainConfig;
18
+ declare const BASE_SEPOLIA: ChainConfig;
19
+ declare const SUPPORTED_CHAINS: Record<number, ChainConfig>;
20
+ declare const CAIP2_TO_CHAIN_ID: Record<string, number>;
21
+ declare function getChainConfig(chainIdOrCaip2: number | string): ChainConfig;
22
+
23
+ declare const ERC8004_IDENTITY_ABI: readonly [{
24
+ readonly name: "register";
25
+ readonly type: "function";
26
+ readonly stateMutability: "nonpayable";
27
+ readonly inputs: readonly [{
28
+ readonly type: "string";
29
+ readonly name: "agentURI";
30
+ }];
31
+ readonly outputs: readonly [{
32
+ readonly type: "uint256";
33
+ readonly name: "agentId";
34
+ }];
35
+ }, {
36
+ readonly name: "ownerOf";
37
+ readonly type: "function";
38
+ readonly stateMutability: "view";
39
+ readonly inputs: readonly [{
40
+ readonly type: "uint256";
41
+ readonly name: "tokenId";
42
+ }];
43
+ readonly outputs: readonly [{
44
+ readonly type: "address";
45
+ }];
46
+ }, {
47
+ readonly name: "tokenURI";
48
+ readonly type: "function";
49
+ readonly stateMutability: "view";
50
+ readonly inputs: readonly [{
51
+ readonly type: "uint256";
52
+ readonly name: "tokenId";
53
+ }];
54
+ readonly outputs: readonly [{
55
+ readonly type: "string";
56
+ }];
57
+ }, {
58
+ readonly name: "getAgentWallet";
59
+ readonly type: "function";
60
+ readonly stateMutability: "view";
61
+ readonly inputs: readonly [{
62
+ readonly type: "uint256";
63
+ readonly name: "agentId";
64
+ }];
65
+ readonly outputs: readonly [{
66
+ readonly type: "address";
67
+ }];
68
+ }, {
69
+ readonly name: "Registered";
70
+ readonly type: "event";
71
+ readonly inputs: readonly [{
72
+ readonly type: "uint256";
73
+ readonly name: "agentId";
74
+ readonly indexed: true;
75
+ }, {
76
+ readonly type: "string";
77
+ readonly name: "agentURI";
78
+ }, {
79
+ readonly type: "address";
80
+ readonly name: "owner";
81
+ readonly indexed: true;
82
+ }];
83
+ }];
84
+ declare const ERC8004_REPUTATION_ABI: readonly [{
85
+ readonly name: "giveFeedback";
86
+ readonly type: "function";
87
+ readonly stateMutability: "nonpayable";
88
+ readonly inputs: readonly [{
89
+ readonly type: "uint256";
90
+ readonly name: "agentId";
91
+ }, {
92
+ readonly type: "int128";
93
+ readonly name: "value";
94
+ }, {
95
+ readonly type: "uint8";
96
+ readonly name: "valueDecimals";
97
+ }, {
98
+ readonly type: "string";
99
+ readonly name: "tag1";
100
+ }, {
101
+ readonly type: "string";
102
+ readonly name: "tag2";
103
+ }, {
104
+ readonly type: "string";
105
+ readonly name: "endpoint";
106
+ }, {
107
+ readonly type: "string";
108
+ readonly name: "feedbackURI";
109
+ }, {
110
+ readonly type: "bytes32";
111
+ readonly name: "feedbackHash";
112
+ }];
113
+ readonly outputs: readonly [];
114
+ }, {
115
+ readonly name: "getSummary";
116
+ readonly type: "function";
117
+ readonly stateMutability: "view";
118
+ readonly inputs: readonly [{
119
+ readonly type: "uint256";
120
+ readonly name: "agentId";
121
+ }, {
122
+ readonly type: "address[]";
123
+ readonly name: "clientAddresses";
124
+ }, {
125
+ readonly type: "string";
126
+ readonly name: "tag1";
127
+ }, {
128
+ readonly type: "string";
129
+ readonly name: "tag2";
130
+ }];
131
+ readonly outputs: readonly [{
132
+ readonly type: "uint64";
133
+ readonly name: "count";
134
+ }, {
135
+ readonly type: "int128";
136
+ readonly name: "summaryValue";
137
+ }, {
138
+ readonly type: "uint8";
139
+ readonly name: "summaryValueDecimals";
140
+ }];
141
+ }, {
142
+ readonly name: "readFeedback";
143
+ readonly type: "function";
144
+ readonly stateMutability: "view";
145
+ readonly inputs: readonly [{
146
+ readonly type: "uint256";
147
+ readonly name: "agentId";
148
+ }, {
149
+ readonly type: "address";
150
+ readonly name: "clientAddress";
151
+ }, {
152
+ readonly type: "uint64";
153
+ readonly name: "feedbackIndex";
154
+ }];
155
+ readonly outputs: readonly [{
156
+ readonly type: "int128";
157
+ readonly name: "value";
158
+ }, {
159
+ readonly type: "uint8";
160
+ readonly name: "valueDecimals";
161
+ }, {
162
+ readonly type: "string";
163
+ readonly name: "tag1";
164
+ }, {
165
+ readonly type: "string";
166
+ readonly name: "tag2";
167
+ }, {
168
+ readonly type: "bool";
169
+ readonly name: "isRevoked";
170
+ }];
171
+ }, {
172
+ readonly name: "NewFeedback";
173
+ readonly type: "event";
174
+ readonly inputs: readonly [{
175
+ readonly type: "uint256";
176
+ readonly name: "agentId";
177
+ readonly indexed: true;
178
+ }, {
179
+ readonly type: "address";
180
+ readonly name: "clientAddress";
181
+ readonly indexed: true;
182
+ }, {
183
+ readonly type: "uint64";
184
+ readonly name: "feedbackIndex";
185
+ }, {
186
+ readonly type: "int128";
187
+ readonly name: "value";
188
+ }, {
189
+ readonly type: "uint8";
190
+ readonly name: "valueDecimals";
191
+ }, {
192
+ readonly type: "string";
193
+ readonly name: "indexedTag1";
194
+ readonly indexed: true;
195
+ }, {
196
+ readonly type: "string";
197
+ readonly name: "tag1";
198
+ }, {
199
+ readonly type: "string";
200
+ readonly name: "tag2";
201
+ }, {
202
+ readonly type: "string";
203
+ readonly name: "endpoint";
204
+ }, {
205
+ readonly type: "string";
206
+ readonly name: "feedbackURI";
207
+ }, {
208
+ readonly type: "bytes32";
209
+ readonly name: "feedbackHash";
210
+ }];
211
+ }];
212
+
213
+ interface X402PaymentOption {
214
+ scheme: "exact";
215
+ network: "eip155:8453" | "eip155:84532";
216
+ amount: string;
217
+ asset: `0x${string}`;
218
+ payTo: `0x${string}`;
219
+ maxTimeoutSeconds: number;
220
+ extra?: {
221
+ name?: string;
222
+ version?: string;
223
+ feePayer?: `0x${string}`;
224
+ };
225
+ }
226
+ interface X402PaymentRequired {
227
+ x402Version: 2;
228
+ error?: string;
229
+ resource: {
230
+ url: string;
231
+ description?: string;
232
+ mimeType?: string;
233
+ };
234
+ accepts: X402PaymentOption[];
235
+ }
236
+ interface EIP3009Authorization {
237
+ from: `0x${string}`;
238
+ to: `0x${string}`;
239
+ value: string;
240
+ validAfter: string;
241
+ validBefore: string;
242
+ nonce: `0x${string}`;
243
+ }
244
+ interface X402PaymentSignaturePayload {
245
+ x402Version: 2;
246
+ resource?: {
247
+ url: string;
248
+ mimeType?: string;
249
+ };
250
+ accepted: X402PaymentOption;
251
+ payload: {
252
+ signature: `0x${string}`;
253
+ authorization: EIP3009Authorization;
254
+ };
255
+ }
256
+ declare const EIP3009_TYPES: {
257
+ readonly TransferWithAuthorization: readonly [{
258
+ readonly name: "from";
259
+ readonly type: "address";
260
+ }, {
261
+ readonly name: "to";
262
+ readonly type: "address";
263
+ }, {
264
+ readonly name: "value";
265
+ readonly type: "uint256";
266
+ }, {
267
+ readonly name: "validAfter";
268
+ readonly type: "uint256";
269
+ }, {
270
+ readonly name: "validBefore";
271
+ readonly type: "uint256";
272
+ }, {
273
+ readonly name: "nonce";
274
+ readonly type: "bytes32";
275
+ }];
276
+ };
277
+ interface X402PaymentResponse {
278
+ success: boolean;
279
+ transaction?: `0x${string}`;
280
+ network: "eip155:8453" | "eip155:84532";
281
+ payer: `0x${string}`;
282
+ errorReason?: string;
283
+ }
284
+ /**
285
+ * Universal base64 encoder that works in Node.js, Cloudflare Workers, and Browser
286
+ */
287
+ declare function encodeBase64Json(obj: unknown): string;
288
+ /**
289
+ * Universal base64 decoder that works in Node.js, Cloudflare Workers, and Browser
290
+ */
291
+ declare function decodeBase64Json<T>(base64: string): T;
292
+
293
+ interface KYAMandate {
294
+ corporateEntity: string;
295
+ entityRegistrationNumber: string;
296
+ agentId: string;
297
+ agentWallet: `0x${string}`;
298
+ maxTxLimitUsd: number;
299
+ liabilityCoverageUsd: number;
300
+ validUntil: number;
301
+ jurisdiction: string;
302
+ }
303
+ declare const KYA_MANDATE_TYPES: {
304
+ readonly CorporateMandate: readonly [{
305
+ readonly name: "corporateEntity";
306
+ readonly type: "string";
307
+ }, {
308
+ readonly name: "entityRegistrationNumber";
309
+ readonly type: "string";
310
+ }, {
311
+ readonly name: "agentId";
312
+ readonly type: "string";
313
+ }, {
314
+ readonly name: "agentWallet";
315
+ readonly type: "address";
316
+ }, {
317
+ readonly name: "maxTxLimitUsd";
318
+ readonly type: "uint256";
319
+ }, {
320
+ readonly name: "liabilityCoverageUsd";
321
+ readonly type: "uint256";
322
+ }, {
323
+ readonly name: "validUntil";
324
+ readonly type: "uint256";
325
+ }, {
326
+ readonly name: "jurisdiction";
327
+ readonly type: "string";
328
+ }];
329
+ };
330
+ declare const KYA_DOMAIN: {
331
+ readonly name: "NullClear KYA Registry";
332
+ readonly version: "1";
333
+ readonly chainId: 8453;
334
+ };
335
+ interface ClearingAttestation {
336
+ clearingId: string;
337
+ buyer: `0x${string}`;
338
+ sellerAgentId: string;
339
+ amountAtomic: string;
340
+ feeAtomic: string;
341
+ responseHash: `0x${string}`;
342
+ timestamp: number;
343
+ cleared: boolean;
344
+ }
345
+ declare const ARBITER_ATTESTATION_TYPES: {
346
+ readonly ClearingAttestation: readonly [{
347
+ readonly name: "clearingId";
348
+ readonly type: "string";
349
+ }, {
350
+ readonly name: "buyer";
351
+ readonly type: "address";
352
+ }, {
353
+ readonly name: "sellerAgentId";
354
+ readonly type: "string";
355
+ }, {
356
+ readonly name: "amountAtomic";
357
+ readonly type: "uint256";
358
+ }, {
359
+ readonly name: "feeAtomic";
360
+ readonly type: "uint256";
361
+ }, {
362
+ readonly name: "responseHash";
363
+ readonly type: "bytes32";
364
+ }, {
365
+ readonly name: "timestamp";
366
+ readonly type: "uint256";
367
+ }, {
368
+ readonly name: "cleared";
369
+ readonly type: "bool";
370
+ }];
371
+ };
372
+ declare const ARBITER_DOMAIN: {
373
+ readonly name: "NullClear Arbiter";
374
+ readonly version: "1";
375
+ readonly chainId: 8453;
376
+ };
377
+
378
+ export { ARBITER_ATTESTATION_TYPES, ARBITER_DOMAIN, BASE_MAINNET, BASE_SEPOLIA, CAIP2_TO_CHAIN_ID, type ChainConfig, type ClearingAttestation, type EIP3009Authorization, EIP3009_TYPES, ERC8004_IDENTITY_ABI, ERC8004_REPUTATION_ABI, type KYAMandate, KYA_DOMAIN, KYA_MANDATE_TYPES, SUPPORTED_CHAINS, type X402PaymentOption, type X402PaymentRequired, type X402PaymentResponse, type X402PaymentSignaturePayload, decodeBase64Json, encodeBase64Json, getChainConfig };