@latticexyz/entrykit 2.2.23-122945eb02d5d8b6475aec2e88f72340ea81f2d6 → 2.2.23-63fb9640350ff7d87d226fa827ad53e1e79f77e9
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.
|
@@ -58,10 +58,16 @@ import { privateKeyToAccount } from "viem/accounts";
|
|
|
58
58
|
// src/quarry/transports/userOpExecutor.ts
|
|
59
59
|
import {
|
|
60
60
|
createTransport,
|
|
61
|
+
getAbiItem,
|
|
61
62
|
numberToHex,
|
|
62
63
|
parseEther
|
|
63
64
|
} from "viem";
|
|
64
|
-
import {
|
|
65
|
+
import {
|
|
66
|
+
entryPoint06Abi,
|
|
67
|
+
entryPoint06Address,
|
|
68
|
+
entryPoint07Address as entryPoint07Address2,
|
|
69
|
+
entryPoint08Address
|
|
70
|
+
} from "viem/account-abstraction";
|
|
65
71
|
|
|
66
72
|
// src/quarry/transports/methods/estimateUserOperationGas.ts
|
|
67
73
|
import { formatUserOperationRequest } from "viem/account-abstraction";
|
|
@@ -138,7 +144,8 @@ error.log = console.error.bind(console);
|
|
|
138
144
|
var debug2 = debug.extend("quarry");
|
|
139
145
|
|
|
140
146
|
// src/quarry/transports/userOpExecutor.ts
|
|
141
|
-
import { setBalance } from "viem/actions";
|
|
147
|
+
import { getLogs, getTransactionReceipt, setBalance } from "viem/actions";
|
|
148
|
+
import { getUserOperationReceipt } from "@latticexyz/common/internal";
|
|
142
149
|
function userOpExecutor({
|
|
143
150
|
executor,
|
|
144
151
|
fallbackDefaultTransport
|
|
@@ -172,8 +179,38 @@ function userOpExecutor({
|
|
|
172
179
|
}
|
|
173
180
|
}
|
|
174
181
|
if (method === "eth_getUserOperationReceipt") {
|
|
175
|
-
const [
|
|
176
|
-
return receipts.get(
|
|
182
|
+
const [userOpHash] = params;
|
|
183
|
+
if (receipts.has(userOpHash)) return receipts.get(userOpHash);
|
|
184
|
+
const event = getAbiItem({
|
|
185
|
+
abi: entryPoint06Abi,
|
|
186
|
+
name: "UserOperationEvent"
|
|
187
|
+
});
|
|
188
|
+
const log = (await getLogs(executor, {
|
|
189
|
+
address: [entryPoint06Address, entryPoint07Address2, entryPoint08Address],
|
|
190
|
+
event,
|
|
191
|
+
args: { userOpHash }
|
|
192
|
+
})).at(0);
|
|
193
|
+
if (!log) return null;
|
|
194
|
+
const hash = log.transactionHash;
|
|
195
|
+
const receipt = await getTransactionReceipt(executor, { hash });
|
|
196
|
+
const userOpReceipt = getUserOperationReceipt(userOpHash, {
|
|
197
|
+
...receipt,
|
|
198
|
+
blobGasPrice: receipt.blobGasPrice ? numberToHex(receipt.blobGasPrice) : void 0,
|
|
199
|
+
blobGasUsed: receipt.blobGasUsed ? numberToHex(receipt.blobGasUsed) : void 0,
|
|
200
|
+
blockNumber: numberToHex(receipt.blockNumber),
|
|
201
|
+
cumulativeGasUsed: numberToHex(receipt.cumulativeGasUsed),
|
|
202
|
+
effectiveGasPrice: numberToHex(receipt.effectiveGasPrice),
|
|
203
|
+
gasUsed: numberToHex(receipt.gasUsed),
|
|
204
|
+
logs: receipt.logs.map((log2) => ({
|
|
205
|
+
...log2,
|
|
206
|
+
blockNumber: numberToHex(log2.blockNumber),
|
|
207
|
+
logIndex: numberToHex(log2.logIndex),
|
|
208
|
+
transactionIndex: numberToHex(log2.transactionIndex)
|
|
209
|
+
})),
|
|
210
|
+
status: receipt.status,
|
|
211
|
+
transactionIndex: numberToHex(receipt.transactionIndex)
|
|
212
|
+
});
|
|
213
|
+
return userOpReceipt;
|
|
177
214
|
}
|
|
178
215
|
if (method === "eth_estimateUserOperationGas") {
|
|
179
216
|
return await estimateUserOperationGas(params);
|
|
@@ -525,37 +562,73 @@ function AppInfo() {
|
|
|
525
562
|
// src/ConnectWallet.tsx
|
|
526
563
|
import { twMerge as twMerge5 } from "tailwind-merge";
|
|
527
564
|
import { useEffect as useEffect3, useRef as useRef2 } from "react";
|
|
528
|
-
import {
|
|
565
|
+
import { useConnect, useConnectors } from "wagmi";
|
|
566
|
+
import { isIdPlaceConnector } from "@latticexyz/id.place/internal";
|
|
567
|
+
import { Fragment, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
529
568
|
function ConnectWallet() {
|
|
530
|
-
const
|
|
531
|
-
const
|
|
532
|
-
useEffect3(() => {
|
|
533
|
-
if (!open && !hasAutoOpenedRef.current) {
|
|
534
|
-
setOpen(true);
|
|
535
|
-
hasAutoOpenedRef.current = true;
|
|
536
|
-
}
|
|
537
|
-
}, [open, setOpen]);
|
|
569
|
+
const connectors = useConnectors();
|
|
570
|
+
const porto = connectors.find(isIdPlaceConnector);
|
|
538
571
|
return /* @__PURE__ */ jsxs7(
|
|
539
572
|
"div",
|
|
540
573
|
{
|
|
541
574
|
className: twMerge5("flex flex-col gap-6 p-6", "animate-in animate-duration-300 fade-in slide-in-from-bottom-8"),
|
|
542
575
|
children: [
|
|
543
576
|
/* @__PURE__ */ jsx9("div", { className: "p-4", children: /* @__PURE__ */ jsx9(AppInfo, {}) }),
|
|
544
|
-
/* @__PURE__ */ jsx9("div", { className: "self-center flex flex-col gap-2 w-60", children: /* @__PURE__ */ jsx9(
|
|
545
|
-
Button,
|
|
546
|
-
{
|
|
547
|
-
variant: "secondary",
|
|
548
|
-
className: "self-auto flex justify-center",
|
|
549
|
-
onClick: () => setOpen(true),
|
|
550
|
-
autoFocus: true,
|
|
551
|
-
children: "Connect wallet"
|
|
552
|
-
},
|
|
553
|
-
"create"
|
|
554
|
-
) })
|
|
577
|
+
/* @__PURE__ */ jsx9("div", { className: "self-center flex flex-col gap-2 w-60", children: porto ? /* @__PURE__ */ jsx9(AccountButton, { connector: porto }) : /* @__PURE__ */ jsx9(WalletButton, {}) })
|
|
555
578
|
]
|
|
556
579
|
}
|
|
557
580
|
);
|
|
558
581
|
}
|
|
582
|
+
function AccountButton({ connector }) {
|
|
583
|
+
const { setOpen } = useModal();
|
|
584
|
+
const { connect, isPending, error: error2 } = useConnect();
|
|
585
|
+
if (error2) {
|
|
586
|
+
console.error("connect error", error2);
|
|
587
|
+
}
|
|
588
|
+
return /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
589
|
+
/* @__PURE__ */ jsx9(
|
|
590
|
+
Button,
|
|
591
|
+
{
|
|
592
|
+
variant: "secondary",
|
|
593
|
+
className: "self-auto flex justify-center",
|
|
594
|
+
pending: isPending,
|
|
595
|
+
onClick: () => connect({ connector }),
|
|
596
|
+
autoFocus: true,
|
|
597
|
+
children: "Sign in"
|
|
598
|
+
},
|
|
599
|
+
"signin"
|
|
600
|
+
),
|
|
601
|
+
/* @__PURE__ */ jsx9(
|
|
602
|
+
"button",
|
|
603
|
+
{
|
|
604
|
+
className: "text-sm self-center transition text-neutral-500 hover:text-white p-2",
|
|
605
|
+
onClick: () => setOpen(true),
|
|
606
|
+
children: "Already have a wallet?"
|
|
607
|
+
}
|
|
608
|
+
)
|
|
609
|
+
] });
|
|
610
|
+
}
|
|
611
|
+
function WalletButton() {
|
|
612
|
+
const { open, setOpen } = useModal();
|
|
613
|
+
const hasAutoOpenedRef = useRef2(false);
|
|
614
|
+
useEffect3(() => {
|
|
615
|
+
if (!open && !hasAutoOpenedRef.current) {
|
|
616
|
+
setOpen(true);
|
|
617
|
+
hasAutoOpenedRef.current = true;
|
|
618
|
+
}
|
|
619
|
+
}, [open, setOpen]);
|
|
620
|
+
return /* @__PURE__ */ jsx9(Fragment, { children: /* @__PURE__ */ jsx9(
|
|
621
|
+
Button,
|
|
622
|
+
{
|
|
623
|
+
variant: "secondary",
|
|
624
|
+
className: "self-auto flex justify-center",
|
|
625
|
+
onClick: () => setOpen(true),
|
|
626
|
+
autoFocus: true,
|
|
627
|
+
children: "Connect wallet"
|
|
628
|
+
},
|
|
629
|
+
"create"
|
|
630
|
+
) });
|
|
631
|
+
}
|
|
559
632
|
|
|
560
633
|
// src/onboarding/ConnectedSteps.tsx
|
|
561
634
|
import { useEffect as useEffect15, useMemo as useMemo4, useRef as useRef5, useState as useState5 } from "react";
|
|
@@ -573,26 +646,35 @@ import { queryOptions, skipToken, useQuery as useQuery2 } from "@tanstack/react-
|
|
|
573
646
|
import { defineStore } from "@latticexyz/store";
|
|
574
647
|
import { parseAbi } from "viem";
|
|
575
648
|
var paymasterAbi = parseAbi([
|
|
649
|
+
// AllowanceSystem
|
|
650
|
+
"error AllowanceSystem_InsufficientAllowance(uint256 allowance, uint256 required)",
|
|
651
|
+
"error AllowanceSystem_NotAuthorized(address caller, address sponsor, address user)",
|
|
652
|
+
"error AllowanceSystem_NotFound(address user, address sponsor)",
|
|
653
|
+
"function removeAllowance(address user, address sponsor)",
|
|
654
|
+
"function getAllowance(address user) view returns (uint256)",
|
|
655
|
+
// GrantSystem
|
|
656
|
+
"error GrantSystem_AllowanceBelowMinimum(uint256 allowance, uint256 min)",
|
|
657
|
+
"error GrantSystem_AllowancesLimitReached(uint256 length, uint256 max)",
|
|
658
|
+
"error GrantSystem_InsufficientBalance(uint256 balance, uint256 required)",
|
|
659
|
+
"function grantAllowance(address user, uint256 allowance) payable",
|
|
660
|
+
// BalanceSystem
|
|
661
|
+
"error BalanceSystem_InsufficientBalance(address user, uint256 amount, uint256 balance)",
|
|
662
|
+
"function depositTo(address to) payable",
|
|
663
|
+
"function withdrawTo(address to, uint256 amount)",
|
|
664
|
+
// SpenderSystem
|
|
576
665
|
"error SpenderSystem_AlreadyRegistered(address spender, address user)",
|
|
577
666
|
"error SpenderSystem_HasOwnBalance(address spender)",
|
|
578
|
-
"error BalanceSystem_BalanceTooHigh(address user, uint256 balance, uint256 max)",
|
|
579
|
-
"error BalanceSystem_InsufficientBalance(address user, uint256 amount, uint256 balance)",
|
|
580
667
|
"function registerSpender(address spender)",
|
|
581
|
-
|
|
582
|
-
"
|
|
668
|
+
// PaymasterSystem
|
|
669
|
+
"error PaymasterSystem_InsufficientFunds(address user, uint256 maxCost, uint256 availableAllowance, uint256 availableBalance)",
|
|
670
|
+
"error PaymasterSystem_OnlyEntryPoint()"
|
|
583
671
|
]);
|
|
584
672
|
var paymasterConfig = defineStore({
|
|
585
673
|
namespaces: {
|
|
586
674
|
root: {
|
|
587
675
|
namespace: "",
|
|
588
676
|
tables: {
|
|
589
|
-
|
|
590
|
-
schema: {
|
|
591
|
-
user: "address",
|
|
592
|
-
allowance: "uint256"
|
|
593
|
-
},
|
|
594
|
-
key: ["user"]
|
|
595
|
-
},
|
|
677
|
+
// Balance gets deposited and is withdrawable
|
|
596
678
|
Balance: {
|
|
597
679
|
schema: {
|
|
598
680
|
user: "address",
|
|
@@ -600,31 +682,26 @@ var paymasterConfig = defineStore({
|
|
|
600
682
|
},
|
|
601
683
|
key: ["user"]
|
|
602
684
|
},
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
},
|
|
608
|
-
key: ["grantor"]
|
|
609
|
-
},
|
|
610
|
-
PassHolder: {
|
|
685
|
+
// Allowance gets granted and is not withdrawable
|
|
686
|
+
// Allowance is organized as a linked list and gets spent from smallest to largest
|
|
687
|
+
Allowance: {
|
|
688
|
+
name: "AllowanceV2",
|
|
611
689
|
schema: {
|
|
612
690
|
user: "address",
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
691
|
+
sponsor: "address",
|
|
692
|
+
allowance: "uint256",
|
|
693
|
+
next: "address",
|
|
694
|
+
previous: "address"
|
|
616
695
|
},
|
|
617
|
-
key: ["user", "
|
|
696
|
+
key: ["user", "sponsor"]
|
|
618
697
|
},
|
|
619
|
-
|
|
698
|
+
AllowanceList: {
|
|
620
699
|
schema: {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
validityPeriod: "uint256",
|
|
625
|
-
grantor: "address"
|
|
700
|
+
user: "address",
|
|
701
|
+
first: "address",
|
|
702
|
+
length: "uint256"
|
|
626
703
|
},
|
|
627
|
-
key: ["
|
|
704
|
+
key: ["user"]
|
|
628
705
|
},
|
|
629
706
|
Spender: {
|
|
630
707
|
schema: {
|
|
@@ -656,7 +733,7 @@ function getPaymaster(chain) {
|
|
|
656
733
|
return {
|
|
657
734
|
type: "quarry",
|
|
658
735
|
address: contracts.quarryPaymaster.address,
|
|
659
|
-
|
|
736
|
+
canSponsor: !!chain.rpcUrls.quarrySponsor?.http?.[0]
|
|
660
737
|
};
|
|
661
738
|
}
|
|
662
739
|
}
|
|
@@ -831,36 +908,21 @@ import { useClient as useClient4 } from "wagmi";
|
|
|
831
908
|
import { queryOptions as queryOptions4, skipToken as skipToken4, useQuery as useQuery5 } from "@tanstack/react-query";
|
|
832
909
|
|
|
833
910
|
// src/quarry/getAllowance.ts
|
|
834
|
-
import {
|
|
835
|
-
import {
|
|
836
|
-
import { getKeyTuple } from "@latticexyz/protocol-parser/internal";
|
|
837
|
-
import { setStorageAt } from "viem/actions";
|
|
911
|
+
import { readContract } from "viem/actions";
|
|
912
|
+
import { getAction as getAction2 } from "viem/utils";
|
|
838
913
|
async function getAllowance({ client, userAddress }) {
|
|
839
914
|
const paymaster = getPaymaster(client.chain);
|
|
840
915
|
if (paymaster?.type !== "quarry") return null;
|
|
841
|
-
|
|
916
|
+
return await getAction2(
|
|
917
|
+
client,
|
|
918
|
+
readContract,
|
|
919
|
+
"readContract"
|
|
920
|
+
)({
|
|
842
921
|
address: paymaster.address,
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
922
|
+
abi: paymasterAbi,
|
|
923
|
+
functionName: "getAllowance",
|
|
924
|
+
args: [userAddress]
|
|
846
925
|
});
|
|
847
|
-
return record.allowance;
|
|
848
|
-
}
|
|
849
|
-
async function setAllowanceSlot({ client, userAddress, allowance }) {
|
|
850
|
-
const paymaster = getPaymaster(client.chain);
|
|
851
|
-
if (paymaster?.type !== "quarry") return;
|
|
852
|
-
const slot = getStaticDataLocation(
|
|
853
|
-
paymasterTables.Allowance.tableId,
|
|
854
|
-
getKeyTuple(paymasterTables.Allowance, { user: userAddress })
|
|
855
|
-
);
|
|
856
|
-
await setStorageAt(
|
|
857
|
-
client.extend(() => ({ mode: "anvil" })),
|
|
858
|
-
{
|
|
859
|
-
address: paymaster.address,
|
|
860
|
-
index: slot,
|
|
861
|
-
value: numberToHex2(allowance, { size: 32 })
|
|
862
|
-
}
|
|
863
|
-
);
|
|
864
926
|
}
|
|
865
927
|
|
|
866
928
|
// src/onboarding/quarry/useAllowance.ts
|
|
@@ -884,11 +946,11 @@ import { useClient as useClient5 } from "wagmi";
|
|
|
884
946
|
import { queryOptions as queryOptions5, skipToken as skipToken5, useQuery as useQuery6 } from "@tanstack/react-query";
|
|
885
947
|
|
|
886
948
|
// src/quarry/getBalance.ts
|
|
887
|
-
import { getRecord as
|
|
949
|
+
import { getRecord as getRecord3 } from "@latticexyz/store/internal";
|
|
888
950
|
async function getBalance({ client, userAddress }) {
|
|
889
951
|
const paymaster = getPaymaster(client.chain);
|
|
890
952
|
if (paymaster?.type !== "quarry") return null;
|
|
891
|
-
const record = await
|
|
953
|
+
const record = await getRecord3(client, {
|
|
892
954
|
address: paymaster.address,
|
|
893
955
|
table: paymasterTables.Balance,
|
|
894
956
|
key: { user: userAddress },
|
|
@@ -1134,55 +1196,42 @@ function Wallet({ isActive, isExpanded, userAddress }) {
|
|
|
1134
1196
|
}
|
|
1135
1197
|
|
|
1136
1198
|
// src/onboarding/quarry/Allowance.tsx
|
|
1137
|
-
import { parseEther as parseEther3 } from "viem";
|
|
1138
|
-
|
|
1139
|
-
// src/onboarding/quarry/useClaimGasPass.ts
|
|
1140
1199
|
import { parseEther as parseEther2 } from "viem";
|
|
1200
|
+
|
|
1201
|
+
// src/onboarding/quarry/useRequestAllowance.ts
|
|
1141
1202
|
import { useMutation, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
1142
1203
|
|
|
1143
|
-
// src/quarry/transports/
|
|
1204
|
+
// src/quarry/transports/quarrySponsor.ts
|
|
1144
1205
|
import { http as http2 } from "viem";
|
|
1145
|
-
function
|
|
1206
|
+
function quarrySponsor() {
|
|
1146
1207
|
return ({ chain }) => {
|
|
1147
|
-
if (!chain) throw new Error("No chain provided to
|
|
1148
|
-
const url = "
|
|
1149
|
-
if (!url) throw new Error(`No \`
|
|
1208
|
+
if (!chain) throw new Error("No chain provided to quarrySponsor transport.");
|
|
1209
|
+
const url = "quarrySponsor" in chain.rpcUrls ? chain.rpcUrls.quarrySponsor.http[0] : void 0;
|
|
1210
|
+
if (!url) throw new Error(`No \`quarrySponsor\` RPC URL found for chain ${chain.id}.`);
|
|
1150
1211
|
return http2(url)({ chain, retryCount: 0 });
|
|
1151
1212
|
};
|
|
1152
1213
|
}
|
|
1153
1214
|
|
|
1154
|
-
// src/quarry/
|
|
1155
|
-
async function
|
|
1156
|
-
const transport =
|
|
1157
|
-
debug2("
|
|
1158
|
-
await transport.request({
|
|
1159
|
-
method: "quarry_issuePass",
|
|
1160
|
-
params: ["0x01", userAddress]
|
|
1161
|
-
});
|
|
1162
|
-
debug2("Claiming gas allowance for", userAddress);
|
|
1215
|
+
// src/quarry/requestAllowance.ts
|
|
1216
|
+
async function requestAllowance({ chain, userAddress }) {
|
|
1217
|
+
const transport = quarrySponsor()({ chain });
|
|
1218
|
+
debug2("Requesting allowance for", userAddress);
|
|
1163
1219
|
await transport.request({
|
|
1164
|
-
method: "
|
|
1165
|
-
params: [
|
|
1220
|
+
method: "sponsor_requestAllowance",
|
|
1221
|
+
params: [userAddress]
|
|
1166
1222
|
});
|
|
1167
1223
|
}
|
|
1168
1224
|
|
|
1169
|
-
// src/onboarding/quarry/
|
|
1170
|
-
|
|
1171
|
-
function useClaimGasPass() {
|
|
1225
|
+
// src/onboarding/quarry/useRequestAllowance.ts
|
|
1226
|
+
function useRequestAllowance() {
|
|
1172
1227
|
const queryClient = useQueryClient3();
|
|
1173
1228
|
const { chain } = useEntryKitConfig();
|
|
1174
|
-
const
|
|
1175
|
-
const mutationKey = ["claimGasPass", chain.id];
|
|
1229
|
+
const mutationKey = ["requestAllowance", chain.id];
|
|
1176
1230
|
return useMutation({
|
|
1177
1231
|
retry: 0,
|
|
1178
1232
|
mutationKey,
|
|
1179
1233
|
mutationFn: async (userAddress) => {
|
|
1180
|
-
|
|
1181
|
-
if (!client) throw new Error("No client?");
|
|
1182
|
-
await setAllowanceSlot({ client, userAddress, allowance: parseEther2("1") });
|
|
1183
|
-
} else {
|
|
1184
|
-
await claimGasPass({ chain, userAddress });
|
|
1185
|
-
}
|
|
1234
|
+
await requestAllowance({ chain, userAddress });
|
|
1186
1235
|
await Promise.all([
|
|
1187
1236
|
queryClient.invalidateQueries({ queryKey: ["getAllowance"] }),
|
|
1188
1237
|
queryClient.invalidateQueries({ queryKey: ["getFunds"] }),
|
|
@@ -1256,15 +1305,15 @@ function useShowQueryError(result) {
|
|
|
1256
1305
|
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1257
1306
|
function Allowance({ isActive, isExpanded, userAddress }) {
|
|
1258
1307
|
const allowance = useShowQueryError(useAllowance(userAddress));
|
|
1259
|
-
const
|
|
1308
|
+
const requestAllowance2 = useShowMutationError(useRequestAllowance());
|
|
1260
1309
|
useEffect6(() => {
|
|
1261
1310
|
const timer = setTimeout(() => {
|
|
1262
|
-
if (isActive &&
|
|
1263
|
-
|
|
1311
|
+
if (isActive && requestAllowance2.status === "idle" && allowance.isSuccess && allowance.data != null && allowance.data < parseEther2("0.01")) {
|
|
1312
|
+
requestAllowance2.mutate(userAddress);
|
|
1264
1313
|
}
|
|
1265
1314
|
});
|
|
1266
1315
|
return () => clearTimeout(timer);
|
|
1267
|
-
}, [allowance.data, allowance.isSuccess,
|
|
1316
|
+
}, [allowance.data, allowance.isSuccess, requestAllowance2, isActive, userAddress]);
|
|
1268
1317
|
return /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-4", children: [
|
|
1269
1318
|
/* @__PURE__ */ jsxs12("div", { className: "flex justify-between gap-4", children: [
|
|
1270
1319
|
/* @__PURE__ */ jsxs12("div", { children: [
|
|
@@ -1277,8 +1326,8 @@ function Allowance({ isActive, isExpanded, userAddress }) {
|
|
|
1277
1326
|
variant: isActive ? "primary" : "tertiary",
|
|
1278
1327
|
className: "flex-shrink-0 text-sm p-1 w-28",
|
|
1279
1328
|
autoFocus: isActive || isExpanded,
|
|
1280
|
-
pending: allowance.status === "pending" ||
|
|
1281
|
-
onClick: () =>
|
|
1329
|
+
pending: allowance.status === "pending" || requestAllowance2.status === "pending",
|
|
1330
|
+
onClick: () => requestAllowance2.mutate(userAddress),
|
|
1282
1331
|
children: "Top up"
|
|
1283
1332
|
}
|
|
1284
1333
|
)
|
|
@@ -1291,11 +1340,11 @@ function Allowance({ isActive, isExpanded, userAddress }) {
|
|
|
1291
1340
|
import { useEffect as useEffect7 } from "react";
|
|
1292
1341
|
|
|
1293
1342
|
// src/onboarding/useSetupSession.ts
|
|
1294
|
-
import { encodeFunctionData } from "viem";
|
|
1343
|
+
import { encodeFunctionData, parseEventLogs as parseEventLogs2 } from "viem";
|
|
1295
1344
|
import { useMutation as useMutation2, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
1296
|
-
import { getAction as
|
|
1297
|
-
import { sendUserOperation as sendUserOperation2, waitForUserOperationReceipt } from "viem/account-abstraction";
|
|
1298
|
-
import { waitForTransactionReceipt as waitForTransactionReceipt2 } from "viem/actions";
|
|
1345
|
+
import { getAction as getAction5 } from "viem/utils";
|
|
1346
|
+
import { entryPoint07Abi as entryPoint07Abi2, sendUserOperation as sendUserOperation2, waitForUserOperationReceipt } from "viem/account-abstraction";
|
|
1347
|
+
import { sendCalls, waitForTransactionReceipt as waitForTransactionReceipt2 } from "viem/actions";
|
|
1299
1348
|
|
|
1300
1349
|
// src/utils/defineCall.ts
|
|
1301
1350
|
function defineCall(call) {
|
|
@@ -1303,23 +1352,23 @@ function defineCall(call) {
|
|
|
1303
1352
|
}
|
|
1304
1353
|
|
|
1305
1354
|
// src/onboarding/useSetupSession.ts
|
|
1306
|
-
import { useClient as
|
|
1355
|
+
import { useClient as useClient8 } from "wagmi";
|
|
1307
1356
|
import { resourceToHex as resourceToHex2 } from "@latticexyz/common";
|
|
1308
1357
|
import IBaseWorldAbi from "@latticexyz/world/out/IBaseWorld.sol/IBaseWorld.abi.json";
|
|
1309
1358
|
|
|
1310
1359
|
// src/utils/callWithSignature.ts
|
|
1311
1360
|
import { parseErc6492Signature } from "viem";
|
|
1312
1361
|
import { writeContract as viem_writeContract } from "viem/actions";
|
|
1313
|
-
import { getAction as
|
|
1362
|
+
import { getAction as getAction4 } from "viem/utils";
|
|
1314
1363
|
|
|
1315
1364
|
// src/utils/signCall.ts
|
|
1316
1365
|
import { toHex } from "viem";
|
|
1317
1366
|
import { signTypedData } from "viem/actions";
|
|
1318
1367
|
import { callWithSignatureTypes } from "@latticexyz/world-module-callwithsignature/internal";
|
|
1319
|
-
import { getRecord as
|
|
1368
|
+
import { getRecord as getRecord4 } from "@latticexyz/store/internal";
|
|
1320
1369
|
import moduleConfig from "@latticexyz/world-module-callwithsignature/mud.config";
|
|
1321
1370
|
import { hexToResource } from "@latticexyz/common";
|
|
1322
|
-
import { getAction as
|
|
1371
|
+
import { getAction as getAction3 } from "viem/utils";
|
|
1323
1372
|
async function signCall({
|
|
1324
1373
|
userClient,
|
|
1325
1374
|
worldAddress,
|
|
@@ -1328,14 +1377,14 @@ async function signCall({
|
|
|
1328
1377
|
nonce: initialNonce,
|
|
1329
1378
|
client
|
|
1330
1379
|
}) {
|
|
1331
|
-
const nonce = initialNonce ?? (client ? (await
|
|
1380
|
+
const nonce = initialNonce ?? (client ? (await getRecord4(client, {
|
|
1332
1381
|
address: worldAddress,
|
|
1333
1382
|
table: moduleConfig.tables.CallWithSignatureNonces,
|
|
1334
1383
|
key: { signer: userClient.account.address },
|
|
1335
1384
|
blockTag: "pending"
|
|
1336
1385
|
})).nonce : 0n);
|
|
1337
1386
|
const { namespace: systemNamespace, name: systemName } = hexToResource(systemId);
|
|
1338
|
-
return await
|
|
1387
|
+
return await getAction3(
|
|
1339
1388
|
userClient,
|
|
1340
1389
|
signTypedData,
|
|
1341
1390
|
"signTypedData"
|
|
@@ -1370,7 +1419,7 @@ async function callWithSignature({
|
|
|
1370
1419
|
"ERC-6492 signatures, like from Coinbase Smart Wallet, are not yet supported. Try using a different wallet?"
|
|
1371
1420
|
);
|
|
1372
1421
|
}
|
|
1373
|
-
return
|
|
1422
|
+
return getAction4(
|
|
1374
1423
|
sessionClient,
|
|
1375
1424
|
viem_writeContract,
|
|
1376
1425
|
"writeContract"
|
|
@@ -1384,10 +1433,65 @@ async function callWithSignature({
|
|
|
1384
1433
|
|
|
1385
1434
|
// src/onboarding/useSetupSession.ts
|
|
1386
1435
|
import { systemsConfig as worldSystemsConfig } from "@latticexyz/world/mud.config";
|
|
1387
|
-
|
|
1436
|
+
|
|
1437
|
+
// src/createBundlerClient.ts
|
|
1438
|
+
import {
|
|
1439
|
+
createBundlerClient as viem_createBundlerClient
|
|
1440
|
+
} from "viem/account-abstraction";
|
|
1441
|
+
|
|
1442
|
+
// src/actions/cachedFeesPerGas.ts
|
|
1443
|
+
import { estimateFeesPerGas } from "viem/actions";
|
|
1444
|
+
function cachedFeesPerGas(client, options = { refreshInterval: 1e4 }) {
|
|
1445
|
+
let fees = null;
|
|
1446
|
+
async function refreshFees() {
|
|
1447
|
+
fees = await estimateFeesPerGas(client);
|
|
1448
|
+
}
|
|
1449
|
+
refreshFees();
|
|
1450
|
+
setInterval(refreshFees, options.refreshInterval);
|
|
1451
|
+
return async () => {
|
|
1452
|
+
if (fees) return fees;
|
|
1453
|
+
fees = await estimateFeesPerGas(client);
|
|
1454
|
+
return fees;
|
|
1455
|
+
};
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
// src/createBundlerClient.ts
|
|
1459
|
+
function createBundlerClient(config) {
|
|
1460
|
+
const client = config.client;
|
|
1461
|
+
if (!client) throw new Error("No `client` provided to `createBundlerClient`.");
|
|
1462
|
+
const chain = config.chain ?? client.chain;
|
|
1463
|
+
const paymaster = chain ? getPaymaster(chain) : void 0;
|
|
1464
|
+
return viem_createBundlerClient({
|
|
1465
|
+
...defaultClientConfig,
|
|
1466
|
+
paymaster: paymaster ? {
|
|
1467
|
+
getPaymasterData: async () => ({
|
|
1468
|
+
paymaster: paymaster.address,
|
|
1469
|
+
paymasterData: "0x"
|
|
1470
|
+
})
|
|
1471
|
+
} : void 0,
|
|
1472
|
+
userOperation: {
|
|
1473
|
+
estimateFeesPerGas: createFeeEstimator(client)
|
|
1474
|
+
},
|
|
1475
|
+
...config
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1478
|
+
function createFeeEstimator(client) {
|
|
1479
|
+
if (!client.chain) return;
|
|
1480
|
+
if (client.chain.id === 31337) {
|
|
1481
|
+
return async () => ({ maxFeePerGas: 100000n, maxPriorityFeePerGas: 0n });
|
|
1482
|
+
}
|
|
1483
|
+
if ([690, 17069, 695569].includes(client.chain.id)) {
|
|
1484
|
+
return cachedFeesPerGas(client);
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
// src/onboarding/useSetupSession.ts
|
|
1489
|
+
import { isIdPlaceConnector as isIdPlaceConnector2 } from "@latticexyz/id.place/internal";
|
|
1490
|
+
import { storeEventsAbi } from "@latticexyz/store";
|
|
1491
|
+
function useSetupSession({ connector, userClient }) {
|
|
1388
1492
|
const queryClient = useQueryClient4();
|
|
1389
1493
|
const { chainId, worldAddress } = useEntryKitConfig();
|
|
1390
|
-
const client =
|
|
1494
|
+
const client = useClient8({ chainId });
|
|
1391
1495
|
const mutationKey = ["setupSession", client?.chain.id, userClient.account.address];
|
|
1392
1496
|
return useMutation2({
|
|
1393
1497
|
retry: 0,
|
|
@@ -1400,8 +1504,69 @@ function useSetupSession({ userClient }) {
|
|
|
1400
1504
|
if (!client) throw new Error("Client not ready.");
|
|
1401
1505
|
const paymaster = getPaymaster(client.chain);
|
|
1402
1506
|
const sessionAddress = sessionClient.account.address;
|
|
1403
|
-
console.log("setting up session");
|
|
1404
|
-
if (
|
|
1507
|
+
console.log("setting up session", userClient);
|
|
1508
|
+
if (isIdPlaceConnector2(connector)) {
|
|
1509
|
+
const calls = [];
|
|
1510
|
+
if (registerSpender && paymaster?.type === "quarry") {
|
|
1511
|
+
console.log("registering spender");
|
|
1512
|
+
calls.push(
|
|
1513
|
+
defineCall({
|
|
1514
|
+
to: paymaster.address,
|
|
1515
|
+
abi: paymasterAbi,
|
|
1516
|
+
functionName: "registerSpender",
|
|
1517
|
+
args: [sessionAddress]
|
|
1518
|
+
})
|
|
1519
|
+
);
|
|
1520
|
+
}
|
|
1521
|
+
if (registerDelegation) {
|
|
1522
|
+
console.log("registering delegation");
|
|
1523
|
+
calls.push(
|
|
1524
|
+
defineCall({
|
|
1525
|
+
to: worldAddress,
|
|
1526
|
+
abi: worldAbi,
|
|
1527
|
+
functionName: "registerDelegation",
|
|
1528
|
+
args: [sessionAddress, unlimitedDelegationControlId, "0x"]
|
|
1529
|
+
})
|
|
1530
|
+
);
|
|
1531
|
+
}
|
|
1532
|
+
if (!calls.length) return;
|
|
1533
|
+
console.log("setting up account with", calls, userClient.account.address, sessionAddress);
|
|
1534
|
+
const { id } = await getAction5(
|
|
1535
|
+
userClient,
|
|
1536
|
+
sendCalls,
|
|
1537
|
+
"sendCalls"
|
|
1538
|
+
)({
|
|
1539
|
+
account: userClient.account,
|
|
1540
|
+
calls
|
|
1541
|
+
});
|
|
1542
|
+
console.log("got send calls ID", id);
|
|
1543
|
+
const bundlerClient = createBundlerClient({
|
|
1544
|
+
transport: getBundlerTransport(client.chain),
|
|
1545
|
+
client
|
|
1546
|
+
});
|
|
1547
|
+
console.log("waiting for receipt");
|
|
1548
|
+
const receipt = await getAction5(
|
|
1549
|
+
bundlerClient,
|
|
1550
|
+
waitForUserOperationReceipt,
|
|
1551
|
+
"waitForUserOperationReceipt"
|
|
1552
|
+
)({ hash: id });
|
|
1553
|
+
console.log("got result", receipt);
|
|
1554
|
+
console.log(
|
|
1555
|
+
"parsed logs",
|
|
1556
|
+
worldAddress,
|
|
1557
|
+
parseEventLogs2({
|
|
1558
|
+
logs: receipt.logs,
|
|
1559
|
+
abi: [
|
|
1560
|
+
...entryPoint07Abi2,
|
|
1561
|
+
// TODO: export account abi from id package
|
|
1562
|
+
// ...abi,
|
|
1563
|
+
...worldAbi,
|
|
1564
|
+
...storeEventsAbi,
|
|
1565
|
+
...calls.flatMap((call) => call.abi)
|
|
1566
|
+
]
|
|
1567
|
+
})
|
|
1568
|
+
);
|
|
1569
|
+
} else if (userClient.account.type === "smart") {
|
|
1405
1570
|
const calls = [];
|
|
1406
1571
|
if (registerSpender && paymaster?.type === "quarry") {
|
|
1407
1572
|
console.log("registering spender");
|
|
@@ -1427,9 +1592,9 @@ function useSetupSession({ userClient }) {
|
|
|
1427
1592
|
}
|
|
1428
1593
|
if (!calls.length) return;
|
|
1429
1594
|
console.log("setting up account with", calls, userClient);
|
|
1430
|
-
const hash = await
|
|
1595
|
+
const hash = await getAction5(userClient, sendUserOperation2, "sendUserOperation")({ calls });
|
|
1431
1596
|
console.log("got user op hash", hash);
|
|
1432
|
-
const receipt = await
|
|
1597
|
+
const receipt = await getAction5(
|
|
1433
1598
|
userClient,
|
|
1434
1599
|
waitForUserOperationReceipt,
|
|
1435
1600
|
"waitForUserOperationReceipt"
|
|
@@ -1477,7 +1642,7 @@ function useSetupSession({ userClient }) {
|
|
|
1477
1642
|
if (!txs.length) return;
|
|
1478
1643
|
console.log("waiting for", txs.length, "receipts");
|
|
1479
1644
|
for (const hash of txs) {
|
|
1480
|
-
const receipt = await
|
|
1645
|
+
const receipt = await getAction5(client, waitForTransactionReceipt2, "waitForTransactionReceipt")({ hash });
|
|
1481
1646
|
console.log("got tx receipt", receipt);
|
|
1482
1647
|
if (receipt.status === "reverted") {
|
|
1483
1648
|
console.error("tx reverted?", receipt);
|
|
@@ -1494,7 +1659,7 @@ function useSetupSession({ userClient }) {
|
|
|
1494
1659
|
}
|
|
1495
1660
|
|
|
1496
1661
|
// src/useSessionClient.ts
|
|
1497
|
-
import { useClient as
|
|
1662
|
+
import { useClient as useClient9 } from "wagmi";
|
|
1498
1663
|
import {
|
|
1499
1664
|
queryOptions as queryOptions8,
|
|
1500
1665
|
useQuery as useQuery10,
|
|
@@ -1504,59 +1669,6 @@ import {
|
|
|
1504
1669
|
// src/getSessionClient.ts
|
|
1505
1670
|
import { smartAccountActions } from "permissionless";
|
|
1506
1671
|
import { callFrom, sendUserOperationFrom } from "@latticexyz/world/internal";
|
|
1507
|
-
|
|
1508
|
-
// src/createBundlerClient.ts
|
|
1509
|
-
import {
|
|
1510
|
-
createBundlerClient as viem_createBundlerClient
|
|
1511
|
-
} from "viem/account-abstraction";
|
|
1512
|
-
|
|
1513
|
-
// src/actions/cachedFeesPerGas.ts
|
|
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
|
|
1530
|
-
function createBundlerClient(config) {
|
|
1531
|
-
const client = config.client;
|
|
1532
|
-
if (!client) throw new Error("No `client` provided to `createBundlerClient`.");
|
|
1533
|
-
const chain = config.chain ?? client.chain;
|
|
1534
|
-
const paymaster = chain ? getPaymaster(chain) : void 0;
|
|
1535
|
-
return viem_createBundlerClient({
|
|
1536
|
-
...defaultClientConfig,
|
|
1537
|
-
paymaster: paymaster ? {
|
|
1538
|
-
getPaymasterData: async () => ({
|
|
1539
|
-
paymaster: paymaster.address,
|
|
1540
|
-
paymasterData: "0x"
|
|
1541
|
-
})
|
|
1542
|
-
} : void 0,
|
|
1543
|
-
userOperation: {
|
|
1544
|
-
estimateFeesPerGas: createFeeEstimator(client)
|
|
1545
|
-
},
|
|
1546
|
-
...config
|
|
1547
|
-
});
|
|
1548
|
-
}
|
|
1549
|
-
function createFeeEstimator(client) {
|
|
1550
|
-
if (!client.chain) return;
|
|
1551
|
-
if (client.chain.id === 31337) {
|
|
1552
|
-
return async () => ({ maxFeePerGas: 100000n, maxPriorityFeePerGas: 0n });
|
|
1553
|
-
}
|
|
1554
|
-
if ([690, 17069, 695569].includes(client.chain.id)) {
|
|
1555
|
-
return cachedFeesPerGas(client);
|
|
1556
|
-
}
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1559
|
-
// src/getSessionClient.ts
|
|
1560
1672
|
async function getSessionClient({
|
|
1561
1673
|
userAddress,
|
|
1562
1674
|
sessionAccount,
|
|
@@ -1620,7 +1732,7 @@ function getSessionClientQueryOptions({
|
|
|
1620
1732
|
function useSessionClient(userAddress) {
|
|
1621
1733
|
const queryClient = useQueryClient5();
|
|
1622
1734
|
const { chainId, worldAddress } = useEntryKitConfig();
|
|
1623
|
-
const client =
|
|
1735
|
+
const client = useClient9({ chainId });
|
|
1624
1736
|
return useQuery10(
|
|
1625
1737
|
getSessionClientQueryOptions({
|
|
1626
1738
|
queryClient,
|
|
@@ -1633,20 +1745,15 @@ function useSessionClient(userAddress) {
|
|
|
1633
1745
|
|
|
1634
1746
|
// src/onboarding/Session.tsx
|
|
1635
1747
|
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1636
|
-
function Session({ isActive, isExpanded, userClient, registerSpender, registerDelegation }) {
|
|
1748
|
+
function Session({ isActive, isExpanded, connector, userClient, registerSpender, registerDelegation }) {
|
|
1637
1749
|
const sessionClient = useShowQueryError(useSessionClient(userClient.account.address));
|
|
1638
|
-
const setup = useShowMutationError(useSetupSession({ userClient }));
|
|
1750
|
+
const setup = useShowMutationError(useSetupSession({ userClient, connector }));
|
|
1639
1751
|
const hasSession = !registerDelegation && !registerDelegation;
|
|
1640
1752
|
const { data: prerequisites } = usePrerequisites(userClient.account.address);
|
|
1641
1753
|
const { hasAllowance, hasGasBalance, hasQuarryGasBalance } = prerequisites ?? {};
|
|
1642
1754
|
useEffect7(() => {
|
|
1643
1755
|
const timer = setTimeout(() => {
|
|
1644
1756
|
if (isActive && setup.status === "idle" && sessionClient.data && !hasSession && (hasAllowance || hasGasBalance || hasQuarryGasBalance)) {
|
|
1645
|
-
setup.mutate({
|
|
1646
|
-
sessionClient: sessionClient.data,
|
|
1647
|
-
registerSpender,
|
|
1648
|
-
registerDelegation
|
|
1649
|
-
});
|
|
1650
1757
|
}
|
|
1651
1758
|
});
|
|
1652
1759
|
return () => clearTimeout(timer);
|
|
@@ -1689,7 +1796,7 @@ function Session({ isActive, isExpanded, userClient, registerSpender, registerDe
|
|
|
1689
1796
|
|
|
1690
1797
|
// src/onboarding/GasBalance.tsx
|
|
1691
1798
|
import { useEffect as useEffect9, useState as useState2 } from "react";
|
|
1692
|
-
import { parseEther as
|
|
1799
|
+
import { parseEther as parseEther3 } from "viem";
|
|
1693
1800
|
import { useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
1694
1801
|
import { useBalance as useBalance2, useWatchBlockNumber } from "wagmi";
|
|
1695
1802
|
|
|
@@ -1976,11 +2083,11 @@ var relayChains_default = {
|
|
|
1976
2083
|
// src/onboarding/useSetBalance.ts
|
|
1977
2084
|
import { useQueryClient as useQueryClient6, useMutation as useMutation3 } from "@tanstack/react-query";
|
|
1978
2085
|
import { setBalance as setBalance2 } from "viem/actions";
|
|
1979
|
-
import { useClient as
|
|
2086
|
+
import { useClient as useClient10 } from "wagmi";
|
|
1980
2087
|
function useSetBalance() {
|
|
1981
2088
|
const queryClient = useQueryClient6();
|
|
1982
2089
|
const { chainId } = useEntryKitConfig();
|
|
1983
|
-
const client =
|
|
2090
|
+
const client = useClient10({ chainId });
|
|
1984
2091
|
return useMutation3({
|
|
1985
2092
|
retry: 0,
|
|
1986
2093
|
mutationKey: ["setBalance", chainId],
|
|
@@ -2057,7 +2164,7 @@ function CheckIcon(props) {
|
|
|
2057
2164
|
}
|
|
2058
2165
|
|
|
2059
2166
|
// src/onboarding/GasBalance.tsx
|
|
2060
|
-
import { Fragment, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2167
|
+
import { Fragment as Fragment2, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2061
2168
|
function GasBalance({ isActive, isExpanded, sessionAddress }) {
|
|
2062
2169
|
const queryClient = useQueryClient7();
|
|
2063
2170
|
const { chain } = useEntryKitConfig();
|
|
@@ -2093,7 +2200,7 @@ function GasBalance({ isActive, isExpanded, sessionAddress }) {
|
|
|
2093
2200
|
pending: balance.status === "pending" || setBalance3.status === "pending",
|
|
2094
2201
|
onClick: () => setBalance3.mutate({
|
|
2095
2202
|
address: sessionAddress,
|
|
2096
|
-
value:
|
|
2203
|
+
value: parseEther3("0.01") + (balance.data?.value ?? 0n)
|
|
2097
2204
|
}),
|
|
2098
2205
|
children: "Top up"
|
|
2099
2206
|
}
|
|
@@ -2119,7 +2226,7 @@ function GasBalance({ isActive, isExpanded, sessionAddress }) {
|
|
|
2119
2226
|
)
|
|
2120
2227
|
) : null
|
|
2121
2228
|
] }),
|
|
2122
|
-
isExpanded ? /* @__PURE__ */ jsxs14(
|
|
2229
|
+
isExpanded ? /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
2123
2230
|
/* @__PURE__ */ jsx19("p", { className: "text-sm", children: "Your session's gas balance is used to pay for onchain computation." }),
|
|
2124
2231
|
/* @__PURE__ */ jsxs14("p", { className: "text-sm", children: [
|
|
2125
2232
|
"Send funds to",
|
|
@@ -2337,7 +2444,7 @@ function useChainBalances({ chains }) {
|
|
|
2337
2444
|
}
|
|
2338
2445
|
|
|
2339
2446
|
// src/onboarding/deposit/ChainSelect.tsx
|
|
2340
|
-
import { Fragment as
|
|
2447
|
+
import { Fragment as Fragment3, jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2341
2448
|
function ChainSelect({ value, onChange }) {
|
|
2342
2449
|
const theme = useTheme();
|
|
2343
2450
|
const { frame } = useFrame();
|
|
@@ -2389,7 +2496,7 @@ function ChainSelect({ value, onChange }) {
|
|
|
2389
2496
|
className: "w-8"
|
|
2390
2497
|
}
|
|
2391
2498
|
) }),
|
|
2392
|
-
/* @__PURE__ */ jsx25(Select.Icon, { asChild: true, children: /* @__PURE__ */ jsxs15(
|
|
2499
|
+
/* @__PURE__ */ jsx25(Select.Icon, { asChild: true, children: /* @__PURE__ */ jsxs15(Fragment3, { children: [
|
|
2393
2500
|
/* @__PURE__ */ jsx25(ChevronDownIcon, { className: "text-sm -mr-1 group-aria-expanded:hidden" }),
|
|
2394
2501
|
/* @__PURE__ */ jsx25(ChevronUpIcon, { className: "text-sm -mr-1 hidden group-aria-expanded:inline" })
|
|
2395
2502
|
] }) })
|
|
@@ -2434,7 +2541,7 @@ function ChainSelect({ value, onChange }) {
|
|
|
2434
2541
|
}
|
|
2435
2542
|
|
|
2436
2543
|
// src/onboarding/deposit/AmountInput.tsx
|
|
2437
|
-
import { formatEther as formatEther3, parseEther as
|
|
2544
|
+
import { formatEther as formatEther3, parseEther as parseEther4 } from "viem";
|
|
2438
2545
|
import { twMerge as twMerge13 } from "tailwind-merge";
|
|
2439
2546
|
import { forwardRef as forwardRef3 } from "react";
|
|
2440
2547
|
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
@@ -2461,7 +2568,7 @@ var AmountInput = forwardRef3(function AmountInput2({ initialAmount, onChange },
|
|
|
2461
2568
|
return input.setCustomValidity("Invalid amount.");
|
|
2462
2569
|
}
|
|
2463
2570
|
input.setCustomValidity("");
|
|
2464
|
-
onChange(
|
|
2571
|
+
onChange(parseEther4(value));
|
|
2465
2572
|
}
|
|
2466
2573
|
}
|
|
2467
2574
|
),
|
|
@@ -2472,7 +2579,7 @@ var AmountInput = forwardRef3(function AmountInput2({ initialAmount, onChange },
|
|
|
2472
2579
|
// src/onboarding/deposit/SubmitButton.tsx
|
|
2473
2580
|
import { useAccount as useAccount2, useBalance as useBalance3, useSwitchChain as useSwitchChain2 } from "wagmi";
|
|
2474
2581
|
import { twMerge as twMerge14 } from "tailwind-merge";
|
|
2475
|
-
import { parseEther as
|
|
2582
|
+
import { parseEther as parseEther5 } from "viem";
|
|
2476
2583
|
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2477
2584
|
var MAX_DEPOSIT_AMOUNT = "0.1";
|
|
2478
2585
|
function SubmitButton({ amount, chainId, className, ...buttonProps }) {
|
|
@@ -2493,7 +2600,7 @@ function SubmitButton({ amount, chainId, className, ...buttonProps }) {
|
|
|
2493
2600
|
}
|
|
2494
2601
|
);
|
|
2495
2602
|
} else if (amount) {
|
|
2496
|
-
if (amount >
|
|
2603
|
+
if (amount > parseEther5(MAX_DEPOSIT_AMOUNT)) {
|
|
2497
2604
|
return /* @__PURE__ */ jsxs17(Button, { type: "button", className: twMerge14("w-full", className), disabled: true, children: [
|
|
2498
2605
|
"Max amount is ",
|
|
2499
2606
|
MAX_DEPOSIT_AMOUNT,
|
|
@@ -2530,7 +2637,7 @@ function formatGas(wei) {
|
|
|
2530
2637
|
}
|
|
2531
2638
|
|
|
2532
2639
|
// src/onboarding/deposit/DepositForm.tsx
|
|
2533
|
-
import { Fragment as
|
|
2640
|
+
import { Fragment as Fragment4, jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2534
2641
|
function DepositForm({
|
|
2535
2642
|
sourceChain,
|
|
2536
2643
|
setSourceChainId,
|
|
@@ -2595,7 +2702,7 @@ function DepositForm({
|
|
|
2595
2702
|
/* @__PURE__ */ jsx29("dt", { children: "Gas balance after deposit" }),
|
|
2596
2703
|
/* @__PURE__ */ jsx29("dd", { children: /* @__PURE__ */ jsx29(Balance, { wei: (quarryBalance.data ?? 0n) + (amount ?? 0n) }) }),
|
|
2597
2704
|
/* @__PURE__ */ jsx29("dt", { children: "Estimated fee" }),
|
|
2598
|
-
/* @__PURE__ */ jsx29("dd", { children: estimatedFee.fee ? /* @__PURE__ */ jsxs18(
|
|
2705
|
+
/* @__PURE__ */ jsx29("dd", { children: estimatedFee.fee ? /* @__PURE__ */ jsxs18(Fragment4, { children: [
|
|
2599
2706
|
formatGas(estimatedFee.fee),
|
|
2600
2707
|
" gwei"
|
|
2601
2708
|
] }) : estimatedFee.error ? /* @__PURE__ */ jsx29("span", { title: String(estimatedFee.error), children: /* @__PURE__ */ jsx29(WarningIcon, { className: "inline-block text-amber-500" }) }) : estimatedFee.isLoading ? /* @__PURE__ */ jsx29(PendingIcon, { className: "inline-block text-xs" }) : null }),
|
|
@@ -2955,7 +3062,7 @@ function DepositStatus({ status, progress, children, onDismiss }) {
|
|
|
2955
3062
|
|
|
2956
3063
|
// src/onboarding/deposit/TransferDepositStatus.tsx
|
|
2957
3064
|
import { useChains as useChains2 } from "wagmi";
|
|
2958
|
-
import { Fragment as
|
|
3065
|
+
import { Fragment as Fragment5, jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2959
3066
|
function TransferDepositStatus({
|
|
2960
3067
|
amount,
|
|
2961
3068
|
chainL1Id,
|
|
@@ -2983,7 +3090,7 @@ function TransferDepositStatus({
|
|
|
2983
3090
|
children: (() => {
|
|
2984
3091
|
const blockExplorer = chain.blockExplorers?.default.url;
|
|
2985
3092
|
if (receipt.status === "pending") {
|
|
2986
|
-
return /* @__PURE__ */ jsxs20(
|
|
3093
|
+
return /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
2987
3094
|
"Confirming deposit on",
|
|
2988
3095
|
" ",
|
|
2989
3096
|
/* @__PURE__ */ jsx34(
|
|
@@ -2999,7 +3106,7 @@ function TransferDepositStatus({
|
|
|
2999
3106
|
] });
|
|
3000
3107
|
}
|
|
3001
3108
|
if (receipt.status === "error") {
|
|
3002
|
-
return /* @__PURE__ */ jsxs20(
|
|
3109
|
+
return /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
3003
3110
|
"Could not find deposit on",
|
|
3004
3111
|
" ",
|
|
3005
3112
|
/* @__PURE__ */ jsx34(
|
|
@@ -3014,7 +3121,7 @@ function TransferDepositStatus({
|
|
|
3014
3121
|
"."
|
|
3015
3122
|
] });
|
|
3016
3123
|
}
|
|
3017
|
-
return /* @__PURE__ */ jsxs20(
|
|
3124
|
+
return /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
3018
3125
|
"Successfully",
|
|
3019
3126
|
" ",
|
|
3020
3127
|
/* @__PURE__ */ jsx34(
|
|
@@ -3037,7 +3144,7 @@ function TransferDepositStatus({
|
|
|
3037
3144
|
// src/onboarding/deposit/RelayDepositStatus.tsx
|
|
3038
3145
|
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
3039
3146
|
import { useChains as useChains3 } from "wagmi";
|
|
3040
|
-
import { Fragment as
|
|
3147
|
+
import { Fragment as Fragment6, jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3041
3148
|
function RelayDepositStatus({
|
|
3042
3149
|
amount,
|
|
3043
3150
|
chainL1Id,
|
|
@@ -3065,20 +3172,20 @@ function RelayDepositStatus({
|
|
|
3065
3172
|
onDismiss,
|
|
3066
3173
|
children: (() => {
|
|
3067
3174
|
if (deposit.status === "pending") {
|
|
3068
|
-
return /* @__PURE__ */ jsxs21(
|
|
3175
|
+
return /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
3069
3176
|
"Relay bridge deposit pending on ",
|
|
3070
3177
|
chainL1.name,
|
|
3071
3178
|
"\u2026"
|
|
3072
3179
|
] });
|
|
3073
3180
|
}
|
|
3074
3181
|
if (deposit.status === "error") {
|
|
3075
|
-
return /* @__PURE__ */ jsxs21(
|
|
3182
|
+
return /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
3076
3183
|
"Relay bridge deposit to ",
|
|
3077
3184
|
chainL2.name,
|
|
3078
3185
|
" failed."
|
|
3079
3186
|
] });
|
|
3080
3187
|
}
|
|
3081
|
-
return /* @__PURE__ */ jsxs21(
|
|
3188
|
+
return /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
3082
3189
|
"Successfully bridged ",
|
|
3083
3190
|
/* @__PURE__ */ jsx35(Balance, { wei: amount }),
|
|
3084
3191
|
" to ",
|
|
@@ -3091,12 +3198,12 @@ function RelayDepositStatus({
|
|
|
3091
3198
|
}
|
|
3092
3199
|
|
|
3093
3200
|
// src/onboarding/deposit/Deposits.tsx
|
|
3094
|
-
import { useAccount as useAccount6, useClient as
|
|
3201
|
+
import { useAccount as useAccount6, useClient as useClient11 } from "wagmi";
|
|
3095
3202
|
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
3096
3203
|
function Deposits() {
|
|
3097
3204
|
const queryClient = useQueryClient8();
|
|
3098
3205
|
const { chainId } = useEntryKitConfig();
|
|
3099
|
-
const client =
|
|
3206
|
+
const client = useClient11({ chainId });
|
|
3100
3207
|
const { address: userAddress } = useAccount6();
|
|
3101
3208
|
const { deposits, removeDeposit } = useDeposits();
|
|
3102
3209
|
const { data: isComplete } = useQuery17({
|
|
@@ -3171,9 +3278,9 @@ function ArrowLeftIcon(props) {
|
|
|
3171
3278
|
}
|
|
3172
3279
|
|
|
3173
3280
|
// src/onboarding/quarry/WithdrawGasBalanceButton.tsx
|
|
3174
|
-
import { getAction as
|
|
3281
|
+
import { getAction as getAction6 } from "viem/utils";
|
|
3175
3282
|
import { waitForTransactionReceipt as waitForTransactionReceipt3 } from "viem/actions";
|
|
3176
|
-
import { useAccount as useAccount7, useClient as
|
|
3283
|
+
import { useAccount as useAccount7, useClient as useClient12, useSwitchChain as useSwitchChain3, useWriteContract as useWriteContract2 } from "wagmi";
|
|
3177
3284
|
import { twMerge as twMerge17 } from "tailwind-merge";
|
|
3178
3285
|
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
3179
3286
|
import { useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
@@ -3184,7 +3291,7 @@ function WithdrawGasBalanceButton({ userAddress }) {
|
|
|
3184
3291
|
const { chain, chainId } = useEntryKitConfig();
|
|
3185
3292
|
const { chainId: userChainId } = useAccount7();
|
|
3186
3293
|
const queryClient = useQueryClient9();
|
|
3187
|
-
const client =
|
|
3294
|
+
const client = useClient12({ chainId });
|
|
3188
3295
|
const paymaster = getPaymaster(chain);
|
|
3189
3296
|
const balance = useShowQueryError(useBalance(userAddress));
|
|
3190
3297
|
const shouldSwitchChain = chainId != null && chainId !== userChainId;
|
|
@@ -3202,7 +3309,7 @@ function WithdrawGasBalanceButton({ userAddress }) {
|
|
|
3202
3309
|
args: [userAddress, balance.data],
|
|
3203
3310
|
chainId
|
|
3204
3311
|
});
|
|
3205
|
-
await
|
|
3312
|
+
await getAction6(client, waitForTransactionReceipt3, "waitForTransactionReceipt")({ hash });
|
|
3206
3313
|
await Promise.all([
|
|
3207
3314
|
queryClient.invalidateQueries({ queryKey: ["balance"] }),
|
|
3208
3315
|
queryClient.invalidateQueries({ queryKey: ["getFunds"] }),
|
|
@@ -3304,7 +3411,7 @@ function GasBalance2({ isActive, isExpanded, isFocused, setFocused, userAddress
|
|
|
3304
3411
|
|
|
3305
3412
|
// src/onboarding/ConnectedSteps.tsx
|
|
3306
3413
|
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
3307
|
-
function ConnectedSteps({ userClient, initialUserAddress }) {
|
|
3414
|
+
function ConnectedSteps({ connector, userClient, initialUserAddress }) {
|
|
3308
3415
|
const { chain } = useEntryKitConfig();
|
|
3309
3416
|
const paymaster = getPaymaster(chain);
|
|
3310
3417
|
const [focusedId, setFocusedId] = useState5(null);
|
|
@@ -3356,7 +3463,7 @@ function ConnectedSteps({ userClient, initialUserAddress }) {
|
|
|
3356
3463
|
});
|
|
3357
3464
|
}
|
|
3358
3465
|
} else if (paymaster.type === "quarry") {
|
|
3359
|
-
if (paymaster.
|
|
3466
|
+
if (paymaster.canSponsor) {
|
|
3360
3467
|
steps2.push({
|
|
3361
3468
|
id: "allowance",
|
|
3362
3469
|
isComplete: !!hasAllowance,
|
|
@@ -3373,7 +3480,16 @@ function ConnectedSteps({ userClient, initialUserAddress }) {
|
|
|
3373
3480
|
steps2.push({
|
|
3374
3481
|
id: "session",
|
|
3375
3482
|
isComplete: !!isSpender && !!hasDelegation,
|
|
3376
|
-
content: (props) => /* @__PURE__ */ jsx41(
|
|
3483
|
+
content: (props) => /* @__PURE__ */ jsx41(
|
|
3484
|
+
Session,
|
|
3485
|
+
{
|
|
3486
|
+
...props,
|
|
3487
|
+
userClient,
|
|
3488
|
+
connector,
|
|
3489
|
+
registerSpender: !isSpender,
|
|
3490
|
+
registerDelegation: !hasDelegation
|
|
3491
|
+
}
|
|
3492
|
+
)
|
|
3377
3493
|
});
|
|
3378
3494
|
return steps2;
|
|
3379
3495
|
}, [
|
|
@@ -3385,7 +3501,8 @@ function ConnectedSteps({ userClient, initialUserAddress }) {
|
|
|
3385
3501
|
paymaster,
|
|
3386
3502
|
sessionAddress,
|
|
3387
3503
|
userAddress,
|
|
3388
|
-
userClient
|
|
3504
|
+
userClient,
|
|
3505
|
+
connector
|
|
3389
3506
|
]);
|
|
3390
3507
|
const [selectedStepId] = useState5(null);
|
|
3391
3508
|
const nextStep = steps.find((step) => step.content != null && !step.isComplete);
|
|
@@ -3428,13 +3545,20 @@ import { useRef as useRef6 } from "react";
|
|
|
3428
3545
|
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
3429
3546
|
function AccountModalContent() {
|
|
3430
3547
|
const { chainId } = useEntryKitConfig();
|
|
3431
|
-
const
|
|
3432
|
-
const {
|
|
3548
|
+
const { address: userAddress, connector } = useAccount8();
|
|
3549
|
+
const userClient = useConnectorClient({ chainId, connector });
|
|
3433
3550
|
const initialUserAddress = useRef6(userAddress);
|
|
3434
3551
|
if (userClient.status !== "success") {
|
|
3435
3552
|
return /* @__PURE__ */ jsx42(ConnectWallet, {});
|
|
3436
3553
|
}
|
|
3437
|
-
return /* @__PURE__ */ jsx42(
|
|
3554
|
+
return /* @__PURE__ */ jsx42(
|
|
3555
|
+
ConnectedSteps,
|
|
3556
|
+
{
|
|
3557
|
+
connector,
|
|
3558
|
+
userClient: userClient.data,
|
|
3559
|
+
initialUserAddress: initialUserAddress.current
|
|
3560
|
+
}
|
|
3561
|
+
);
|
|
3438
3562
|
}
|
|
3439
3563
|
|
|
3440
3564
|
// src/AccountModal.tsx
|
|
@@ -3445,7 +3569,7 @@ import { ErrorBoundary } from "react-error-boundary";
|
|
|
3445
3569
|
import { wait } from "@latticexyz/common/utils";
|
|
3446
3570
|
import { useEffect as useEffect16 } from "react";
|
|
3447
3571
|
import { twMerge as twMerge19 } from "tailwind-merge";
|
|
3448
|
-
import { Fragment as
|
|
3572
|
+
import { Fragment as Fragment7, jsx as jsx43, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3449
3573
|
function ErrorOverlay({ error: error2, retry, dismiss }) {
|
|
3450
3574
|
useEffect16(() => {
|
|
3451
3575
|
if (error2) {
|
|
@@ -3471,7 +3595,7 @@ function ErrorOverlay({ error: error2, retry, dismiss }) {
|
|
|
3471
3595
|
"transition duration-300",
|
|
3472
3596
|
error2 ? "translate-y-0 opacity-100 pointer-events-auto" : "-translate-y-4 opacity-0"
|
|
3473
3597
|
),
|
|
3474
|
-
children: error2 ? /* @__PURE__ */ jsx43(
|
|
3598
|
+
children: error2 ? /* @__PURE__ */ jsx43(Fragment7, { children: /* @__PURE__ */ jsxs25("div", { className: "w-full max-h-full bg-blue-700 text-white/80 overflow-auto", children: [
|
|
3475
3599
|
/* @__PURE__ */ jsxs25("div", { className: "space-y-6 px-8 pt-8", children: [
|
|
3476
3600
|
/* @__PURE__ */ jsx43("div", { className: "text-white text-lg font-bold", children: "Oops! It broke :(" }),
|
|
3477
3601
|
/* @__PURE__ */ jsx43("div", { className: "font-mono text-xs whitespace-pre-wrap", children: error2.message.trim() }),
|
|
@@ -3600,11 +3724,11 @@ import { twMerge as twMerge22 } from "tailwind-merge";
|
|
|
3600
3724
|
|
|
3601
3725
|
// src/AccountName.tsx
|
|
3602
3726
|
import { twMerge as twMerge21 } from "tailwind-merge";
|
|
3603
|
-
import { Fragment as
|
|
3727
|
+
import { Fragment as Fragment8, jsx as jsx48, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3604
3728
|
function AccountName({ address }) {
|
|
3605
3729
|
const { data: ens } = useENS(address);
|
|
3606
3730
|
const avatar = usePreloadImage(ens?.avatar);
|
|
3607
|
-
return /* @__PURE__ */ jsxs28(
|
|
3731
|
+
return /* @__PURE__ */ jsxs28(Fragment8, { children: [
|
|
3608
3732
|
/* @__PURE__ */ jsxs28("span", { className: "flex-shrink-0 w-6 h-6 -my-1 -mx-0.5 grid place-items-center", children: [
|
|
3609
3733
|
/* @__PURE__ */ jsx48(
|
|
3610
3734
|
"img",
|
|
@@ -3648,7 +3772,7 @@ var secondaryClassNames = twMerge22(
|
|
|
3648
3772
|
var secondaryInteractiveClassNames = twMerge22(
|
|
3649
3773
|
"cursor-pointer outline-none hover:bg-neutral-200 data-[highlighted]:bg-neutral-200 dark:hover:bg-neutral-700"
|
|
3650
3774
|
);
|
|
3651
|
-
function
|
|
3775
|
+
function AccountButton2() {
|
|
3652
3776
|
const { openAccountModal, accountModalOpen } = useAccountModal();
|
|
3653
3777
|
const { status, address: userAddress } = useAccount9();
|
|
3654
3778
|
const initialUserAddress = useRef7(userAddress);
|
|
@@ -3737,6 +3861,8 @@ function useSessionClientReady() {
|
|
|
3737
3861
|
// src/createWagmiConfig.ts
|
|
3738
3862
|
import { createConfig } from "wagmi";
|
|
3739
3863
|
import { getDefaultConfig } from "connectkit";
|
|
3864
|
+
|
|
3865
|
+
// src/getDefaultConnectors.ts
|
|
3740
3866
|
import { injected, coinbaseWallet, safe } from "wagmi/connectors";
|
|
3741
3867
|
|
|
3742
3868
|
// src/connectors/walletConnect.ts
|
|
@@ -3745,7 +3871,7 @@ import {
|
|
|
3745
3871
|
SwitchChainError,
|
|
3746
3872
|
UserRejectedRequestError,
|
|
3747
3873
|
getAddress,
|
|
3748
|
-
numberToHex as
|
|
3874
|
+
numberToHex as numberToHex2
|
|
3749
3875
|
} from "viem";
|
|
3750
3876
|
walletConnect.type = "walletConnect";
|
|
3751
3877
|
function walletConnect(parameters) {
|
|
@@ -3942,7 +4068,7 @@ function walletConnect(parameters) {
|
|
|
3942
4068
|
}),
|
|
3943
4069
|
provider.request({
|
|
3944
4070
|
method: "wallet_switchEthereumChain",
|
|
3945
|
-
params: [{ chainId:
|
|
4071
|
+
params: [{ chainId: numberToHex2(chainId) }]
|
|
3946
4072
|
})
|
|
3947
4073
|
]);
|
|
3948
4074
|
const requestedChains = await this.getRequestedChainsIds();
|
|
@@ -3961,7 +4087,7 @@ function walletConnect(parameters) {
|
|
|
3961
4087
|
else rpcUrls = [...chain.rpcUrls.default.http];
|
|
3962
4088
|
const addEthereumChain = {
|
|
3963
4089
|
blockExplorerUrls,
|
|
3964
|
-
chainId:
|
|
4090
|
+
chainId: numberToHex2(chainId),
|
|
3965
4091
|
chainName: addEthereumChainParameter?.chainName ?? chain.name,
|
|
3966
4092
|
iconUrls: addEthereumChainParameter?.iconUrls,
|
|
3967
4093
|
nativeCurrency: addEthereumChainParameter?.nativeCurrency ?? chain.nativeCurrency,
|
|
@@ -4072,8 +4198,8 @@ function extractRpcUrls(parameters) {
|
|
|
4072
4198
|
return transports.map(({ value }) => value?.url || fallbackUrl);
|
|
4073
4199
|
}
|
|
4074
4200
|
|
|
4075
|
-
// src/
|
|
4076
|
-
function
|
|
4201
|
+
// src/getDefaultConnectors.ts
|
|
4202
|
+
function getDefaultConnectors(config) {
|
|
4077
4203
|
const connectors = [];
|
|
4078
4204
|
const shouldUseSafeConnector = !(typeof window === "undefined") && window?.parent !== window;
|
|
4079
4205
|
if (shouldUseSafeConnector) {
|
|
@@ -4098,6 +4224,12 @@ function createWagmiConfig(config) {
|
|
|
4098
4224
|
})
|
|
4099
4225
|
);
|
|
4100
4226
|
}
|
|
4227
|
+
return connectors;
|
|
4228
|
+
}
|
|
4229
|
+
|
|
4230
|
+
// src/createWagmiConfig.ts
|
|
4231
|
+
function createWagmiConfig(config) {
|
|
4232
|
+
const connectors = config.connectors ?? getDefaultConnectors(config);
|
|
4101
4233
|
const configParams = getDefaultConfig({
|
|
4102
4234
|
chains: config.chains,
|
|
4103
4235
|
transports: config.transports,
|
|
@@ -4130,7 +4262,7 @@ function withFeeCache(chain, options = { refreshInterval: 1e4 }) {
|
|
|
4130
4262
|
}
|
|
4131
4263
|
|
|
4132
4264
|
// src/validateSigner.ts
|
|
4133
|
-
import { readContract } from "viem/actions";
|
|
4265
|
+
import { readContract as readContract2 } from "viem/actions";
|
|
4134
4266
|
async function internal_validateSigner({
|
|
4135
4267
|
client,
|
|
4136
4268
|
worldAddress,
|
|
@@ -4138,7 +4270,7 @@ async function internal_validateSigner({
|
|
|
4138
4270
|
sessionAddress,
|
|
4139
4271
|
signerAddress
|
|
4140
4272
|
}) {
|
|
4141
|
-
const ownerAddress = await
|
|
4273
|
+
const ownerAddress = await readContract2(client, {
|
|
4142
4274
|
address: sessionAddress,
|
|
4143
4275
|
abi: simpleAccountAbi,
|
|
4144
4276
|
functionName: "owner"
|
|
@@ -4173,10 +4305,14 @@ var simpleAccountAbi = [
|
|
|
4173
4305
|
}
|
|
4174
4306
|
];
|
|
4175
4307
|
export {
|
|
4176
|
-
AccountButton,
|
|
4308
|
+
AccountButton2 as AccountButton,
|
|
4177
4309
|
EntryKitProvider,
|
|
4310
|
+
createBundlerClient,
|
|
4178
4311
|
createWagmiConfig,
|
|
4312
|
+
defineCall,
|
|
4179
4313
|
defineConfig,
|
|
4314
|
+
getBundlerTransport,
|
|
4315
|
+
getDefaultConnectors,
|
|
4180
4316
|
getFundsQueryOptions,
|
|
4181
4317
|
internal_validateSigner,
|
|
4182
4318
|
useAccountModal,
|