@latticexyz/entrykit 2.2.22-8c4b624756007fd02b1c3c3494e34128a5f1c044 → 2.2.22-98707edd061dabe30900f1b1b8b52f9fd72add97
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({
|
|
143
|
-
|
|
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
|
-
|
|
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
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
})
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
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
|
-
|
|
229
|
+
throw new Error(`Chain ${chain.id} config did not include a bundler RPC URL.`);
|
|
204
230
|
}
|
|
205
231
|
|
|
206
232
|
// src/EntryKitConfigProvider.tsx
|