@latticexyz/entrykit 2.2.21-581228bd857077023efdb496a9a44fa62ff89936 → 2.2.21-6bdbc94fec997316fa5bea10015974a158de043d
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
|
}
|
|
@@ -797,7 +818,9 @@ function listener(event) {
|
|
|
797
818
|
store2.persist.rehydrate();
|
|
798
819
|
}
|
|
799
820
|
}
|
|
800
|
-
window
|
|
821
|
+
if (typeof window !== "undefined") {
|
|
822
|
+
window.addEventListener("storage", listener);
|
|
823
|
+
}
|
|
801
824
|
|
|
802
825
|
// src/getSessionSigner.ts
|
|
803
826
|
import { generatePrivateKey, privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
|
|
@@ -824,7 +847,7 @@ async function getSessionAccount({
|
|
|
824
847
|
}) {
|
|
825
848
|
const signer = getSessionSigner(userAddress);
|
|
826
849
|
const account = await toSimpleSmartAccount({ client, owner: signer });
|
|
827
|
-
return account;
|
|
850
|
+
return { account, signer };
|
|
828
851
|
}
|
|
829
852
|
|
|
830
853
|
// src/useSessionAccount.ts
|
|
@@ -859,9 +882,9 @@ function getPrequisitesQueryOptions({
|
|
|
859
882
|
queryKey,
|
|
860
883
|
async queryFn() {
|
|
861
884
|
const paymaster = getPaymaster(client.chain);
|
|
862
|
-
const {
|
|
863
|
-
|
|
864
|
-
);
|
|
885
|
+
const {
|
|
886
|
+
account: { address: sessionAddress }
|
|
887
|
+
} = await queryClient.fetchQuery(getSessionAccountQueryOptions({ client, userAddress }));
|
|
865
888
|
const [sessionBalance, allowance, spender, hasDelegation] = await Promise.all([
|
|
866
889
|
!paymaster ? queryClient.fetchQuery(
|
|
867
890
|
getBalanceQueryOptions(config, { chainId: client.chain.id, address: sessionAddress })
|
|
@@ -990,10 +1013,10 @@ function removeError(error2) {
|
|
|
990
1013
|
}
|
|
991
1014
|
|
|
992
1015
|
// src/errors/useShowMutationError.ts
|
|
993
|
-
import { useEffect as
|
|
1016
|
+
import { useEffect as useEffect4 } from "react";
|
|
994
1017
|
function useShowMutationError(result) {
|
|
995
1018
|
const { error: error2, reset } = result;
|
|
996
|
-
|
|
1019
|
+
useEffect4(() => {
|
|
997
1020
|
if (!error2) return;
|
|
998
1021
|
return addError({ error: error2, dismiss: reset });
|
|
999
1022
|
}, [error2, reset]);
|
|
@@ -1128,13 +1151,13 @@ function Balance({ wei }) {
|
|
|
1128
1151
|
}
|
|
1129
1152
|
|
|
1130
1153
|
// src/onboarding/quarry/Allowance.tsx
|
|
1131
|
-
import { useEffect as
|
|
1154
|
+
import { useEffect as useEffect6 } from "react";
|
|
1132
1155
|
|
|
1133
1156
|
// src/errors/useShowQueryError.ts
|
|
1134
|
-
import { useEffect as
|
|
1157
|
+
import { useEffect as useEffect5 } from "react";
|
|
1135
1158
|
function useShowQueryError(result) {
|
|
1136
1159
|
const { error: error2, refetch } = result;
|
|
1137
|
-
|
|
1160
|
+
useEffect5(() => {
|
|
1138
1161
|
if (!error2) return;
|
|
1139
1162
|
return addError({ error: error2, retry: refetch, dismiss: () => {
|
|
1140
1163
|
} });
|
|
@@ -1147,7 +1170,7 @@ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
|
1147
1170
|
function Allowance({ isActive, isExpanded, userAddress }) {
|
|
1148
1171
|
const allowance = useShowQueryError(useAllowance(userAddress));
|
|
1149
1172
|
const claimGasPass2 = useShowMutationError(useClaimGasPass());
|
|
1150
|
-
|
|
1173
|
+
useEffect6(() => {
|
|
1151
1174
|
const timer = setTimeout(() => {
|
|
1152
1175
|
if (isActive && claimGasPass2.status === "idle" && allowance.isSuccess && allowance.data != null && allowance.data < minGasBalance) {
|
|
1153
1176
|
claimGasPass2.mutate(userAddress);
|
|
@@ -1374,7 +1397,7 @@ function useSetupSession({ userClient }) {
|
|
|
1374
1397
|
}
|
|
1375
1398
|
|
|
1376
1399
|
// src/onboarding/Session.tsx
|
|
1377
|
-
import { useEffect as
|
|
1400
|
+
import { useEffect as useEffect7 } from "react";
|
|
1378
1401
|
|
|
1379
1402
|
// src/useSessionClient.ts
|
|
1380
1403
|
import { useClient as useClient8 } from "wagmi";
|
|
@@ -1427,6 +1450,7 @@ function createFeeEstimator(client) {
|
|
|
1427
1450
|
async function getSessionClient({
|
|
1428
1451
|
userAddress,
|
|
1429
1452
|
sessionAccount,
|
|
1453
|
+
sessionSigner,
|
|
1430
1454
|
worldAddress
|
|
1431
1455
|
}) {
|
|
1432
1456
|
const client = sessionAccount.client;
|
|
@@ -1444,7 +1468,7 @@ async function getSessionClient({
|
|
|
1444
1468
|
delegatorAddress: userAddress,
|
|
1445
1469
|
publicClient: client
|
|
1446
1470
|
})
|
|
1447
|
-
).extend(() => ({ userAddress }));
|
|
1471
|
+
).extend(() => ({ userAddress, worldAddress, internal_signer: sessionSigner }));
|
|
1448
1472
|
return sessionClient;
|
|
1449
1473
|
}
|
|
1450
1474
|
function clientHasChain(client) {
|
|
@@ -1463,9 +1487,12 @@ function getSessionClientQueryOptions({
|
|
|
1463
1487
|
userAddress ? {
|
|
1464
1488
|
queryKey,
|
|
1465
1489
|
async queryFn() {
|
|
1466
|
-
const sessionAccount = await queryClient.fetchQuery(
|
|
1490
|
+
const { account: sessionAccount, signer: sessionSigner } = await queryClient.fetchQuery(
|
|
1491
|
+
getSessionAccountQueryOptions({ client, userAddress })
|
|
1492
|
+
);
|
|
1467
1493
|
return await getSessionClient({
|
|
1468
1494
|
sessionAccount,
|
|
1495
|
+
sessionSigner,
|
|
1469
1496
|
userAddress,
|
|
1470
1497
|
worldAddress
|
|
1471
1498
|
});
|
|
@@ -1496,7 +1523,7 @@ function Session({ isActive, isExpanded, userClient, registerSpender, registerDe
|
|
|
1496
1523
|
const sessionClient = useShowQueryError(useSessionClient(userClient.account.address));
|
|
1497
1524
|
const setup = useShowMutationError(useSetupSession({ userClient }));
|
|
1498
1525
|
const hasSession = !registerDelegation && !registerDelegation;
|
|
1499
|
-
|
|
1526
|
+
useEffect7(() => {
|
|
1500
1527
|
const timer = setTimeout(() => {
|
|
1501
1528
|
if (isActive && setup.status === "idle" && sessionClient.data && !hasSession) {
|
|
1502
1529
|
setup.mutate({
|
|
@@ -1554,9 +1581,15 @@ var relayChains_default = {
|
|
|
1554
1581
|
"111": {
|
|
1555
1582
|
bridgeUrl: "https://testnets.relay.link/bridge/bob"
|
|
1556
1583
|
},
|
|
1584
|
+
"130": {
|
|
1585
|
+
bridgeUrl: "https://relay.link/bridge/unichain"
|
|
1586
|
+
},
|
|
1557
1587
|
"137": {
|
|
1558
1588
|
bridgeUrl: "https://relay.link/bridge/polygon"
|
|
1559
1589
|
},
|
|
1590
|
+
"146": {
|
|
1591
|
+
bridgeUrl: "https://relay.link/bridge/sonic"
|
|
1592
|
+
},
|
|
1560
1593
|
"185": {
|
|
1561
1594
|
bridgeUrl: "https://relay.link/bridge/mint"
|
|
1562
1595
|
},
|
|
@@ -1575,6 +1608,9 @@ var relayChains_default = {
|
|
|
1575
1608
|
"690": {
|
|
1576
1609
|
bridgeUrl: "https://relay.link/bridge/redstone"
|
|
1577
1610
|
},
|
|
1611
|
+
"747": {
|
|
1612
|
+
bridgeUrl: "https://relay.link/bridge/flow-evm"
|
|
1613
|
+
},
|
|
1578
1614
|
"919": {
|
|
1579
1615
|
bridgeUrl: "https://testnets.relay.link/bridge/mode-testnet"
|
|
1580
1616
|
},
|
|
@@ -1590,18 +1626,30 @@ var relayChains_default = {
|
|
|
1590
1626
|
"1329": {
|
|
1591
1627
|
bridgeUrl: "https://relay.link/bridge/sei"
|
|
1592
1628
|
},
|
|
1629
|
+
"1424": {
|
|
1630
|
+
bridgeUrl: "https://relay.link/bridge/perennial"
|
|
1631
|
+
},
|
|
1632
|
+
"1514": {
|
|
1633
|
+
bridgeUrl: "https://relay.link/bridge/story"
|
|
1634
|
+
},
|
|
1593
1635
|
"1625": {
|
|
1594
1636
|
bridgeUrl: "https://relay.link/bridge/gravity"
|
|
1595
1637
|
},
|
|
1596
1638
|
"1868": {
|
|
1597
1639
|
bridgeUrl: "https://relay.link/bridge/soneium"
|
|
1598
1640
|
},
|
|
1641
|
+
"1923": {
|
|
1642
|
+
bridgeUrl: "https://relay.link/bridge/swellchain"
|
|
1643
|
+
},
|
|
1599
1644
|
"1993": {
|
|
1600
1645
|
bridgeUrl: "https://testnets.relay.link/bridge/b3"
|
|
1601
1646
|
},
|
|
1602
1647
|
"1996": {
|
|
1603
1648
|
bridgeUrl: "https://relay.link/bridge/sanko"
|
|
1604
1649
|
},
|
|
1650
|
+
"2187": {
|
|
1651
|
+
bridgeUrl: "https://relay.link/bridge/game7"
|
|
1652
|
+
},
|
|
1605
1653
|
"2741": {
|
|
1606
1654
|
bridgeUrl: "https://relay.link/bridge/abstract"
|
|
1607
1655
|
},
|
|
@@ -1671,6 +1719,9 @@ var relayChains_default = {
|
|
|
1671
1719
|
"42170": {
|
|
1672
1720
|
bridgeUrl: "https://relay.link/bridge/arbitrum-nova"
|
|
1673
1721
|
},
|
|
1722
|
+
"42220": {
|
|
1723
|
+
bridgeUrl: "https://relay.link/bridge/celo"
|
|
1724
|
+
},
|
|
1674
1725
|
"43114": {
|
|
1675
1726
|
bridgeUrl: "https://relay.link/bridge/avalanche"
|
|
1676
1727
|
},
|
|
@@ -1701,12 +1752,18 @@ var relayChains_default = {
|
|
|
1701
1752
|
"80002": {
|
|
1702
1753
|
bridgeUrl: "https://testnets.relay.link/bridge/amoy"
|
|
1703
1754
|
},
|
|
1755
|
+
"80094": {
|
|
1756
|
+
bridgeUrl: "https://relay.link/bridge/berachain"
|
|
1757
|
+
},
|
|
1704
1758
|
"81457": {
|
|
1705
1759
|
bridgeUrl: "https://relay.link/bridge/blast"
|
|
1706
1760
|
},
|
|
1707
1761
|
"84532": {
|
|
1708
1762
|
bridgeUrl: "https://testnets.relay.link/bridge/base-sepolia"
|
|
1709
1763
|
},
|
|
1764
|
+
"167000": {
|
|
1765
|
+
bridgeUrl: "https://relay.link/bridge/taiko"
|
|
1766
|
+
},
|
|
1710
1767
|
"167009": {
|
|
1711
1768
|
bridgeUrl: "https://testnets.relay.link/bridge/hekla"
|
|
1712
1769
|
},
|
|
@@ -1722,6 +1779,9 @@ var relayChains_default = {
|
|
|
1722
1779
|
"660279": {
|
|
1723
1780
|
bridgeUrl: "https://relay.link/bridge/xai"
|
|
1724
1781
|
},
|
|
1782
|
+
"695569": {
|
|
1783
|
+
bridgeUrl: "https://testnets.relay.link/bridge/pyrope"
|
|
1784
|
+
},
|
|
1725
1785
|
"911867": {
|
|
1726
1786
|
bridgeUrl: "https://testnets.relay.link/bridge/odyssey"
|
|
1727
1787
|
},
|
|
@@ -1734,6 +1794,9 @@ var relayChains_default = {
|
|
|
1734
1794
|
"3397901": {
|
|
1735
1795
|
bridgeUrl: "https://testnets.relay.link/bridge/funki-testnet"
|
|
1736
1796
|
},
|
|
1797
|
+
"3441006": {
|
|
1798
|
+
bridgeUrl: "https://testnets.relay.link/bridge/manta-pacific-testnet"
|
|
1799
|
+
},
|
|
1737
1800
|
"4457845": {
|
|
1738
1801
|
bridgeUrl: "https://testnets.relay.link/bridge/zero-sepolia"
|
|
1739
1802
|
},
|
|
@@ -1761,6 +1824,9 @@ var relayChains_default = {
|
|
|
1761
1824
|
"792703809": {
|
|
1762
1825
|
bridgeUrl: "https://relay.link/bridge/solana"
|
|
1763
1826
|
},
|
|
1827
|
+
"845320008": {
|
|
1828
|
+
bridgeUrl: "https://testnets.relay.link/bridge/lordchain-testnet"
|
|
1829
|
+
},
|
|
1764
1830
|
"888888888": {
|
|
1765
1831
|
bridgeUrl: "https://relay.link/bridge/ancient8"
|
|
1766
1832
|
},
|
|
@@ -1872,7 +1938,7 @@ function ConnectedSteps({ userClient, initialUserAddress }) {
|
|
|
1872
1938
|
const paymaster = getPaymaster(chain);
|
|
1873
1939
|
const userAddress = userClient.account.address;
|
|
1874
1940
|
const { data: prerequisites, error: prerequisitesError } = usePrerequisites(userAddress);
|
|
1875
|
-
|
|
1941
|
+
useEffect8(() => {
|
|
1876
1942
|
if (prerequisitesError) {
|
|
1877
1943
|
console.error("Could not get prerequisites", prerequisitesError);
|
|
1878
1944
|
}
|
|
@@ -1880,7 +1946,7 @@ function ConnectedSteps({ userClient, initialUserAddress }) {
|
|
|
1880
1946
|
const { closeAccountModal } = useAccountModal();
|
|
1881
1947
|
const isNewConnection = userAddress !== initialUserAddress;
|
|
1882
1948
|
const initialPrerequisites = useRef2(prerequisites);
|
|
1883
|
-
|
|
1949
|
+
useEffect8(() => {
|
|
1884
1950
|
if (prerequisites == null) return;
|
|
1885
1951
|
if (initialPrerequisites.current == null) {
|
|
1886
1952
|
initialPrerequisites.current = prerequisites;
|
|
@@ -1969,7 +2035,7 @@ function AccountModalContent() {
|
|
|
1969
2035
|
}
|
|
1970
2036
|
|
|
1971
2037
|
// src/AccountModal.tsx
|
|
1972
|
-
import { DialogClose
|
|
2038
|
+
import { DialogClose } from "@radix-ui/react-dialog";
|
|
1973
2039
|
|
|
1974
2040
|
// src/icons/IconSVG.tsx
|
|
1975
2041
|
import { twMerge as twMerge8 } from "tailwind-merge";
|
|
@@ -2009,11 +2075,11 @@ import { ErrorBoundary } from "react-error-boundary";
|
|
|
2009
2075
|
|
|
2010
2076
|
// src/errors/ErrorOverlay.tsx
|
|
2011
2077
|
import { wait } from "@latticexyz/common/utils";
|
|
2012
|
-
import { useEffect as
|
|
2078
|
+
import { useEffect as useEffect9 } from "react";
|
|
2013
2079
|
import { twMerge as twMerge9 } from "tailwind-merge";
|
|
2014
2080
|
import { Fragment as Fragment2, jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2015
2081
|
function ErrorOverlay({ error: error2, retry, dismiss }) {
|
|
2016
|
-
|
|
2082
|
+
useEffect9(() => {
|
|
2017
2083
|
if (error2) {
|
|
2018
2084
|
console.error(error2);
|
|
2019
2085
|
}
|
|
@@ -2107,51 +2173,48 @@ function ErrorsOverlay() {
|
|
|
2107
2173
|
import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2108
2174
|
function AccountModal() {
|
|
2109
2175
|
const { accountModalOpen, toggleAccountModal } = useAccountModal();
|
|
2110
|
-
return /* @__PURE__ */
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2176
|
+
return /* @__PURE__ */ jsx24(Modal, { open: accountModalOpen, onOpenChange: toggleAccountModal, children: accountModalOpen ? /* @__PURE__ */ jsxs16(
|
|
2177
|
+
"div",
|
|
2178
|
+
{
|
|
2179
|
+
className: twMerge10(
|
|
2180
|
+
"relative py-2 ring-1",
|
|
2181
|
+
"bg-neutral-900 text-neutral-400 ring-neutral-700/50",
|
|
2182
|
+
"links:font-medium links:underline links:underline-offset-4",
|
|
2183
|
+
"links:text-white",
|
|
2184
|
+
"links:decoration-neutral-500 hover:links:decoration-orange-500"
|
|
2185
|
+
),
|
|
2186
|
+
children: [
|
|
2187
|
+
/* @__PURE__ */ jsxs16(ErrorBoundary, { FallbackComponent: ErrorFallback, children: [
|
|
2188
|
+
/* @__PURE__ */ jsx24(AccountModalContent, {}),
|
|
2189
|
+
/* @__PURE__ */ jsx24(ErrorsOverlay, {})
|
|
2190
|
+
] }),
|
|
2191
|
+
/* @__PURE__ */ jsxs16(
|
|
2192
|
+
"a",
|
|
2193
|
+
{
|
|
2194
|
+
href: "https://mud.dev",
|
|
2195
|
+
target: "_blank",
|
|
2196
|
+
rel: "noreferrer noopener",
|
|
2197
|
+
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",
|
|
2198
|
+
children: [
|
|
2199
|
+
/* @__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" }) }),
|
|
2200
|
+
/* @__PURE__ */ jsx24("span", { children: "Powered by MUD" })
|
|
2201
|
+
]
|
|
2202
|
+
}
|
|
2121
2203
|
),
|
|
2122
|
-
children:
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
/* @__PURE__ */ jsx24(ErrorsOverlay, {})
|
|
2137
|
-
] }),
|
|
2138
|
-
/* @__PURE__ */ jsxs16(
|
|
2139
|
-
"a",
|
|
2140
|
-
{
|
|
2141
|
-
href: "https://mud.dev",
|
|
2142
|
-
target: "_blank",
|
|
2143
|
-
rel: "noreferrer noopener",
|
|
2144
|
-
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",
|
|
2145
|
-
children: [
|
|
2146
|
-
/* @__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" }) }),
|
|
2147
|
-
/* @__PURE__ */ jsx24("span", { children: "Powered by MUD" })
|
|
2148
|
-
]
|
|
2149
|
-
}
|
|
2150
|
-
)
|
|
2151
|
-
]
|
|
2152
|
-
}
|
|
2153
|
-
) : null
|
|
2154
|
-
] });
|
|
2204
|
+
/* @__PURE__ */ jsx24("div", { className: "absolute top-0 right-0", children: /* @__PURE__ */ jsx24(
|
|
2205
|
+
DialogClose,
|
|
2206
|
+
{
|
|
2207
|
+
className: twMerge10(
|
|
2208
|
+
"pointer-events-auto leading-none p-2 transition",
|
|
2209
|
+
"text-white/20 hover:text-white/40"
|
|
2210
|
+
),
|
|
2211
|
+
title: "Close",
|
|
2212
|
+
children: /* @__PURE__ */ jsx24(CloseIcon, { className: "m-0" })
|
|
2213
|
+
}
|
|
2214
|
+
) })
|
|
2215
|
+
]
|
|
2216
|
+
}
|
|
2217
|
+
) : null });
|
|
2155
2218
|
}
|
|
2156
2219
|
|
|
2157
2220
|
// src/EntryKitProvider.tsx
|
|
@@ -2342,6 +2405,50 @@ function getConnectors({
|
|
|
2342
2405
|
projectId: config.walletConnectProjectId
|
|
2343
2406
|
});
|
|
2344
2407
|
}
|
|
2408
|
+
|
|
2409
|
+
// src/validateSigner.ts
|
|
2410
|
+
import { readContract } from "viem/actions";
|
|
2411
|
+
async function internal_validateSigner({
|
|
2412
|
+
client,
|
|
2413
|
+
worldAddress,
|
|
2414
|
+
userAddress,
|
|
2415
|
+
sessionAddress,
|
|
2416
|
+
signerAddress
|
|
2417
|
+
}) {
|
|
2418
|
+
const ownerAddress = await readContract(client, {
|
|
2419
|
+
address: sessionAddress,
|
|
2420
|
+
abi: simpleAccountAbi,
|
|
2421
|
+
functionName: "owner"
|
|
2422
|
+
});
|
|
2423
|
+
if (ownerAddress.toLowerCase() !== signerAddress.toLowerCase()) {
|
|
2424
|
+
throw new Error(`Session account owner (${ownerAddress}) does not match message signer (${signerAddress}).`);
|
|
2425
|
+
}
|
|
2426
|
+
const hasDelegation = await getDelegation({
|
|
2427
|
+
client,
|
|
2428
|
+
worldAddress,
|
|
2429
|
+
sessionAddress,
|
|
2430
|
+
userAddress,
|
|
2431
|
+
blockTag: "latest"
|
|
2432
|
+
});
|
|
2433
|
+
if (!hasDelegation) {
|
|
2434
|
+
throw new Error(`Session account (${sessionAddress}) does not have delegation for user account (${userAddress}).`);
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
var simpleAccountAbi = [
|
|
2438
|
+
{
|
|
2439
|
+
inputs: [],
|
|
2440
|
+
name: "owner",
|
|
2441
|
+
outputs: [
|
|
2442
|
+
{
|
|
2443
|
+
internalType: "address",
|
|
2444
|
+
name: "",
|
|
2445
|
+
type: "address"
|
|
2446
|
+
}
|
|
2447
|
+
],
|
|
2448
|
+
stateMutability: "view",
|
|
2449
|
+
type: "function"
|
|
2450
|
+
}
|
|
2451
|
+
];
|
|
2345
2452
|
export {
|
|
2346
2453
|
AccountButton,
|
|
2347
2454
|
EntryKitProvider,
|
|
@@ -2349,6 +2456,7 @@ export {
|
|
|
2349
2456
|
defineConfig,
|
|
2350
2457
|
getConnectors,
|
|
2351
2458
|
getWallets,
|
|
2459
|
+
internal_validateSigner,
|
|
2352
2460
|
useAccountModal,
|
|
2353
2461
|
useEntryKitConfig,
|
|
2354
2462
|
useSessionClientReady as useSessionClient
|