@latticexyz/entrykit 2.2.22-5fa416eb3cdce964723463b48b91c49aabdf9f0b → 2.2.22-630621831e17a0f1d8d9b3ed313032a19f349d13

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.
@@ -139,8 +139,11 @@ var debug2 = debug.extend("quarry");
139
139
 
140
140
  // src/quarry/transports/userOpExecutor.ts
141
141
  import { setBalance } from "viem/actions";
142
- function userOpExecutor({ executor }) {
143
- return () => {
142
+ function userOpExecutor({
143
+ executor,
144
+ fallbackEth
145
+ }) {
146
+ return (opts) => {
144
147
  debug2("using a local user op executor", executor.account.address);
145
148
  if (executor.chain.id === 31337) {
146
149
  debug2("setting executor balance");
@@ -175,7 +178,9 @@ function userOpExecutor({ executor }) {
175
178
  if (method === "eth_estimateUserOperationGas") {
176
179
  return await estimateUserOperationGas(params);
177
180
  }
178
- throw new Error(`userOpExecutor: method "${method}" not supported`);
181
+ debug2(`userOpExecutor: method "${method}" not overridden, falling back to fallback transport`);
182
+ const { request: fallbackRequest } = fallbackEth(opts);
183
+ return fallbackRequest({ method, params });
179
184
  };
180
185
  return createTransport({
181
186
  key: "userOpExecutor",
@@ -187,20 +192,41 @@ function userOpExecutor({ executor }) {
187
192
  }
188
193
 
189
194
  // src/getBundlerTransport.ts
195
+ import { wiresaw } from "@latticexyz/common/internal";
190
196
  function getBundlerTransport(chain) {
197
+ const ethRpcUrl = chain.rpcUrls.default.http[0];
191
198
  const bundlerHttpUrl = chain.rpcUrls.bundler?.http[0];
192
- const bundlerTransport = bundlerHttpUrl ? http(bundlerHttpUrl) : chain.id === 31337 ? userOpExecutor({
193
- executor: createClient({
194
- chain,
195
- transport: fallback([webSocket(), http()]),
196
- account: privateKeyToAccount(keccak256(stringToHex("local user op executor"))),
197
- pollingInterval: 10
198
- }).extend(transactionQueue())
199
- }) : null;
200
- if (!bundlerTransport) {
201
- throw new Error(`Chain ${chain.id} config did not include a bundler RPC URL.`);
199
+ const wiresawWebSocketUrl = chain.rpcUrls.wiresaw?.webSocket?.[0];
200
+ if (wiresawWebSocketUrl) {
201
+ return wiresaw({
202
+ wiresaw: webSocket(wiresawWebSocketUrl),
203
+ fallbackBundler: http(bundlerHttpUrl),
204
+ fallbackEth: http(ethRpcUrl)
205
+ });
206
+ }
207
+ const wiresawHttpUrl = chain.rpcUrls.wiresaw?.http[0];
208
+ if (wiresawHttpUrl) {
209
+ return wiresaw({
210
+ wiresaw: http(wiresawHttpUrl),
211
+ fallbackBundler: http(bundlerHttpUrl),
212
+ fallbackEth: http(ethRpcUrl)
213
+ });
214
+ }
215
+ if (bundlerHttpUrl) {
216
+ return http(bundlerHttpUrl);
217
+ }
218
+ if (chain.id === 31337) {
219
+ return userOpExecutor({
220
+ executor: createClient({
221
+ chain,
222
+ transport: fallback([webSocket(), http()]),
223
+ account: privateKeyToAccount(keccak256(stringToHex("local user op executor"))),
224
+ pollingInterval: 10
225
+ }).extend(transactionQueue()),
226
+ fallbackEth: http(ethRpcUrl)
227
+ });
202
228
  }
203
- return bundlerTransport;
229
+ throw new Error(`Chain ${chain.id} config did not include a bundler RPC URL.`);
204
230
  }
205
231
 
206
232
  // src/EntryKitConfigProvider.tsx