@fangorn-network/sdk 0.1.0-dev
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/LICENSE.md +20 -0
- package/README.md +80 -0
- package/lib/cli/cli.d.ts +2 -0
- package/lib/cli/cli.js +571 -0
- package/lib/cli/index.d.ts +10 -0
- package/lib/cli/index.js +18 -0
- package/lib/cli/sell.d.ts +28 -0
- package/lib/cli/sell.js +95 -0
- package/lib/cli/stage.d.ts +19 -0
- package/lib/cli/stage.js +94 -0
- package/lib/config.d.ts +697 -0
- package/lib/config.js +45 -0
- package/lib/contracts/data-registry/abi.d.ts +442 -0
- package/lib/contracts/data-registry/abi.js +508 -0
- package/lib/contracts/data-registry/index.d.ts +131 -0
- package/lib/contracts/data-registry/index.js +183 -0
- package/lib/contracts/index.d.ts +6 -0
- package/lib/contracts/index.js +6 -0
- package/lib/contracts/logs.d.ts +17 -0
- package/lib/contracts/logs.js +28 -0
- package/lib/contracts/settlement-registry/abi.d.ts +810 -0
- package/lib/contracts/settlement-registry/abi.js +962 -0
- package/lib/contracts/settlement-registry/index.d.ts +143 -0
- package/lib/contracts/settlement-registry/index.js +213 -0
- package/lib/contracts/write.d.ts +59 -0
- package/lib/contracts/write.js +102 -0
- package/lib/crypto/aes.d.ts +19 -0
- package/lib/crypto/aes.js +26 -0
- package/lib/crypto/encryption.d.ts +38 -0
- package/lib/crypto/encryption.js +68 -0
- package/lib/crypto/paid.d.ts +104 -0
- package/lib/crypto/paid.js +147 -0
- package/lib/crypto/rand.d.ts +5 -0
- package/lib/crypto/rand.js +16 -0
- package/lib/crypto/types.d.ts +23 -0
- package/lib/crypto/types.js +1 -0
- package/lib/engine/car.d.ts +14 -0
- package/lib/engine/car.js +42 -0
- package/lib/engine/index.d.ts +206 -0
- package/lib/engine/index.js +377 -0
- package/lib/engine/records.d.ts +121 -0
- package/lib/engine/records.js +239 -0
- package/lib/engine/test-helpers.d.ts +38 -0
- package/lib/engine/test-helpers.js +63 -0
- package/lib/erc8004.d.ts +56 -0
- package/lib/erc8004.js +140 -0
- package/lib/fangorn.d.ts +342 -0
- package/lib/fangorn.js +642 -0
- package/lib/feed.d.ts +34 -0
- package/lib/feed.js +67 -0
- package/lib/index.d.ts +17 -0
- package/lib/index.js +16 -0
- package/lib/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +77 -0
- package/lib/node_modules/@vitest/expect/dist/index.js +1414 -0
- package/lib/node_modules/@vitest/pretty-format/dist/index.js +858 -0
- package/lib/node_modules/@vitest/runner/dist/chunk-tasks.js +51 -0
- package/lib/node_modules/@vitest/runner/dist/index.js +1199 -0
- package/lib/node_modules/@vitest/runner/dist/utils.js +3 -0
- package/lib/node_modules/@vitest/snapshot/dist/index.js +1075 -0
- package/lib/node_modules/@vitest/spy/dist/index.js +353 -0
- package/lib/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +7 -0
- package/lib/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js +81 -0
- package/lib/node_modules/@vitest/utils/dist/diff.js +1345 -0
- package/lib/node_modules/@vitest/utils/dist/display.js +534 -0
- package/lib/node_modules/@vitest/utils/dist/error.js +30 -0
- package/lib/node_modules/@vitest/utils/dist/helpers.js +118 -0
- package/lib/node_modules/@vitest/utils/dist/serialize.js +76 -0
- package/lib/node_modules/@vitest/utils/dist/source-map.js +93 -0
- package/lib/node_modules/@vitest/utils/dist/timers.js +36 -0
- package/lib/node_modules/chai/index.js +2874 -0
- package/lib/node_modules/magic-string/dist/magic-string.es.js +939 -0
- package/lib/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +81 -0
- package/lib/node_modules/tinyrainbow/dist/index.js +85 -0
- package/lib/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +5 -0
- package/lib/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +50 -0
- package/lib/node_modules/vitest/dist/chunks/utils.DvEY5TfP.js +44 -0
- package/lib/node_modules/vitest/dist/chunks/vi.2VT5v0um.js +2578 -0
- package/lib/providers/storage/car.d.ts +36 -0
- package/lib/providers/storage/car.js +81 -0
- package/lib/providers/storage/index.d.ts +5 -0
- package/lib/providers/storage/index.js +5 -0
- package/lib/providers/storage/pinata.d.ts +53 -0
- package/lib/providers/storage/pinata.js +178 -0
- package/lib/providers/storage/signed-url.d.ts +54 -0
- package/lib/providers/storage/signed-url.js +122 -0
- package/lib/providers/storage/types.d.ts +62 -0
- package/lib/providers/storage/types.js +1 -0
- package/lib/providers/storage/utils.d.ts +30 -0
- package/lib/providers/storage/utils.js +107 -0
- package/lib/repo/index.d.ts +56 -0
- package/lib/repo/index.js +73 -0
- package/lib/test/key-server.d.ts +12 -0
- package/lib/test/key-server.js +30 -0
- package/lib/test/mem-registry.d.ts +46 -0
- package/lib/test/mem-registry.js +114 -0
- package/lib/test/sdk-suite.d.ts +10 -0
- package/lib/test/sdk-suite.js +155 -0
- package/lib/test/testbed.d.ts +16786 -0
- package/lib/test/testbed.js +175 -0
- package/lib/types/index.d.ts +37 -0
- package/lib/types/index.js +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
//#region src/contracts/data-registry/abi.ts
|
|
2
|
+
/**
|
|
3
|
+
* Generated from `forge inspect DataRegistry abi` in fangorn-network/contracts
|
|
4
|
+
* (solidity/src/DataRegistry.sol). Regenerate with scripts/gen-abis.sh, do not edit.
|
|
5
|
+
*/
|
|
6
|
+
const DATA_REGISTRY_ABI = [
|
|
7
|
+
{
|
|
8
|
+
type: "constructor",
|
|
9
|
+
inputs: [],
|
|
10
|
+
stateMutability: "nonpayable"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
type: "function",
|
|
14
|
+
name: "EPOCH_SECONDS",
|
|
15
|
+
inputs: [],
|
|
16
|
+
outputs: [{
|
|
17
|
+
name: "",
|
|
18
|
+
type: "uint64",
|
|
19
|
+
internalType: "uint64"
|
|
20
|
+
}],
|
|
21
|
+
stateMutability: "view"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: "function",
|
|
25
|
+
name: "UPDATE_TYPEHASH",
|
|
26
|
+
inputs: [],
|
|
27
|
+
outputs: [{
|
|
28
|
+
name: "",
|
|
29
|
+
type: "bytes32",
|
|
30
|
+
internalType: "bytes32"
|
|
31
|
+
}],
|
|
32
|
+
stateMutability: "view"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: "function",
|
|
36
|
+
name: "UPGRADE_INTERFACE_VERSION",
|
|
37
|
+
inputs: [],
|
|
38
|
+
outputs: [{
|
|
39
|
+
name: "",
|
|
40
|
+
type: "string",
|
|
41
|
+
internalType: "string"
|
|
42
|
+
}],
|
|
43
|
+
stateMutability: "view"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: "function",
|
|
47
|
+
name: "WINDOW",
|
|
48
|
+
inputs: [],
|
|
49
|
+
outputs: [{
|
|
50
|
+
name: "",
|
|
51
|
+
type: "uint64",
|
|
52
|
+
internalType: "uint64"
|
|
53
|
+
}],
|
|
54
|
+
stateMutability: "view"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: "function",
|
|
58
|
+
name: "admin",
|
|
59
|
+
inputs: [],
|
|
60
|
+
outputs: [{
|
|
61
|
+
name: "",
|
|
62
|
+
type: "address",
|
|
63
|
+
internalType: "address"
|
|
64
|
+
}],
|
|
65
|
+
stateMutability: "view"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: "function",
|
|
69
|
+
name: "commitHead",
|
|
70
|
+
inputs: [
|
|
71
|
+
{
|
|
72
|
+
name: "repo",
|
|
73
|
+
type: "string",
|
|
74
|
+
internalType: "string"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "epoch",
|
|
78
|
+
type: "uint64",
|
|
79
|
+
internalType: "uint64"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "parent",
|
|
83
|
+
type: "bytes32",
|
|
84
|
+
internalType: "bytes32"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "root",
|
|
88
|
+
type: "bytes32",
|
|
89
|
+
internalType: "bytes32"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: "car",
|
|
93
|
+
type: "bytes",
|
|
94
|
+
internalType: "bytes"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
outputs: [{
|
|
98
|
+
name: "",
|
|
99
|
+
type: "bytes32",
|
|
100
|
+
internalType: "bytes32"
|
|
101
|
+
}],
|
|
102
|
+
stateMutability: "pure"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
type: "function",
|
|
106
|
+
name: "currentEpoch",
|
|
107
|
+
inputs: [],
|
|
108
|
+
outputs: [{
|
|
109
|
+
name: "",
|
|
110
|
+
type: "uint64",
|
|
111
|
+
internalType: "uint64"
|
|
112
|
+
}],
|
|
113
|
+
stateMutability: "view"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
type: "function",
|
|
117
|
+
name: "domainSeparator",
|
|
118
|
+
inputs: [],
|
|
119
|
+
outputs: [{
|
|
120
|
+
name: "",
|
|
121
|
+
type: "bytes32",
|
|
122
|
+
internalType: "bytes32"
|
|
123
|
+
}],
|
|
124
|
+
stateMutability: "view"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
type: "function",
|
|
128
|
+
name: "getHead",
|
|
129
|
+
inputs: [{
|
|
130
|
+
name: "publisher",
|
|
131
|
+
type: "address",
|
|
132
|
+
internalType: "address"
|
|
133
|
+
}, {
|
|
134
|
+
name: "repo_id",
|
|
135
|
+
type: "bytes32",
|
|
136
|
+
internalType: "bytes32"
|
|
137
|
+
}],
|
|
138
|
+
outputs: [{
|
|
139
|
+
name: "pos",
|
|
140
|
+
type: "uint64",
|
|
141
|
+
internalType: "uint64"
|
|
142
|
+
}, {
|
|
143
|
+
name: "head",
|
|
144
|
+
type: "bytes32",
|
|
145
|
+
internalType: "bytes32"
|
|
146
|
+
}],
|
|
147
|
+
stateMutability: "view"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
type: "function",
|
|
151
|
+
name: "initialize",
|
|
152
|
+
inputs: [{
|
|
153
|
+
name: "admin_",
|
|
154
|
+
type: "address",
|
|
155
|
+
internalType: "address"
|
|
156
|
+
}],
|
|
157
|
+
outputs: [],
|
|
158
|
+
stateMutability: "nonpayable"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
type: "function",
|
|
162
|
+
name: "logLength",
|
|
163
|
+
inputs: [],
|
|
164
|
+
outputs: [{
|
|
165
|
+
name: "",
|
|
166
|
+
type: "uint64",
|
|
167
|
+
internalType: "uint64"
|
|
168
|
+
}],
|
|
169
|
+
stateMutability: "view"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
type: "function",
|
|
173
|
+
name: "logRoot",
|
|
174
|
+
inputs: [],
|
|
175
|
+
outputs: [{
|
|
176
|
+
name: "",
|
|
177
|
+
type: "bytes32",
|
|
178
|
+
internalType: "bytes32"
|
|
179
|
+
}],
|
|
180
|
+
stateMutability: "view"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
type: "function",
|
|
184
|
+
name: "peaks",
|
|
185
|
+
inputs: [{
|
|
186
|
+
name: "",
|
|
187
|
+
type: "uint256",
|
|
188
|
+
internalType: "uint256"
|
|
189
|
+
}],
|
|
190
|
+
outputs: [{
|
|
191
|
+
name: "",
|
|
192
|
+
type: "bytes32",
|
|
193
|
+
internalType: "bytes32"
|
|
194
|
+
}],
|
|
195
|
+
stateMutability: "view"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
type: "function",
|
|
199
|
+
name: "proxiableUUID",
|
|
200
|
+
inputs: [],
|
|
201
|
+
outputs: [{
|
|
202
|
+
name: "",
|
|
203
|
+
type: "bytes32",
|
|
204
|
+
internalType: "bytes32"
|
|
205
|
+
}],
|
|
206
|
+
stateMutability: "view"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
type: "function",
|
|
210
|
+
name: "repoCount",
|
|
211
|
+
inputs: [{
|
|
212
|
+
name: "publisher",
|
|
213
|
+
type: "address",
|
|
214
|
+
internalType: "address"
|
|
215
|
+
}],
|
|
216
|
+
outputs: [{
|
|
217
|
+
name: "",
|
|
218
|
+
type: "uint256",
|
|
219
|
+
internalType: "uint256"
|
|
220
|
+
}],
|
|
221
|
+
stateMutability: "view"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
type: "function",
|
|
225
|
+
name: "repoIds",
|
|
226
|
+
inputs: [{
|
|
227
|
+
name: "",
|
|
228
|
+
type: "address",
|
|
229
|
+
internalType: "address"
|
|
230
|
+
}, {
|
|
231
|
+
name: "",
|
|
232
|
+
type: "uint256",
|
|
233
|
+
internalType: "uint256"
|
|
234
|
+
}],
|
|
235
|
+
outputs: [{
|
|
236
|
+
name: "",
|
|
237
|
+
type: "bytes32",
|
|
238
|
+
internalType: "bytes32"
|
|
239
|
+
}],
|
|
240
|
+
stateMutability: "view"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
type: "function",
|
|
244
|
+
name: "setAdmin",
|
|
245
|
+
inputs: [{
|
|
246
|
+
name: "new_admin",
|
|
247
|
+
type: "address",
|
|
248
|
+
internalType: "address"
|
|
249
|
+
}],
|
|
250
|
+
outputs: [],
|
|
251
|
+
stateMutability: "nonpayable"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
type: "function",
|
|
255
|
+
name: "update",
|
|
256
|
+
inputs: [
|
|
257
|
+
{
|
|
258
|
+
name: "repo",
|
|
259
|
+
type: "string",
|
|
260
|
+
internalType: "string"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
name: "epoch",
|
|
264
|
+
type: "uint64",
|
|
265
|
+
internalType: "uint64"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: "parent",
|
|
269
|
+
type: "bytes32",
|
|
270
|
+
internalType: "bytes32"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
name: "root",
|
|
274
|
+
type: "bytes32",
|
|
275
|
+
internalType: "bytes32"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
name: "car",
|
|
279
|
+
type: "bytes",
|
|
280
|
+
internalType: "bytes"
|
|
281
|
+
}
|
|
282
|
+
],
|
|
283
|
+
outputs: [{
|
|
284
|
+
name: "",
|
|
285
|
+
type: "bytes32",
|
|
286
|
+
internalType: "bytes32"
|
|
287
|
+
}],
|
|
288
|
+
stateMutability: "nonpayable"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
type: "function",
|
|
292
|
+
name: "updateBySig",
|
|
293
|
+
inputs: [
|
|
294
|
+
{
|
|
295
|
+
name: "publisher",
|
|
296
|
+
type: "address",
|
|
297
|
+
internalType: "address"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
name: "repo",
|
|
301
|
+
type: "string",
|
|
302
|
+
internalType: "string"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
name: "epoch",
|
|
306
|
+
type: "uint64",
|
|
307
|
+
internalType: "uint64"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
name: "parent",
|
|
311
|
+
type: "bytes32",
|
|
312
|
+
internalType: "bytes32"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
name: "root",
|
|
316
|
+
type: "bytes32",
|
|
317
|
+
internalType: "bytes32"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
name: "car",
|
|
321
|
+
type: "bytes",
|
|
322
|
+
internalType: "bytes"
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: "signature",
|
|
326
|
+
type: "bytes",
|
|
327
|
+
internalType: "bytes"
|
|
328
|
+
}
|
|
329
|
+
],
|
|
330
|
+
outputs: [{
|
|
331
|
+
name: "",
|
|
332
|
+
type: "bytes32",
|
|
333
|
+
internalType: "bytes32"
|
|
334
|
+
}],
|
|
335
|
+
stateMutability: "nonpayable"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
type: "function",
|
|
339
|
+
name: "upgradeToAndCall",
|
|
340
|
+
inputs: [{
|
|
341
|
+
name: "newImplementation",
|
|
342
|
+
type: "address",
|
|
343
|
+
internalType: "address"
|
|
344
|
+
}, {
|
|
345
|
+
name: "data",
|
|
346
|
+
type: "bytes",
|
|
347
|
+
internalType: "bytes"
|
|
348
|
+
}],
|
|
349
|
+
outputs: [],
|
|
350
|
+
stateMutability: "payable"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
type: "event",
|
|
354
|
+
name: "AdminChanged",
|
|
355
|
+
inputs: [{
|
|
356
|
+
name: "previous_admin",
|
|
357
|
+
type: "address",
|
|
358
|
+
indexed: false,
|
|
359
|
+
internalType: "address"
|
|
360
|
+
}, {
|
|
361
|
+
name: "new_admin",
|
|
362
|
+
type: "address",
|
|
363
|
+
indexed: false,
|
|
364
|
+
internalType: "address"
|
|
365
|
+
}],
|
|
366
|
+
anonymous: false
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
type: "event",
|
|
370
|
+
name: "Initialized",
|
|
371
|
+
inputs: [{
|
|
372
|
+
name: "version",
|
|
373
|
+
type: "uint64",
|
|
374
|
+
indexed: false,
|
|
375
|
+
internalType: "uint64"
|
|
376
|
+
}],
|
|
377
|
+
anonymous: false
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
type: "event",
|
|
381
|
+
name: "Updated",
|
|
382
|
+
inputs: [
|
|
383
|
+
{
|
|
384
|
+
name: "publisher",
|
|
385
|
+
type: "address",
|
|
386
|
+
indexed: true,
|
|
387
|
+
internalType: "address"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
name: "repo_id",
|
|
391
|
+
type: "bytes32",
|
|
392
|
+
indexed: true,
|
|
393
|
+
internalType: "bytes32"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
name: "repo",
|
|
397
|
+
type: "string",
|
|
398
|
+
indexed: false,
|
|
399
|
+
internalType: "string"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
name: "pos",
|
|
403
|
+
type: "uint64",
|
|
404
|
+
indexed: false,
|
|
405
|
+
internalType: "uint64"
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
name: "parent",
|
|
409
|
+
type: "bytes32",
|
|
410
|
+
indexed: false,
|
|
411
|
+
internalType: "bytes32"
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
name: "head",
|
|
415
|
+
type: "bytes32",
|
|
416
|
+
indexed: false,
|
|
417
|
+
internalType: "bytes32"
|
|
418
|
+
}
|
|
419
|
+
],
|
|
420
|
+
anonymous: false
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
type: "event",
|
|
424
|
+
name: "Upgraded",
|
|
425
|
+
inputs: [{
|
|
426
|
+
name: "implementation",
|
|
427
|
+
type: "address",
|
|
428
|
+
indexed: true,
|
|
429
|
+
internalType: "address"
|
|
430
|
+
}],
|
|
431
|
+
anonymous: false
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
type: "error",
|
|
435
|
+
name: "AddressEmptyCode",
|
|
436
|
+
inputs: [{
|
|
437
|
+
name: "target",
|
|
438
|
+
type: "address",
|
|
439
|
+
internalType: "address"
|
|
440
|
+
}]
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
type: "error",
|
|
444
|
+
name: "BadSignature",
|
|
445
|
+
inputs: []
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
type: "error",
|
|
449
|
+
name: "ERC1967InvalidImplementation",
|
|
450
|
+
inputs: [{
|
|
451
|
+
name: "implementation",
|
|
452
|
+
type: "address",
|
|
453
|
+
internalType: "address"
|
|
454
|
+
}]
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
type: "error",
|
|
458
|
+
name: "ERC1967NonPayable",
|
|
459
|
+
inputs: []
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
type: "error",
|
|
463
|
+
name: "EpochOutOfWindow",
|
|
464
|
+
inputs: []
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
type: "error",
|
|
468
|
+
name: "FailedCall",
|
|
469
|
+
inputs: []
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
type: "error",
|
|
473
|
+
name: "InvalidInitialization",
|
|
474
|
+
inputs: []
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
type: "error",
|
|
478
|
+
name: "NotInitializing",
|
|
479
|
+
inputs: []
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
type: "error",
|
|
483
|
+
name: "StaleStateRoot",
|
|
484
|
+
inputs: []
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
type: "error",
|
|
488
|
+
name: "UUPSUnauthorizedCallContext",
|
|
489
|
+
inputs: []
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
type: "error",
|
|
493
|
+
name: "UUPSUnsupportedProxiableUUID",
|
|
494
|
+
inputs: [{
|
|
495
|
+
name: "slot",
|
|
496
|
+
type: "bytes32",
|
|
497
|
+
internalType: "bytes32"
|
|
498
|
+
}]
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
type: "error",
|
|
502
|
+
name: "Unauthorized",
|
|
503
|
+
inputs: []
|
|
504
|
+
}
|
|
505
|
+
];
|
|
506
|
+
|
|
507
|
+
//#endregion
|
|
508
|
+
export { DATA_REGISTRY_ABI };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { PreparedTx } from "../write.js";
|
|
2
|
+
import { Address, Hash, Hex, PublicClient, TypedDataDomain, WalletClient } from "viem";
|
|
3
|
+
|
|
4
|
+
//#region src/contracts/data-registry/index.d.ts
|
|
5
|
+
/** A repo's on-chain id: keccak256 of its name's UTF-8 bytes, never of the name as hex. */
|
|
6
|
+
declare function repoId(repo: string): Hex;
|
|
7
|
+
declare const ZERO_HEAD: Hex;
|
|
8
|
+
/** η: epoch length in seconds. e(t) = ⌊t / η⌋. */
|
|
9
|
+
declare const EPOCH_SECONDS = 3600;
|
|
10
|
+
/** W: how many epochs a commit may lag the ordering's clock. */
|
|
11
|
+
declare const WINDOW = 24;
|
|
12
|
+
declare function epochOf(unixSeconds: number | bigint): number;
|
|
13
|
+
/** What an update carries: the commit's fields, from which the registry computes its head. */
|
|
14
|
+
interface CommitUpdate {
|
|
15
|
+
repo: string;
|
|
16
|
+
epoch: number;
|
|
17
|
+
/** digest of the parent commit, or ZERO_HEAD */
|
|
18
|
+
parent: Hex;
|
|
19
|
+
/** digest of the state root */
|
|
20
|
+
root: Hex;
|
|
21
|
+
/** the CAR's CID, as bytes */
|
|
22
|
+
car: Hex;
|
|
23
|
+
}
|
|
24
|
+
declare const UPDATE_TYPES: {
|
|
25
|
+
readonly Update: readonly [{
|
|
26
|
+
readonly name: "publisher";
|
|
27
|
+
readonly type: "address";
|
|
28
|
+
}, {
|
|
29
|
+
readonly name: "repo";
|
|
30
|
+
readonly type: "string";
|
|
31
|
+
}, {
|
|
32
|
+
readonly name: "epoch";
|
|
33
|
+
readonly type: "uint64";
|
|
34
|
+
}, {
|
|
35
|
+
readonly name: "parent";
|
|
36
|
+
readonly type: "bytes32";
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "root";
|
|
39
|
+
readonly type: "bytes32";
|
|
40
|
+
}, {
|
|
41
|
+
readonly name: "car";
|
|
42
|
+
readonly type: "bytes";
|
|
43
|
+
}];
|
|
44
|
+
};
|
|
45
|
+
declare const dataDomain: (chainId: number, registry: Address) => TypedDataDomain;
|
|
46
|
+
declare const updateMessage: (publisher: Address, u: CommitUpdate) => {
|
|
47
|
+
publisher: `0x${string}`;
|
|
48
|
+
repo: string;
|
|
49
|
+
epoch: bigint;
|
|
50
|
+
parent: `0x${string}`;
|
|
51
|
+
root: `0x${string}`;
|
|
52
|
+
car: `0x${string}`;
|
|
53
|
+
};
|
|
54
|
+
/** ρ = (P, s): one publisher's repo. */
|
|
55
|
+
interface RepoRef {
|
|
56
|
+
publisher: Address;
|
|
57
|
+
repo: string;
|
|
58
|
+
}
|
|
59
|
+
/** One entry of the update log U, (P, s, i, h, t): a repo's head moved from `parent` to `head`. */
|
|
60
|
+
interface UpdateEntry {
|
|
61
|
+
publisher: Address;
|
|
62
|
+
repo: string;
|
|
63
|
+
/** The head's position in the repo's history, from 1. */
|
|
64
|
+
pos: number;
|
|
65
|
+
parent: Hex;
|
|
66
|
+
head: Hex;
|
|
67
|
+
/** The block the entry is in: where log scans and cursors resume. */
|
|
68
|
+
t: bigint;
|
|
69
|
+
/** That block's timestamp: the `t` of the paper's entry, and what the contract's log leaf hashes. */
|
|
70
|
+
timestamp: bigint;
|
|
71
|
+
/** Unique per entry, for de-duplication across catch-up and live. */
|
|
72
|
+
id: string;
|
|
73
|
+
}
|
|
74
|
+
/** A slice of the update log: every repo, one publisher's, one repo name across publishers, or one repo. */
|
|
75
|
+
interface LogFilter {
|
|
76
|
+
publisher?: Address;
|
|
77
|
+
repo?: string;
|
|
78
|
+
}
|
|
79
|
+
interface Registry {
|
|
80
|
+
/** e(t) at the ordering's current clock. A commit's epoch must be within W of it. */
|
|
81
|
+
epoch(): Promise<number>;
|
|
82
|
+
/** H(ρ): the committed head, or ZERO_HEAD for a repo never written. */
|
|
83
|
+
head(ref: RepoRef): Promise<Hex>;
|
|
84
|
+
/** Moves the signer's repo to the commit `u`. Valid only while `u.parent` is the head (Theorem 3). */
|
|
85
|
+
update(u: CommitUpdate): Promise<Hash>;
|
|
86
|
+
/** `update` as an unsigned transaction for `publisher` to sign. */
|
|
87
|
+
prepareUpdate(publisher: Address, u: CommitUpdate): Promise<PreparedTx>;
|
|
88
|
+
/** The signer's EIP-712 signature over `u`, for `updateBySig`. */
|
|
89
|
+
signUpdate(u: CommitUpdate): Promise<Hex>;
|
|
90
|
+
/** `update` for `publisher`, on its signature. Anyone may submit it. */
|
|
91
|
+
updateBySig(publisher: Address, u: CommitUpdate, signature: Hex): Promise<Hash>;
|
|
92
|
+
/** The entries of a log between two clock values, oldest first. */
|
|
93
|
+
log(filter: LogFilter, from: bigint, to?: bigint): Promise<UpdateEntry[]>;
|
|
94
|
+
/** Follow the log live. Returns an unsubscribe function. */
|
|
95
|
+
watch(filter: LogFilter, onEntry: (entry: UpdateEntry) => void, onError?: (err: Error) => void, pollingInterval?: number): () => void;
|
|
96
|
+
/** The ordering's current clock value (a block number). */
|
|
97
|
+
clock(): Promise<bigint>;
|
|
98
|
+
}
|
|
99
|
+
interface ChainRegistryConfig {
|
|
100
|
+
dataRegistryContractAddress: Address;
|
|
101
|
+
logWindow?: bigint;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The registry on the DataRegistry contract.
|
|
105
|
+
*
|
|
106
|
+
* Gap against Definition 3.7: the log is read as events through a trusted RPC,
|
|
107
|
+
* not proven against the contract's mountain range.
|
|
108
|
+
*/
|
|
109
|
+
declare class ChainRegistry implements Registry {
|
|
110
|
+
private publicClient;
|
|
111
|
+
private walletClient?;
|
|
112
|
+
private readonly data;
|
|
113
|
+
private readonly logWindow?;
|
|
114
|
+
constructor(config: ChainRegistryConfig, publicClient: PublicClient, walletClient?: WalletClient | undefined);
|
|
115
|
+
epoch(): Promise<number>;
|
|
116
|
+
head(ref: RepoRef): Promise<Hex>;
|
|
117
|
+
update(u: CommitUpdate): Promise<Hash>;
|
|
118
|
+
prepareUpdate(publisher: Address, u: CommitUpdate): Promise<PreparedTx>;
|
|
119
|
+
signUpdate(u: CommitUpdate): Promise<Hex>;
|
|
120
|
+
updateBySig(publisher: Address, u: CommitUpdate, signature: Hex): Promise<Hash>;
|
|
121
|
+
private write;
|
|
122
|
+
/** U's `Updated` events, narrowed on-chain by publisher and repo. */
|
|
123
|
+
private source;
|
|
124
|
+
log(filter: LogFilter, from: bigint, to?: bigint): Promise<UpdateEntry[]>;
|
|
125
|
+
/** Logs don't carry their block's timestamp: one block read per distinct block. */
|
|
126
|
+
private withTimestamps;
|
|
127
|
+
watch(filter: LogFilter, onEntry: (entry: UpdateEntry) => void, onError?: (err: Error) => void, pollingInterval?: number): () => void;
|
|
128
|
+
clock(): Promise<bigint>;
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
export { ChainRegistry, ChainRegistryConfig, CommitUpdate, EPOCH_SECONDS, LogFilter, Registry, RepoRef, UPDATE_TYPES, UpdateEntry, WINDOW, ZERO_HEAD, dataDomain, epochOf, repoId, updateMessage };
|