@fangorn-network/sdk 2026.10.28 → 2026.11.3
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 +37 -653
- package/lib/cli/cli.js +46 -357
- package/lib/cli/index.d.ts +1 -4
- package/lib/cli/index.js +2 -20
- package/lib/cli/sell.d.ts +28 -0
- package/lib/cli/sell.js +95 -0
- package/lib/config.d.ts +163 -226
- package/lib/config.js +8 -35
- package/lib/contracts/data-registry/abi.d.ts +206 -6
- package/lib/contracts/data-registry/abi.js +415 -186
- package/lib/contracts/data-registry/index.d.ts +126 -2
- package/lib/contracts/data-registry/index.js +174 -1
- package/lib/contracts/index.d.ts +4 -7
- package/lib/contracts/index.js +4 -7
- package/lib/contracts/logs.d.ts +1 -1
- package/lib/contracts/logs.js +1 -1
- package/lib/contracts/{membership-registry → settlement-registry}/abi.d.ts +288 -637
- package/lib/contracts/settlement-registry/abi.js +947 -0
- package/lib/contracts/settlement-registry/index.d.ts +141 -0
- package/lib/contracts/settlement-registry/index.js +209 -0
- package/lib/crypto/aes.d.ts +2 -2
- package/lib/crypto/aes.js +4 -4
- package/lib/crypto/encryption.d.ts +8 -109
- package/lib/crypto/encryption.js +16 -114
- package/lib/crypto/paid.d.ts +104 -0
- package/lib/crypto/paid.js +147 -0
- package/lib/engine/index.d.ts +23 -12
- package/lib/engine/index.js +68 -29
- package/lib/engine/records.d.ts +4 -7
- package/lib/engine/records.js +6 -6
- package/lib/engine/test-helpers.d.ts +2 -3
- package/lib/engine/test-helpers.js +7 -5
- package/lib/erc8004.js +7 -10
- package/lib/fangorn.d.ts +65 -96
- package/lib/fangorn.js +110 -168
- package/lib/feed.d.ts +7 -8
- package/lib/feed.js +7 -8
- package/lib/index.d.ts +10 -13
- package/lib/index.js +10 -13
- package/lib/providers/storage/signed-url.d.ts +2 -10
- package/lib/providers/storage/signed-url.js +5 -15
- package/lib/providers/storage/types.d.ts +1 -1
- package/lib/providers/storage/utils.js +5 -3
- package/lib/test/key-server.d.ts +12 -0
- package/lib/test/key-server.js +30 -0
- package/lib/test/mem-registry.d.ts +14 -19
- package/lib/test/mem-registry.js +44 -37
- package/lib/test/sdk-suite.d.ts +1 -4
- package/lib/test/sdk-suite.js +16 -87
- package/lib/test/testbed.d.ts +35 -45
- package/lib/test/testbed.js +29 -56
- package/lib/types/index.d.ts +6 -11
- package/package.json +2 -5
- package/lib/contracts/app-registry/abi.d.ts +0 -1306
- package/lib/contracts/app-registry/abi.js +0 -1493
- package/lib/contracts/app-registry/index.d.ts +0 -200
- package/lib/contracts/app-registry/index.js +0 -325
- package/lib/contracts/membership-registry/abi.js +0 -1333
- package/lib/contracts/membership-registry/index.d.ts +0 -79
- package/lib/contracts/membership-registry/index.js +0 -104
- package/lib/contracts/types.d.ts +0 -8
- package/lib/contracts/types.js +0 -10
- package/lib/harness/examples/hackmd/build-markdown-graph.d.ts +0 -1
- package/lib/harness/examples/hackmd/build-markdown-graph.js +0 -17
- package/lib/harness/index.d.ts +0 -58
- package/lib/harness/index.js +0 -73
- package/lib/registry.d.ts +0 -118
- package/lib/registry.js +0 -184
package/lib/config.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { arbitrumSepolia, baseSepolia } from "viem/chains";
|
|
1
|
+
import { baseSepolia } from "viem/chains";
|
|
3
2
|
|
|
4
3
|
//#region src/config.ts
|
|
5
4
|
/**
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
function appId(name) {
|
|
9
|
-
return keccak256(toHex(name));
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Blank input means "not set", never an app called "". Returns the trimmed value,
|
|
5
|
+
* Blank input means "not set", never a value of "". Returns the trimmed value,
|
|
13
6
|
* or undefined when it is missing or only whitespace, so it can sit on the left of
|
|
14
7
|
* a `??` fallback. `??` on the raw value would let "" through: it is not nullish.
|
|
15
8
|
*/
|
|
@@ -17,27 +10,10 @@ function nonBlank(value) {
|
|
|
17
10
|
const trimmed = value?.trim();
|
|
18
11
|
return trimmed === "" ? void 0 : trimmed;
|
|
19
12
|
}
|
|
20
|
-
function toAppId(nameOrId) {
|
|
21
|
-
const name = nameOrId.trim();
|
|
22
|
-
if (!name) throw new Error("App name or id must not be blank.");
|
|
23
|
-
return /^0x[0-9a-fA-F]{64}$/.test(name) ? name : appId(name);
|
|
24
|
-
}
|
|
25
|
-
const ArbitrumSepoliaConfig = {
|
|
26
|
-
dataRegistryContractAddress: "0x72B5f83526F3893aF9f1eE0f32A27218EA09f8aE",
|
|
27
|
-
appRegistryContractAddress: "0x55e6209ea1833ceD900989a3b3b22466934E04A5",
|
|
28
|
-
membershipRegistryContractAddress: "0xDF17030Cd65435C86eb043F31DDACa99E819E347",
|
|
29
|
-
appRegistryFromBlock: 319536642n,
|
|
30
|
-
chain: arbitrumSepolia,
|
|
31
|
-
rpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
|
|
32
|
-
caip2: 421614,
|
|
33
|
-
ipfsGateway: "https://ipfs.io",
|
|
34
|
-
logWindow: 100000n
|
|
35
|
-
};
|
|
36
13
|
const BaseSepoliaConfig = {
|
|
37
|
-
dataRegistryContractAddress: "
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
appRegistryFromBlock: 51469588n,
|
|
14
|
+
dataRegistryContractAddress: "0x0F3eb0E62CF610dbaC6B3aD4Bf4cE38Ab50EBCC5",
|
|
15
|
+
settlementRegistryContractAddress: "0x61A5A195B54F57ada786Ba6689CdB04553cf7fBc",
|
|
16
|
+
fromBlock: 53592845n,
|
|
41
17
|
chain: baseSepolia,
|
|
42
18
|
rpcUrl: "https://base-sepolia-rpc.publicnode.com",
|
|
43
19
|
caip2: 84532,
|
|
@@ -54,12 +30,9 @@ const FangornConfig = BaseSepoliaConfig;
|
|
|
54
30
|
/**
|
|
55
31
|
* The networks supported by Fangorn, by the name `CHAIN_NAME` takes.
|
|
56
32
|
*/
|
|
57
|
-
const SupportedNetworks = {
|
|
58
|
-
arbitrumSepolia: ArbitrumSepoliaConfig,
|
|
59
|
-
baseSepolia: BaseSepoliaConfig
|
|
60
|
-
};
|
|
33
|
+
const SupportedNetworks = { baseSepolia: BaseSepoliaConfig };
|
|
61
34
|
/**
|
|
62
|
-
* Get a network's deployment by name ("
|
|
35
|
+
* Get a network's deployment by name ("baseSepolia").
|
|
63
36
|
* @returns The corresponding config if it is supported, otherwise an error
|
|
64
37
|
*/
|
|
65
38
|
function getNetwork(name) {
|
|
@@ -69,4 +42,4 @@ function getNetwork(name) {
|
|
|
69
42
|
}
|
|
70
43
|
|
|
71
44
|
//#endregion
|
|
72
|
-
export {
|
|
45
|
+
export { BaseSepoliaConfig, FangornConfig, SupportedNetworks, getNetwork as default, nonBlank };
|
|
@@ -7,6 +7,26 @@ declare const DATA_REGISTRY_ABI: readonly [{
|
|
|
7
7
|
readonly type: "constructor";
|
|
8
8
|
readonly inputs: readonly [];
|
|
9
9
|
readonly stateMutability: "nonpayable";
|
|
10
|
+
}, {
|
|
11
|
+
readonly type: "function";
|
|
12
|
+
readonly name: "EPOCH_SECONDS";
|
|
13
|
+
readonly inputs: readonly [];
|
|
14
|
+
readonly outputs: readonly [{
|
|
15
|
+
readonly name: "";
|
|
16
|
+
readonly type: "uint64";
|
|
17
|
+
readonly internalType: "uint64";
|
|
18
|
+
}];
|
|
19
|
+
readonly stateMutability: "view";
|
|
20
|
+
}, {
|
|
21
|
+
readonly type: "function";
|
|
22
|
+
readonly name: "UPDATE_TYPEHASH";
|
|
23
|
+
readonly inputs: readonly [];
|
|
24
|
+
readonly outputs: readonly [{
|
|
25
|
+
readonly name: "";
|
|
26
|
+
readonly type: "bytes32";
|
|
27
|
+
readonly internalType: "bytes32";
|
|
28
|
+
}];
|
|
29
|
+
readonly stateMutability: "view";
|
|
10
30
|
}, {
|
|
11
31
|
readonly type: "function";
|
|
12
32
|
readonly name: "UPGRADE_INTERFACE_VERSION";
|
|
@@ -17,6 +37,16 @@ declare const DATA_REGISTRY_ABI: readonly [{
|
|
|
17
37
|
readonly internalType: "string";
|
|
18
38
|
}];
|
|
19
39
|
readonly stateMutability: "view";
|
|
40
|
+
}, {
|
|
41
|
+
readonly type: "function";
|
|
42
|
+
readonly name: "WINDOW";
|
|
43
|
+
readonly inputs: readonly [];
|
|
44
|
+
readonly outputs: readonly [{
|
|
45
|
+
readonly name: "";
|
|
46
|
+
readonly type: "uint64";
|
|
47
|
+
readonly internalType: "uint64";
|
|
48
|
+
}];
|
|
49
|
+
readonly stateMutability: "view";
|
|
20
50
|
}, {
|
|
21
51
|
readonly type: "function";
|
|
22
52
|
readonly name: "admin";
|
|
@@ -27,6 +57,56 @@ declare const DATA_REGISTRY_ABI: readonly [{
|
|
|
27
57
|
readonly internalType: "address";
|
|
28
58
|
}];
|
|
29
59
|
readonly stateMutability: "view";
|
|
60
|
+
}, {
|
|
61
|
+
readonly type: "function";
|
|
62
|
+
readonly name: "commitHead";
|
|
63
|
+
readonly inputs: readonly [{
|
|
64
|
+
readonly name: "repo";
|
|
65
|
+
readonly type: "string";
|
|
66
|
+
readonly internalType: "string";
|
|
67
|
+
}, {
|
|
68
|
+
readonly name: "epoch";
|
|
69
|
+
readonly type: "uint64";
|
|
70
|
+
readonly internalType: "uint64";
|
|
71
|
+
}, {
|
|
72
|
+
readonly name: "parent";
|
|
73
|
+
readonly type: "bytes32";
|
|
74
|
+
readonly internalType: "bytes32";
|
|
75
|
+
}, {
|
|
76
|
+
readonly name: "root";
|
|
77
|
+
readonly type: "bytes32";
|
|
78
|
+
readonly internalType: "bytes32";
|
|
79
|
+
}, {
|
|
80
|
+
readonly name: "car";
|
|
81
|
+
readonly type: "bytes";
|
|
82
|
+
readonly internalType: "bytes";
|
|
83
|
+
}];
|
|
84
|
+
readonly outputs: readonly [{
|
|
85
|
+
readonly name: "";
|
|
86
|
+
readonly type: "bytes32";
|
|
87
|
+
readonly internalType: "bytes32";
|
|
88
|
+
}];
|
|
89
|
+
readonly stateMutability: "pure";
|
|
90
|
+
}, {
|
|
91
|
+
readonly type: "function";
|
|
92
|
+
readonly name: "currentEpoch";
|
|
93
|
+
readonly inputs: readonly [];
|
|
94
|
+
readonly outputs: readonly [{
|
|
95
|
+
readonly name: "";
|
|
96
|
+
readonly type: "uint64";
|
|
97
|
+
readonly internalType: "uint64";
|
|
98
|
+
}];
|
|
99
|
+
readonly stateMutability: "view";
|
|
100
|
+
}, {
|
|
101
|
+
readonly type: "function";
|
|
102
|
+
readonly name: "domainSeparator";
|
|
103
|
+
readonly inputs: readonly [];
|
|
104
|
+
readonly outputs: readonly [{
|
|
105
|
+
readonly name: "";
|
|
106
|
+
readonly type: "bytes32";
|
|
107
|
+
readonly internalType: "bytes32";
|
|
108
|
+
}];
|
|
109
|
+
readonly stateMutability: "view";
|
|
30
110
|
}, {
|
|
31
111
|
readonly type: "function";
|
|
32
112
|
readonly name: "getHead";
|
|
@@ -59,6 +139,40 @@ declare const DATA_REGISTRY_ABI: readonly [{
|
|
|
59
139
|
}];
|
|
60
140
|
readonly outputs: readonly [];
|
|
61
141
|
readonly stateMutability: "nonpayable";
|
|
142
|
+
}, {
|
|
143
|
+
readonly type: "function";
|
|
144
|
+
readonly name: "logLength";
|
|
145
|
+
readonly inputs: readonly [];
|
|
146
|
+
readonly outputs: readonly [{
|
|
147
|
+
readonly name: "";
|
|
148
|
+
readonly type: "uint64";
|
|
149
|
+
readonly internalType: "uint64";
|
|
150
|
+
}];
|
|
151
|
+
readonly stateMutability: "view";
|
|
152
|
+
}, {
|
|
153
|
+
readonly type: "function";
|
|
154
|
+
readonly name: "logRoot";
|
|
155
|
+
readonly inputs: readonly [];
|
|
156
|
+
readonly outputs: readonly [{
|
|
157
|
+
readonly name: "";
|
|
158
|
+
readonly type: "bytes32";
|
|
159
|
+
readonly internalType: "bytes32";
|
|
160
|
+
}];
|
|
161
|
+
readonly stateMutability: "view";
|
|
162
|
+
}, {
|
|
163
|
+
readonly type: "function";
|
|
164
|
+
readonly name: "peaks";
|
|
165
|
+
readonly inputs: readonly [{
|
|
166
|
+
readonly name: "";
|
|
167
|
+
readonly type: "uint256";
|
|
168
|
+
readonly internalType: "uint256";
|
|
169
|
+
}];
|
|
170
|
+
readonly outputs: readonly [{
|
|
171
|
+
readonly name: "";
|
|
172
|
+
readonly type: "bytes32";
|
|
173
|
+
readonly internalType: "bytes32";
|
|
174
|
+
}];
|
|
175
|
+
readonly stateMutability: "view";
|
|
62
176
|
}, {
|
|
63
177
|
readonly type: "function";
|
|
64
178
|
readonly name: "proxiableUUID";
|
|
@@ -69,6 +183,38 @@ declare const DATA_REGISTRY_ABI: readonly [{
|
|
|
69
183
|
readonly internalType: "bytes32";
|
|
70
184
|
}];
|
|
71
185
|
readonly stateMutability: "view";
|
|
186
|
+
}, {
|
|
187
|
+
readonly type: "function";
|
|
188
|
+
readonly name: "repoCount";
|
|
189
|
+
readonly inputs: readonly [{
|
|
190
|
+
readonly name: "publisher";
|
|
191
|
+
readonly type: "address";
|
|
192
|
+
readonly internalType: "address";
|
|
193
|
+
}];
|
|
194
|
+
readonly outputs: readonly [{
|
|
195
|
+
readonly name: "";
|
|
196
|
+
readonly type: "uint256";
|
|
197
|
+
readonly internalType: "uint256";
|
|
198
|
+
}];
|
|
199
|
+
readonly stateMutability: "view";
|
|
200
|
+
}, {
|
|
201
|
+
readonly type: "function";
|
|
202
|
+
readonly name: "repoIds";
|
|
203
|
+
readonly inputs: readonly [{
|
|
204
|
+
readonly name: "";
|
|
205
|
+
readonly type: "address";
|
|
206
|
+
readonly internalType: "address";
|
|
207
|
+
}, {
|
|
208
|
+
readonly name: "";
|
|
209
|
+
readonly type: "uint256";
|
|
210
|
+
readonly internalType: "uint256";
|
|
211
|
+
}];
|
|
212
|
+
readonly outputs: readonly [{
|
|
213
|
+
readonly name: "";
|
|
214
|
+
readonly type: "bytes32";
|
|
215
|
+
readonly internalType: "bytes32";
|
|
216
|
+
}];
|
|
217
|
+
readonly stateMutability: "view";
|
|
72
218
|
}, {
|
|
73
219
|
readonly type: "function";
|
|
74
220
|
readonly name: "setAdmin";
|
|
@@ -86,16 +232,66 @@ declare const DATA_REGISTRY_ABI: readonly [{
|
|
|
86
232
|
readonly name: "repo";
|
|
87
233
|
readonly type: "string";
|
|
88
234
|
readonly internalType: "string";
|
|
235
|
+
}, {
|
|
236
|
+
readonly name: "epoch";
|
|
237
|
+
readonly type: "uint64";
|
|
238
|
+
readonly internalType: "uint64";
|
|
89
239
|
}, {
|
|
90
240
|
readonly name: "parent";
|
|
91
241
|
readonly type: "bytes32";
|
|
92
242
|
readonly internalType: "bytes32";
|
|
93
243
|
}, {
|
|
94
|
-
readonly name: "
|
|
244
|
+
readonly name: "root";
|
|
245
|
+
readonly type: "bytes32";
|
|
246
|
+
readonly internalType: "bytes32";
|
|
247
|
+
}, {
|
|
248
|
+
readonly name: "car";
|
|
249
|
+
readonly type: "bytes";
|
|
250
|
+
readonly internalType: "bytes";
|
|
251
|
+
}];
|
|
252
|
+
readonly outputs: readonly [{
|
|
253
|
+
readonly name: "";
|
|
254
|
+
readonly type: "bytes32";
|
|
255
|
+
readonly internalType: "bytes32";
|
|
256
|
+
}];
|
|
257
|
+
readonly stateMutability: "nonpayable";
|
|
258
|
+
}, {
|
|
259
|
+
readonly type: "function";
|
|
260
|
+
readonly name: "updateBySig";
|
|
261
|
+
readonly inputs: readonly [{
|
|
262
|
+
readonly name: "publisher";
|
|
263
|
+
readonly type: "address";
|
|
264
|
+
readonly internalType: "address";
|
|
265
|
+
}, {
|
|
266
|
+
readonly name: "repo";
|
|
267
|
+
readonly type: "string";
|
|
268
|
+
readonly internalType: "string";
|
|
269
|
+
}, {
|
|
270
|
+
readonly name: "epoch";
|
|
271
|
+
readonly type: "uint64";
|
|
272
|
+
readonly internalType: "uint64";
|
|
273
|
+
}, {
|
|
274
|
+
readonly name: "parent";
|
|
275
|
+
readonly type: "bytes32";
|
|
276
|
+
readonly internalType: "bytes32";
|
|
277
|
+
}, {
|
|
278
|
+
readonly name: "root";
|
|
279
|
+
readonly type: "bytes32";
|
|
280
|
+
readonly internalType: "bytes32";
|
|
281
|
+
}, {
|
|
282
|
+
readonly name: "car";
|
|
283
|
+
readonly type: "bytes";
|
|
284
|
+
readonly internalType: "bytes";
|
|
285
|
+
}, {
|
|
286
|
+
readonly name: "signature";
|
|
287
|
+
readonly type: "bytes";
|
|
288
|
+
readonly internalType: "bytes";
|
|
289
|
+
}];
|
|
290
|
+
readonly outputs: readonly [{
|
|
291
|
+
readonly name: "";
|
|
95
292
|
readonly type: "bytes32";
|
|
96
293
|
readonly internalType: "bytes32";
|
|
97
294
|
}];
|
|
98
|
-
readonly outputs: readonly [];
|
|
99
295
|
readonly stateMutability: "nonpayable";
|
|
100
296
|
}, {
|
|
101
297
|
readonly type: "function";
|
|
@@ -189,6 +385,10 @@ declare const DATA_REGISTRY_ABI: readonly [{
|
|
|
189
385
|
readonly type: "address";
|
|
190
386
|
readonly internalType: "address";
|
|
191
387
|
}];
|
|
388
|
+
}, {
|
|
389
|
+
readonly type: "error";
|
|
390
|
+
readonly name: "BadSignature";
|
|
391
|
+
readonly inputs: readonly [];
|
|
192
392
|
}, {
|
|
193
393
|
readonly type: "error";
|
|
194
394
|
readonly name: "ERC1967InvalidImplementation";
|
|
@@ -201,6 +401,10 @@ declare const DATA_REGISTRY_ABI: readonly [{
|
|
|
201
401
|
readonly type: "error";
|
|
202
402
|
readonly name: "ERC1967NonPayable";
|
|
203
403
|
readonly inputs: readonly [];
|
|
404
|
+
}, {
|
|
405
|
+
readonly type: "error";
|
|
406
|
+
readonly name: "EpochOutOfWindow";
|
|
407
|
+
readonly inputs: readonly [];
|
|
204
408
|
}, {
|
|
205
409
|
readonly type: "error";
|
|
206
410
|
readonly name: "FailedCall";
|
|
@@ -233,10 +437,6 @@ declare const DATA_REGISTRY_ABI: readonly [{
|
|
|
233
437
|
readonly type: "error";
|
|
234
438
|
readonly name: "Unauthorized";
|
|
235
439
|
readonly inputs: readonly [];
|
|
236
|
-
}, {
|
|
237
|
-
readonly type: "error";
|
|
238
|
-
readonly name: "ZeroHead";
|
|
239
|
-
readonly inputs: readonly [];
|
|
240
440
|
}];
|
|
241
441
|
//#endregion
|
|
242
442
|
export { DATA_REGISTRY_ABI };
|