@latticexyz/entrykit 2.2.21-c3d156de242e9e234d4b23b55d6391a258bfc2c4 → 2.2.21-c67535174198d5cace8b7fdafaaff54a580f128a
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address } from 'viem/accounts';
|
|
2
|
-
import { Chain, Client, Transport, Account, Address as Address$1 } from 'viem';
|
|
2
|
+
import { Chain, Client, Transport, Account, Address as Address$1, LocalAccount } from 'viem';
|
|
3
3
|
import { SmartAccount } from 'viem/account-abstraction';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
@@ -68,6 +68,12 @@ declare function defineConfig(input: EntryKitConfigInput): EntryKitConfig;
|
|
|
68
68
|
type ConnectedClient<chain extends Chain = Chain> = Client<Transport, chain, Account>;
|
|
69
69
|
type SessionClient<chain extends Chain = Chain> = Client<Transport, chain, SmartAccount> & {
|
|
70
70
|
readonly userAddress: Address$1;
|
|
71
|
+
/**
|
|
72
|
+
* World address used for delegated calls. Assumes a delegation has been set up between the user account and session account.
|
|
73
|
+
*/
|
|
74
|
+
readonly worldAddress: Address$1;
|
|
75
|
+
/** @internal */
|
|
76
|
+
readonly internal_signer: LocalAccount;
|
|
71
77
|
};
|
|
72
78
|
|
|
73
79
|
type Props = {
|
|
@@ -120,4 +126,15 @@ declare function getWallets(_config: {
|
|
|
120
126
|
readonly chainId: number;
|
|
121
127
|
}): WalletList;
|
|
122
128
|
|
|
123
|
-
|
|
129
|
+
/**
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
declare function internal_validateSigner({ client, worldAddress, userAddress, sessionAddress, signerAddress, }: {
|
|
133
|
+
client: Client;
|
|
134
|
+
worldAddress: Address$1;
|
|
135
|
+
userAddress: Address$1;
|
|
136
|
+
sessionAddress: Address$1;
|
|
137
|
+
signerAddress: Address$1;
|
|
138
|
+
}): Promise<void>;
|
|
139
|
+
|
|
140
|
+
export { AccountButton, type ConnectedClient, type CreateWagmiConfigOptions, type EntryKitConfig, type EntryKitConfigInput, EntryKitProvider, type SessionClient, createWagmiConfig, defineConfig, getConnectors, getWallets, internal_validateSigner, useAccountModal, useEntryKitConfig, useSessionClientReady as useSessionClient };
|
|
@@ -8,7 +8,14 @@ function defineConfig(input) {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
// src/ui/Modal.tsx
|
|
11
|
-
import {
|
|
11
|
+
import { useEffect as useEffect2 } from "react";
|
|
12
|
+
import {
|
|
13
|
+
Root as DialogRoot,
|
|
14
|
+
DialogPortal,
|
|
15
|
+
DialogContent,
|
|
16
|
+
DialogTitle,
|
|
17
|
+
DialogDescription
|
|
18
|
+
} from "@radix-ui/react-dialog";
|
|
12
19
|
|
|
13
20
|
// src/ui/Shadow.tsx
|
|
14
21
|
import { forwardRef, useEffect, useRef, useState } from "react";
|
|
@@ -165,7 +172,7 @@ function userOpExecutor({ executor }) {
|
|
|
165
172
|
if (method === "eth_estimateUserOperationGas") {
|
|
166
173
|
return await estimateUserOperationGas(params);
|
|
167
174
|
}
|
|
168
|
-
throw new Error("
|
|
175
|
+
throw new Error(`userOpExecutor: method "${method}" not supported`);
|
|
169
176
|
};
|
|
170
177
|
return createTransport({
|
|
171
178
|
key: "userOpExecutor",
|
|
@@ -300,6 +307,19 @@ var Shadow = forwardRef(function Shadow2({ mode, children }, forwardedRef) {
|
|
|
300
307
|
import { twMerge } from "tailwind-merge";
|
|
301
308
|
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
302
309
|
function Modal({ open, onOpenChange, children }) {
|
|
310
|
+
useEffect2(() => {
|
|
311
|
+
function onKeyDown(event) {
|
|
312
|
+
if (event.defaultPrevented) return;
|
|
313
|
+
if (event.key === "Escape" && open) {
|
|
314
|
+
event.preventDefault();
|
|
315
|
+
onOpenChange?.(false);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
window.addEventListener("keydown", onKeyDown);
|
|
319
|
+
return () => {
|
|
320
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
321
|
+
};
|
|
322
|
+
}, [onOpenChange, open]);
|
|
303
323
|
return /* @__PURE__ */ jsx4(DialogRoot, { open, onOpenChange, children: /* @__PURE__ */ jsx4(DialogPortal, { children: /* @__PURE__ */ jsxs2(Shadow, { mode: "modal", children: [
|
|
304
324
|
/* @__PURE__ */ jsx4("div", { className: twMerge("fixed inset-0", "bg-neutral-800/85", "animate-in animate-duration-300 fade-in") }),
|
|
305
325
|
/* @__PURE__ */ jsx4(
|
|
@@ -310,17 +330,11 @@ function Modal({ open, onOpenChange, children }) {
|
|
|
310
330
|
"grid items-end sm:items-center",
|
|
311
331
|
"animate-in animate-duration-300 fade-in slide-in-from-bottom-16"
|
|
312
332
|
),
|
|
313
|
-
children: /* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */
|
|
314
|
-
|
|
315
|
-
{
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
onOpenAutoFocus: (event) => {
|
|
319
|
-
event.preventDefault();
|
|
320
|
-
},
|
|
321
|
-
children
|
|
322
|
-
}
|
|
323
|
-
) })
|
|
333
|
+
children: /* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsxs2(DialogContent, { className: "outline-none w-full max-w-[26rem] mx-auto", children: [
|
|
334
|
+
/* @__PURE__ */ jsx4(DialogTitle, { className: "sr-only", children: "EntryKit" }),
|
|
335
|
+
/* @__PURE__ */ jsx4(DialogDescription, { className: "sr-only", children: "Sign in to this app" }),
|
|
336
|
+
children
|
|
337
|
+
] }) })
|
|
324
338
|
}
|
|
325
339
|
)
|
|
326
340
|
] }) }) });
|
|
@@ -495,13 +509,13 @@ function AppInfo() {
|
|
|
495
509
|
|
|
496
510
|
// src/ConnectWallet.tsx
|
|
497
511
|
import { twMerge as twMerge5 } from "tailwind-merge";
|
|
498
|
-
import { useEffect as
|
|
512
|
+
import { useEffect as useEffect3, useState as useState2 } from "react";
|
|
499
513
|
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
500
514
|
function ConnectWallet() {
|
|
501
515
|
const userAccount = useAccount();
|
|
502
516
|
const { openConnectModal, connectModalOpen } = useConnectModal();
|
|
503
517
|
const [hasAutoOpened, setHasAutoOpened] = useState2(false);
|
|
504
|
-
|
|
518
|
+
useEffect3(() => {
|
|
505
519
|
if (!connectModalOpen && !hasAutoOpened) {
|
|
506
520
|
openConnectModal?.();
|
|
507
521
|
setHasAutoOpened(true);
|
|
@@ -531,7 +545,7 @@ function ConnectWallet() {
|
|
|
531
545
|
}
|
|
532
546
|
|
|
533
547
|
// src/onboarding/ConnectedSteps.tsx
|
|
534
|
-
import { useEffect as
|
|
548
|
+
import { useEffect as useEffect8, useMemo as useMemo2, useRef as useRef2, useState as useState3 } from "react";
|
|
535
549
|
import { twMerge as twMerge7 } from "tailwind-merge";
|
|
536
550
|
|
|
537
551
|
// src/onboarding/common.ts
|
|
@@ -738,12 +752,19 @@ var worldAbi = parseAbi2([
|
|
|
738
752
|
]);
|
|
739
753
|
|
|
740
754
|
// src/onboarding/getDelegation.ts
|
|
741
|
-
async function getDelegation({
|
|
755
|
+
async function getDelegation({
|
|
756
|
+
client,
|
|
757
|
+
worldAddress,
|
|
758
|
+
userAddress,
|
|
759
|
+
sessionAddress,
|
|
760
|
+
// TODO: move everything to latest instead of pending
|
|
761
|
+
blockTag = "pending"
|
|
762
|
+
}) {
|
|
742
763
|
const record = await getRecord3(client, {
|
|
743
764
|
address: worldAddress,
|
|
744
765
|
table: worldTables.UserDelegationControl,
|
|
745
766
|
key: { delegator: userAddress, delegatee: sessionAddress },
|
|
746
|
-
blockTag
|
|
767
|
+
blockTag
|
|
747
768
|
});
|
|
748
769
|
return record.delegationControlId === unlimitedDelegationControlId;
|
|
749
770
|
}
|
|
@@ -826,7 +847,7 @@ async function getSessionAccount({
|
|
|
826
847
|
}) {
|
|
827
848
|
const signer = getSessionSigner(userAddress);
|
|
828
849
|
const account = await toSimpleSmartAccount({ client, owner: signer });
|
|
829
|
-
return account;
|
|
850
|
+
return { account, signer };
|
|
830
851
|
}
|
|
831
852
|
|
|
832
853
|
// src/useSessionAccount.ts
|
|
@@ -861,9 +882,9 @@ function getPrequisitesQueryOptions({
|
|
|
861
882
|
queryKey,
|
|
862
883
|
async queryFn() {
|
|
863
884
|
const paymaster = getPaymaster(client.chain);
|
|
864
|
-
const {
|
|
865
|
-
|
|
866
|
-
);
|
|
885
|
+
const {
|
|
886
|
+
account: { address: sessionAddress }
|
|
887
|
+
} = await queryClient.fetchQuery(getSessionAccountQueryOptions({ client, userAddress }));
|
|
867
888
|
const [sessionBalance, allowance, spender, hasDelegation] = await Promise.all([
|
|
868
889
|
!paymaster ? queryClient.fetchQuery(
|
|
869
890
|
getBalanceQueryOptions(config, { chainId: client.chain.id, address: sessionAddress })
|
|
@@ -992,10 +1013,10 @@ function removeError(error2) {
|
|
|
992
1013
|
}
|
|
993
1014
|
|
|
994
1015
|
// src/errors/useShowMutationError.ts
|
|
995
|
-
import { useEffect as
|
|
1016
|
+
import { useEffect as useEffect4 } from "react";
|
|
996
1017
|
function useShowMutationError(result) {
|
|
997
1018
|
const { error: error2, reset } = result;
|
|
998
|
-
|
|
1019
|
+
useEffect4(() => {
|
|
999
1020
|
if (!error2) return;
|
|
1000
1021
|
return addError({ error: error2, dismiss: reset });
|
|
1001
1022
|
}, [error2, reset]);
|
|
@@ -1130,13 +1151,13 @@ function Balance({ wei }) {
|
|
|
1130
1151
|
}
|
|
1131
1152
|
|
|
1132
1153
|
// src/onboarding/quarry/Allowance.tsx
|
|
1133
|
-
import { useEffect as
|
|
1154
|
+
import { useEffect as useEffect6 } from "react";
|
|
1134
1155
|
|
|
1135
1156
|
// src/errors/useShowQueryError.ts
|
|
1136
|
-
import { useEffect as
|
|
1157
|
+
import { useEffect as useEffect5 } from "react";
|
|
1137
1158
|
function useShowQueryError(result) {
|
|
1138
1159
|
const { error: error2, refetch } = result;
|
|
1139
|
-
|
|
1160
|
+
useEffect5(() => {
|
|
1140
1161
|
if (!error2) return;
|
|
1141
1162
|
return addError({ error: error2, retry: refetch, dismiss: () => {
|
|
1142
1163
|
} });
|
|
@@ -1149,7 +1170,7 @@ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
|
1149
1170
|
function Allowance({ isActive, isExpanded, userAddress }) {
|
|
1150
1171
|
const allowance = useShowQueryError(useAllowance(userAddress));
|
|
1151
1172
|
const claimGasPass2 = useShowMutationError(useClaimGasPass());
|
|
1152
|
-
|
|
1173
|
+
useEffect6(() => {
|
|
1153
1174
|
const timer = setTimeout(() => {
|
|
1154
1175
|
if (isActive && claimGasPass2.status === "idle" && allowance.isSuccess && allowance.data != null && allowance.data < minGasBalance) {
|
|
1155
1176
|
claimGasPass2.mutate(userAddress);
|
|
@@ -1376,7 +1397,7 @@ function useSetupSession({ userClient }) {
|
|
|
1376
1397
|
}
|
|
1377
1398
|
|
|
1378
1399
|
// src/onboarding/Session.tsx
|
|
1379
|
-
import { useEffect as
|
|
1400
|
+
import { useEffect as useEffect7 } from "react";
|
|
1380
1401
|
|
|
1381
1402
|
// src/useSessionClient.ts
|
|
1382
1403
|
import { useClient as useClient8 } from "wagmi";
|
|
@@ -1426,9 +1447,11 @@ function createFeeEstimator(client) {
|
|
|
1426
1447
|
}
|
|
1427
1448
|
|
|
1428
1449
|
// src/getSessionClient.ts
|
|
1450
|
+
import { internal_getFeeRef } from "@latticexyz/common";
|
|
1429
1451
|
async function getSessionClient({
|
|
1430
1452
|
userAddress,
|
|
1431
1453
|
sessionAccount,
|
|
1454
|
+
sessionSigner,
|
|
1432
1455
|
worldAddress
|
|
1433
1456
|
}) {
|
|
1434
1457
|
const client = sessionAccount.client;
|
|
@@ -1438,7 +1461,20 @@ async function getSessionClient({
|
|
|
1438
1461
|
const bundlerClient = createBundlerClient({
|
|
1439
1462
|
transport: getBundlerTransport(client.chain),
|
|
1440
1463
|
client,
|
|
1441
|
-
account: sessionAccount
|
|
1464
|
+
account: sessionAccount,
|
|
1465
|
+
userOperation: {
|
|
1466
|
+
estimateFeesPerGas: async ({ userOperation }) => {
|
|
1467
|
+
const { fees } = await internal_getFeeRef({ client, refreshInterval: 5e3 });
|
|
1468
|
+
if (fees.maxFeePerGas == null || fees.maxPriorityFeePerGas == null) {
|
|
1469
|
+
throw new Error("Unexpected undefined fee per gas");
|
|
1470
|
+
}
|
|
1471
|
+
console.log("estimated fees per gas", { fees, userOperation });
|
|
1472
|
+
return {
|
|
1473
|
+
maxFeePerGas: userOperation.maxFeePerGas ?? fees.maxFeePerGas,
|
|
1474
|
+
maxPriorityFeePerGas: userOperation.maxPriorityFeePerGas ?? fees.maxPriorityFeePerGas
|
|
1475
|
+
};
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1442
1478
|
});
|
|
1443
1479
|
const sessionClient = bundlerClient.extend(smartAccountActions).extend(
|
|
1444
1480
|
callFrom({
|
|
@@ -1446,7 +1482,7 @@ async function getSessionClient({
|
|
|
1446
1482
|
delegatorAddress: userAddress,
|
|
1447
1483
|
publicClient: client
|
|
1448
1484
|
})
|
|
1449
|
-
).extend(() => ({ userAddress }));
|
|
1485
|
+
).extend(() => ({ userAddress, worldAddress, internal_signer: sessionSigner }));
|
|
1450
1486
|
return sessionClient;
|
|
1451
1487
|
}
|
|
1452
1488
|
function clientHasChain(client) {
|
|
@@ -1465,9 +1501,12 @@ function getSessionClientQueryOptions({
|
|
|
1465
1501
|
userAddress ? {
|
|
1466
1502
|
queryKey,
|
|
1467
1503
|
async queryFn() {
|
|
1468
|
-
const sessionAccount = await queryClient.fetchQuery(
|
|
1504
|
+
const { account: sessionAccount, signer: sessionSigner } = await queryClient.fetchQuery(
|
|
1505
|
+
getSessionAccountQueryOptions({ client, userAddress })
|
|
1506
|
+
);
|
|
1469
1507
|
return await getSessionClient({
|
|
1470
1508
|
sessionAccount,
|
|
1509
|
+
sessionSigner,
|
|
1471
1510
|
userAddress,
|
|
1472
1511
|
worldAddress
|
|
1473
1512
|
});
|
|
@@ -1498,7 +1537,7 @@ function Session({ isActive, isExpanded, userClient, registerSpender, registerDe
|
|
|
1498
1537
|
const sessionClient = useShowQueryError(useSessionClient(userClient.account.address));
|
|
1499
1538
|
const setup = useShowMutationError(useSetupSession({ userClient }));
|
|
1500
1539
|
const hasSession = !registerDelegation && !registerDelegation;
|
|
1501
|
-
|
|
1540
|
+
useEffect7(() => {
|
|
1502
1541
|
const timer = setTimeout(() => {
|
|
1503
1542
|
if (isActive && setup.status === "idle" && sessionClient.data && !hasSession) {
|
|
1504
1543
|
setup.mutate({
|
|
@@ -1556,9 +1595,15 @@ var relayChains_default = {
|
|
|
1556
1595
|
"111": {
|
|
1557
1596
|
bridgeUrl: "https://testnets.relay.link/bridge/bob"
|
|
1558
1597
|
},
|
|
1598
|
+
"130": {
|
|
1599
|
+
bridgeUrl: "https://relay.link/bridge/unichain"
|
|
1600
|
+
},
|
|
1559
1601
|
"137": {
|
|
1560
1602
|
bridgeUrl: "https://relay.link/bridge/polygon"
|
|
1561
1603
|
},
|
|
1604
|
+
"146": {
|
|
1605
|
+
bridgeUrl: "https://relay.link/bridge/sonic"
|
|
1606
|
+
},
|
|
1562
1607
|
"185": {
|
|
1563
1608
|
bridgeUrl: "https://relay.link/bridge/mint"
|
|
1564
1609
|
},
|
|
@@ -1577,6 +1622,9 @@ var relayChains_default = {
|
|
|
1577
1622
|
"690": {
|
|
1578
1623
|
bridgeUrl: "https://relay.link/bridge/redstone"
|
|
1579
1624
|
},
|
|
1625
|
+
"747": {
|
|
1626
|
+
bridgeUrl: "https://relay.link/bridge/flow-evm"
|
|
1627
|
+
},
|
|
1580
1628
|
"919": {
|
|
1581
1629
|
bridgeUrl: "https://testnets.relay.link/bridge/mode-testnet"
|
|
1582
1630
|
},
|
|
@@ -1592,18 +1640,30 @@ var relayChains_default = {
|
|
|
1592
1640
|
"1329": {
|
|
1593
1641
|
bridgeUrl: "https://relay.link/bridge/sei"
|
|
1594
1642
|
},
|
|
1643
|
+
"1424": {
|
|
1644
|
+
bridgeUrl: "https://relay.link/bridge/perennial"
|
|
1645
|
+
},
|
|
1646
|
+
"1514": {
|
|
1647
|
+
bridgeUrl: "https://relay.link/bridge/story"
|
|
1648
|
+
},
|
|
1595
1649
|
"1625": {
|
|
1596
1650
|
bridgeUrl: "https://relay.link/bridge/gravity"
|
|
1597
1651
|
},
|
|
1598
1652
|
"1868": {
|
|
1599
1653
|
bridgeUrl: "https://relay.link/bridge/soneium"
|
|
1600
1654
|
},
|
|
1655
|
+
"1923": {
|
|
1656
|
+
bridgeUrl: "https://relay.link/bridge/swellchain"
|
|
1657
|
+
},
|
|
1601
1658
|
"1993": {
|
|
1602
1659
|
bridgeUrl: "https://testnets.relay.link/bridge/b3"
|
|
1603
1660
|
},
|
|
1604
1661
|
"1996": {
|
|
1605
1662
|
bridgeUrl: "https://relay.link/bridge/sanko"
|
|
1606
1663
|
},
|
|
1664
|
+
"2187": {
|
|
1665
|
+
bridgeUrl: "https://relay.link/bridge/game7"
|
|
1666
|
+
},
|
|
1607
1667
|
"2741": {
|
|
1608
1668
|
bridgeUrl: "https://relay.link/bridge/abstract"
|
|
1609
1669
|
},
|
|
@@ -1673,6 +1733,9 @@ var relayChains_default = {
|
|
|
1673
1733
|
"42170": {
|
|
1674
1734
|
bridgeUrl: "https://relay.link/bridge/arbitrum-nova"
|
|
1675
1735
|
},
|
|
1736
|
+
"42220": {
|
|
1737
|
+
bridgeUrl: "https://relay.link/bridge/celo"
|
|
1738
|
+
},
|
|
1676
1739
|
"43114": {
|
|
1677
1740
|
bridgeUrl: "https://relay.link/bridge/avalanche"
|
|
1678
1741
|
},
|
|
@@ -1703,12 +1766,18 @@ var relayChains_default = {
|
|
|
1703
1766
|
"80002": {
|
|
1704
1767
|
bridgeUrl: "https://testnets.relay.link/bridge/amoy"
|
|
1705
1768
|
},
|
|
1769
|
+
"80094": {
|
|
1770
|
+
bridgeUrl: "https://relay.link/bridge/berachain"
|
|
1771
|
+
},
|
|
1706
1772
|
"81457": {
|
|
1707
1773
|
bridgeUrl: "https://relay.link/bridge/blast"
|
|
1708
1774
|
},
|
|
1709
1775
|
"84532": {
|
|
1710
1776
|
bridgeUrl: "https://testnets.relay.link/bridge/base-sepolia"
|
|
1711
1777
|
},
|
|
1778
|
+
"167000": {
|
|
1779
|
+
bridgeUrl: "https://relay.link/bridge/taiko"
|
|
1780
|
+
},
|
|
1712
1781
|
"167009": {
|
|
1713
1782
|
bridgeUrl: "https://testnets.relay.link/bridge/hekla"
|
|
1714
1783
|
},
|
|
@@ -1724,6 +1793,9 @@ var relayChains_default = {
|
|
|
1724
1793
|
"660279": {
|
|
1725
1794
|
bridgeUrl: "https://relay.link/bridge/xai"
|
|
1726
1795
|
},
|
|
1796
|
+
"695569": {
|
|
1797
|
+
bridgeUrl: "https://testnets.relay.link/bridge/pyrope"
|
|
1798
|
+
},
|
|
1727
1799
|
"911867": {
|
|
1728
1800
|
bridgeUrl: "https://testnets.relay.link/bridge/odyssey"
|
|
1729
1801
|
},
|
|
@@ -1736,6 +1808,9 @@ var relayChains_default = {
|
|
|
1736
1808
|
"3397901": {
|
|
1737
1809
|
bridgeUrl: "https://testnets.relay.link/bridge/funki-testnet"
|
|
1738
1810
|
},
|
|
1811
|
+
"3441006": {
|
|
1812
|
+
bridgeUrl: "https://testnets.relay.link/bridge/manta-pacific-testnet"
|
|
1813
|
+
},
|
|
1739
1814
|
"4457845": {
|
|
1740
1815
|
bridgeUrl: "https://testnets.relay.link/bridge/zero-sepolia"
|
|
1741
1816
|
},
|
|
@@ -1763,6 +1838,9 @@ var relayChains_default = {
|
|
|
1763
1838
|
"792703809": {
|
|
1764
1839
|
bridgeUrl: "https://relay.link/bridge/solana"
|
|
1765
1840
|
},
|
|
1841
|
+
"845320008": {
|
|
1842
|
+
bridgeUrl: "https://testnets.relay.link/bridge/lordchain-testnet"
|
|
1843
|
+
},
|
|
1766
1844
|
"888888888": {
|
|
1767
1845
|
bridgeUrl: "https://relay.link/bridge/ancient8"
|
|
1768
1846
|
},
|
|
@@ -1874,7 +1952,7 @@ function ConnectedSteps({ userClient, initialUserAddress }) {
|
|
|
1874
1952
|
const paymaster = getPaymaster(chain);
|
|
1875
1953
|
const userAddress = userClient.account.address;
|
|
1876
1954
|
const { data: prerequisites, error: prerequisitesError } = usePrerequisites(userAddress);
|
|
1877
|
-
|
|
1955
|
+
useEffect8(() => {
|
|
1878
1956
|
if (prerequisitesError) {
|
|
1879
1957
|
console.error("Could not get prerequisites", prerequisitesError);
|
|
1880
1958
|
}
|
|
@@ -1882,7 +1960,7 @@ function ConnectedSteps({ userClient, initialUserAddress }) {
|
|
|
1882
1960
|
const { closeAccountModal } = useAccountModal();
|
|
1883
1961
|
const isNewConnection = userAddress !== initialUserAddress;
|
|
1884
1962
|
const initialPrerequisites = useRef2(prerequisites);
|
|
1885
|
-
|
|
1963
|
+
useEffect8(() => {
|
|
1886
1964
|
if (prerequisites == null) return;
|
|
1887
1965
|
if (initialPrerequisites.current == null) {
|
|
1888
1966
|
initialPrerequisites.current = prerequisites;
|
|
@@ -1971,7 +2049,7 @@ function AccountModalContent() {
|
|
|
1971
2049
|
}
|
|
1972
2050
|
|
|
1973
2051
|
// src/AccountModal.tsx
|
|
1974
|
-
import { DialogClose
|
|
2052
|
+
import { DialogClose } from "@radix-ui/react-dialog";
|
|
1975
2053
|
|
|
1976
2054
|
// src/icons/IconSVG.tsx
|
|
1977
2055
|
import { twMerge as twMerge8 } from "tailwind-merge";
|
|
@@ -2011,11 +2089,11 @@ import { ErrorBoundary } from "react-error-boundary";
|
|
|
2011
2089
|
|
|
2012
2090
|
// src/errors/ErrorOverlay.tsx
|
|
2013
2091
|
import { wait } from "@latticexyz/common/utils";
|
|
2014
|
-
import { useEffect as
|
|
2092
|
+
import { useEffect as useEffect9 } from "react";
|
|
2015
2093
|
import { twMerge as twMerge9 } from "tailwind-merge";
|
|
2016
2094
|
import { Fragment as Fragment2, jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2017
2095
|
function ErrorOverlay({ error: error2, retry, dismiss }) {
|
|
2018
|
-
|
|
2096
|
+
useEffect9(() => {
|
|
2019
2097
|
if (error2) {
|
|
2020
2098
|
console.error(error2);
|
|
2021
2099
|
}
|
|
@@ -2109,51 +2187,48 @@ function ErrorsOverlay() {
|
|
|
2109
2187
|
import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2110
2188
|
function AccountModal() {
|
|
2111
2189
|
const { accountModalOpen, toggleAccountModal } = useAccountModal();
|
|
2112
|
-
return /* @__PURE__ */
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2190
|
+
return /* @__PURE__ */ jsx24(Modal, { open: accountModalOpen, onOpenChange: toggleAccountModal, children: accountModalOpen ? /* @__PURE__ */ jsxs16(
|
|
2191
|
+
"div",
|
|
2192
|
+
{
|
|
2193
|
+
className: twMerge10(
|
|
2194
|
+
"relative py-2 ring-1",
|
|
2195
|
+
"bg-neutral-900 text-neutral-400 ring-neutral-700/50",
|
|
2196
|
+
"links:font-medium links:underline links:underline-offset-4",
|
|
2197
|
+
"links:text-white",
|
|
2198
|
+
"links:decoration-neutral-500 hover:links:decoration-orange-500"
|
|
2199
|
+
),
|
|
2200
|
+
children: [
|
|
2201
|
+
/* @__PURE__ */ jsxs16(ErrorBoundary, { FallbackComponent: ErrorFallback, children: [
|
|
2202
|
+
/* @__PURE__ */ jsx24(AccountModalContent, {}),
|
|
2203
|
+
/* @__PURE__ */ jsx24(ErrorsOverlay, {})
|
|
2204
|
+
] }),
|
|
2205
|
+
/* @__PURE__ */ jsxs16(
|
|
2206
|
+
"a",
|
|
2207
|
+
{
|
|
2208
|
+
href: "https://mud.dev",
|
|
2209
|
+
target: "_blank",
|
|
2210
|
+
rel: "noreferrer noopener",
|
|
2211
|
+
className: "group self-center p-3 flex items-center justify-center gap-2 links-unset text-sm font-mono transition text-neutral-400 hover:text-white",
|
|
2212
|
+
children: [
|
|
2213
|
+
/* @__PURE__ */ jsx24("span", { className: "block w-4 h-4", children: /* @__PURE__ */ jsx24(Logo, { className: "w-full h-full text-orange-500 group-hover:rotate-90 transition duration-300" }) }),
|
|
2214
|
+
/* @__PURE__ */ jsx24("span", { children: "Powered by MUD" })
|
|
2215
|
+
]
|
|
2216
|
+
}
|
|
2123
2217
|
),
|
|
2124
|
-
children:
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
/* @__PURE__ */ jsx24(ErrorsOverlay, {})
|
|
2139
|
-
] }),
|
|
2140
|
-
/* @__PURE__ */ jsxs16(
|
|
2141
|
-
"a",
|
|
2142
|
-
{
|
|
2143
|
-
href: "https://mud.dev",
|
|
2144
|
-
target: "_blank",
|
|
2145
|
-
rel: "noreferrer noopener",
|
|
2146
|
-
className: "group self-center p-3 flex items-center justify-center gap-2 links-unset text-sm font-mono transition text-neutral-400 hover:text-white",
|
|
2147
|
-
children: [
|
|
2148
|
-
/* @__PURE__ */ jsx24("span", { className: "block w-4 h-4", children: /* @__PURE__ */ jsx24(Logo, { className: "w-full h-full text-orange-500 group-hover:rotate-90 transition duration-300" }) }),
|
|
2149
|
-
/* @__PURE__ */ jsx24("span", { children: "Powered by MUD" })
|
|
2150
|
-
]
|
|
2151
|
-
}
|
|
2152
|
-
)
|
|
2153
|
-
]
|
|
2154
|
-
}
|
|
2155
|
-
) : null
|
|
2156
|
-
] });
|
|
2218
|
+
/* @__PURE__ */ jsx24("div", { className: "absolute top-0 right-0", children: /* @__PURE__ */ jsx24(
|
|
2219
|
+
DialogClose,
|
|
2220
|
+
{
|
|
2221
|
+
className: twMerge10(
|
|
2222
|
+
"pointer-events-auto leading-none p-2 transition",
|
|
2223
|
+
"text-white/20 hover:text-white/40"
|
|
2224
|
+
),
|
|
2225
|
+
title: "Close",
|
|
2226
|
+
children: /* @__PURE__ */ jsx24(CloseIcon, { className: "m-0" })
|
|
2227
|
+
}
|
|
2228
|
+
) })
|
|
2229
|
+
]
|
|
2230
|
+
}
|
|
2231
|
+
) : null });
|
|
2157
2232
|
}
|
|
2158
2233
|
|
|
2159
2234
|
// src/EntryKitProvider.tsx
|
|
@@ -2344,6 +2419,50 @@ function getConnectors({
|
|
|
2344
2419
|
projectId: config.walletConnectProjectId
|
|
2345
2420
|
});
|
|
2346
2421
|
}
|
|
2422
|
+
|
|
2423
|
+
// src/validateSigner.ts
|
|
2424
|
+
import { readContract } from "viem/actions";
|
|
2425
|
+
async function internal_validateSigner({
|
|
2426
|
+
client,
|
|
2427
|
+
worldAddress,
|
|
2428
|
+
userAddress,
|
|
2429
|
+
sessionAddress,
|
|
2430
|
+
signerAddress
|
|
2431
|
+
}) {
|
|
2432
|
+
const ownerAddress = await readContract(client, {
|
|
2433
|
+
address: sessionAddress,
|
|
2434
|
+
abi: simpleAccountAbi,
|
|
2435
|
+
functionName: "owner"
|
|
2436
|
+
});
|
|
2437
|
+
if (ownerAddress.toLowerCase() !== signerAddress.toLowerCase()) {
|
|
2438
|
+
throw new Error(`Session account owner (${ownerAddress}) does not match message signer (${signerAddress}).`);
|
|
2439
|
+
}
|
|
2440
|
+
const hasDelegation = await getDelegation({
|
|
2441
|
+
client,
|
|
2442
|
+
worldAddress,
|
|
2443
|
+
sessionAddress,
|
|
2444
|
+
userAddress,
|
|
2445
|
+
blockTag: "latest"
|
|
2446
|
+
});
|
|
2447
|
+
if (!hasDelegation) {
|
|
2448
|
+
throw new Error(`Session account (${sessionAddress}) does not have delegation for user account (${userAddress}).`);
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
var simpleAccountAbi = [
|
|
2452
|
+
{
|
|
2453
|
+
inputs: [],
|
|
2454
|
+
name: "owner",
|
|
2455
|
+
outputs: [
|
|
2456
|
+
{
|
|
2457
|
+
internalType: "address",
|
|
2458
|
+
name: "",
|
|
2459
|
+
type: "address"
|
|
2460
|
+
}
|
|
2461
|
+
],
|
|
2462
|
+
stateMutability: "view",
|
|
2463
|
+
type: "function"
|
|
2464
|
+
}
|
|
2465
|
+
];
|
|
2347
2466
|
export {
|
|
2348
2467
|
AccountButton,
|
|
2349
2468
|
EntryKitProvider,
|
|
@@ -2351,6 +2470,7 @@ export {
|
|
|
2351
2470
|
defineConfig,
|
|
2352
2471
|
getConnectors,
|
|
2353
2472
|
getWallets,
|
|
2473
|
+
internal_validateSigner,
|
|
2354
2474
|
useAccountModal,
|
|
2355
2475
|
useEntryKitConfig,
|
|
2356
2476
|
useSessionClientReady as useSessionClient
|