@fangorn-network/sdk 0.1.0-dev → 0.1.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/lib/cli/cli.js +328 -128
- package/lib/cli/index.d.ts +4 -1
- package/lib/cli/index.js +20 -2
- package/lib/config.d.ts +111 -48
- package/lib/config.js +39 -11
- package/lib/contracts/app-registry/abi.d.ts +1265 -0
- package/lib/contracts/app-registry/abi.js +1454 -0
- package/lib/contracts/app-registry/index.d.ts +161 -0
- package/lib/contracts/app-registry/index.js +274 -0
- package/lib/contracts/data-registry/abi.d.ts +19 -195
- package/lib/contracts/data-registry/abi.js +206 -409
- package/lib/contracts/data-registry/index.d.ts +2 -126
- package/lib/contracts/data-registry/index.js +1 -174
- package/lib/contracts/index.d.ts +7 -4
- package/lib/contracts/index.js +7 -4
- package/lib/contracts/logs.d.ts +1 -1
- package/lib/contracts/logs.js +1 -1
- package/lib/contracts/{settlement-registry → membership-registry}/abi.d.ts +636 -301
- package/lib/contracts/membership-registry/abi.js +1333 -0
- package/lib/contracts/membership-registry/index.d.ts +79 -0
- package/lib/contracts/membership-registry/index.js +104 -0
- package/lib/contracts/types.d.ts +10 -0
- package/lib/contracts/types.js +12 -0
- package/lib/crypto/aes.d.ts +2 -2
- package/lib/crypto/aes.js +4 -4
- package/lib/crypto/encryption.d.ts +109 -8
- package/lib/crypto/encryption.js +114 -16
- package/lib/engine/car.d.ts +1 -5
- package/lib/engine/car.js +2 -2
- package/lib/engine/index.d.ts +14 -33
- package/lib/engine/index.js +41 -98
- package/lib/engine/records.d.ts +8 -19
- package/lib/engine/records.js +7 -81
- package/lib/engine/test-helpers.d.ts +3 -2
- package/lib/engine/test-helpers.js +5 -7
- package/lib/erc8004.js +10 -7
- package/lib/fangorn.d.ts +86 -65
- package/lib/fangorn.js +153 -115
- package/lib/feed.d.ts +8 -7
- package/lib/feed.js +8 -7
- package/lib/harness/examples/hackmd/build-markdown-graph.d.ts +1 -0
- package/lib/harness/examples/hackmd/build-markdown-graph.js +17 -0
- package/lib/harness/index.d.ts +58 -0
- package/lib/harness/index.js +73 -0
- package/lib/index.d.ts +13 -10
- package/lib/index.js +13 -10
- package/lib/node_modules/{@jridgewell → .pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell}/sourcemap-codec/dist/sourcemap-codec.js +1 -1
- package/lib/node_modules/{@vitest → .pnpm/@vitest_expect@4.0.18/node_modules/@vitest}/expect/dist/index.js +8 -8
- package/lib/node_modules/{@vitest → .pnpm/@vitest_pretty-format@4.0.18/node_modules/@vitest}/pretty-format/dist/index.js +2 -2
- package/lib/node_modules/{@vitest → .pnpm/@vitest_runner@4.0.18/node_modules/@vitest}/runner/dist/chunk-tasks.js +2 -2
- package/lib/node_modules/{@vitest → .pnpm/@vitest_runner@4.0.18/node_modules/@vitest}/runner/dist/index.js +4 -4
- package/lib/node_modules/{@vitest → .pnpm/@vitest_snapshot@4.0.18/node_modules/@vitest}/snapshot/dist/index.js +4 -4
- package/lib/node_modules/{@vitest → .pnpm/@vitest_spy@4.0.18/node_modules/@vitest}/spy/dist/index.js +1 -1
- package/lib/node_modules/{@vitest → .pnpm/@vitest_utils@4.0.18/node_modules/@vitest}/utils/dist/chunk-_commonjsHelpers.js +1 -1
- package/lib/node_modules/{@vitest → .pnpm/@vitest_utils@4.0.18/node_modules/@vitest}/utils/dist/chunk-pathe.M-eThtNZ.js +1 -1
- package/lib/node_modules/{@vitest → .pnpm/@vitest_utils@4.0.18/node_modules/@vitest}/utils/dist/diff.js +3 -3
- package/lib/node_modules/{@vitest → .pnpm/@vitest_utils@4.0.18/node_modules/@vitest}/utils/dist/display.js +2 -2
- package/lib/node_modules/{@vitest → .pnpm/@vitest_utils@4.0.18/node_modules/@vitest}/utils/dist/error.js +2 -2
- package/lib/node_modules/{@vitest → .pnpm/@vitest_utils@4.0.18/node_modules/@vitest}/utils/dist/helpers.js +1 -1
- package/lib/node_modules/{@vitest → .pnpm/@vitest_utils@4.0.18/node_modules/@vitest}/utils/dist/serialize.js +1 -1
- package/lib/node_modules/{@vitest → .pnpm/@vitest_utils@4.0.18/node_modules/@vitest}/utils/dist/source-map.js +1 -1
- package/lib/node_modules/{@vitest → .pnpm/@vitest_utils@4.0.18/node_modules/@vitest}/utils/dist/timers.js +1 -1
- package/lib/node_modules/{chai → .pnpm/chai@6.2.2/node_modules/chai}/index.js +1 -1
- package/lib/node_modules/{magic-string → .pnpm/magic-string@0.30.21/node_modules/magic-string}/dist/magic-string.es.js +2 -2
- package/lib/node_modules/{pathe → .pnpm/pathe@2.0.3/node_modules/pathe}/dist/shared/pathe.M-eThtNZ.js +1 -1
- package/lib/node_modules/{tinyrainbow → .pnpm/tinyrainbow@3.0.3/node_modules/tinyrainbow}/dist/index.js +1 -1
- package/lib/node_modules/{vitest → .pnpm/vitest@4.0.18_@types_node@24.10.1_jiti@2.6.1_terser@5.51.2_tsx@4.21.0_yaml@2.8.2/node_modules/vitest}/dist/chunks/_commonjsHelpers.D26ty3Ew.js +1 -1
- package/lib/node_modules/{vitest → .pnpm/vitest@4.0.18_@types_node@24.10.1_jiti@2.6.1_terser@5.51.2_tsx@4.21.0_yaml@2.8.2/node_modules/vitest}/dist/chunks/date.Bq6ZW5rf.js +1 -1
- package/lib/node_modules/{vitest → .pnpm/vitest@4.0.18_@types_node@24.10.1_jiti@2.6.1_terser@5.51.2_tsx@4.21.0_yaml@2.8.2/node_modules/vitest}/dist/chunks/utils.DvEY5TfP.js +2 -2
- package/lib/node_modules/{vitest → .pnpm/vitest@4.0.18_@types_node@24.10.1_jiti@2.6.1_terser@5.51.2_tsx@4.21.0_yaml@2.8.2/node_modules/vitest}/dist/chunks/vi.2VT5v0um.js +11 -11
- package/lib/providers/storage/signed-url.d.ts +10 -2
- package/lib/providers/storage/signed-url.js +15 -5
- package/lib/providers/storage/types.d.ts +1 -1
- package/lib/providers/storage/utils.js +3 -5
- package/lib/registry.d.ts +118 -0
- package/lib/registry.js +184 -0
- package/lib/test/mem-registry.d.ts +19 -14
- package/lib/test/mem-registry.js +37 -44
- package/lib/test/sdk-suite.d.ts +4 -1
- package/lib/test/sdk-suite.js +89 -18
- package/lib/test/testbed.d.ts +5227 -5218
- package/lib/test/testbed.js +56 -29
- package/lib/types/index.d.ts +11 -6
- package/package.json +1 -1
- package/lib/cli/sell.d.ts +0 -28
- package/lib/cli/sell.js +0 -95
- package/lib/cli/stage.d.ts +0 -19
- package/lib/cli/stage.js +0 -94
- package/lib/contracts/settlement-registry/abi.js +0 -962
- package/lib/contracts/settlement-registry/index.d.ts +0 -143
- package/lib/contracts/settlement-registry/index.js +0 -213
- package/lib/crypto/paid.d.ts +0 -104
- package/lib/crypto/paid.js +0 -147
- package/lib/test/key-server.d.ts +0 -12
- package/lib/test/key-server.js +0 -30
- /package/lib/node_modules/{@vitest → .pnpm/@vitest_runner@4.0.18/node_modules/@vitest}/runner/dist/utils.js +0 -0
package/lib/cli/index.js
CHANGED
|
@@ -1,10 +1,28 @@
|
|
|
1
|
+
import getNetwork from "../config.js";
|
|
1
2
|
import "./cli.js";
|
|
2
|
-
import { isCancel } from "@clack/prompts";
|
|
3
|
+
import { isCancel, select } from "@clack/prompts";
|
|
3
4
|
|
|
4
5
|
//#region src/cli/index.ts
|
|
6
|
+
const getChain = (chainStr) => {
|
|
7
|
+
return getNetwork(chainStr).chain;
|
|
8
|
+
};
|
|
5
9
|
const handleCancel = (value) => {
|
|
6
10
|
if (isCancel(value)) process.exit(0);
|
|
7
11
|
};
|
|
12
|
+
const selectChain = async () => {
|
|
13
|
+
const chainChoice = await select({
|
|
14
|
+
message: "Pick your chain.",
|
|
15
|
+
options: [{
|
|
16
|
+
value: "baseSepolia",
|
|
17
|
+
label: "Base Sepolia"
|
|
18
|
+
}, {
|
|
19
|
+
value: "arbitrumSepolia",
|
|
20
|
+
label: "Arbitrum Sepolia"
|
|
21
|
+
}]
|
|
22
|
+
});
|
|
23
|
+
handleCancel(chainChoice);
|
|
24
|
+
return chainChoice.toString();
|
|
25
|
+
};
|
|
8
26
|
function parseGadgetArg(raw) {
|
|
9
27
|
const match = /^(\w+)\(([^)]*)\)$/.exec(raw);
|
|
10
28
|
if (!match) throw new Error(`Invalid gadget format: "${raw}". Expected e.g. Payment(0.00001)`);
|
|
@@ -15,4 +33,4 @@ function parseGadgetArg(raw) {
|
|
|
15
33
|
}
|
|
16
34
|
|
|
17
35
|
//#endregion
|
|
18
|
-
export { handleCancel, parseGadgetArg };
|
|
36
|
+
export { getChain, handleCancel, parseGadgetArg, selectChain };
|
package/lib/config.d.ts
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import * as viem_chains0 from "viem/chains";
|
|
2
1
|
import * as viem0 from "viem";
|
|
3
2
|
import { Chain, Hex } from "viem";
|
|
4
|
-
import * as
|
|
3
|
+
import * as viem_chains0 from "viem/chains";
|
|
5
4
|
|
|
6
5
|
//#region src/config.d.ts
|
|
7
6
|
/**
|
|
8
|
-
*
|
|
7
|
+
* Derive an app id from a human-readable name (keccak256(hex(name)).
|
|
8
|
+
*/
|
|
9
|
+
declare function appId(name: string): Hex;
|
|
10
|
+
/**
|
|
11
|
+
* Blank input means "not set", never an app called "". Returns the trimmed value,
|
|
9
12
|
* or undefined when it is missing or only whitespace, so it can sit on the left of
|
|
10
13
|
* a `??` fallback. `??` on the raw value would let "" through: it is not nullish.
|
|
11
14
|
*/
|
|
12
15
|
declare function nonBlank(value: string | undefined): string | undefined;
|
|
13
|
-
|
|
16
|
+
declare function toAppId(nameOrId: string): Hex;
|
|
17
|
+
interface AppConfig {
|
|
14
18
|
dataRegistryContractAddress: Hex;
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
appRegistryContractAddress: Hex;
|
|
20
|
+
membershipRegistryContractAddress: Hex;
|
|
21
|
+
appRegistryFromBlock: bigint;
|
|
17
22
|
chain: Chain;
|
|
18
23
|
rpcUrl: string;
|
|
19
24
|
caip2: number;
|
|
@@ -21,10 +26,67 @@ interface NetworkConfig {
|
|
|
21
26
|
logWindow?: bigint;
|
|
22
27
|
signedUrlWorker?: string;
|
|
23
28
|
}
|
|
29
|
+
declare const ArbitrumSepoliaConfig: {
|
|
30
|
+
dataRegistryContractAddress: "0x72B5f83526F3893aF9f1eE0f32A27218EA09f8aE";
|
|
31
|
+
appRegistryContractAddress: "0x55e6209ea1833ceD900989a3b3b22466934E04A5";
|
|
32
|
+
membershipRegistryContractAddress: "0xDF17030Cd65435C86eb043F31DDACa99E819E347";
|
|
33
|
+
appRegistryFromBlock: bigint;
|
|
34
|
+
chain: {
|
|
35
|
+
blockExplorers: {
|
|
36
|
+
readonly default: {
|
|
37
|
+
readonly name: "Arbiscan";
|
|
38
|
+
readonly url: "https://sepolia.arbiscan.io";
|
|
39
|
+
readonly apiUrl: "https://api-sepolia.arbiscan.io/api";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
blockTime: 250;
|
|
43
|
+
contracts: {
|
|
44
|
+
readonly multicall3: {
|
|
45
|
+
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
46
|
+
readonly blockCreated: 81930;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
ensTlds?: readonly string[] | undefined;
|
|
50
|
+
id: 421614;
|
|
51
|
+
name: "Arbitrum Sepolia";
|
|
52
|
+
nativeCurrency: {
|
|
53
|
+
readonly name: "Arbitrum Sepolia Ether";
|
|
54
|
+
readonly symbol: "ETH";
|
|
55
|
+
readonly decimals: 18;
|
|
56
|
+
};
|
|
57
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
58
|
+
rpcUrls: {
|
|
59
|
+
readonly default: {
|
|
60
|
+
readonly http: readonly ["https://sepolia-rollup.arbitrum.io/rpc"];
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
sourceId?: number | undefined | undefined;
|
|
64
|
+
testnet: true;
|
|
65
|
+
custom?: Record<string, unknown> | undefined;
|
|
66
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
67
|
+
fees?: viem0.ChainFees<undefined> | undefined;
|
|
68
|
+
formatters?: undefined;
|
|
69
|
+
prepareTransactionRequest?: ((args: viem0.PrepareTransactionRequestParameters, options: {
|
|
70
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
71
|
+
}) => Promise<viem0.PrepareTransactionRequestParameters>) | [fn: ((args: viem0.PrepareTransactionRequestParameters, options: {
|
|
72
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
73
|
+
}) => Promise<viem0.PrepareTransactionRequestParameters>) | undefined, options: {
|
|
74
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
75
|
+
}] | undefined;
|
|
76
|
+
serializers?: viem0.ChainSerializers<undefined, viem0.TransactionSerializable> | undefined;
|
|
77
|
+
verifyHash?: ((client: viem0.Client, parameters: viem0.VerifyHashActionParameters) => Promise<viem0.VerifyHashActionReturnType>) | undefined;
|
|
78
|
+
};
|
|
79
|
+
rpcUrl: string;
|
|
80
|
+
caip2: number;
|
|
81
|
+
ipfsGateway: string;
|
|
82
|
+
logWindow: bigint;
|
|
83
|
+
signedUrlWorker: string;
|
|
84
|
+
};
|
|
24
85
|
declare const BaseSepoliaConfig: {
|
|
25
|
-
dataRegistryContractAddress: "
|
|
26
|
-
|
|
27
|
-
|
|
86
|
+
dataRegistryContractAddress: "0xE9183f768865dd2Cde5f1B71F8446F0Cd798ebe0";
|
|
87
|
+
appRegistryContractAddress: "0x0D3e98399df41b558048Cdd7D71723c37A3A9D6F";
|
|
88
|
+
membershipRegistryContractAddress: "0x0e96C012b5c53622EcDAA82F342E31C2623A04f5";
|
|
89
|
+
appRegistryFromBlock: bigint;
|
|
28
90
|
chain: {
|
|
29
91
|
blockExplorers: {
|
|
30
92
|
readonly default: {
|
|
@@ -112,7 +174,7 @@ declare const BaseSepoliaConfig: {
|
|
|
112
174
|
gasUsed: bigint;
|
|
113
175
|
hash: `0x${string}` | null;
|
|
114
176
|
logsBloom: `0x${string}` | null;
|
|
115
|
-
miner:
|
|
177
|
+
miner: viem0.Address;
|
|
116
178
|
mixHash: viem0.Hash;
|
|
117
179
|
nonce: `0x${string}` | null;
|
|
118
180
|
number: bigint | null;
|
|
@@ -138,14 +200,14 @@ declare const BaseSepoliaConfig: {
|
|
|
138
200
|
format: (args: viem_chains0.OpStackRpcTransaction, action?: string | undefined) => ({
|
|
139
201
|
blockHash: `0x${string}` | null;
|
|
140
202
|
blockNumber: bigint | null;
|
|
141
|
-
from:
|
|
203
|
+
from: viem0.Address;
|
|
142
204
|
gas: bigint;
|
|
143
205
|
hash: viem0.Hash;
|
|
144
206
|
input: viem0.Hex;
|
|
145
207
|
nonce: number;
|
|
146
208
|
r: viem0.Hex;
|
|
147
209
|
s: viem0.Hex;
|
|
148
|
-
to:
|
|
210
|
+
to: viem0.Address | null;
|
|
149
211
|
transactionIndex: number | null;
|
|
150
212
|
typeHex: viem0.Hex | null;
|
|
151
213
|
v: bigint;
|
|
@@ -163,8 +225,8 @@ declare const BaseSepoliaConfig: {
|
|
|
163
225
|
r: viem0.Hex;
|
|
164
226
|
s: viem0.Hex;
|
|
165
227
|
v: bigint;
|
|
166
|
-
to:
|
|
167
|
-
from:
|
|
228
|
+
to: viem0.Address | null;
|
|
229
|
+
from: viem0.Address;
|
|
168
230
|
gas: bigint;
|
|
169
231
|
nonce: number;
|
|
170
232
|
value: bigint;
|
|
@@ -190,14 +252,14 @@ declare const BaseSepoliaConfig: {
|
|
|
190
252
|
} | {
|
|
191
253
|
blockHash: `0x${string}` | null;
|
|
192
254
|
blockNumber: bigint | null;
|
|
193
|
-
from:
|
|
255
|
+
from: viem0.Address;
|
|
194
256
|
gas: bigint;
|
|
195
257
|
hash: viem0.Hash;
|
|
196
258
|
input: viem0.Hex;
|
|
197
259
|
nonce: number;
|
|
198
260
|
r: viem0.Hex;
|
|
199
261
|
s: viem0.Hex;
|
|
200
|
-
to:
|
|
262
|
+
to: viem0.Address | null;
|
|
201
263
|
transactionIndex: number | null;
|
|
202
264
|
typeHex: viem0.Hex | null;
|
|
203
265
|
v: bigint;
|
|
@@ -218,14 +280,14 @@ declare const BaseSepoliaConfig: {
|
|
|
218
280
|
} | {
|
|
219
281
|
blockHash: `0x${string}` | null;
|
|
220
282
|
blockNumber: bigint | null;
|
|
221
|
-
from:
|
|
283
|
+
from: viem0.Address;
|
|
222
284
|
gas: bigint;
|
|
223
285
|
hash: viem0.Hash;
|
|
224
286
|
input: viem0.Hex;
|
|
225
287
|
nonce: number;
|
|
226
288
|
r: viem0.Hex;
|
|
227
289
|
s: viem0.Hex;
|
|
228
|
-
to:
|
|
290
|
+
to: viem0.Address | null;
|
|
229
291
|
transactionIndex: number | null;
|
|
230
292
|
typeHex: viem0.Hex | null;
|
|
231
293
|
v: bigint;
|
|
@@ -246,14 +308,14 @@ declare const BaseSepoliaConfig: {
|
|
|
246
308
|
} | {
|
|
247
309
|
blockHash: `0x${string}` | null;
|
|
248
310
|
blockNumber: bigint | null;
|
|
249
|
-
from:
|
|
311
|
+
from: viem0.Address;
|
|
250
312
|
gas: bigint;
|
|
251
313
|
hash: viem0.Hash;
|
|
252
314
|
input: viem0.Hex;
|
|
253
315
|
nonce: number;
|
|
254
316
|
r: viem0.Hex;
|
|
255
317
|
s: viem0.Hex;
|
|
256
|
-
to:
|
|
318
|
+
to: viem0.Address | null;
|
|
257
319
|
transactionIndex: number | null;
|
|
258
320
|
typeHex: viem0.Hex | null;
|
|
259
321
|
v: bigint;
|
|
@@ -274,14 +336,14 @@ declare const BaseSepoliaConfig: {
|
|
|
274
336
|
} | {
|
|
275
337
|
blockHash: `0x${string}` | null;
|
|
276
338
|
blockNumber: bigint | null;
|
|
277
|
-
from:
|
|
339
|
+
from: viem0.Address;
|
|
278
340
|
gas: bigint;
|
|
279
341
|
hash: viem0.Hash;
|
|
280
342
|
input: viem0.Hex;
|
|
281
343
|
nonce: number;
|
|
282
344
|
r: viem0.Hex;
|
|
283
345
|
s: viem0.Hex;
|
|
284
|
-
to:
|
|
346
|
+
to: viem0.Address | null;
|
|
285
347
|
transactionIndex: number | null;
|
|
286
348
|
typeHex: viem0.Hex | null;
|
|
287
349
|
v: bigint;
|
|
@@ -310,16 +372,16 @@ declare const BaseSepoliaConfig: {
|
|
|
310
372
|
blockHash: viem0.Hash;
|
|
311
373
|
blockNumber: bigint;
|
|
312
374
|
blockTimestamp?: bigint | undefined;
|
|
313
|
-
contractAddress:
|
|
375
|
+
contractAddress: viem0.Address | null | undefined;
|
|
314
376
|
cumulativeGasUsed: bigint;
|
|
315
377
|
effectiveGasPrice: bigint;
|
|
316
|
-
from:
|
|
378
|
+
from: viem0.Address;
|
|
317
379
|
gasUsed: bigint;
|
|
318
380
|
logs: viem0.Log<bigint, number, false>[];
|
|
319
381
|
logsBloom: viem0.Hex;
|
|
320
382
|
root?: `0x${string}` | undefined;
|
|
321
383
|
status: "success" | "reverted";
|
|
322
|
-
to:
|
|
384
|
+
to: viem0.Address | null;
|
|
323
385
|
transactionHash: viem0.Hash;
|
|
324
386
|
transactionIndex: number;
|
|
325
387
|
type: viem0.TransactionType;
|
|
@@ -356,9 +418,10 @@ declare const BaseSepoliaConfig: {
|
|
|
356
418
|
* built from.
|
|
357
419
|
*/
|
|
358
420
|
declare const FangornConfig: {
|
|
359
|
-
dataRegistryContractAddress: "
|
|
360
|
-
|
|
361
|
-
|
|
421
|
+
dataRegistryContractAddress: "0xE9183f768865dd2Cde5f1B71F8446F0Cd798ebe0";
|
|
422
|
+
appRegistryContractAddress: "0x0D3e98399df41b558048Cdd7D71723c37A3A9D6F";
|
|
423
|
+
membershipRegistryContractAddress: "0x0e96C012b5c53622EcDAA82F342E31C2623A04f5";
|
|
424
|
+
appRegistryFromBlock: bigint;
|
|
362
425
|
chain: {
|
|
363
426
|
blockExplorers: {
|
|
364
427
|
readonly default: {
|
|
@@ -446,7 +509,7 @@ declare const FangornConfig: {
|
|
|
446
509
|
gasUsed: bigint;
|
|
447
510
|
hash: `0x${string}` | null;
|
|
448
511
|
logsBloom: `0x${string}` | null;
|
|
449
|
-
miner:
|
|
512
|
+
miner: viem0.Address;
|
|
450
513
|
mixHash: viem0.Hash;
|
|
451
514
|
nonce: `0x${string}` | null;
|
|
452
515
|
number: bigint | null;
|
|
@@ -472,14 +535,14 @@ declare const FangornConfig: {
|
|
|
472
535
|
format: (args: viem_chains0.OpStackRpcTransaction, action?: string | undefined) => ({
|
|
473
536
|
blockHash: `0x${string}` | null;
|
|
474
537
|
blockNumber: bigint | null;
|
|
475
|
-
from:
|
|
538
|
+
from: viem0.Address;
|
|
476
539
|
gas: bigint;
|
|
477
540
|
hash: viem0.Hash;
|
|
478
541
|
input: viem0.Hex;
|
|
479
542
|
nonce: number;
|
|
480
543
|
r: viem0.Hex;
|
|
481
544
|
s: viem0.Hex;
|
|
482
|
-
to:
|
|
545
|
+
to: viem0.Address | null;
|
|
483
546
|
transactionIndex: number | null;
|
|
484
547
|
typeHex: viem0.Hex | null;
|
|
485
548
|
v: bigint;
|
|
@@ -497,8 +560,8 @@ declare const FangornConfig: {
|
|
|
497
560
|
r: viem0.Hex;
|
|
498
561
|
s: viem0.Hex;
|
|
499
562
|
v: bigint;
|
|
500
|
-
to:
|
|
501
|
-
from:
|
|
563
|
+
to: viem0.Address | null;
|
|
564
|
+
from: viem0.Address;
|
|
502
565
|
gas: bigint;
|
|
503
566
|
nonce: number;
|
|
504
567
|
value: bigint;
|
|
@@ -524,14 +587,14 @@ declare const FangornConfig: {
|
|
|
524
587
|
} | {
|
|
525
588
|
blockHash: `0x${string}` | null;
|
|
526
589
|
blockNumber: bigint | null;
|
|
527
|
-
from:
|
|
590
|
+
from: viem0.Address;
|
|
528
591
|
gas: bigint;
|
|
529
592
|
hash: viem0.Hash;
|
|
530
593
|
input: viem0.Hex;
|
|
531
594
|
nonce: number;
|
|
532
595
|
r: viem0.Hex;
|
|
533
596
|
s: viem0.Hex;
|
|
534
|
-
to:
|
|
597
|
+
to: viem0.Address | null;
|
|
535
598
|
transactionIndex: number | null;
|
|
536
599
|
typeHex: viem0.Hex | null;
|
|
537
600
|
v: bigint;
|
|
@@ -552,14 +615,14 @@ declare const FangornConfig: {
|
|
|
552
615
|
} | {
|
|
553
616
|
blockHash: `0x${string}` | null;
|
|
554
617
|
blockNumber: bigint | null;
|
|
555
|
-
from:
|
|
618
|
+
from: viem0.Address;
|
|
556
619
|
gas: bigint;
|
|
557
620
|
hash: viem0.Hash;
|
|
558
621
|
input: viem0.Hex;
|
|
559
622
|
nonce: number;
|
|
560
623
|
r: viem0.Hex;
|
|
561
624
|
s: viem0.Hex;
|
|
562
|
-
to:
|
|
625
|
+
to: viem0.Address | null;
|
|
563
626
|
transactionIndex: number | null;
|
|
564
627
|
typeHex: viem0.Hex | null;
|
|
565
628
|
v: bigint;
|
|
@@ -580,14 +643,14 @@ declare const FangornConfig: {
|
|
|
580
643
|
} | {
|
|
581
644
|
blockHash: `0x${string}` | null;
|
|
582
645
|
blockNumber: bigint | null;
|
|
583
|
-
from:
|
|
646
|
+
from: viem0.Address;
|
|
584
647
|
gas: bigint;
|
|
585
648
|
hash: viem0.Hash;
|
|
586
649
|
input: viem0.Hex;
|
|
587
650
|
nonce: number;
|
|
588
651
|
r: viem0.Hex;
|
|
589
652
|
s: viem0.Hex;
|
|
590
|
-
to:
|
|
653
|
+
to: viem0.Address | null;
|
|
591
654
|
transactionIndex: number | null;
|
|
592
655
|
typeHex: viem0.Hex | null;
|
|
593
656
|
v: bigint;
|
|
@@ -608,14 +671,14 @@ declare const FangornConfig: {
|
|
|
608
671
|
} | {
|
|
609
672
|
blockHash: `0x${string}` | null;
|
|
610
673
|
blockNumber: bigint | null;
|
|
611
|
-
from:
|
|
674
|
+
from: viem0.Address;
|
|
612
675
|
gas: bigint;
|
|
613
676
|
hash: viem0.Hash;
|
|
614
677
|
input: viem0.Hex;
|
|
615
678
|
nonce: number;
|
|
616
679
|
r: viem0.Hex;
|
|
617
680
|
s: viem0.Hex;
|
|
618
|
-
to:
|
|
681
|
+
to: viem0.Address | null;
|
|
619
682
|
transactionIndex: number | null;
|
|
620
683
|
typeHex: viem0.Hex | null;
|
|
621
684
|
v: bigint;
|
|
@@ -644,16 +707,16 @@ declare const FangornConfig: {
|
|
|
644
707
|
blockHash: viem0.Hash;
|
|
645
708
|
blockNumber: bigint;
|
|
646
709
|
blockTimestamp?: bigint | undefined;
|
|
647
|
-
contractAddress:
|
|
710
|
+
contractAddress: viem0.Address | null | undefined;
|
|
648
711
|
cumulativeGasUsed: bigint;
|
|
649
712
|
effectiveGasPrice: bigint;
|
|
650
|
-
from:
|
|
713
|
+
from: viem0.Address;
|
|
651
714
|
gasUsed: bigint;
|
|
652
715
|
logs: viem0.Log<bigint, number, false>[];
|
|
653
716
|
logsBloom: viem0.Hex;
|
|
654
717
|
root?: `0x${string}` | undefined;
|
|
655
718
|
status: "success" | "reverted";
|
|
656
|
-
to:
|
|
719
|
+
to: viem0.Address | null;
|
|
657
720
|
transactionHash: viem0.Hash;
|
|
658
721
|
transactionIndex: number;
|
|
659
722
|
type: viem0.TransactionType;
|
|
@@ -687,11 +750,11 @@ declare const FangornConfig: {
|
|
|
687
750
|
/**
|
|
688
751
|
* The networks supported by Fangorn, by the name `CHAIN_NAME` takes.
|
|
689
752
|
*/
|
|
690
|
-
declare const SupportedNetworks: Record<string,
|
|
753
|
+
declare const SupportedNetworks: Record<string, AppConfig>;
|
|
691
754
|
/**
|
|
692
|
-
* Get a network's deployment by name ("baseSepolia").
|
|
755
|
+
* Get a network's deployment by name ("arbitrumSepolia" or "baseSepolia").
|
|
693
756
|
* @returns The corresponding config if it is supported, otherwise an error
|
|
694
757
|
*/
|
|
695
|
-
declare function getNetwork(name: string):
|
|
758
|
+
declare function getNetwork(name: string): AppConfig;
|
|
696
759
|
//#endregion
|
|
697
|
-
export { BaseSepoliaConfig, FangornConfig,
|
|
760
|
+
export { AppConfig, ArbitrumSepoliaConfig, BaseSepoliaConfig, FangornConfig, SupportedNetworks, appId, getNetwork as default, nonBlank, toAppId };
|
package/lib/config.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { keccak256, toHex } from "viem";
|
|
2
|
+
import { arbitrumSepolia, baseSepolia } from "viem/chains";
|
|
2
3
|
|
|
3
4
|
//#region src/config.ts
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Derive an app id from a human-readable name (keccak256(hex(name)).
|
|
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,
|
|
6
13
|
* or undefined when it is missing or only whitespace, so it can sit on the left of
|
|
7
14
|
* a `??` fallback. `??` on the raw value would let "" through: it is not nullish.
|
|
8
15
|
*/
|
|
@@ -10,16 +17,34 @@ function nonBlank(value) {
|
|
|
10
17
|
const trimmed = value?.trim();
|
|
11
18
|
return trimmed === "" ? void 0 : trimmed;
|
|
12
19
|
}
|
|
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
|
+
signedUrlWorker: "https://pinata-url-provider.fangorn-0be.workers.dev"
|
|
36
|
+
};
|
|
13
37
|
const BaseSepoliaConfig = {
|
|
14
|
-
dataRegistryContractAddress: "
|
|
15
|
-
|
|
16
|
-
|
|
38
|
+
dataRegistryContractAddress: "0xE9183f768865dd2Cde5f1B71F8446F0Cd798ebe0",
|
|
39
|
+
appRegistryContractAddress: "0x0D3e98399df41b558048Cdd7D71723c37A3A9D6F",
|
|
40
|
+
membershipRegistryContractAddress: "0x0e96C012b5c53622EcDAA82F342E31C2623A04f5",
|
|
41
|
+
appRegistryFromBlock: 48340483n,
|
|
17
42
|
chain: baseSepolia,
|
|
18
43
|
rpcUrl: "https://base-sepolia-rpc.publicnode.com",
|
|
19
44
|
caip2: 84532,
|
|
20
|
-
ipfsGateway: "https://ipfs
|
|
21
|
-
logWindow:
|
|
22
|
-
signedUrlWorker: "https://
|
|
45
|
+
ipfsGateway: "https://ipfs.io",
|
|
46
|
+
logWindow: 10000n,
|
|
47
|
+
signedUrlWorker: "https://pinata-url-provider-base.fangorn-0be.workers.dev"
|
|
23
48
|
};
|
|
24
49
|
/**
|
|
25
50
|
* The default network: what `Fangorn.create` uses without a `config`, and the CLI
|
|
@@ -30,9 +55,12 @@ const FangornConfig = BaseSepoliaConfig;
|
|
|
30
55
|
/**
|
|
31
56
|
* The networks supported by Fangorn, by the name `CHAIN_NAME` takes.
|
|
32
57
|
*/
|
|
33
|
-
const SupportedNetworks = {
|
|
58
|
+
const SupportedNetworks = {
|
|
59
|
+
arbitrumSepolia: ArbitrumSepoliaConfig,
|
|
60
|
+
baseSepolia: BaseSepoliaConfig
|
|
61
|
+
};
|
|
34
62
|
/**
|
|
35
|
-
* Get a network's deployment by name ("baseSepolia").
|
|
63
|
+
* Get a network's deployment by name ("arbitrumSepolia" or "baseSepolia").
|
|
36
64
|
* @returns The corresponding config if it is supported, otherwise an error
|
|
37
65
|
*/
|
|
38
66
|
function getNetwork(name) {
|
|
@@ -42,4 +70,4 @@ function getNetwork(name) {
|
|
|
42
70
|
}
|
|
43
71
|
|
|
44
72
|
//#endregion
|
|
45
|
-
export { BaseSepoliaConfig, FangornConfig, SupportedNetworks, getNetwork as default, nonBlank };
|
|
73
|
+
export { ArbitrumSepoliaConfig, BaseSepoliaConfig, FangornConfig, SupportedNetworks, appId, getNetwork as default, nonBlank, toAppId };
|