@fangorn-network/sdk 2026.10.19-dev → 2026.10.21-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/README.md +20 -4
- package/lib/cli/cli.js +76 -45
- package/lib/cli/erc8004.d.ts +54 -0
- package/lib/cli/erc8004.js +140 -0
- package/lib/cli/index.d.ts +3 -91
- package/lib/cli/index.js +5 -2
- package/lib/config.d.ts +350 -111
- package/lib/config.js +31 -19
- package/lib/contracts/app-registry/index.d.ts +2 -1
- package/lib/contracts/app-registry/index.js +3 -2
- package/lib/contracts/logs.d.ts +6 -10
- package/lib/contracts/logs.js +5 -9
- package/lib/engine/index.d.ts +2 -16
- package/lib/engine/index.js +2 -18
- package/lib/fangorn.d.ts +3 -6
- package/lib/fangorn.js +3 -8
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -2
- package/lib/registry.d.ts +2 -0
- package/lib/registry.js +3 -1
- package/lib/test/testbed.d.ts +5013 -5013
- package/package.json +2 -3
package/lib/config.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as viem5576 from "viem";
|
|
2
2
|
import { Chain, Hex } from "viem";
|
|
3
|
+
import * as viem_chains0 from "viem/chains";
|
|
4
|
+
import * as abitype9 from "abitype";
|
|
3
5
|
|
|
4
6
|
//#region src/config.d.ts
|
|
5
7
|
/**
|
|
@@ -13,109 +15,6 @@ declare function appId(name: string): Hex;
|
|
|
13
15
|
*/
|
|
14
16
|
declare function nonBlank(value: string | undefined): string | undefined;
|
|
15
17
|
declare function toAppId(nameOrId: string): Hex;
|
|
16
|
-
/**
|
|
17
|
-
* The networks supported by Fangorn currently
|
|
18
|
-
*/
|
|
19
|
-
declare const SupportedNetworks: {
|
|
20
|
-
ArbitrumSepolia: {
|
|
21
|
-
name: string;
|
|
22
|
-
chain: {
|
|
23
|
-
blockExplorers: {
|
|
24
|
-
readonly default: {
|
|
25
|
-
readonly name: "Arbiscan";
|
|
26
|
-
readonly url: "https://sepolia.arbiscan.io";
|
|
27
|
-
readonly apiUrl: "https://api-sepolia.arbiscan.io/api";
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
blockTime: 250;
|
|
31
|
-
contracts: {
|
|
32
|
-
readonly multicall3: {
|
|
33
|
-
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
34
|
-
readonly blockCreated: 81930;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
ensTlds?: readonly string[] | undefined;
|
|
38
|
-
id: 421614;
|
|
39
|
-
name: "Arbitrum Sepolia";
|
|
40
|
-
nativeCurrency: {
|
|
41
|
-
readonly name: "Arbitrum Sepolia Ether";
|
|
42
|
-
readonly symbol: "ETH";
|
|
43
|
-
readonly decimals: 18;
|
|
44
|
-
};
|
|
45
|
-
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
46
|
-
rpcUrls: {
|
|
47
|
-
readonly default: {
|
|
48
|
-
readonly http: readonly ["https://sepolia-rollup.arbitrum.io/rpc"];
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
sourceId?: number | undefined | undefined;
|
|
52
|
-
testnet: true;
|
|
53
|
-
custom?: Record<string, unknown> | undefined;
|
|
54
|
-
extendSchema?: Record<string, unknown> | undefined;
|
|
55
|
-
fees?: viem5596.ChainFees<undefined> | undefined;
|
|
56
|
-
formatters?: undefined;
|
|
57
|
-
prepareTransactionRequest?: ((args: viem5596.PrepareTransactionRequestParameters, options: {
|
|
58
|
-
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
59
|
-
}) => Promise<viem5596.PrepareTransactionRequestParameters>) | [fn: ((args: viem5596.PrepareTransactionRequestParameters, options: {
|
|
60
|
-
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
61
|
-
}) => Promise<viem5596.PrepareTransactionRequestParameters>) | undefined, options: {
|
|
62
|
-
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
63
|
-
}] | undefined;
|
|
64
|
-
serializers?: viem5596.ChainSerializers<undefined, viem5596.TransactionSerializable> | undefined;
|
|
65
|
-
verifyHash?: ((client: viem5596.Client, parameters: viem5596.VerifyHashActionParameters) => Promise<viem5596.VerifyHashActionReturnType>) | undefined;
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Get the network based on the string name
|
|
71
|
-
* @param name "arbitrumSepolia" is the only one supported right now
|
|
72
|
-
* @returns The corresponding network if it is supported, otherwise an error
|
|
73
|
-
*/
|
|
74
|
-
declare function getNetwork(name: string): {
|
|
75
|
-
blockExplorers: {
|
|
76
|
-
readonly default: {
|
|
77
|
-
readonly name: "Arbiscan";
|
|
78
|
-
readonly url: "https://sepolia.arbiscan.io";
|
|
79
|
-
readonly apiUrl: "https://api-sepolia.arbiscan.io/api";
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
blockTime: 250;
|
|
83
|
-
contracts: {
|
|
84
|
-
readonly multicall3: {
|
|
85
|
-
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
86
|
-
readonly blockCreated: 81930;
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
ensTlds?: readonly string[] | undefined;
|
|
90
|
-
id: 421614;
|
|
91
|
-
name: "Arbitrum Sepolia";
|
|
92
|
-
nativeCurrency: {
|
|
93
|
-
readonly name: "Arbitrum Sepolia Ether";
|
|
94
|
-
readonly symbol: "ETH";
|
|
95
|
-
readonly decimals: 18;
|
|
96
|
-
};
|
|
97
|
-
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
98
|
-
rpcUrls: {
|
|
99
|
-
readonly default: {
|
|
100
|
-
readonly http: readonly ["https://sepolia-rollup.arbitrum.io/rpc"];
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
sourceId?: number | undefined | undefined;
|
|
104
|
-
testnet: true;
|
|
105
|
-
custom?: Record<string, unknown> | undefined;
|
|
106
|
-
extendSchema?: Record<string, unknown> | undefined;
|
|
107
|
-
fees?: viem5596.ChainFees<undefined> | undefined;
|
|
108
|
-
formatters?: undefined;
|
|
109
|
-
prepareTransactionRequest?: ((args: viem5596.PrepareTransactionRequestParameters, options: {
|
|
110
|
-
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
111
|
-
}) => Promise<viem5596.PrepareTransactionRequestParameters>) | [fn: ((args: viem5596.PrepareTransactionRequestParameters, options: {
|
|
112
|
-
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
113
|
-
}) => Promise<viem5596.PrepareTransactionRequestParameters>) | undefined, options: {
|
|
114
|
-
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
115
|
-
}] | undefined;
|
|
116
|
-
serializers?: viem5596.ChainSerializers<undefined, viem5596.TransactionSerializable> | undefined;
|
|
117
|
-
verifyHash?: ((client: viem5596.Client, parameters: viem5596.VerifyHashActionParameters) => Promise<viem5596.VerifyHashActionReturnType>) | undefined;
|
|
118
|
-
};
|
|
119
18
|
interface AppConfig {
|
|
120
19
|
dataRegistryContractAddress: Hex;
|
|
121
20
|
appRegistryContractAddress: Hex;
|
|
@@ -125,6 +24,7 @@ interface AppConfig {
|
|
|
125
24
|
rpcUrl: string;
|
|
126
25
|
caip2: number;
|
|
127
26
|
ipfsGateway: string;
|
|
27
|
+
logWindow?: bigint;
|
|
128
28
|
}
|
|
129
29
|
declare const FangornConfig: {
|
|
130
30
|
dataRegistryContractAddress: "0x72B5f83526F3893aF9f1eE0f32A27218EA09f8aE";
|
|
@@ -164,21 +64,360 @@ declare const FangornConfig: {
|
|
|
164
64
|
testnet: true;
|
|
165
65
|
custom?: Record<string, unknown> | undefined;
|
|
166
66
|
extendSchema?: Record<string, unknown> | undefined;
|
|
167
|
-
fees?:
|
|
67
|
+
fees?: viem5576.ChainFees<undefined> | undefined;
|
|
168
68
|
formatters?: undefined;
|
|
169
|
-
prepareTransactionRequest?: ((args:
|
|
69
|
+
prepareTransactionRequest?: ((args: viem5576.PrepareTransactionRequestParameters, options: {
|
|
170
70
|
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
171
|
-
}) => Promise<
|
|
71
|
+
}) => Promise<viem5576.PrepareTransactionRequestParameters>) | [fn: ((args: viem5576.PrepareTransactionRequestParameters, options: {
|
|
172
72
|
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
173
|
-
}) => Promise<
|
|
73
|
+
}) => Promise<viem5576.PrepareTransactionRequestParameters>) | undefined, options: {
|
|
174
74
|
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
175
75
|
}] | undefined;
|
|
176
|
-
serializers?:
|
|
177
|
-
verifyHash?: ((client:
|
|
76
|
+
serializers?: viem5576.ChainSerializers<undefined, viem5576.TransactionSerializable> | undefined;
|
|
77
|
+
verifyHash?: ((client: viem5576.Client, parameters: viem5576.VerifyHashActionParameters) => Promise<viem5576.VerifyHashActionReturnType>) | undefined;
|
|
178
78
|
};
|
|
179
79
|
rpcUrl: string;
|
|
180
80
|
caip2: number;
|
|
181
81
|
ipfsGateway: string;
|
|
82
|
+
logWindow: bigint;
|
|
182
83
|
};
|
|
84
|
+
declare const BaseSepoliaConfig: {
|
|
85
|
+
dataRegistryContractAddress: "0xE9183f768865dd2Cde5f1B71F8446F0Cd798ebe0";
|
|
86
|
+
appRegistryContractAddress: "0x0D3e98399df41b558048Cdd7D71723c37A3A9D6F";
|
|
87
|
+
membershipRegistryContractAddress: "0x0e96C012b5c53622EcDAA82F342E31C2623A04f5";
|
|
88
|
+
appRegistryFromBlock: bigint;
|
|
89
|
+
chain: {
|
|
90
|
+
blockExplorers: {
|
|
91
|
+
readonly default: {
|
|
92
|
+
readonly name: "Basescan";
|
|
93
|
+
readonly url: "https://sepolia.basescan.org";
|
|
94
|
+
readonly apiUrl: "https://api-sepolia.basescan.org/api";
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
blockTime: 2000;
|
|
98
|
+
contracts: {
|
|
99
|
+
readonly disputeGameFactory: {
|
|
100
|
+
readonly 11155111: {
|
|
101
|
+
readonly address: "0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1";
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
readonly l2OutputOracle: {
|
|
105
|
+
readonly 11155111: {
|
|
106
|
+
readonly address: "0x84457ca9D0163FbC4bbfe4Dfbb20ba46e48DF254";
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
readonly portal: {
|
|
110
|
+
readonly 11155111: {
|
|
111
|
+
readonly address: "0x49f53e41452c74589e85ca1677426ba426459e85";
|
|
112
|
+
readonly blockCreated: 4446677;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
readonly l1StandardBridge: {
|
|
116
|
+
readonly 11155111: {
|
|
117
|
+
readonly address: "0xfd0Bf71F60660E2f608ed56e1659C450eB113120";
|
|
118
|
+
readonly blockCreated: 4446677;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
readonly multicall3: {
|
|
122
|
+
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
123
|
+
readonly blockCreated: 1059647;
|
|
124
|
+
};
|
|
125
|
+
readonly gasPriceOracle: {
|
|
126
|
+
readonly address: "0x420000000000000000000000000000000000000F";
|
|
127
|
+
};
|
|
128
|
+
readonly l1Block: {
|
|
129
|
+
readonly address: "0x4200000000000000000000000000000000000015";
|
|
130
|
+
};
|
|
131
|
+
readonly l2CrossDomainMessenger: {
|
|
132
|
+
readonly address: "0x4200000000000000000000000000000000000007";
|
|
133
|
+
};
|
|
134
|
+
readonly l2Erc721Bridge: {
|
|
135
|
+
readonly address: "0x4200000000000000000000000000000000000014";
|
|
136
|
+
};
|
|
137
|
+
readonly l2StandardBridge: {
|
|
138
|
+
readonly address: "0x4200000000000000000000000000000000000010";
|
|
139
|
+
};
|
|
140
|
+
readonly l2ToL1MessagePasser: {
|
|
141
|
+
readonly address: "0x4200000000000000000000000000000000000016";
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
ensTlds?: readonly string[] | undefined;
|
|
145
|
+
id: 84532;
|
|
146
|
+
name: "Base Sepolia";
|
|
147
|
+
nativeCurrency: {
|
|
148
|
+
readonly name: "Sepolia Ether";
|
|
149
|
+
readonly symbol: "ETH";
|
|
150
|
+
readonly decimals: 18;
|
|
151
|
+
};
|
|
152
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
153
|
+
rpcUrls: {
|
|
154
|
+
readonly default: {
|
|
155
|
+
readonly http: readonly ["https://sepolia.base.org"];
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
sourceId: 11155111;
|
|
159
|
+
testnet: true;
|
|
160
|
+
custom?: Record<string, unknown> | undefined;
|
|
161
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
162
|
+
fees?: viem5576.ChainFees<undefined> | undefined;
|
|
163
|
+
formatters: {
|
|
164
|
+
readonly block: {
|
|
165
|
+
exclude: [] | undefined;
|
|
166
|
+
format: (args: viem_chains0.OpStackRpcBlock, action?: string | undefined) => {
|
|
167
|
+
baseFeePerGas: bigint | null;
|
|
168
|
+
blobGasUsed: bigint;
|
|
169
|
+
difficulty: bigint;
|
|
170
|
+
excessBlobGas: bigint;
|
|
171
|
+
extraData: viem5576.Hex;
|
|
172
|
+
gasLimit: bigint;
|
|
173
|
+
gasUsed: bigint;
|
|
174
|
+
hash: `0x${string}` | null;
|
|
175
|
+
logsBloom: `0x${string}` | null;
|
|
176
|
+
miner: abitype9.Address;
|
|
177
|
+
mixHash: viem5576.Hash;
|
|
178
|
+
nonce: `0x${string}` | null;
|
|
179
|
+
number: bigint | null;
|
|
180
|
+
parentBeaconBlockRoot?: `0x${string}` | undefined;
|
|
181
|
+
parentHash: viem5576.Hash;
|
|
182
|
+
receiptsRoot: viem5576.Hex;
|
|
183
|
+
sealFields: viem5576.Hex[];
|
|
184
|
+
sha3Uncles: viem5576.Hash;
|
|
185
|
+
size: bigint;
|
|
186
|
+
stateRoot: viem5576.Hash;
|
|
187
|
+
timestamp: bigint;
|
|
188
|
+
totalDifficulty: bigint | null;
|
|
189
|
+
transactions: `0x${string}`[] | viem_chains0.OpStackTransaction<boolean>[];
|
|
190
|
+
transactionsRoot: viem5576.Hash;
|
|
191
|
+
uncles: viem5576.Hash[];
|
|
192
|
+
withdrawals?: viem5576.Withdrawal[] | undefined | undefined;
|
|
193
|
+
withdrawalsRoot?: `0x${string}` | undefined;
|
|
194
|
+
} & {};
|
|
195
|
+
type: "block";
|
|
196
|
+
};
|
|
197
|
+
readonly transaction: {
|
|
198
|
+
exclude: [] | undefined;
|
|
199
|
+
format: (args: viem_chains0.OpStackRpcTransaction, action?: string | undefined) => ({
|
|
200
|
+
blockHash: `0x${string}` | null;
|
|
201
|
+
blockNumber: bigint | null;
|
|
202
|
+
from: abitype9.Address;
|
|
203
|
+
gas: bigint;
|
|
204
|
+
hash: viem5576.Hash;
|
|
205
|
+
input: viem5576.Hex;
|
|
206
|
+
nonce: number;
|
|
207
|
+
r: viem5576.Hex;
|
|
208
|
+
s: viem5576.Hex;
|
|
209
|
+
to: abitype9.Address | null;
|
|
210
|
+
transactionIndex: number | null;
|
|
211
|
+
typeHex: viem5576.Hex | null;
|
|
212
|
+
v: bigint;
|
|
213
|
+
value: bigint;
|
|
214
|
+
yParity: number;
|
|
215
|
+
gasPrice?: undefined | undefined;
|
|
216
|
+
maxFeePerBlobGas?: undefined | undefined;
|
|
217
|
+
maxFeePerGas: bigint;
|
|
218
|
+
maxPriorityFeePerGas: bigint;
|
|
219
|
+
isSystemTx?: boolean;
|
|
220
|
+
mint?: bigint | undefined | undefined;
|
|
221
|
+
sourceHash: viem5576.Hex;
|
|
222
|
+
type: "deposit";
|
|
223
|
+
} | {
|
|
224
|
+
r: viem5576.Hex;
|
|
225
|
+
s: viem5576.Hex;
|
|
226
|
+
v: bigint;
|
|
227
|
+
to: abitype9.Address | null;
|
|
228
|
+
from: abitype9.Address;
|
|
229
|
+
gas: bigint;
|
|
230
|
+
nonce: number;
|
|
231
|
+
value: bigint;
|
|
232
|
+
blockHash: `0x${string}` | null;
|
|
233
|
+
blockNumber: bigint | null;
|
|
234
|
+
hash: viem5576.Hash;
|
|
235
|
+
input: viem5576.Hex;
|
|
236
|
+
transactionIndex: number | null;
|
|
237
|
+
typeHex: viem5576.Hex | null;
|
|
238
|
+
accessList?: undefined | undefined;
|
|
239
|
+
authorizationList?: undefined | undefined;
|
|
240
|
+
blobVersionedHashes?: undefined | undefined;
|
|
241
|
+
chainId?: number | undefined;
|
|
242
|
+
yParity?: undefined | undefined;
|
|
243
|
+
type: "legacy";
|
|
244
|
+
gasPrice: bigint;
|
|
245
|
+
maxFeePerBlobGas?: undefined | undefined;
|
|
246
|
+
maxFeePerGas?: undefined | undefined;
|
|
247
|
+
maxPriorityFeePerGas?: undefined | undefined;
|
|
248
|
+
isSystemTx?: undefined | undefined;
|
|
249
|
+
mint?: undefined | undefined;
|
|
250
|
+
sourceHash?: undefined | undefined;
|
|
251
|
+
} | {
|
|
252
|
+
blockHash: `0x${string}` | null;
|
|
253
|
+
blockNumber: bigint | null;
|
|
254
|
+
from: abitype9.Address;
|
|
255
|
+
gas: bigint;
|
|
256
|
+
hash: viem5576.Hash;
|
|
257
|
+
input: viem5576.Hex;
|
|
258
|
+
nonce: number;
|
|
259
|
+
r: viem5576.Hex;
|
|
260
|
+
s: viem5576.Hex;
|
|
261
|
+
to: abitype9.Address | null;
|
|
262
|
+
transactionIndex: number | null;
|
|
263
|
+
typeHex: viem5576.Hex | null;
|
|
264
|
+
v: bigint;
|
|
265
|
+
value: bigint;
|
|
266
|
+
yParity: number;
|
|
267
|
+
accessList: viem5576.AccessList;
|
|
268
|
+
authorizationList?: undefined | undefined;
|
|
269
|
+
blobVersionedHashes?: undefined | undefined;
|
|
270
|
+
chainId: number;
|
|
271
|
+
type: "eip2930";
|
|
272
|
+
gasPrice: bigint;
|
|
273
|
+
maxFeePerBlobGas?: undefined | undefined;
|
|
274
|
+
maxFeePerGas?: undefined | undefined;
|
|
275
|
+
maxPriorityFeePerGas?: undefined | undefined;
|
|
276
|
+
isSystemTx?: undefined | undefined;
|
|
277
|
+
mint?: undefined | undefined;
|
|
278
|
+
sourceHash?: undefined | undefined;
|
|
279
|
+
} | {
|
|
280
|
+
blockHash: `0x${string}` | null;
|
|
281
|
+
blockNumber: bigint | null;
|
|
282
|
+
from: abitype9.Address;
|
|
283
|
+
gas: bigint;
|
|
284
|
+
hash: viem5576.Hash;
|
|
285
|
+
input: viem5576.Hex;
|
|
286
|
+
nonce: number;
|
|
287
|
+
r: viem5576.Hex;
|
|
288
|
+
s: viem5576.Hex;
|
|
289
|
+
to: abitype9.Address | null;
|
|
290
|
+
transactionIndex: number | null;
|
|
291
|
+
typeHex: viem5576.Hex | null;
|
|
292
|
+
v: bigint;
|
|
293
|
+
value: bigint;
|
|
294
|
+
yParity: number;
|
|
295
|
+
accessList: viem5576.AccessList;
|
|
296
|
+
authorizationList?: undefined | undefined;
|
|
297
|
+
blobVersionedHashes?: undefined | undefined;
|
|
298
|
+
chainId: number;
|
|
299
|
+
type: "eip1559";
|
|
300
|
+
gasPrice?: undefined | undefined;
|
|
301
|
+
maxFeePerBlobGas?: undefined | undefined;
|
|
302
|
+
maxFeePerGas: bigint;
|
|
303
|
+
maxPriorityFeePerGas: bigint;
|
|
304
|
+
isSystemTx?: undefined | undefined;
|
|
305
|
+
mint?: undefined | undefined;
|
|
306
|
+
sourceHash?: undefined | undefined;
|
|
307
|
+
} | {
|
|
308
|
+
blockHash: `0x${string}` | null;
|
|
309
|
+
blockNumber: bigint | null;
|
|
310
|
+
from: abitype9.Address;
|
|
311
|
+
gas: bigint;
|
|
312
|
+
hash: viem5576.Hash;
|
|
313
|
+
input: viem5576.Hex;
|
|
314
|
+
nonce: number;
|
|
315
|
+
r: viem5576.Hex;
|
|
316
|
+
s: viem5576.Hex;
|
|
317
|
+
to: abitype9.Address | null;
|
|
318
|
+
transactionIndex: number | null;
|
|
319
|
+
typeHex: viem5576.Hex | null;
|
|
320
|
+
v: bigint;
|
|
321
|
+
value: bigint;
|
|
322
|
+
yParity: number;
|
|
323
|
+
accessList: viem5576.AccessList;
|
|
324
|
+
authorizationList?: undefined | undefined;
|
|
325
|
+
blobVersionedHashes: readonly viem5576.Hex[];
|
|
326
|
+
chainId: number;
|
|
327
|
+
type: "eip4844";
|
|
328
|
+
gasPrice?: undefined | undefined;
|
|
329
|
+
maxFeePerBlobGas: bigint;
|
|
330
|
+
maxFeePerGas: bigint;
|
|
331
|
+
maxPriorityFeePerGas: bigint;
|
|
332
|
+
isSystemTx?: undefined | undefined;
|
|
333
|
+
mint?: undefined | undefined;
|
|
334
|
+
sourceHash?: undefined | undefined;
|
|
335
|
+
} | {
|
|
336
|
+
blockHash: `0x${string}` | null;
|
|
337
|
+
blockNumber: bigint | null;
|
|
338
|
+
from: abitype9.Address;
|
|
339
|
+
gas: bigint;
|
|
340
|
+
hash: viem5576.Hash;
|
|
341
|
+
input: viem5576.Hex;
|
|
342
|
+
nonce: number;
|
|
343
|
+
r: viem5576.Hex;
|
|
344
|
+
s: viem5576.Hex;
|
|
345
|
+
to: abitype9.Address | null;
|
|
346
|
+
transactionIndex: number | null;
|
|
347
|
+
typeHex: viem5576.Hex | null;
|
|
348
|
+
v: bigint;
|
|
349
|
+
value: bigint;
|
|
350
|
+
yParity: number;
|
|
351
|
+
accessList: viem5576.AccessList;
|
|
352
|
+
authorizationList: viem5576.SignedAuthorizationList;
|
|
353
|
+
blobVersionedHashes?: undefined | undefined;
|
|
354
|
+
chainId: number;
|
|
355
|
+
type: "eip7702";
|
|
356
|
+
gasPrice?: undefined | undefined;
|
|
357
|
+
maxFeePerBlobGas?: undefined | undefined;
|
|
358
|
+
maxFeePerGas: bigint;
|
|
359
|
+
maxPriorityFeePerGas: bigint;
|
|
360
|
+
isSystemTx?: undefined | undefined;
|
|
361
|
+
mint?: undefined | undefined;
|
|
362
|
+
sourceHash?: undefined | undefined;
|
|
363
|
+
}) & {};
|
|
364
|
+
type: "transaction";
|
|
365
|
+
};
|
|
366
|
+
readonly transactionReceipt: {
|
|
367
|
+
exclude: [] | undefined;
|
|
368
|
+
format: (args: viem_chains0.OpStackRpcTransactionReceipt, action?: string | undefined) => {
|
|
369
|
+
blobGasPrice?: bigint | undefined;
|
|
370
|
+
blobGasUsed?: bigint | undefined;
|
|
371
|
+
blockHash: viem5576.Hash;
|
|
372
|
+
blockNumber: bigint;
|
|
373
|
+
blockTimestamp?: bigint | undefined;
|
|
374
|
+
contractAddress: abitype9.Address | null | undefined;
|
|
375
|
+
cumulativeGasUsed: bigint;
|
|
376
|
+
effectiveGasPrice: bigint;
|
|
377
|
+
from: abitype9.Address;
|
|
378
|
+
gasUsed: bigint;
|
|
379
|
+
logs: viem5576.Log<bigint, number, false>[];
|
|
380
|
+
logsBloom: viem5576.Hex;
|
|
381
|
+
root?: `0x${string}` | undefined;
|
|
382
|
+
status: "success" | "reverted";
|
|
383
|
+
to: abitype9.Address | null;
|
|
384
|
+
transactionHash: viem5576.Hash;
|
|
385
|
+
transactionIndex: number;
|
|
386
|
+
type: viem5576.TransactionType;
|
|
387
|
+
l1GasPrice: bigint | null;
|
|
388
|
+
l1GasUsed: bigint | null;
|
|
389
|
+
l1Fee: bigint | null;
|
|
390
|
+
l1FeeScalar: number | null;
|
|
391
|
+
} & {};
|
|
392
|
+
type: "transactionReceipt";
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
prepareTransactionRequest?: ((args: viem5576.PrepareTransactionRequestParameters, options: {
|
|
396
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
397
|
+
}) => Promise<viem5576.PrepareTransactionRequestParameters>) | [fn: ((args: viem5576.PrepareTransactionRequestParameters, options: {
|
|
398
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
399
|
+
}) => Promise<viem5576.PrepareTransactionRequestParameters>) | undefined, options: {
|
|
400
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
401
|
+
}] | undefined;
|
|
402
|
+
serializers: {
|
|
403
|
+
readonly transaction: typeof viem_chains0.serializeTransactionOpStack;
|
|
404
|
+
};
|
|
405
|
+
verifyHash?: ((client: viem5576.Client, parameters: viem5576.VerifyHashActionParameters) => Promise<viem5576.VerifyHashActionReturnType>) | undefined;
|
|
406
|
+
readonly network: "base-sepolia";
|
|
407
|
+
};
|
|
408
|
+
rpcUrl: string;
|
|
409
|
+
caip2: number;
|
|
410
|
+
ipfsGateway: string;
|
|
411
|
+
logWindow: bigint;
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* The networks supported by Fangorn, by the name `CHAIN_NAME` takes.
|
|
415
|
+
*/
|
|
416
|
+
declare const SupportedNetworks: Record<string, AppConfig>;
|
|
417
|
+
/**
|
|
418
|
+
* Get a network's deployment by name ("arbitrumSepolia" or "baseSepolia").
|
|
419
|
+
* @returns The corresponding config if it is supported, otherwise an error
|
|
420
|
+
*/
|
|
421
|
+
declare function getNetwork(name: string): AppConfig;
|
|
183
422
|
//#endregion
|
|
184
|
-
export { AppConfig, FangornConfig, SupportedNetworks, appId, getNetwork as default, nonBlank, toAppId };
|
|
423
|
+
export { AppConfig, BaseSepoliaConfig, FangornConfig, SupportedNetworks, appId, getNetwork as default, nonBlank, toAppId };
|
package/lib/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { keccak256, toHex } from "viem";
|
|
2
|
-
import { arbitrumSepolia } from "viem/chains";
|
|
2
|
+
import { arbitrumSepolia, baseSepolia } from "viem/chains";
|
|
3
3
|
|
|
4
4
|
//#region src/config.ts
|
|
5
5
|
/**
|
|
@@ -22,22 +22,6 @@ function toAppId(nameOrId) {
|
|
|
22
22
|
if (!name) throw new Error("App name or id must not be blank.");
|
|
23
23
|
return /^0x[0-9a-fA-F]{64}$/.test(name) ? name : appId(name);
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
26
|
-
* The networks supported by Fangorn currently
|
|
27
|
-
*/
|
|
28
|
-
const SupportedNetworks = { ArbitrumSepolia: {
|
|
29
|
-
name: "arbitrumSepolia",
|
|
30
|
-
chain: arbitrumSepolia
|
|
31
|
-
} };
|
|
32
|
-
/**
|
|
33
|
-
* Get the network based on the string name
|
|
34
|
-
* @param name "arbitrumSepolia" is the only one supported right now
|
|
35
|
-
* @returns The corresponding network if it is supported, otherwise an error
|
|
36
|
-
*/
|
|
37
|
-
function getNetwork(name) {
|
|
38
|
-
if (name === SupportedNetworks.ArbitrumSepolia.name) return arbitrumSepolia;
|
|
39
|
-
throw new Error(`Chain ${name} is not supported`);
|
|
40
|
-
}
|
|
41
25
|
const FangornConfig = {
|
|
42
26
|
dataRegistryContractAddress: "0x72B5f83526F3893aF9f1eE0f32A27218EA09f8aE",
|
|
43
27
|
appRegistryContractAddress: "0x55e6209ea1833ceD900989a3b3b22466934E04A5",
|
|
@@ -46,8 +30,36 @@ const FangornConfig = {
|
|
|
46
30
|
chain: arbitrumSepolia,
|
|
47
31
|
rpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
|
|
48
32
|
caip2: 421614,
|
|
49
|
-
ipfsGateway: "https://ipfs.io"
|
|
33
|
+
ipfsGateway: "https://ipfs.io",
|
|
34
|
+
logWindow: 100000n
|
|
35
|
+
};
|
|
36
|
+
const BaseSepoliaConfig = {
|
|
37
|
+
dataRegistryContractAddress: "0xE9183f768865dd2Cde5f1B71F8446F0Cd798ebe0",
|
|
38
|
+
appRegistryContractAddress: "0x0D3e98399df41b558048Cdd7D71723c37A3A9D6F",
|
|
39
|
+
membershipRegistryContractAddress: "0x0e96C012b5c53622EcDAA82F342E31C2623A04f5",
|
|
40
|
+
appRegistryFromBlock: 48340483n,
|
|
41
|
+
chain: baseSepolia,
|
|
42
|
+
rpcUrl: "https://base-sepolia-rpc.publicnode.com",
|
|
43
|
+
caip2: 84532,
|
|
44
|
+
ipfsGateway: "https://ipfs.io",
|
|
45
|
+
logWindow: 10000n
|
|
50
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* The networks supported by Fangorn, by the name `CHAIN_NAME` takes.
|
|
49
|
+
*/
|
|
50
|
+
const SupportedNetworks = {
|
|
51
|
+
arbitrumSepolia: FangornConfig,
|
|
52
|
+
baseSepolia: BaseSepoliaConfig
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Get a network's deployment by name ("arbitrumSepolia" or "baseSepolia").
|
|
56
|
+
* @returns The corresponding config if it is supported, otherwise an error
|
|
57
|
+
*/
|
|
58
|
+
function getNetwork(name) {
|
|
59
|
+
const config = SupportedNetworks[name];
|
|
60
|
+
if (!config) throw new Error(`Chain ${name} is not supported. Use one of: ${Object.keys(SupportedNetworks).join(", ")}`);
|
|
61
|
+
return config;
|
|
62
|
+
}
|
|
51
63
|
|
|
52
64
|
//#endregion
|
|
53
|
-
export { FangornConfig, SupportedNetworks, appId, getNetwork as default, nonBlank, toAppId };
|
|
65
|
+
export { BaseSepoliaConfig, FangornConfig, SupportedNetworks, appId, getNetwork as default, nonBlank, toAppId };
|
|
@@ -32,7 +32,8 @@ declare class AppRegistryClient {
|
|
|
32
32
|
private appId;
|
|
33
33
|
private publicClient;
|
|
34
34
|
private walletClient;
|
|
35
|
-
|
|
35
|
+
private logWindow?;
|
|
36
|
+
constructor(contractAddress: Address, appId: Hex | undefined, publicClient: PublicClient, walletClient: WalletClient, logWindow?: bigint | undefined);
|
|
36
37
|
getAppId(): Hex | undefined;
|
|
37
38
|
setAppId(appId: Hex | undefined): void;
|
|
38
39
|
getAddress(): Address;
|
|
@@ -13,11 +13,12 @@ import { erc20Abi, hexToBigInt } from "viem";
|
|
|
13
13
|
* Scoped to one app, which may be unset: then only the calls that take no app work.
|
|
14
14
|
*/
|
|
15
15
|
var AppRegistryClient = class {
|
|
16
|
-
constructor(contractAddress, appId, publicClient, walletClient) {
|
|
16
|
+
constructor(contractAddress, appId, publicClient, walletClient, logWindow) {
|
|
17
17
|
this.contractAddress = contractAddress;
|
|
18
18
|
this.appId = appId;
|
|
19
19
|
this.publicClient = publicClient;
|
|
20
20
|
this.walletClient = walletClient;
|
|
21
|
+
this.logWindow = logWindow;
|
|
21
22
|
}
|
|
22
23
|
getAppId() {
|
|
23
24
|
return this.appId;
|
|
@@ -195,7 +196,7 @@ var AppRegistryClient = class {
|
|
|
195
196
|
fromBlock: from,
|
|
196
197
|
toBlock: to,
|
|
197
198
|
strict: true
|
|
198
|
-
}))).map((log) => ({
|
|
199
|
+
}), this.logWindow)).map((log) => ({
|
|
199
200
|
appId: log.args.app_id,
|
|
200
201
|
agentUri: log.args.agent_uri,
|
|
201
202
|
blockNumber: log.blockNumber,
|
package/lib/contracts/logs.d.ts
CHANGED
|
@@ -6,16 +6,12 @@ import { PublicClient } from "viem";
|
|
|
6
6
|
* Run `fetch` over [fromBlock, toBlock] in consecutive block windows and
|
|
7
7
|
* concatenate the results, oldest window first.
|
|
8
8
|
*
|
|
9
|
-
* RPC providers limit how many blocks one `eth_getLogs` call can cover
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* more.
|
|
15
|
-
*
|
|
16
|
-
* `defaultWindow` is for a query the endpoint is known to serve over a wider
|
|
17
|
-
* range. `FANGORN_LOG_WINDOW` still overrides it.
|
|
9
|
+
* RPC providers limit how many blocks one `eth_getLogs` call can cover (the
|
|
10
|
+
* Base Sepolia one 50,000, sepolia.base.org 200), and a call past the limit fails
|
|
11
|
+
* outright, taking whatever depends on it (a catch-up, a directory listing) with
|
|
12
|
+
* it. Each network's config says what its RPC takes (`AppConfig.logWindow`, passed
|
|
13
|
+
* here as `defaultWindow`); `FANGORN_LOG_WINDOW` overrides it, for a private RPC.
|
|
18
14
|
*/
|
|
19
|
-
declare function getLogsInWindows<T>(publicClient: PublicClient, fromBlock: bigint, toBlock: bigint | undefined, fetch: (fromBlock: bigint, toBlock: bigint) => Promise<T[]>, defaultWindow?: bigint): Promise<T[]>;
|
|
15
|
+
declare function getLogsInWindows<T>(publicClient: PublicClient, fromBlock: bigint, toBlock: bigint | undefined, fetch: (fromBlock: bigint, toBlock: bigint) => Promise<T[]>, defaultWindow?: bigint | undefined): Promise<T[]>;
|
|
20
16
|
//#endregion
|
|
21
17
|
export { getLogsInWindows };
|
package/lib/contracts/logs.js
CHANGED
|
@@ -5,15 +5,11 @@ import { nonBlank } from "../config.js";
|
|
|
5
5
|
* Run `fetch` over [fromBlock, toBlock] in consecutive block windows and
|
|
6
6
|
* concatenate the results, oldest window first.
|
|
7
7
|
*
|
|
8
|
-
* RPC providers limit how many blocks one `eth_getLogs` call can cover
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* more.
|
|
14
|
-
*
|
|
15
|
-
* `defaultWindow` is for a query the endpoint is known to serve over a wider
|
|
16
|
-
* range. `FANGORN_LOG_WINDOW` still overrides it.
|
|
8
|
+
* RPC providers limit how many blocks one `eth_getLogs` call can cover (the
|
|
9
|
+
* Base Sepolia one 50,000, sepolia.base.org 200), and a call past the limit fails
|
|
10
|
+
* outright, taking whatever depends on it (a catch-up, a directory listing) with
|
|
11
|
+
* it. Each network's config says what its RPC takes (`AppConfig.logWindow`, passed
|
|
12
|
+
* here as `defaultWindow`); `FANGORN_LOG_WINDOW` overrides it, for a private RPC.
|
|
17
13
|
*/
|
|
18
14
|
async function getLogsInWindows(publicClient, fromBlock, toBlock, fetch, defaultWindow = 1000n) {
|
|
19
15
|
const tuned = typeof process !== "undefined" ? nonBlank(process.env.FANGORN_LOG_WINDOW) : void 0;
|