@latticexyz/entrykit 2.2.23-a7ce36bd855c91c1a0e7a515c6ed7422ef59973d → 2.2.23-ba07cf09273fba0a246eaf341cdb4eec5328f120
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.
|
@@ -111,6 +111,11 @@ type CreateWagmiConfigOptions<chains extends readonly [Chain, ...Chain[]] = read
|
|
|
111
111
|
} & Pick<CreateConfigParameters<chains, transports>, "pollingInterval">;
|
|
112
112
|
declare function createWagmiConfig<const chains extends readonly [Chain, ...Chain[]], transports extends Record<chains[number]["id"], Transport>>(config: CreateWagmiConfigOptions<chains, transports>): Config<chains, transports>;
|
|
113
113
|
|
|
114
|
+
type WithFeeCacheOptions = {
|
|
115
|
+
refreshInterval?: number;
|
|
116
|
+
};
|
|
117
|
+
declare function withFeeCache<chain extends Chain>(chain: chain, options?: WithFeeCacheOptions): chain;
|
|
118
|
+
|
|
114
119
|
/**
|
|
115
120
|
* @internal
|
|
116
121
|
*/
|
|
@@ -154,4 +159,4 @@ declare function useFunds(userAddress: Address$1 | undefined): _tanstack_react_q
|
|
|
154
159
|
paymasterBalance: bigint | null;
|
|
155
160
|
}, Error>;
|
|
156
161
|
|
|
157
|
-
export { AccountButton, type ConnectedClient, type CreateWagmiConfigOptions, type EntryKitConfig, type EntryKitConfigInput, EntryKitProvider, type SessionClient, createWagmiConfig, defineConfig, getFundsQueryOptions, internal_validateSigner, useAccountModal, useEntryKitConfig, useFunds, useSessionClientReady as useSessionClient };
|
|
162
|
+
export { AccountButton, type ConnectedClient, type CreateWagmiConfigOptions, type EntryKitConfig, type EntryKitConfigInput, EntryKitProvider, type SessionClient, createWagmiConfig, defineConfig, getFundsQueryOptions, internal_validateSigner, useAccountModal, useEntryKitConfig, useFunds, useSessionClientReady as useSessionClient, withFeeCache };
|
|
@@ -1509,8 +1509,24 @@ import { callFrom, sendUserOperationFrom } from "@latticexyz/world/internal";
|
|
|
1509
1509
|
import {
|
|
1510
1510
|
createBundlerClient as viem_createBundlerClient
|
|
1511
1511
|
} from "viem/account-abstraction";
|
|
1512
|
-
|
|
1512
|
+
|
|
1513
|
+
// src/actions/cachedFeesPerGas.ts
|
|
1513
1514
|
import { estimateFeesPerGas } from "viem/actions";
|
|
1515
|
+
function cachedFeesPerGas(client, options = { refreshInterval: 1e4 }) {
|
|
1516
|
+
let fees = null;
|
|
1517
|
+
async function refreshFees() {
|
|
1518
|
+
fees = await estimateFeesPerGas(client);
|
|
1519
|
+
}
|
|
1520
|
+
refreshFees();
|
|
1521
|
+
setInterval(refreshFees, options.refreshInterval);
|
|
1522
|
+
return async () => {
|
|
1523
|
+
if (fees) return fees;
|
|
1524
|
+
fees = await estimateFeesPerGas(client);
|
|
1525
|
+
return fees;
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
// src/createBundlerClient.ts
|
|
1514
1530
|
function createBundlerClient(config) {
|
|
1515
1531
|
const client = config.client;
|
|
1516
1532
|
if (!client) throw new Error("No `client` provided to `createBundlerClient`.");
|
|
@@ -1536,7 +1552,7 @@ function createFeeEstimator(client) {
|
|
|
1536
1552
|
return async () => ({ maxFeePerGas: 100000n, maxPriorityFeePerGas: 0n });
|
|
1537
1553
|
}
|
|
1538
1554
|
if ([690, 17069, 695569].includes(client.chain.id)) {
|
|
1539
|
-
return (
|
|
1555
|
+
return cachedFeesPerGas(client);
|
|
1540
1556
|
}
|
|
1541
1557
|
}
|
|
1542
1558
|
|
|
@@ -3155,7 +3171,7 @@ function ArrowLeftIcon(props) {
|
|
|
3155
3171
|
}
|
|
3156
3172
|
|
|
3157
3173
|
// src/onboarding/quarry/WithdrawGasBalanceButton.tsx
|
|
3158
|
-
import { getAction as
|
|
3174
|
+
import { getAction as getAction5 } from "viem/utils";
|
|
3159
3175
|
import { waitForTransactionReceipt as waitForTransactionReceipt3 } from "viem/actions";
|
|
3160
3176
|
import { useAccount as useAccount7, useClient as useClient13, useSwitchChain as useSwitchChain3, useWriteContract as useWriteContract2 } from "wagmi";
|
|
3161
3177
|
import { twMerge as twMerge17 } from "tailwind-merge";
|
|
@@ -3186,7 +3202,7 @@ function WithdrawGasBalanceButton({ userAddress }) {
|
|
|
3186
3202
|
args: [userAddress, balance.data],
|
|
3187
3203
|
chainId
|
|
3188
3204
|
});
|
|
3189
|
-
await
|
|
3205
|
+
await getAction5(client, waitForTransactionReceipt3, "waitForTransactionReceipt")({ hash });
|
|
3190
3206
|
await Promise.all([
|
|
3191
3207
|
queryClient.invalidateQueries({ queryKey: ["balance"] }),
|
|
3192
3208
|
queryClient.invalidateQueries({ queryKey: ["getFunds"] }),
|
|
@@ -4094,6 +4110,25 @@ function createWagmiConfig(config) {
|
|
|
4094
4110
|
return createConfig(configParams);
|
|
4095
4111
|
}
|
|
4096
4112
|
|
|
4113
|
+
// src/utils/withFeeCache.ts
|
|
4114
|
+
import { createClient as createClient3, http as http3 } from "viem";
|
|
4115
|
+
function withFeeCache(chain, options = { refreshInterval: 1e4 }) {
|
|
4116
|
+
if (chain.fees?.estimateFeesPerGas) {
|
|
4117
|
+
throw new Error("withFeeCache: estimateFeesPerGas already defined in chain config");
|
|
4118
|
+
}
|
|
4119
|
+
const client = createClient3({
|
|
4120
|
+
chain,
|
|
4121
|
+
transport: http3()
|
|
4122
|
+
});
|
|
4123
|
+
return {
|
|
4124
|
+
...chain,
|
|
4125
|
+
fees: {
|
|
4126
|
+
...chain.fees,
|
|
4127
|
+
estimateFeesPerGas: cachedFeesPerGas(client, options)
|
|
4128
|
+
}
|
|
4129
|
+
};
|
|
4130
|
+
}
|
|
4131
|
+
|
|
4097
4132
|
// src/validateSigner.ts
|
|
4098
4133
|
import { readContract } from "viem/actions";
|
|
4099
4134
|
async function internal_validateSigner({
|
|
@@ -4147,6 +4182,7 @@ export {
|
|
|
4147
4182
|
useAccountModal,
|
|
4148
4183
|
useEntryKitConfig,
|
|
4149
4184
|
useFunds,
|
|
4150
|
-
useSessionClientReady as useSessionClient
|
|
4185
|
+
useSessionClientReady as useSessionClient,
|
|
4186
|
+
withFeeCache
|
|
4151
4187
|
};
|
|
4152
4188
|
//# sourceMappingURL=internal.js.map
|