@orderly.network/wallet-connector-privy 3.0.0-beta.2 → 3.0.0-beta.4
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.
- package/dist/index.d.mts +15 -8
- package/dist/index.d.ts +15 -8
- package/dist/index.js +1325 -1086
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1210 -971
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var viemExport = require('viem');
|
|
4
4
|
var WagmiExport = require('wagmi');
|
|
5
5
|
var WagmiConnectorsExport = require('wagmi/connectors');
|
|
6
|
-
var
|
|
6
|
+
var React7 = require('react');
|
|
7
7
|
var chains = require('viem/chains');
|
|
8
8
|
var hooks = require('@orderly.network/hooks');
|
|
9
9
|
var types = require('@orderly.network/types');
|
|
@@ -12,6 +12,7 @@ var i18n = require('@orderly.network/i18n');
|
|
|
12
12
|
var agwReact = require('@abstract-foundation/agw-react');
|
|
13
13
|
var utils = require('@orderly.network/utils');
|
|
14
14
|
var walletAdapterBase = require('@solana/wallet-adapter-base');
|
|
15
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
15
16
|
var reactAuth = require('@privy-io/react-auth');
|
|
16
17
|
var walletAdapterReact = require('@solana/wallet-adapter-react');
|
|
17
18
|
var zustand = require('zustand');
|
|
@@ -42,7 +43,7 @@ function _interopNamespace(e) {
|
|
|
42
43
|
var viemExport__namespace = /*#__PURE__*/_interopNamespace(viemExport);
|
|
43
44
|
var WagmiExport__namespace = /*#__PURE__*/_interopNamespace(WagmiExport);
|
|
44
45
|
var WagmiConnectorsExport__namespace = /*#__PURE__*/_interopNamespace(WagmiConnectorsExport);
|
|
45
|
-
var
|
|
46
|
+
var React7__default = /*#__PURE__*/_interopDefault(React7);
|
|
46
47
|
|
|
47
48
|
// src/index.ts
|
|
48
49
|
var Network = /* @__PURE__ */ ((Network3) => {
|
|
@@ -83,15 +84,13 @@ var WalletChainTypeEnum = /* @__PURE__ */ ((WalletChainTypeEnum2) => {
|
|
|
83
84
|
WalletChainTypeEnum2["EVM_SOL"] = "EVM_SOL";
|
|
84
85
|
return WalletChainTypeEnum2;
|
|
85
86
|
})(WalletChainTypeEnum || {});
|
|
86
|
-
|
|
87
|
-
// src/providers/abstractWallet/abstractWalletProvider.tsx
|
|
88
|
-
var AbstractWalletContext = React19.createContext(
|
|
87
|
+
var AbstractWalletContext = React7.createContext(
|
|
89
88
|
null
|
|
90
89
|
);
|
|
91
90
|
var AbstractWalletProvider = (props) => {
|
|
92
91
|
const { network } = useWalletConnectorPrivy();
|
|
93
92
|
const { login, logout } = agwReact.useLoginWithAbstract();
|
|
94
|
-
const [wallet, setWallet] =
|
|
93
|
+
const [wallet, setWallet] = React7.useState(null);
|
|
95
94
|
const { data: client, isLoading: isClientLoading } = agwReact.useAbstractClient();
|
|
96
95
|
const { connector } = WagmiExport.useAccount();
|
|
97
96
|
const { address, status } = agwReact.useGlobalWalletSignerAccount();
|
|
@@ -101,10 +100,10 @@ var AbstractWalletProvider = (props) => {
|
|
|
101
100
|
const disconnect = () => {
|
|
102
101
|
return logout();
|
|
103
102
|
};
|
|
104
|
-
const isConnected =
|
|
103
|
+
const isConnected = React7.useMemo(() => {
|
|
105
104
|
return !!(client && connector);
|
|
106
105
|
}, [client, connector]);
|
|
107
|
-
const connectedChain =
|
|
106
|
+
const connectedChain = React7.useMemo(() => {
|
|
108
107
|
if (!client || !connector) {
|
|
109
108
|
return;
|
|
110
109
|
}
|
|
@@ -113,7 +112,7 @@ var AbstractWalletProvider = (props) => {
|
|
|
113
112
|
namespace: types.ChainNamespace.evm
|
|
114
113
|
};
|
|
115
114
|
}, [client, connector]);
|
|
116
|
-
const value =
|
|
115
|
+
const value = React7.useMemo(
|
|
117
116
|
() => ({
|
|
118
117
|
isConnected,
|
|
119
118
|
connect,
|
|
@@ -123,7 +122,7 @@ var AbstractWalletProvider = (props) => {
|
|
|
123
122
|
}),
|
|
124
123
|
[connect, disconnect, isConnected, wallet, connectedChain]
|
|
125
124
|
);
|
|
126
|
-
|
|
125
|
+
React7.useEffect(() => {
|
|
127
126
|
if (!client || !connector || !address) {
|
|
128
127
|
setWallet(null);
|
|
129
128
|
return;
|
|
@@ -161,7 +160,7 @@ var AbstractWalletProvider = (props) => {
|
|
|
161
160
|
setWallet(tempWallet);
|
|
162
161
|
});
|
|
163
162
|
}, [client, connectedChain, connector, address, isClientLoading]);
|
|
164
|
-
|
|
163
|
+
React7.useEffect(() => {
|
|
165
164
|
utils.windowGuard(() => {
|
|
166
165
|
const connection = localStorage.getItem(
|
|
167
166
|
"privy-caw:cm04asygd041fmry9zmcyn5o5:connection"
|
|
@@ -171,10 +170,10 @@ var AbstractWalletProvider = (props) => {
|
|
|
171
170
|
}
|
|
172
171
|
});
|
|
173
172
|
}, []);
|
|
174
|
-
return /* @__PURE__ */
|
|
173
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AbstractWalletContext.Provider, { value, children: props.children });
|
|
175
174
|
};
|
|
176
175
|
function useAbstractWallet() {
|
|
177
|
-
const context =
|
|
176
|
+
const context = React7.useContext(AbstractWalletContext);
|
|
178
177
|
if (!context) {
|
|
179
178
|
throw new Error(
|
|
180
179
|
"useAbstractWallet must be used within a AbstractWalletProvider"
|
|
@@ -205,15 +204,15 @@ var defaultPrivyWalletContextValue = {
|
|
|
205
204
|
},
|
|
206
205
|
disconnect: () => Promise.resolve()
|
|
207
206
|
};
|
|
208
|
-
var PrivyWalletContext =
|
|
207
|
+
var PrivyWalletContext = React7.createContext(null);
|
|
209
208
|
var PrivyWalletProvider = ({
|
|
210
209
|
children
|
|
211
210
|
}) => {
|
|
212
211
|
const { connectorWalletType } = useWalletConnectorPrivy();
|
|
213
212
|
if (connectorWalletType.disablePrivy) {
|
|
214
|
-
return /* @__PURE__ */
|
|
213
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PrivyWalletContext.Provider, { value: defaultPrivyWalletContextValue, children });
|
|
215
214
|
}
|
|
216
|
-
return /* @__PURE__ */
|
|
215
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PrivyWalletProviderInner, { children });
|
|
217
216
|
};
|
|
218
217
|
var PrivyWalletProviderInner = ({
|
|
219
218
|
children
|
|
@@ -229,17 +228,17 @@ var PrivyWalletProviderInner = ({
|
|
|
229
228
|
createWallet: createEvmWallet
|
|
230
229
|
} = reactAuth.usePrivy();
|
|
231
230
|
const { wallets: walletsEVM } = reactAuth.useWallets();
|
|
232
|
-
const connectedRef =
|
|
231
|
+
const connectedRef = React7.useRef(false);
|
|
233
232
|
const {
|
|
234
233
|
ready: solanaReady,
|
|
235
234
|
wallets: walletsSOL,
|
|
236
235
|
createWallet: createSolanaWallet,
|
|
237
236
|
exportWallet: exportSolanaWallet
|
|
238
237
|
} = reactAuth.useSolanaWallets();
|
|
239
|
-
const [walletEVM, setWalletEVM] =
|
|
240
|
-
const [walletSOL, setWalletSOL] =
|
|
241
|
-
const [allWalletsEVM, setAllWalletsEVM] =
|
|
242
|
-
const [allWalletsSOL, setAllWalletsSOL] =
|
|
238
|
+
const [walletEVM, setWalletEVM] = React7.useState(null);
|
|
239
|
+
const [walletSOL, setWalletSOL] = React7.useState(null);
|
|
240
|
+
const [allWalletsEVM, setAllWalletsEVM] = React7.useState([]);
|
|
241
|
+
const [allWalletsSOL, setAllWalletsSOL] = React7.useState([]);
|
|
243
242
|
const [selectedEvmAddress, setSelectedEvmAddress] = hooks.useLocalStorage(
|
|
244
243
|
"privy_selected_evm_address",
|
|
245
244
|
""
|
|
@@ -248,9 +247,9 @@ var PrivyWalletProviderInner = ({
|
|
|
248
247
|
"privy_selected_sol_address",
|
|
249
248
|
""
|
|
250
249
|
);
|
|
251
|
-
const rawEvmWalletsRef =
|
|
250
|
+
const rawEvmWalletsRef = React7.useRef(/* @__PURE__ */ new Map());
|
|
252
251
|
const { track } = hooks.useTrack();
|
|
253
|
-
const linkedAccount =
|
|
252
|
+
const linkedAccount = React7.useMemo(() => {
|
|
254
253
|
const account = user?.linkedAccounts?.filter((item) => item.type !== "wallet" && item.type !== "smart_wallet").sort(
|
|
255
254
|
(a, b) => (b.latestVerifiedAt?.getTime() ?? 0) - (a.latestVerifiedAt?.getTime() ?? 0)
|
|
256
255
|
)[0];
|
|
@@ -310,7 +309,7 @@ var PrivyWalletProviderInner = ({
|
|
|
310
309
|
}
|
|
311
310
|
return Promise.reject("no namespace");
|
|
312
311
|
};
|
|
313
|
-
const selectWallet =
|
|
312
|
+
const selectWallet = React7.useCallback(
|
|
314
313
|
(namespace, address) => {
|
|
315
314
|
if (namespace === types.ChainNamespace.evm) {
|
|
316
315
|
const found = allWalletsEVM.find(
|
|
@@ -337,13 +336,13 @@ var PrivyWalletProviderInner = ({
|
|
|
337
336
|
setSelectedSolAddress
|
|
338
337
|
]
|
|
339
338
|
);
|
|
340
|
-
const isConnected =
|
|
339
|
+
const isConnected = React7.useMemo(() => {
|
|
341
340
|
if (ready && authenticated) {
|
|
342
341
|
return true;
|
|
343
342
|
}
|
|
344
343
|
return false;
|
|
345
344
|
}, [ready, authenticated]);
|
|
346
|
-
|
|
345
|
+
React7.useEffect(() => {
|
|
347
346
|
if (!authenticated || !walletsEVM || !walletsEVM[0]) {
|
|
348
347
|
setAllWalletsEVM([]);
|
|
349
348
|
setWalletEVM(null);
|
|
@@ -390,7 +389,7 @@ var PrivyWalletProviderInner = ({
|
|
|
390
389
|
setWalletEVM(null);
|
|
391
390
|
});
|
|
392
391
|
}, [walletsEVM, authenticated]);
|
|
393
|
-
|
|
392
|
+
React7.useEffect(() => {
|
|
394
393
|
if (!authenticated) {
|
|
395
394
|
setAllWalletsSOL([]);
|
|
396
395
|
setWalletSOL(null);
|
|
@@ -436,7 +435,7 @@ var PrivyWalletProviderInner = ({
|
|
|
436
435
|
const preferred = selectedSolAddress ? builtWallets.find((w) => w.accounts[0]?.address === selectedSolAddress) : void 0;
|
|
437
436
|
setWalletSOL(preferred ?? builtWallets[0] ?? null);
|
|
438
437
|
}, [walletsSOL, authenticated, solanaReady, network, solanaInfo]);
|
|
439
|
-
|
|
438
|
+
React7.useEffect(() => {
|
|
440
439
|
if (isConnected && linkedAccount) {
|
|
441
440
|
if (connectedRef.current) {
|
|
442
441
|
return;
|
|
@@ -448,7 +447,7 @@ var PrivyWalletProviderInner = ({
|
|
|
448
447
|
});
|
|
449
448
|
}
|
|
450
449
|
}, [isConnected, linkedAccount, connectedRef]);
|
|
451
|
-
const value =
|
|
450
|
+
const value = React7.useMemo(
|
|
452
451
|
() => ({
|
|
453
452
|
connect,
|
|
454
453
|
walletEVM,
|
|
@@ -480,10 +479,10 @@ var PrivyWalletProviderInner = ({
|
|
|
480
479
|
selectWallet
|
|
481
480
|
]
|
|
482
481
|
);
|
|
483
|
-
return /* @__PURE__ */
|
|
482
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PrivyWalletContext.Provider, { value, children });
|
|
484
483
|
};
|
|
485
484
|
function usePrivyWallet() {
|
|
486
|
-
const context =
|
|
485
|
+
const context = React7.useContext(PrivyWalletContext);
|
|
487
486
|
if (!context) {
|
|
488
487
|
throw new Error("usePrivyWallet must be used within a PrivyWalletProvider");
|
|
489
488
|
}
|
|
@@ -594,8 +593,6 @@ var useSolanaWalletStore = zustand.create((set, get) => ({
|
|
|
594
593
|
setWalletMethods: (methods) => set({ walletMethods: methods }),
|
|
595
594
|
setPendingWalletName: (name) => set({ pendingWalletName: name })
|
|
596
595
|
}));
|
|
597
|
-
|
|
598
|
-
// src/providers/solana/solanaWalletProvider.tsx
|
|
599
596
|
var defaultUseSolanaWallet = {
|
|
600
597
|
wallets: [],
|
|
601
598
|
select: () => Promise.resolve(),
|
|
@@ -608,7 +605,7 @@ var defaultUseSolanaWallet = {
|
|
|
608
605
|
sendTransaction: () => Promise.resolve(),
|
|
609
606
|
disconnect: () => Promise.resolve()
|
|
610
607
|
};
|
|
611
|
-
var SolanaWalletContext =
|
|
608
|
+
var SolanaWalletContext = React7.createContext(
|
|
612
609
|
null
|
|
613
610
|
);
|
|
614
611
|
var SolanaWalletProvider = ({
|
|
@@ -636,7 +633,7 @@ var SolanaWalletProvider = ({
|
|
|
636
633
|
setWalletMethods,
|
|
637
634
|
isManual
|
|
638
635
|
} = useSolanaWalletStore();
|
|
639
|
-
|
|
636
|
+
React7.useEffect(() => {
|
|
640
637
|
if (!walletSolana || isManual) return;
|
|
641
638
|
if (!publicKey) {
|
|
642
639
|
return;
|
|
@@ -680,7 +677,7 @@ var SolanaWalletProvider = ({
|
|
|
680
677
|
solanaInfo,
|
|
681
678
|
isManual
|
|
682
679
|
]);
|
|
683
|
-
|
|
680
|
+
React7.useEffect(() => {
|
|
684
681
|
setWalletMethods({
|
|
685
682
|
select,
|
|
686
683
|
connectSolana,
|
|
@@ -707,7 +704,7 @@ var SolanaWalletProvider = ({
|
|
|
707
704
|
network,
|
|
708
705
|
solanaInfo
|
|
709
706
|
]);
|
|
710
|
-
const dedupedWallets =
|
|
707
|
+
const dedupedWallets = React7.useMemo(() => {
|
|
711
708
|
const seen = /* @__PURE__ */ new Set();
|
|
712
709
|
return wallets.filter((w) => {
|
|
713
710
|
const name = w?.adapter?.name?.toLowerCase?.();
|
|
@@ -716,7 +713,7 @@ var SolanaWalletProvider = ({
|
|
|
716
713
|
return true;
|
|
717
714
|
});
|
|
718
715
|
}, [wallets]);
|
|
719
|
-
const value =
|
|
716
|
+
const value = React7.useMemo(
|
|
720
717
|
() => ({
|
|
721
718
|
wallets: dedupedWallets,
|
|
722
719
|
connectedChain: publicKey ? {
|
|
@@ -730,10 +727,10 @@ var SolanaWalletProvider = ({
|
|
|
730
727
|
}),
|
|
731
728
|
[dedupedWallets, publicKey, wallet, network]
|
|
732
729
|
);
|
|
733
|
-
return /* @__PURE__ */
|
|
730
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SolanaWalletContext.Provider, { value, children });
|
|
734
731
|
};
|
|
735
732
|
function useSolanaWallet() {
|
|
736
|
-
const context =
|
|
733
|
+
const context = React7.useContext(SolanaWalletContext);
|
|
737
734
|
if (!context) {
|
|
738
735
|
throw new Error(
|
|
739
736
|
"useSolanaWallet must be used within a SolanaWalletProvider"
|
|
@@ -741,17 +738,17 @@ function useSolanaWallet() {
|
|
|
741
738
|
}
|
|
742
739
|
return context;
|
|
743
740
|
}
|
|
744
|
-
var WagmiWalletContext =
|
|
741
|
+
var WagmiWalletContext = React7.createContext(null);
|
|
745
742
|
var WagmiWalletProvider = ({
|
|
746
743
|
children
|
|
747
744
|
}) => {
|
|
748
745
|
const { connectorWalletType } = useWalletConnectorPrivy();
|
|
749
|
-
const [wallet, setWallet] =
|
|
746
|
+
const [wallet, setWallet] = React7.useState(void 0);
|
|
750
747
|
const { connect, connectors: wagmiConnectors2 } = connectorWalletType.disableWagmi ? { connect: () => Promise.resolve(), connectors: [] } : WagmiExport.useConnect();
|
|
751
748
|
const { disconnect } = connectorWalletType.disableWagmi ? { disconnect: () => Promise.resolve() } : WagmiExport.useDisconnect();
|
|
752
749
|
const { connector, isConnected, address, chainId } = connectorWalletType.disableWagmi ? { connector: null, isConnected: false, address: null, chainId: null } : WagmiExport.useAccount();
|
|
753
750
|
const { switchChain } = connectorWalletType.disableWagmi ? { switchChain: () => Promise.resolve() } : WagmiExport.useSwitchChain();
|
|
754
|
-
const connectedChain =
|
|
751
|
+
const connectedChain = React7.useMemo(() => {
|
|
755
752
|
if (chainId) {
|
|
756
753
|
return {
|
|
757
754
|
id: chainId,
|
|
@@ -760,7 +757,7 @@ var WagmiWalletProvider = ({
|
|
|
760
757
|
}
|
|
761
758
|
return null;
|
|
762
759
|
}, [chainId]);
|
|
763
|
-
const setChain =
|
|
760
|
+
const setChain = React7.useCallback(
|
|
764
761
|
(chainId2) => {
|
|
765
762
|
return new Promise((resolve, reject) => {
|
|
766
763
|
switchChain(
|
|
@@ -776,7 +773,7 @@ var WagmiWalletProvider = ({
|
|
|
776
773
|
},
|
|
777
774
|
[switchChain]
|
|
778
775
|
);
|
|
779
|
-
|
|
776
|
+
React7.useEffect(() => {
|
|
780
777
|
if (!connector || !isConnected) {
|
|
781
778
|
setWallet(void 0);
|
|
782
779
|
return;
|
|
@@ -801,12 +798,12 @@ var WagmiWalletProvider = ({
|
|
|
801
798
|
});
|
|
802
799
|
});
|
|
803
800
|
}, [connector, chainId, isConnected, address, connectedChain]);
|
|
804
|
-
const connectors =
|
|
801
|
+
const connectors = React7.useMemo(() => {
|
|
805
802
|
return wagmiConnectors2.filter((connector2) => connector2.id !== "injected").sort(
|
|
806
803
|
(a, b) => a.type === "injected" ? -1 : 1
|
|
807
804
|
);
|
|
808
805
|
}, [wagmiConnectors2]);
|
|
809
|
-
const value =
|
|
806
|
+
const value = React7.useMemo(
|
|
810
807
|
() => ({
|
|
811
808
|
connectors,
|
|
812
809
|
connect,
|
|
@@ -826,16 +823,16 @@ var WagmiWalletProvider = ({
|
|
|
826
823
|
isConnected
|
|
827
824
|
]
|
|
828
825
|
);
|
|
829
|
-
return /* @__PURE__ */
|
|
826
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WagmiWalletContext.Provider, { value, children });
|
|
830
827
|
};
|
|
831
828
|
function useWagmiWallet() {
|
|
832
|
-
const context =
|
|
829
|
+
const context = React7.useContext(WagmiWalletContext);
|
|
833
830
|
if (!context) {
|
|
834
831
|
throw new Error("useWagmiWallet must be used within a WagmiWalletProvider");
|
|
835
832
|
}
|
|
836
833
|
return context;
|
|
837
834
|
}
|
|
838
|
-
var MoreIcon = (props) => /* @__PURE__ */
|
|
835
|
+
var MoreIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
839
836
|
"svg",
|
|
840
837
|
{
|
|
841
838
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -843,13 +840,15 @@ var MoreIcon = (props) => /* @__PURE__ */ React19__default.default.createElement
|
|
|
843
840
|
height: "16",
|
|
844
841
|
viewBox: "0 0 16 16",
|
|
845
842
|
fill: "currentColor",
|
|
846
|
-
...props
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
843
|
+
...props,
|
|
844
|
+
children: [
|
|
845
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.00521 6.66797C8.74161 6.66797 9.33854 7.26464 9.33854 8.0013C9.33854 8.73797 8.74161 9.33464 8.00521 9.33464C7.26881 9.33464 6.67188 8.73797 6.67188 8.0013C6.67188 7.26464 7.26881 6.66797 8.00521 6.66797Z" }),
|
|
846
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.33333 6.66797C4.06973 6.66797 4.66667 7.26464 4.66667 8.0013C4.66667 8.73797 4.06973 9.33464 3.33333 9.33464C2.59693 9.33464 2 8.73797 2 8.0013C2 7.26464 2.59693 6.66797 3.33333 6.66797Z" }),
|
|
847
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12.6666 6.66797C13.403 6.66797 14 7.26464 14 8.0013C14 8.73797 13.403 9.33464 12.6666 9.33464C11.9302 9.33464 11.3333 8.73797 11.3333 8.0013C11.3333 7.26464 11.9302 6.66797 12.6666 6.66797Z" })
|
|
848
|
+
]
|
|
849
|
+
}
|
|
851
850
|
);
|
|
852
|
-
var DisconnectIcon = (props) => /* @__PURE__ */
|
|
851
|
+
var DisconnectIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
853
852
|
"svg",
|
|
854
853
|
{
|
|
855
854
|
width: "16",
|
|
@@ -857,17 +856,17 @@ var DisconnectIcon = (props) => /* @__PURE__ */ React19__default.default.createE
|
|
|
857
856
|
viewBox: "0 0 16 16",
|
|
858
857
|
xmlns: "http://www.w3.org/2000/svg",
|
|
859
858
|
fill: "currentColor",
|
|
860
|
-
...props
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
}
|
|
868
|
-
|
|
859
|
+
...props,
|
|
860
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("g", { id: "box-arrow-right", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
861
|
+
"path",
|
|
862
|
+
{
|
|
863
|
+
id: "Vector",
|
|
864
|
+
d: "M1.99365 4.66056C1.99365 3.1879 3.18759 1.9939 4.66032 1.9939H7.32698C8.79965 1.9939 9.99365 3.1879 9.99365 4.66056C9.99365 5.02856 9.69498 5.32723 9.32698 5.32723C8.95898 5.32723 8.66032 5.02856 8.66032 4.66056C8.66032 3.92389 8.06365 3.32723 7.32698 3.32723H4.66032C3.92392 3.32723 3.32699 3.92389 3.32699 4.66056V11.3272C3.32699 12.0639 3.92392 12.6606 4.66032 12.6606H7.32698C8.06365 12.6606 8.66032 12.0639 8.66032 11.3272C8.66032 10.9592 8.95898 10.6606 9.32698 10.6606C9.69498 10.6606 9.99365 10.9592 9.99365 11.3272C9.99365 12.7999 8.79965 13.9939 7.32698 13.9939H4.66032C3.18759 13.9939 1.99365 12.7999 1.99365 11.3272V4.66056ZM6.66032 7.99389C6.66032 7.62589 6.95898 7.32722 7.32698 7.32722H12.369L11.0563 5.99389L11.9937 5.05656L14.473 7.51456C14.733 7.77523 14.733 8.21255 14.473 8.47322L11.9937 10.9312L11.0563 9.99389L12.369 8.66056H7.32698C6.95898 8.66056 6.66032 8.36189 6.66032 7.99389Z"
|
|
865
|
+
}
|
|
866
|
+
) })
|
|
867
|
+
}
|
|
869
868
|
);
|
|
870
|
-
var ArrowRightIcon = ({ size, ...props }) => /* @__PURE__ */
|
|
869
|
+
var ArrowRightIcon = ({ size, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
871
870
|
"svg",
|
|
872
871
|
{
|
|
873
872
|
width: size,
|
|
@@ -875,106 +874,125 @@ var ArrowRightIcon = ({ size, ...props }) => /* @__PURE__ */ React19__default.de
|
|
|
875
874
|
viewBox: "0 0 14 14",
|
|
876
875
|
fill: "currentColor",
|
|
877
876
|
xmlns: "http://www.w3.org/2000/svg",
|
|
878
|
-
...props
|
|
879
|
-
|
|
880
|
-
|
|
877
|
+
...props,
|
|
878
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.50696 6.9958C3.50696 6.6738 3.76788 6.41305 4.08971 6.41305C4.36842 6.41305 7.62762 6.41305 8.49679 6.41305L6.76662 4.6648L7.58621 3.84521L10.336 6.57697C10.4504 6.69072 10.507 6.84355 10.507 6.99639C10.507 7.14864 10.4498 7.30089 10.336 7.41464L7.58621 10.1464L6.76662 9.3268L8.49679 7.57854C7.62762 7.57854 4.36842 7.57854 4.08971 7.57854C3.76788 7.57854 3.50696 7.3178 3.50696 6.9958Z" })
|
|
879
|
+
}
|
|
881
880
|
);
|
|
882
881
|
var ArrowRightLinearGradientIcon = ({
|
|
883
882
|
size,
|
|
884
883
|
...props
|
|
885
|
-
}) => /* @__PURE__ */
|
|
884
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
886
885
|
"svg",
|
|
887
886
|
{
|
|
888
887
|
xmlns: "http://www.w3.org/2000/svg",
|
|
889
888
|
width: size,
|
|
890
889
|
height: size,
|
|
891
890
|
viewBox: "0 0 20 20",
|
|
892
|
-
fill: "none"
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
891
|
+
fill: "none",
|
|
892
|
+
children: [
|
|
893
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
894
|
+
"path",
|
|
895
|
+
{
|
|
896
|
+
d: "M5.01001 9.994C5.01001 9.534 5.38276 9.1615 5.84251 9.1615C6.24068 9.1615 10.8967 9.1615 12.1383 9.1615L9.66667 6.664L10.8375 5.49316L14.7658 9.39568C14.9292 9.55818 15.01 9.7765 15.01 9.99484C15.01 10.2123 14.9283 10.4298 14.7658 10.5923L10.8375 14.4948L9.66667 13.324L12.1383 10.8265C10.8967 10.8265 6.24068 10.8265 5.84251 10.8265C5.38276 10.8265 5.01001 10.454 5.01001 9.994Z",
|
|
897
|
+
fill: "url(#paint0_linear_2269_12077)"
|
|
898
|
+
}
|
|
899
|
+
),
|
|
900
|
+
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
901
|
+
"linearGradient",
|
|
902
|
+
{
|
|
903
|
+
id: "paint0_linear_2269_12077",
|
|
904
|
+
x1: "15.01",
|
|
905
|
+
y1: "9.994",
|
|
906
|
+
x2: "5.01001",
|
|
907
|
+
y2: "9.994",
|
|
908
|
+
gradientUnits: "userSpaceOnUse",
|
|
909
|
+
children: [
|
|
910
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "rgb(var(--oui-gradient-brand-end))" }),
|
|
911
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "rgb(var(--oui-gradient-brand-start))" })
|
|
912
|
+
]
|
|
913
|
+
}
|
|
914
|
+
) })
|
|
915
|
+
]
|
|
916
|
+
}
|
|
914
917
|
);
|
|
915
918
|
var PwaDialog = ui.modal.create((props) => {
|
|
916
919
|
const { visible, hide, resolve, reject, onOpenChange } = ui.useModal();
|
|
917
|
-
const [domain, setDomain] =
|
|
920
|
+
const [domain, setDomain] = React7.useState("");
|
|
918
921
|
const { t } = i18n.useTranslation();
|
|
919
|
-
|
|
922
|
+
React7.useEffect(() => {
|
|
920
923
|
setDomain(window.location.hostname);
|
|
921
924
|
}, []);
|
|
922
|
-
return /* @__PURE__ */
|
|
923
|
-
|
|
924
|
-
{
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
{
|
|
930
|
-
className: "oui-relative oui-h-[52px] oui-w-full oui-rounded-[44px] oui-bg-base-static-contrast/10 oui-p-2 oui-px-4",
|
|
931
|
-
itemAlign: "center",
|
|
932
|
-
justify: "center"
|
|
933
|
-
},
|
|
934
|
-
/* @__PURE__ */ React19__default.default.createElement(ui.Text, { className: "oui-text-base-static-contrast-80 oui-text-[18px] oui-leading-[36px] oui-flex-1 oui-text-center oui-whitespace-nowrap" }, domain),
|
|
935
|
-
/* @__PURE__ */ React19__default.default.createElement(ShareIcon, { className: "oui-absolute oui-right-4 oui-top-1/2 oui-translate-y-[-50%]" })
|
|
936
|
-
))
|
|
937
|
-
}
|
|
938
|
-
), /* @__PURE__ */ React19__default.default.createElement(
|
|
939
|
-
StepItem,
|
|
940
|
-
{
|
|
941
|
-
index: 2,
|
|
942
|
-
title: t("connector.privy.pwa.step2"),
|
|
943
|
-
classNames: {
|
|
944
|
-
content: "oui-bg-[#e9e9eb]"
|
|
945
|
-
},
|
|
946
|
-
content: /* @__PURE__ */ React19__default.default.createElement(
|
|
947
|
-
ui.Flex,
|
|
948
|
-
{
|
|
949
|
-
className: "oui-w-full oui-bg-secondary oui-rounded-[12px]",
|
|
950
|
-
direction: "column"
|
|
951
|
-
},
|
|
952
|
-
/* @__PURE__ */ React19__default.default.createElement(
|
|
953
|
-
ui.Flex,
|
|
925
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.SimpleSheet, { open: visible, onOpenChange, children: [
|
|
926
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.SheetHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast-80 oui-text ", children: t("connector.privy.pwa.sheetTitle") }) }),
|
|
927
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", gap: 3, className: "oui-w-full", children: [
|
|
928
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast-80 oui-text ", children: t("connector.privy.pwa.description") }),
|
|
929
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", gap: 4, className: "oui-w-full", children: [
|
|
930
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
931
|
+
StepItem,
|
|
954
932
|
{
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
933
|
+
index: 1,
|
|
934
|
+
title: t("connector.privy.pwa.step1"),
|
|
935
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { className: "oui-w-full oui-bg-dark-8", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
936
|
+
ui.Flex,
|
|
937
|
+
{
|
|
938
|
+
className: "oui-relative oui-h-[52px] oui-w-full oui-rounded-[44px] oui-bg-base-static-contrast/10 oui-p-2 oui-px-4",
|
|
939
|
+
itemAlign: "center",
|
|
940
|
+
justify: "center",
|
|
941
|
+
children: [
|
|
942
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-static-contrast-80 oui-text-[18px] oui-leading-[36px] oui-flex-1 oui-text-center oui-whitespace-nowrap", children: domain }),
|
|
943
|
+
/* @__PURE__ */ jsxRuntime.jsx(ShareIcon, { className: "oui-absolute oui-right-4 oui-top-1/2 oui-translate-y-[-50%]" })
|
|
944
|
+
]
|
|
945
|
+
}
|
|
946
|
+
) })
|
|
947
|
+
}
|
|
960
948
|
),
|
|
961
|
-
/* @__PURE__ */
|
|
962
|
-
|
|
963
|
-
ui.Flex,
|
|
949
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
950
|
+
StepItem,
|
|
964
951
|
{
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
952
|
+
index: 2,
|
|
953
|
+
title: t("connector.privy.pwa.step2"),
|
|
954
|
+
classNames: {
|
|
955
|
+
content: "oui-bg-[#e9e9eb]"
|
|
956
|
+
},
|
|
957
|
+
content: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
958
|
+
ui.Flex,
|
|
959
|
+
{
|
|
960
|
+
className: "oui-w-full oui-bg-secondary oui-rounded-[12px]",
|
|
961
|
+
direction: "column",
|
|
962
|
+
children: [
|
|
963
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
964
|
+
ui.Flex,
|
|
965
|
+
{
|
|
966
|
+
className: "oui-w-full oui-px-4 oui-py-3",
|
|
967
|
+
justify: "start",
|
|
968
|
+
itemAlign: "center",
|
|
969
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-[18px] oui-text-base-static-contrast-20", children: t("connector.privy.pwa.findOnPage") })
|
|
970
|
+
}
|
|
971
|
+
),
|
|
972
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { className: "oui-border-base-static-contrast-20 oui-w-full" }),
|
|
973
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
974
|
+
ui.Flex,
|
|
975
|
+
{
|
|
976
|
+
className: "oui-w-full oui-px-4 oui-py-3",
|
|
977
|
+
justify: "between",
|
|
978
|
+
itemAlign: "center",
|
|
979
|
+
children: [
|
|
980
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-col-span-2 oui-whitespace-nowrap oui-text-[18px] oui-text-base-static-contrast-80", children: t("connector.privy.pwa.addToHomeScreen") }),
|
|
981
|
+
/* @__PURE__ */ jsxRuntime.jsx(AddIcon, {})
|
|
982
|
+
]
|
|
983
|
+
}
|
|
984
|
+
)
|
|
985
|
+
]
|
|
986
|
+
}
|
|
987
|
+
)
|
|
988
|
+
}
|
|
971
989
|
)
|
|
972
|
-
)
|
|
973
|
-
}
|
|
974
|
-
)
|
|
990
|
+
] })
|
|
991
|
+
] })
|
|
992
|
+
] });
|
|
975
993
|
});
|
|
976
994
|
var ShareIcon = (props) => {
|
|
977
|
-
return /* @__PURE__ */
|
|
995
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
978
996
|
"svg",
|
|
979
997
|
{
|
|
980
998
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -982,87 +1000,96 @@ var ShareIcon = (props) => {
|
|
|
982
1000
|
height: "28",
|
|
983
1001
|
viewBox: "0 0 28 28",
|
|
984
1002
|
fill: "none",
|
|
985
|
-
className: props.className
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
+
className: props.className,
|
|
1004
|
+
children: [
|
|
1005
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1006
|
+
"path",
|
|
1007
|
+
{
|
|
1008
|
+
d: "M5 23.3333V13.6667C5 12.1939 6.15127 11 7.57143 11H10.6744V12.7778H7.57143C7.09804 12.7778 6.71429 13.1757 6.71429 13.6667V23.3333C6.71429 23.8243 7.09804 24.2222 7.57143 24.2222H20.4286C20.902 24.2222 21.2857 23.8243 21.2857 23.3333V13.6667C21.2857 13.1757 20.902 12.7778 20.4286 12.7778H17.555V11H20.4286C21.8487 11 23 12.1939 23 13.6667V23.3333C23 24.8061 21.8487 26 20.4286 26H7.57143C6.15127 26 5 24.8061 5 23.3333Z",
|
|
1009
|
+
fill: "black",
|
|
1010
|
+
fillOpacity: "0.48"
|
|
1011
|
+
}
|
|
1012
|
+
),
|
|
1013
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1014
|
+
"path",
|
|
1015
|
+
{
|
|
1016
|
+
d: "M13.3759 2.25933C13.7206 1.91356 14.2794 1.91356 14.6241 2.25933L20.2416 7.89432C20.586 8.24011 20.5862 8.80066 20.2416 9.14634C19.897 9.49203 19.3382 9.49185 18.9935 9.14634L14.8827 5.02278V19H13.1173V5.02278L9.00654 9.14634C8.66182 9.49185 8.10301 9.49203 7.7584 9.14634C7.41378 8.80066 7.41396 8.24011 7.7584 7.89432L13.3759 2.25933Z",
|
|
1017
|
+
fill: "black",
|
|
1018
|
+
fillOpacity: "0.48"
|
|
1019
|
+
}
|
|
1020
|
+
)
|
|
1021
|
+
]
|
|
1022
|
+
}
|
|
1003
1023
|
);
|
|
1004
1024
|
};
|
|
1005
1025
|
var AddIcon = () => {
|
|
1006
|
-
return /* @__PURE__ */
|
|
1026
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1007
1027
|
"svg",
|
|
1008
1028
|
{
|
|
1009
1029
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1010
1030
|
width: "24",
|
|
1011
1031
|
height: "24",
|
|
1012
1032
|
viewBox: "0 0 24 24",
|
|
1013
|
-
fill: "none"
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1033
|
+
fill: "none",
|
|
1034
|
+
children: [
|
|
1035
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1036
|
+
"path",
|
|
1037
|
+
{
|
|
1038
|
+
d: "M7.00598 3.92969H17.006C18.6627 3.92969 20.006 5.27297 20.006 6.92969V16.9297C20.006 18.5864 18.6627 19.9297 17.006 19.9297H7.00598C5.34927 19.9297 4.00598 18.5864 4.00598 16.9297V6.92969C4.00598 5.27297 5.34927 3.92969 7.00598 3.92969Z",
|
|
1039
|
+
stroke: "black",
|
|
1040
|
+
strokeOpacity: "0.88",
|
|
1041
|
+
strokeWidth: "2"
|
|
1042
|
+
}
|
|
1043
|
+
),
|
|
1044
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1045
|
+
"path",
|
|
1046
|
+
{
|
|
1047
|
+
d: "M8 12L16 12",
|
|
1048
|
+
stroke: "black",
|
|
1049
|
+
strokeOpacity: "0.88",
|
|
1050
|
+
strokeWidth: "2",
|
|
1051
|
+
strokeLinecap: "round"
|
|
1052
|
+
}
|
|
1053
|
+
),
|
|
1054
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1055
|
+
"path",
|
|
1056
|
+
{
|
|
1057
|
+
d: "M12 8L12 16",
|
|
1058
|
+
stroke: "black",
|
|
1059
|
+
strokeOpacity: "0.88",
|
|
1060
|
+
strokeWidth: "2",
|
|
1061
|
+
strokeLinecap: "round"
|
|
1062
|
+
}
|
|
1063
|
+
)
|
|
1064
|
+
]
|
|
1065
|
+
}
|
|
1044
1066
|
);
|
|
1045
1067
|
};
|
|
1046
1068
|
var StepItem = (props) => {
|
|
1047
|
-
return /* @__PURE__ */
|
|
1069
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1048
1070
|
ui.Flex,
|
|
1049
1071
|
{
|
|
1050
1072
|
className: " oui-rounded-[12px] oui-w-full oui-overflow-hidden",
|
|
1051
|
-
direction: "column"
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1073
|
+
direction: "column",
|
|
1074
|
+
children: [
|
|
1075
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { className: "oui-bg-base-4 oui-w-full oui-px-3 oui-py-3 oui-gap-[6px]", children: [
|
|
1076
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast-80 oui-text-xs oui-w-[18px] oui-h-[18px] oui-rounded-[100%] oui-bg-[linear-gradient(270deg,rgb(var(--oui-gradient-brand-end))_0%,rgb(var(--oui-gradient-brand-start))_100%)] oui-text-center oui-text-base-static-contrast", children: props.index }),
|
|
1077
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-text-base-contrast-80 oui-text-xs", children: props.title })
|
|
1078
|
+
] }),
|
|
1079
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1080
|
+
ui.Flex,
|
|
1081
|
+
{
|
|
1082
|
+
className: ui.cn(
|
|
1083
|
+
"oui-bg-secondary oui-h-[120px] oui-w-full oui-px-6",
|
|
1084
|
+
props.classNames?.content
|
|
1085
|
+
),
|
|
1086
|
+
justify: "center",
|
|
1087
|
+
itemAlign: "center",
|
|
1088
|
+
children: props.content
|
|
1089
|
+
}
|
|
1090
|
+
)
|
|
1091
|
+
]
|
|
1092
|
+
}
|
|
1066
1093
|
);
|
|
1067
1094
|
};
|
|
1068
1095
|
var OrderlyOSS = "https://oss.orderly.network";
|
|
@@ -1128,20 +1155,20 @@ function useWallet2() {
|
|
|
1128
1155
|
isConnected: isConnectedAbstract,
|
|
1129
1156
|
disconnect: disconnectAbstract
|
|
1130
1157
|
} = useAbstractWallet();
|
|
1131
|
-
const [wallet, setWallet] =
|
|
1132
|
-
const [namespace, setNamespace] =
|
|
1133
|
-
const [walletType, setWalletType] =
|
|
1158
|
+
const [wallet, setWallet] = React7.useState(null);
|
|
1159
|
+
const [namespace, setNamespace] = React7.useState(null);
|
|
1160
|
+
const [walletType, setWalletType] = React7.useState(null);
|
|
1134
1161
|
const { storageChain, setStorageChain } = hooks.useStorageChain();
|
|
1135
1162
|
const { setOpenConnectDrawer, targetWalletType, setTargetWalletType } = useWalletConnectorPrivy();
|
|
1136
|
-
const supportedEvmChainIds =
|
|
1163
|
+
const supportedEvmChainIds = React7.useMemo(() => {
|
|
1137
1164
|
const ids = initChains?.map((c) => c.id).filter((id) => !types.SolanaChains.has(id) && !types.AbstractChains.has(id));
|
|
1138
1165
|
return new Set(ids ?? []);
|
|
1139
1166
|
}, [initChains]);
|
|
1140
|
-
const preferredEvmChainId =
|
|
1167
|
+
const preferredEvmChainId = React7.useMemo(() => {
|
|
1141
1168
|
const preferredOrder = network === "mainnet" ? types.defaultMainnetChains : types.defaultTestnetChains;
|
|
1142
1169
|
return preferredOrder.map((c) => c.id).find((id) => supportedEvmChainIds.has(id));
|
|
1143
1170
|
}, [network, supportedEvmChainIds]);
|
|
1144
|
-
const defaultEvmChainId =
|
|
1171
|
+
const defaultEvmChainId = React7.useMemo(() => {
|
|
1145
1172
|
for (const chain of initChains ?? []) {
|
|
1146
1173
|
if (!types.SolanaChains.has(chain.id) && !types.AbstractChains.has(chain.id)) {
|
|
1147
1174
|
return chain.id;
|
|
@@ -1150,7 +1177,7 @@ function useWallet2() {
|
|
|
1150
1177
|
return void 0;
|
|
1151
1178
|
}, [initChains]);
|
|
1152
1179
|
const fallbackEvmChainId = preferredEvmChainId ?? defaultEvmChainId;
|
|
1153
|
-
const isManual =
|
|
1180
|
+
const isManual = React7.useRef(false);
|
|
1154
1181
|
const connect = (params) => {
|
|
1155
1182
|
setTargetWalletType(void 0);
|
|
1156
1183
|
try {
|
|
@@ -1181,13 +1208,13 @@ function useWallet2() {
|
|
|
1181
1208
|
} catch (e) {
|
|
1182
1209
|
}
|
|
1183
1210
|
};
|
|
1184
|
-
const isPrivy =
|
|
1211
|
+
const isPrivy = React7.useMemo(() => {
|
|
1185
1212
|
if (connectorKey === "privy" /* PRIVY */) {
|
|
1186
1213
|
return true;
|
|
1187
1214
|
}
|
|
1188
1215
|
return false;
|
|
1189
1216
|
}, [connectorKey]);
|
|
1190
|
-
const [connectedChain, setConnectedChain] =
|
|
1217
|
+
const [connectedChain, setConnectedChain] = React7.useState();
|
|
1191
1218
|
const setChain = async (chain) => {
|
|
1192
1219
|
const chainType = getChainType(parseInt(chain.chainId));
|
|
1193
1220
|
if (isPrivy) {
|
|
@@ -1342,7 +1369,7 @@ function useWallet2() {
|
|
|
1342
1369
|
setConnectedChain(null);
|
|
1343
1370
|
setNamespace(null);
|
|
1344
1371
|
};
|
|
1345
|
-
|
|
1372
|
+
React7.useEffect(() => {
|
|
1346
1373
|
if (connectorKey !== "privy" /* PRIVY */) {
|
|
1347
1374
|
return;
|
|
1348
1375
|
}
|
|
@@ -1370,12 +1397,12 @@ function useWallet2() {
|
|
|
1370
1397
|
}
|
|
1371
1398
|
}
|
|
1372
1399
|
}, [connectorKey, privyWalletEVM, privyWalletSOL, storageChain]);
|
|
1373
|
-
|
|
1400
|
+
React7.useEffect(() => {
|
|
1374
1401
|
if (connectorKey === "privy" /* PRIVY */ && isConnectedPrivy && types.AbstractChains.has(storageChain.chainId)) {
|
|
1375
1402
|
setOpenConnectDrawer(true);
|
|
1376
1403
|
}
|
|
1377
1404
|
}, [connectorKey, isConnectedPrivy, storageChain]);
|
|
1378
|
-
|
|
1405
|
+
React7.useEffect(() => {
|
|
1379
1406
|
if (connectorKey === "privy" /* PRIVY */) {
|
|
1380
1407
|
return;
|
|
1381
1408
|
}
|
|
@@ -1434,25 +1461,30 @@ function useWallet2() {
|
|
|
1434
1461
|
}
|
|
1435
1462
|
function AbstractConnectArea({ connect }) {
|
|
1436
1463
|
const { isMobile } = ui.useScreen();
|
|
1437
|
-
return /* @__PURE__ */
|
|
1438
|
-
"div",
|
|
1439
|
-
{
|
|
1440
|
-
|
|
1441
|
-
" oui-flex oui-flex-1 oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-rounded-[6px] oui-px-2 oui-py-[11px]",
|
|
1442
|
-
isMobile ? "oui-bg-base-5" : "oui-bg-base-10"
|
|
1443
|
-
),
|
|
1444
|
-
onClick: () => connect()
|
|
1445
|
-
},
|
|
1446
|
-
/* @__PURE__ */ React19__default.default.createElement("div", { className: "oui-flex oui-size-[18px] oui-items-center oui-justify-center" }, /* @__PURE__ */ React19__default.default.createElement(
|
|
1447
|
-
"img",
|
|
1464
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1465
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-mb-2 oui-text-sm oui-font-semibold oui-text-base-contrast-80", children: "Abstract" }),
|
|
1466
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-grid oui-grid-cols-2 oui-gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1467
|
+
"div",
|
|
1448
1468
|
{
|
|
1449
|
-
className: ui.cn(
|
|
1450
|
-
|
|
1451
|
-
|
|
1469
|
+
className: ui.cn(
|
|
1470
|
+
" oui-flex oui-flex-1 oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-rounded-[6px] oui-px-2 oui-py-[11px]",
|
|
1471
|
+
isMobile ? "oui-bg-base-5" : "oui-bg-base-10"
|
|
1472
|
+
),
|
|
1473
|
+
onClick: () => connect(),
|
|
1474
|
+
children: [
|
|
1475
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-flex oui-size-[18px] oui-items-center oui-justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1476
|
+
"img",
|
|
1477
|
+
{
|
|
1478
|
+
className: ui.cn("oui-size-[12px]"),
|
|
1479
|
+
src: `${PrivyConnectorImagePath}/abstract.png`,
|
|
1480
|
+
alt: "abstract wallet"
|
|
1481
|
+
}
|
|
1482
|
+
) }),
|
|
1483
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-text-base-contrast", children: "Abstract" })
|
|
1484
|
+
]
|
|
1452
1485
|
}
|
|
1453
|
-
))
|
|
1454
|
-
|
|
1455
|
-
)));
|
|
1486
|
+
) })
|
|
1487
|
+
] });
|
|
1456
1488
|
}
|
|
1457
1489
|
var RenderLoginMethodsDom = ({
|
|
1458
1490
|
connect,
|
|
@@ -1463,104 +1495,112 @@ var RenderLoginMethodsDom = ({
|
|
|
1463
1495
|
const arr = [];
|
|
1464
1496
|
if (loginMethods?.includes("email")) {
|
|
1465
1497
|
arr.push(
|
|
1466
|
-
/* @__PURE__ */
|
|
1498
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1467
1499
|
"div",
|
|
1468
1500
|
{
|
|
1469
1501
|
className: ui.cn(
|
|
1470
1502
|
"oui-flex oui-cursor-pointer oui-items-center oui-justify-center oui-gap-1 oui-rounded-[6px] oui-border-none oui-px-2 oui-py-[11px]",
|
|
1471
1503
|
"oui-bg-[#333948]"
|
|
1472
1504
|
),
|
|
1473
|
-
onClick: () => connect({ walletType: "privy", extraType: "email" })
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1505
|
+
onClick: () => connect({ walletType: "privy", extraType: "email" }),
|
|
1506
|
+
children: [
|
|
1507
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1508
|
+
"img",
|
|
1509
|
+
{
|
|
1510
|
+
src: "https://oss.orderly.network/static/sdk/privy/email.svg",
|
|
1511
|
+
className: "oui-size-[18px]"
|
|
1512
|
+
}
|
|
1513
|
+
),
|
|
1514
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-text-base-static", children: t("connector.privy.email") })
|
|
1515
|
+
]
|
|
1516
|
+
}
|
|
1483
1517
|
)
|
|
1484
1518
|
);
|
|
1485
1519
|
}
|
|
1486
1520
|
if (loginMethods?.includes("google")) {
|
|
1487
1521
|
arr.push(
|
|
1488
|
-
/* @__PURE__ */
|
|
1522
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1489
1523
|
"div",
|
|
1490
1524
|
{
|
|
1491
1525
|
className: ui.cn(
|
|
1492
1526
|
"oui-flex oui-cursor-pointer oui-items-center oui-justify-center oui-gap-1 oui-rounded-[6px] oui-border-none oui-px-2 oui-py-[11px]",
|
|
1493
1527
|
"oui-bg-[#335FFC]"
|
|
1494
1528
|
),
|
|
1495
|
-
onClick: () => connect({ walletType: "privy", extraType: "google" })
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1529
|
+
onClick: () => connect({ walletType: "privy", extraType: "google" }),
|
|
1530
|
+
children: [
|
|
1531
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1532
|
+
"img",
|
|
1533
|
+
{
|
|
1534
|
+
src: "https://oss.orderly.network/static/sdk/privy/google.svg",
|
|
1535
|
+
className: "oui-size-[18px]"
|
|
1536
|
+
}
|
|
1537
|
+
),
|
|
1538
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-text-base-static", children: t("connector.privy.google") })
|
|
1539
|
+
]
|
|
1540
|
+
}
|
|
1505
1541
|
)
|
|
1506
1542
|
);
|
|
1507
1543
|
}
|
|
1508
1544
|
if (loginMethods?.includes("twitter")) {
|
|
1509
1545
|
arr.push(
|
|
1510
|
-
/* @__PURE__ */
|
|
1546
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1511
1547
|
"div",
|
|
1512
1548
|
{
|
|
1513
1549
|
className: ui.cn(
|
|
1514
1550
|
"oui-flex oui-cursor-pointer oui-items-center oui-justify-center oui-gap-1 oui-rounded-[6px] oui-border-none oui-px-2 oui-py-[11px]",
|
|
1515
1551
|
"oui-bg-[#07080A]"
|
|
1516
1552
|
),
|
|
1517
|
-
onClick: () => connect({ walletType: "privy", extraType: "twitter" })
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1553
|
+
onClick: () => connect({ walletType: "privy", extraType: "twitter" }),
|
|
1554
|
+
children: [
|
|
1555
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1556
|
+
"img",
|
|
1557
|
+
{
|
|
1558
|
+
src: "https://oss.orderly.network/static/sdk/privy/twitter.svg",
|
|
1559
|
+
className: "oui-size-[18px]"
|
|
1560
|
+
}
|
|
1561
|
+
),
|
|
1562
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-text-base-static", children: t("connector.privy.twitter") })
|
|
1563
|
+
]
|
|
1564
|
+
}
|
|
1527
1565
|
)
|
|
1528
1566
|
);
|
|
1529
1567
|
}
|
|
1530
1568
|
if (loginMethods?.includes("telegram")) {
|
|
1531
1569
|
arr.push(
|
|
1532
|
-
/* @__PURE__ */
|
|
1570
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1533
1571
|
"div",
|
|
1534
1572
|
{
|
|
1535
1573
|
className: ui.cn(
|
|
1536
1574
|
"oui-flex oui-cursor-pointer oui-items-center oui-justify-center oui-gap-1 oui-rounded-[6px] oui-border-none oui-px-2 oui-py-[11px]",
|
|
1537
1575
|
"oui-bg-[#3D79A9]"
|
|
1538
1576
|
),
|
|
1539
|
-
onClick: () => connect({ walletType: "privy", extraType: "telegram" })
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1577
|
+
onClick: () => connect({ walletType: "privy", extraType: "telegram" }),
|
|
1578
|
+
children: [
|
|
1579
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1580
|
+
"svg",
|
|
1581
|
+
{
|
|
1582
|
+
width: "18",
|
|
1583
|
+
height: "18",
|
|
1584
|
+
viewBox: "0 0 18 18",
|
|
1585
|
+
fill: "none",
|
|
1586
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1587
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1588
|
+
"path",
|
|
1589
|
+
{
|
|
1590
|
+
d: "M2.652 8.12916L15.0683 4.04929C15.6468 3.87358 16.1499 4.16929 15.9587 4.91069L13.8458 13.3962C13.6898 13.9961 13.2672 14.1461 12.6836 13.859L9.46384 11.8362L7.90929 13.109C7.73824 13.2547 7.59234 13.379 7.2603 13.379L7.4867 10.5891L13.4584 5.99923C13.72 5.80638 13.398 5.69495 13.0559 5.8878L5.68061 9.8434L2.50107 8.99914C1.81687 8.81058 1.80178 8.41201 2.652 8.12916Z",
|
|
1591
|
+
className: "oui-fill-white"
|
|
1592
|
+
}
|
|
1593
|
+
)
|
|
1594
|
+
}
|
|
1595
|
+
),
|
|
1596
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-text-base-static", children: t("connector.privy.telegram") })
|
|
1597
|
+
]
|
|
1598
|
+
}
|
|
1559
1599
|
)
|
|
1560
1600
|
);
|
|
1561
1601
|
}
|
|
1562
1602
|
return arr.map((item, index) => {
|
|
1563
|
-
return /* @__PURE__ */
|
|
1603
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { children: item }, index);
|
|
1564
1604
|
});
|
|
1565
1605
|
};
|
|
1566
1606
|
var PrivyConnectAreaMobile = ({
|
|
@@ -1570,7 +1610,10 @@ var PrivyConnectAreaMobile = ({
|
|
|
1570
1610
|
const { isMobile, isDesktop } = ui.useScreen();
|
|
1571
1611
|
const { connectorWalletType, privyConfig } = useWalletConnectorPrivy();
|
|
1572
1612
|
const loginMethods = privyConfig.loginMethods;
|
|
1573
|
-
return /* @__PURE__ */
|
|
1613
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", className: "oui-w-full", children: [
|
|
1614
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { cols: 2, rows: 2, className: "oui-w-full", gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(RenderLoginMethodsDom, { connect, loginMethods }) }),
|
|
1615
|
+
(!connectorWalletType.disableWagmi || !connectorWalletType.disableSolana) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-mt-4 oui-h-px oui-w-full oui-bg-line md:oui-mt-5" })
|
|
1616
|
+
] });
|
|
1574
1617
|
};
|
|
1575
1618
|
var PrivyConnectAreaDesktop = ({
|
|
1576
1619
|
connect
|
|
@@ -1578,16 +1621,19 @@ var PrivyConnectAreaDesktop = ({
|
|
|
1578
1621
|
const { t } = i18n.useTranslation();
|
|
1579
1622
|
const { connectorWalletType, privyConfig } = useWalletConnectorPrivy();
|
|
1580
1623
|
const loginMethods = privyConfig.loginMethods;
|
|
1581
|
-
return /* @__PURE__ */
|
|
1624
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", itemAlign: "start", className: "oui-w-full", children: [
|
|
1625
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { cols: 1, gap: 2, className: "oui-w-full", children: /* @__PURE__ */ jsxRuntime.jsx(RenderLoginMethodsDom, { connect, loginMethods }) }),
|
|
1626
|
+
(!connectorWalletType.disableWagmi || !connectorWalletType.disableSolana) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-mt-4 oui-h-px oui-w-full oui-bg-line md:oui-mt-5" })
|
|
1627
|
+
] });
|
|
1582
1628
|
};
|
|
1583
1629
|
function PrivyConnectArea({
|
|
1584
1630
|
connect
|
|
1585
1631
|
}) {
|
|
1586
1632
|
const { isDesktop } = ui.useScreen();
|
|
1587
1633
|
if (isDesktop) {
|
|
1588
|
-
return /* @__PURE__ */
|
|
1634
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PrivyConnectAreaDesktop, { connect });
|
|
1589
1635
|
}
|
|
1590
|
-
return /* @__PURE__ */
|
|
1636
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PrivyConnectAreaMobile, { connect });
|
|
1591
1637
|
}
|
|
1592
1638
|
function RenderPrivyTypeIcon({
|
|
1593
1639
|
type,
|
|
@@ -1595,7 +1641,7 @@ function RenderPrivyTypeIcon({
|
|
|
1595
1641
|
black
|
|
1596
1642
|
}) {
|
|
1597
1643
|
if (type === "email") {
|
|
1598
|
-
return /* @__PURE__ */
|
|
1644
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1599
1645
|
"img",
|
|
1600
1646
|
{
|
|
1601
1647
|
src: `https://oss.orderly.network/static/sdk/privy/email${black ? "-black" : ""}.svg`,
|
|
@@ -1604,7 +1650,7 @@ function RenderPrivyTypeIcon({
|
|
|
1604
1650
|
);
|
|
1605
1651
|
}
|
|
1606
1652
|
if (type === "google_oauth") {
|
|
1607
|
-
return /* @__PURE__ */
|
|
1653
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1608
1654
|
"img",
|
|
1609
1655
|
{
|
|
1610
1656
|
src: "https://oss.orderly.network/static/sdk/privy/google.svg",
|
|
@@ -1613,7 +1659,7 @@ function RenderPrivyTypeIcon({
|
|
|
1613
1659
|
);
|
|
1614
1660
|
}
|
|
1615
1661
|
if (type === "twitter_oauth") {
|
|
1616
|
-
return /* @__PURE__ */
|
|
1662
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1617
1663
|
"img",
|
|
1618
1664
|
{
|
|
1619
1665
|
src: `https://oss.orderly.network/static/sdk/privy/twitter${black ? "-black" : ""}.svg`,
|
|
@@ -1622,25 +1668,25 @@ function RenderPrivyTypeIcon({
|
|
|
1622
1668
|
);
|
|
1623
1669
|
}
|
|
1624
1670
|
if (type === "telegram") {
|
|
1625
|
-
return /* @__PURE__ */
|
|
1671
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1626
1672
|
"svg",
|
|
1627
1673
|
{
|
|
1628
1674
|
width: size,
|
|
1629
1675
|
height: size,
|
|
1630
1676
|
viewBox: "0 0 18 18",
|
|
1631
1677
|
fill: "none",
|
|
1632
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1678
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1679
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1680
|
+
"path",
|
|
1681
|
+
{
|
|
1682
|
+
d: "M2.652 8.12916L15.0683 4.04929C15.6468 3.87358 16.1499 4.16929 15.9587 4.91069L13.8458 13.3962C13.6898 13.9961 13.2672 14.1461 12.6836 13.859L9.46384 11.8362L7.90929 13.109C7.73824 13.2547 7.59234 13.379 7.2603 13.379L7.4867 10.5891L13.4584 5.99923C13.72 5.80638 13.398 5.69495 13.0559 5.8878L5.68061 9.8434L2.50107 8.99914C1.81687 8.81058 1.80178 8.41201 2.652 8.12916Z",
|
|
1683
|
+
fill: black ? "black" : "white"
|
|
1684
|
+
}
|
|
1685
|
+
)
|
|
1686
|
+
}
|
|
1641
1687
|
);
|
|
1642
1688
|
}
|
|
1643
|
-
return /* @__PURE__ */
|
|
1689
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1644
1690
|
"img",
|
|
1645
1691
|
{
|
|
1646
1692
|
src: `https://oss.orderly.network/static/sdk/privy/email${black ? "-black" : ""}.svg`,
|
|
@@ -1652,7 +1698,7 @@ function RenderWalletIcon({
|
|
|
1652
1698
|
connector
|
|
1653
1699
|
}) {
|
|
1654
1700
|
const icon = connector.icon ? connector.icon : getWalletIcon(connector.type);
|
|
1655
|
-
return /* @__PURE__ */
|
|
1701
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-w-[18px] oui-h-[18px] oui-flex oui-items-center oui-justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1656
1702
|
"img",
|
|
1657
1703
|
{
|
|
1658
1704
|
className: ui.cn(
|
|
@@ -1661,80 +1707,93 @@ function RenderWalletIcon({
|
|
|
1661
1707
|
src: icon,
|
|
1662
1708
|
alt: connector.name
|
|
1663
1709
|
}
|
|
1664
|
-
));
|
|
1710
|
+
) });
|
|
1665
1711
|
}
|
|
1666
1712
|
function EVMChainPopover({ children }) {
|
|
1667
1713
|
const { getChainsByNetwork } = useWalletConnectorPrivy();
|
|
1668
|
-
const [chains] =
|
|
1714
|
+
const [chains] = React7.useState(getChainsByNetwork("mainnet"));
|
|
1669
1715
|
const { t } = i18n.useTranslation();
|
|
1670
1716
|
const { isMobile } = ui.useScreen();
|
|
1671
|
-
const [open, setOpen] =
|
|
1717
|
+
const [open, setOpen] = React7.useState(false);
|
|
1672
1718
|
if (isMobile) {
|
|
1673
|
-
return /* @__PURE__ */
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
open,
|
|
1677
|
-
size: "xs",
|
|
1678
|
-
onOpenChange: setOpen,
|
|
1679
|
-
classNames: {
|
|
1680
|
-
content: "oui-p-4 oui-z-[99]",
|
|
1681
|
-
overlay: "oui-z-[99]"
|
|
1682
|
-
},
|
|
1683
|
-
title: t("connector.privy.supportedEvmChain")
|
|
1684
|
-
},
|
|
1685
|
-
/* @__PURE__ */ React19__default.default.createElement("div", { className: "oui-p-1 oui-grid oui-grid-cols-2 oui-gap-x-2 oui-gap-y-3 oui-text-2xs oui-text-base-contrast-54" }, chains.map((item, key) => /* @__PURE__ */ React19__default.default.createElement(
|
|
1686
|
-
"div",
|
|
1719
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1720
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1721
|
+
ui.SimpleDialog,
|
|
1687
1722
|
{
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1723
|
+
open,
|
|
1724
|
+
size: "xs",
|
|
1725
|
+
onOpenChange: setOpen,
|
|
1726
|
+
classNames: {
|
|
1727
|
+
content: "oui-p-4 oui-z-[99]",
|
|
1728
|
+
overlay: "oui-z-[99]"
|
|
1729
|
+
},
|
|
1730
|
+
title: t("connector.privy.supportedEvmChain"),
|
|
1731
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-p-1 oui-grid oui-grid-cols-2 oui-gap-x-2 oui-gap-y-3 oui-text-2xs oui-text-base-contrast-54", children: chains.map((item, key) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1732
|
+
"div",
|
|
1733
|
+
{
|
|
1734
|
+
className: "oui-flex oui-items-center oui-justify-start oui-gap-1",
|
|
1735
|
+
children: [
|
|
1736
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.ChainIcon, { chainId: item.id, size: "2xs" }),
|
|
1737
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: item.name })
|
|
1738
|
+
]
|
|
1739
|
+
},
|
|
1740
|
+
key
|
|
1741
|
+
)) })
|
|
1742
|
+
}
|
|
1743
|
+
),
|
|
1744
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { onClick: () => setOpen(true), children })
|
|
1745
|
+
] });
|
|
1695
1746
|
}
|
|
1696
|
-
return /* @__PURE__ */
|
|
1747
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1697
1748
|
ui.Popover,
|
|
1698
1749
|
{
|
|
1699
|
-
content: /* @__PURE__ */
|
|
1700
|
-
"div",
|
|
1701
|
-
{
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1750
|
+
content: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1751
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-font-semibold oui-text-base-contrast", children: t("connector.privy.supportedEvmChain") }),
|
|
1752
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-mt-3 oui-grid oui-grid-cols-3 oui-gap-x-2 oui-gap-y-3 oui-text-2xs oui-text-base-contrast-54", children: chains.map((item, key) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1753
|
+
"div",
|
|
1754
|
+
{
|
|
1755
|
+
className: "oui-flex oui-items-center oui-justify-start oui-gap-1",
|
|
1756
|
+
children: [
|
|
1757
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.ChainIcon, { chainId: item.id, size: "2xs" }),
|
|
1758
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: item.name })
|
|
1759
|
+
]
|
|
1760
|
+
},
|
|
1761
|
+
key
|
|
1762
|
+
)) })
|
|
1763
|
+
] }),
|
|
1708
1764
|
arrow: true,
|
|
1709
1765
|
contentProps: {
|
|
1710
1766
|
side: "bottom",
|
|
1711
1767
|
align: "center",
|
|
1712
1768
|
className: "oui-p-2 oui-z-[65]"
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
|
|
1769
|
+
},
|
|
1770
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("button", { children })
|
|
1771
|
+
}
|
|
1716
1772
|
);
|
|
1717
1773
|
}
|
|
1718
|
-
|
|
1719
|
-
// src/components/renderConnector/solanaConnector.tsx
|
|
1720
1774
|
function SOLConnectArea({
|
|
1721
1775
|
connect
|
|
1722
1776
|
}) {
|
|
1723
1777
|
const { wallets } = useSolanaWallet();
|
|
1724
1778
|
const { isMobile } = ui.useScreen();
|
|
1725
|
-
return /* @__PURE__ */
|
|
1726
|
-
"div",
|
|
1727
|
-
{
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1779
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1780
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-mb-2 oui-text-sm oui-font-semibold oui-text-base-contrast-80", children: "Solana" }),
|
|
1781
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-grid oui-grid-cols-2 oui-gap-2", children: wallets.map((item, key) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1782
|
+
"div",
|
|
1783
|
+
{
|
|
1784
|
+
className: ui.cn(
|
|
1785
|
+
" oui-flex oui-flex-1 oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-rounded-[6px] oui-px-2 oui-py-[11px]",
|
|
1786
|
+
isMobile ? "oui-bg-base-5" : "oui-bg-base-10"
|
|
1787
|
+
),
|
|
1788
|
+
onClick: () => connect(item.adapter),
|
|
1789
|
+
children: [
|
|
1790
|
+
/* @__PURE__ */ jsxRuntime.jsx(RenderWalletIcon, { connector: item.adapter }),
|
|
1791
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-text-base-contrast", children: item.adapter.name })
|
|
1792
|
+
]
|
|
1793
|
+
},
|
|
1794
|
+
key
|
|
1795
|
+
)) })
|
|
1796
|
+
] });
|
|
1738
1797
|
}
|
|
1739
1798
|
function EVMConnectArea({
|
|
1740
1799
|
connect
|
|
@@ -1750,22 +1809,25 @@ function EVMConnectArea({
|
|
|
1750
1809
|
}
|
|
1751
1810
|
connect(item);
|
|
1752
1811
|
};
|
|
1753
|
-
return /* @__PURE__ */
|
|
1754
|
-
"div",
|
|
1755
|
-
{
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1812
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "", children: [
|
|
1813
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-mb-2 oui-text-sm oui-font-semibold oui-text-base-contrast-80", children: "EVM" }),
|
|
1814
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-grid oui-grid-cols-2 oui-gap-2", children: connectors.map((item, key) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1815
|
+
"div",
|
|
1816
|
+
{
|
|
1817
|
+
className: ui.cn(
|
|
1818
|
+
" oui-flex oui-flex-1 oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-rounded-[6px] oui-px-2 oui-py-[11px]",
|
|
1819
|
+
isMobile ? "oui-bg-base-5" : "oui-bg-base-10"
|
|
1820
|
+
),
|
|
1821
|
+
onClick: () => onConnect(item),
|
|
1822
|
+
children: [
|
|
1823
|
+
/* @__PURE__ */ jsxRuntime.jsx(RenderWalletIcon, { connector: item }),
|
|
1824
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-text-base-contrast", children: item.name })
|
|
1825
|
+
]
|
|
1826
|
+
},
|
|
1827
|
+
key
|
|
1828
|
+
)) })
|
|
1829
|
+
] });
|
|
1766
1830
|
}
|
|
1767
|
-
|
|
1768
|
-
// src/components/renderConnector/index.tsx
|
|
1769
1831
|
function RenderConnector() {
|
|
1770
1832
|
const { connect } = useWallet2();
|
|
1771
1833
|
const {
|
|
@@ -1794,7 +1856,7 @@ function RenderConnector() {
|
|
|
1794
1856
|
if (connectorWalletType.disablePrivy) {
|
|
1795
1857
|
return null;
|
|
1796
1858
|
}
|
|
1797
|
-
return /* @__PURE__ */
|
|
1859
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1798
1860
|
PrivyConnectArea,
|
|
1799
1861
|
{
|
|
1800
1862
|
connect: (type) => handleConnect({
|
|
@@ -1811,7 +1873,7 @@ function RenderConnector() {
|
|
|
1811
1873
|
if (!walletChainTypeConfig.hasEvm) {
|
|
1812
1874
|
return null;
|
|
1813
1875
|
}
|
|
1814
|
-
return /* @__PURE__ */
|
|
1876
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1815
1877
|
EVMConnectArea,
|
|
1816
1878
|
{
|
|
1817
1879
|
connect: (connector) => handleConnect({
|
|
@@ -1828,7 +1890,7 @@ function RenderConnector() {
|
|
|
1828
1890
|
if (!walletChainTypeConfig.hasSol) {
|
|
1829
1891
|
return null;
|
|
1830
1892
|
}
|
|
1831
|
-
return /* @__PURE__ */
|
|
1893
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1832
1894
|
SOLConnectArea,
|
|
1833
1895
|
{
|
|
1834
1896
|
connect: (walletAdapter) => handleConnect({
|
|
@@ -1845,7 +1907,7 @@ function RenderConnector() {
|
|
|
1845
1907
|
if (!walletChainTypeConfig.hasAbstract) {
|
|
1846
1908
|
return null;
|
|
1847
1909
|
}
|
|
1848
|
-
return /* @__PURE__ */
|
|
1910
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1849
1911
|
AbstractConnectArea,
|
|
1850
1912
|
{
|
|
1851
1913
|
connect: () => handleConnect({ walletType: "Abstract" /* ABSTRACT */ })
|
|
@@ -1875,7 +1937,10 @@ function RenderConnector() {
|
|
|
1875
1937
|
return null;
|
|
1876
1938
|
}
|
|
1877
1939
|
};
|
|
1878
|
-
return /* @__PURE__ */
|
|
1940
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.ScrollArea, { className: "oui-flex oui-grow oui-shrik oui-basis-auto oui-custom-scrollbar", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cn("oui-flex oui-flex-col oui-gap-4", "md:oui-gap-5"), children: [
|
|
1941
|
+
renderPrivyConnectArea(),
|
|
1942
|
+
orderedWalletKeys.map((key) => /* @__PURE__ */ jsxRuntime.jsx(React7__default.default.Fragment, { children: renderByKey(key) }, key))
|
|
1943
|
+
] }) });
|
|
1879
1944
|
}
|
|
1880
1945
|
function SwitchNetworkTips({
|
|
1881
1946
|
tipsContent
|
|
@@ -1897,29 +1962,34 @@ function SwitchNetworkTips({
|
|
|
1897
1962
|
(error) => void 0
|
|
1898
1963
|
);
|
|
1899
1964
|
};
|
|
1900
|
-
return /* @__PURE__ */
|
|
1965
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1901
1966
|
"div",
|
|
1902
1967
|
{
|
|
1903
1968
|
onClick: onSwitchNetwork,
|
|
1904
|
-
className: "oui-mb-3 oui-flex oui-cursor-pointer oui-items-center oui-justify-between oui-gap-1 oui-rounded-[8px] oui-bg-[rgba(var(--oui-color-warning-darken),0.1)] oui-px-2 oui-py-[6px] "
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1969
|
+
className: "oui-mb-3 oui-flex oui-cursor-pointer oui-items-center oui-justify-between oui-gap-1 oui-rounded-[8px] oui-bg-[rgba(var(--oui-color-warning-darken),0.1)] oui-px-2 oui-py-[6px] ",
|
|
1970
|
+
children: [
|
|
1971
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 1, children: [
|
|
1972
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1973
|
+
ui.ExclamationFillIcon,
|
|
1974
|
+
{
|
|
1975
|
+
size: 14,
|
|
1976
|
+
className: " oui-shrink-0 oui-text-warning-darken"
|
|
1977
|
+
}
|
|
1978
|
+
),
|
|
1979
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-text-warning-darken", children: t("connector.privy.switchNetwork.tips", {
|
|
1980
|
+
chainName: tipsContent
|
|
1981
|
+
}) })
|
|
1982
|
+
] }),
|
|
1983
|
+
/* @__PURE__ */ jsxRuntime.jsx(ArrowRightIcon, { size: 14, className: "oui-text-warning-darken" })
|
|
1984
|
+
]
|
|
1985
|
+
}
|
|
1916
1986
|
);
|
|
1917
1987
|
}
|
|
1918
1988
|
var StorageChainNotCurrentWalletType = ({
|
|
1919
1989
|
currentWalletType
|
|
1920
1990
|
}) => {
|
|
1921
1991
|
const { storageChain } = hooks.useStorageChain();
|
|
1922
|
-
const tipsContent =
|
|
1992
|
+
const tipsContent = React7.useMemo(() => {
|
|
1923
1993
|
if (!currentWalletType || currentWalletType.size === 0 || !storageChain) {
|
|
1924
1994
|
return null;
|
|
1925
1995
|
}
|
|
@@ -1945,7 +2015,7 @@ var StorageChainNotCurrentWalletType = ({
|
|
|
1945
2015
|
}).join("/");
|
|
1946
2016
|
return text;
|
|
1947
2017
|
}, [storageChain, currentWalletType]);
|
|
1948
|
-
return /* @__PURE__ */
|
|
2018
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SwitchNetworkTips, { tipsContent });
|
|
1949
2019
|
};
|
|
1950
2020
|
var getCardBgClassName = (type = "EVM" /* EVM */) => {
|
|
1951
2021
|
const cardBgColorMap = {
|
|
@@ -1969,7 +2039,7 @@ function WalletCard(props) {
|
|
|
1969
2039
|
await navigator.clipboard.writeText(address);
|
|
1970
2040
|
ui.toast.success(t("common.copy.copied"));
|
|
1971
2041
|
};
|
|
1972
|
-
return /* @__PURE__ */
|
|
2042
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1973
2043
|
"div",
|
|
1974
2044
|
{
|
|
1975
2045
|
className: ui.cn(
|
|
@@ -1980,46 +2050,60 @@ function WalletCard(props) {
|
|
|
1980
2050
|
props.isMulti || false,
|
|
1981
2051
|
props.type
|
|
1982
2052
|
)
|
|
1983
|
-
)
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2053
|
+
),
|
|
2054
|
+
children: [
|
|
2055
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2056
|
+
"div",
|
|
2057
|
+
{
|
|
2058
|
+
style: {
|
|
2059
|
+
position: "absolute",
|
|
2060
|
+
top: 0,
|
|
2061
|
+
right: -20,
|
|
2062
|
+
background: "url('https://oss.orderly.network/static/sdk/wallet-card-bg.png')",
|
|
2063
|
+
width: "110px",
|
|
2064
|
+
height: "110px",
|
|
2065
|
+
backgroundSize: "contain",
|
|
2066
|
+
backgroundRepeat: "no-repeat",
|
|
2067
|
+
backgroundPosition: "center",
|
|
2068
|
+
zIndex: 0
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
),
|
|
2072
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-relative oui-z-10 oui-flex oui-h-full oui-flex-col oui-justify-between", children: [
|
|
2073
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-items-center oui-justify-between", children: [
|
|
2074
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-sm oui-font-semibold oui-text-secondary", children: ui.formatAddress(props.address) }),
|
|
2075
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-items-center oui-justify-center oui-gap-2", children: [
|
|
2076
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { content: t("common.copy"), className: "oui-z-[65]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2077
|
+
ui.CopyIcon,
|
|
2078
|
+
{
|
|
2079
|
+
size: 16,
|
|
2080
|
+
opacity: 1,
|
|
2081
|
+
className: "oui-cursor-pointer oui-text-secondary/80 hover:oui-text-secondary",
|
|
2082
|
+
onClick: () => copyAddress(props.address)
|
|
2083
|
+
}
|
|
2084
|
+
) }),
|
|
2085
|
+
props.isPrivy ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2086
|
+
PrivyWalletHandleOption,
|
|
2087
|
+
{
|
|
2088
|
+
address: props.address,
|
|
2089
|
+
type: props.type
|
|
2090
|
+
}
|
|
2091
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(NonPrivyWalletHandleOption, { walletType: props.type })
|
|
2092
|
+
] })
|
|
2093
|
+
] }),
|
|
2094
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-items-center oui-justify-between", children: [
|
|
2095
|
+
/* @__PURE__ */ jsxRuntime.jsx(RenderWalletType, { walletType: props.type }),
|
|
2096
|
+
props.isMulti && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "[&_button]:oui-border-secondary/80 [&_svg]:oui-text-secondary", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2097
|
+
ui.Checkbox,
|
|
2098
|
+
{
|
|
2099
|
+
checked: props.isActive,
|
|
2100
|
+
onCheckedChange: props.onActiveChange
|
|
2101
|
+
}
|
|
2102
|
+
) })
|
|
2103
|
+
] })
|
|
2104
|
+
] })
|
|
2105
|
+
]
|
|
2106
|
+
}
|
|
2023
2107
|
);
|
|
2024
2108
|
}
|
|
2025
2109
|
function NonPrivyWalletHandleOption({
|
|
@@ -2041,7 +2125,7 @@ function NonPrivyWalletHandleOption({
|
|
|
2041
2125
|
}
|
|
2042
2126
|
disconnect(walletConnectType);
|
|
2043
2127
|
};
|
|
2044
|
-
return /* @__PURE__ */
|
|
2128
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: () => disconnectWallet(), children: /* @__PURE__ */ jsxRuntime.jsx(DisconnectIcon, { className: "oui-size-4 oui-cursor-pointer oui-text-secondary/80 hover:oui-text-secondary" }) });
|
|
2045
2129
|
}
|
|
2046
2130
|
function PrivyWalletHandleOption({
|
|
2047
2131
|
address,
|
|
@@ -2049,75 +2133,90 @@ function PrivyWalletHandleOption({
|
|
|
2049
2133
|
}) {
|
|
2050
2134
|
const { t } = i18n.useTranslation();
|
|
2051
2135
|
const { exportWallet } = usePrivyWallet();
|
|
2052
|
-
return /* @__PURE__ */
|
|
2053
|
-
ui.
|
|
2054
|
-
{
|
|
2055
|
-
|
|
2056
|
-
align: "end",
|
|
2057
|
-
side: "top",
|
|
2058
|
-
style: { width: "100px" },
|
|
2059
|
-
className: "oui-z-[65] oui-rounded oui-p-1 oui-font-semibold",
|
|
2060
|
-
sideOffset: 0
|
|
2061
|
-
},
|
|
2062
|
-
/* @__PURE__ */ React19__default.default.createElement(
|
|
2063
|
-
ui.DropdownMenuItem,
|
|
2136
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenuRoot, { children: [
|
|
2137
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { children: /* @__PURE__ */ jsxRuntime.jsx(MoreIcon, { className: "oui-cursor-pointer oui-text-secondary/80 hover:oui-text-secondary" }) }) }),
|
|
2138
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2139
|
+
ui.DropdownMenuContent,
|
|
2064
2140
|
{
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2141
|
+
size: "xl",
|
|
2142
|
+
align: "end",
|
|
2143
|
+
side: "top",
|
|
2144
|
+
style: { width: "100px" },
|
|
2145
|
+
className: "oui-z-[65] oui-rounded oui-p-1 oui-font-semibold",
|
|
2146
|
+
sideOffset: 0,
|
|
2147
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2148
|
+
ui.DropdownMenuItem,
|
|
2149
|
+
{
|
|
2150
|
+
className: "oui-cursor-pointer oui-px-2 oui-py-1 oui-text-2xs oui-text-base-contrast-54 hover:oui-text-base-contrast",
|
|
2151
|
+
onClick: () => {
|
|
2152
|
+
const ns = type === "EVM" /* EVM */ ? types.ChainNamespace.evm : types.ChainNamespace.solana;
|
|
2153
|
+
exportWallet(ns, address);
|
|
2154
|
+
},
|
|
2155
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: t("common.export") })
|
|
2156
|
+
}
|
|
2157
|
+
)
|
|
2158
|
+
}
|
|
2159
|
+
) })
|
|
2160
|
+
] });
|
|
2074
2161
|
}
|
|
2075
2162
|
var RenderWalletType = ({ walletType }) => {
|
|
2076
2163
|
if (walletType === "SOL" /* SOL */) {
|
|
2077
|
-
return /* @__PURE__ */
|
|
2078
|
-
"
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2164
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-items-center oui-justify-start oui-gap-1", children: [
|
|
2165
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2166
|
+
"img",
|
|
2167
|
+
{
|
|
2168
|
+
src: "https://oss.orderly.network/static/sdk/solana-logo.png",
|
|
2169
|
+
className: "oui-w-4"
|
|
2170
|
+
}
|
|
2171
|
+
) }),
|
|
2172
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-font-semibold oui-text-secondary", children: "Solana" })
|
|
2173
|
+
] });
|
|
2084
2174
|
}
|
|
2085
2175
|
if (walletType === "Abstract" /* ABSTRACT */) {
|
|
2086
|
-
return /* @__PURE__ */
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2176
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-items-center oui-justify-start oui-gap-[6px]", children: [
|
|
2177
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2178
|
+
"img",
|
|
2179
|
+
{
|
|
2180
|
+
src: `${PrivyConnectorImagePath}/abstract-transparent.png`,
|
|
2181
|
+
className: "oui-w-4"
|
|
2182
|
+
}
|
|
2183
|
+
),
|
|
2184
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-font-semibold oui-text-secondary", children: "Abstract" })
|
|
2185
|
+
] });
|
|
2093
2186
|
}
|
|
2094
2187
|
if (walletType === "EVM" /* EVM */) {
|
|
2095
|
-
return /* @__PURE__ */
|
|
2096
|
-
"
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
{
|
|
2104
|
-
className: "oui-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2188
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-flex oui-items-center oui-justify-center oui-gap-1", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-relative oui-flex oui-items-center oui-justify-center", children: [
|
|
2189
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-flex oui-h-[18px] oui-items-center oui-justify-center ", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2190
|
+
"img",
|
|
2191
|
+
{
|
|
2192
|
+
src: "https://oss.orderly.network/static/sdk/chains.png",
|
|
2193
|
+
className: "oui-relative oui-z-0 oui-h-[18px] oui-w-[49px]"
|
|
2194
|
+
}
|
|
2195
|
+
) }),
|
|
2196
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-relative oui-left-[-9px] oui-flex oui-items-center oui-justify-center oui-gap-1", children: [
|
|
2197
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-flex oui-size-[18px] oui-items-center oui-justify-center oui-rounded-full oui-bg-base-5", children: /* @__PURE__ */ jsxRuntime.jsx(EVMChainPopover, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2198
|
+
MoreIcon,
|
|
2199
|
+
{
|
|
2200
|
+
className: "oui-relative oui-z-10 oui-size-3 oui-text-secondary/80 hover:oui-text-secondary",
|
|
2201
|
+
style: { zIndex: 1 }
|
|
2202
|
+
}
|
|
2203
|
+
) }) }),
|
|
2204
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-font-semibold oui-text-secondary", children: "Evm" })
|
|
2205
|
+
] })
|
|
2206
|
+
] }) });
|
|
2108
2207
|
}
|
|
2109
|
-
return /* @__PURE__ */
|
|
2208
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
2110
2209
|
};
|
|
2111
2210
|
function AddAbstractWallet() {
|
|
2112
|
-
const [visible, setVisible] =
|
|
2211
|
+
const [visible, setVisible] = React7.useState(false);
|
|
2113
2212
|
const onToggleVisibility = () => {
|
|
2114
2213
|
setVisible(!visible);
|
|
2115
2214
|
};
|
|
2116
2215
|
const { connect } = useWallet2();
|
|
2117
2216
|
const { targetWalletType } = useWalletConnectorPrivy();
|
|
2118
|
-
const [open, setOpen] =
|
|
2217
|
+
const [open, setOpen] = React7.useState(false);
|
|
2119
2218
|
const { t } = i18n.useTranslation();
|
|
2120
|
-
|
|
2219
|
+
React7.useEffect(() => {
|
|
2121
2220
|
let timer = 0;
|
|
2122
2221
|
if (targetWalletType === "Abstract" /* ABSTRACT */) {
|
|
2123
2222
|
timer = window.setTimeout(() => {
|
|
@@ -2130,7 +2229,7 @@ function AddAbstractWallet() {
|
|
|
2130
2229
|
}
|
|
2131
2230
|
};
|
|
2132
2231
|
}, [targetWalletType]);
|
|
2133
|
-
|
|
2232
|
+
React7.useEffect(() => {
|
|
2134
2233
|
if (open === false) {
|
|
2135
2234
|
return;
|
|
2136
2235
|
}
|
|
@@ -2143,70 +2242,79 @@ function AddAbstractWallet() {
|
|
|
2143
2242
|
}
|
|
2144
2243
|
};
|
|
2145
2244
|
}, [open]);
|
|
2146
|
-
return /* @__PURE__ */
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
className: "oui-z-[65] oui-max-w-[200px] oui-text-warning-darken",
|
|
2150
|
-
open,
|
|
2151
|
-
content: t("connector.privy.addAbstractWallet.tips")
|
|
2152
|
-
},
|
|
2153
|
-
/* @__PURE__ */ React19__default.default.createElement("div", { className: "oui-flex oui-items-center oui-justify-center oui-gap-1 " }, /* @__PURE__ */ React19__default.default.createElement(
|
|
2154
|
-
"img",
|
|
2245
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-rounded-[8px] oui-bg-base-10 oui-px-2 oui-py-[11px]", children: [
|
|
2246
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2247
|
+
ui.Tooltip,
|
|
2155
2248
|
{
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2249
|
+
className: "oui-z-[65] oui-max-w-[200px] oui-text-warning-darken",
|
|
2250
|
+
open,
|
|
2251
|
+
content: t("connector.privy.addAbstractWallet.tips"),
|
|
2252
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-items-center oui-justify-center oui-gap-1 ", children: [
|
|
2253
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2254
|
+
"img",
|
|
2255
|
+
{
|
|
2256
|
+
src: `${PrivyConnectorImagePath}/abstract-transparent.png`,
|
|
2257
|
+
className: "oui-size-[15px]"
|
|
2258
|
+
}
|
|
2259
|
+
),
|
|
2260
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-font-semibold oui-text-base-contrast-80", children: t("connector.privy.addAbstractWallet") }),
|
|
2261
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { onClick: onToggleVisibility, children: visible ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2262
|
+
ui.ChevronDownIcon,
|
|
2263
|
+
{
|
|
2264
|
+
size: 16,
|
|
2265
|
+
opacity: 1,
|
|
2266
|
+
className: "oui-text-base-contrast-36"
|
|
2267
|
+
}
|
|
2268
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2269
|
+
ui.ChevronUpIcon,
|
|
2270
|
+
{
|
|
2271
|
+
size: 16,
|
|
2272
|
+
opacity: 1,
|
|
2273
|
+
className: "oui-text-base-contrast"
|
|
2274
|
+
}
|
|
2275
|
+
) })
|
|
2276
|
+
] })
|
|
2172
2277
|
}
|
|
2173
|
-
)
|
|
2174
|
-
|
|
2175
|
-
"div",
|
|
2176
|
-
{
|
|
2177
|
-
className: ui.cn(
|
|
2178
|
-
"oui-transition-height oui-grid oui-grid-cols-2 oui-gap-2 oui-overflow-hidden oui-duration-150",
|
|
2179
|
-
visible ? "oui-mt-0 oui-max-h-0" : "oui-mt-3 oui-max-h-[400px]"
|
|
2180
|
-
)
|
|
2181
|
-
},
|
|
2182
|
-
/* @__PURE__ */ React19__default.default.createElement(
|
|
2278
|
+
),
|
|
2279
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2183
2280
|
"div",
|
|
2184
2281
|
{
|
|
2185
|
-
className:
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2282
|
+
className: ui.cn(
|
|
2283
|
+
"oui-transition-height oui-grid oui-grid-cols-2 oui-gap-2 oui-overflow-hidden oui-duration-150",
|
|
2284
|
+
visible ? "oui-mt-0 oui-max-h-0" : "oui-mt-3 oui-max-h-[400px]"
|
|
2285
|
+
),
|
|
2286
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2287
|
+
"div",
|
|
2288
|
+
{
|
|
2289
|
+
className: "oui-flex oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-bg-base-9 oui-px-2 oui-py-[11px]",
|
|
2290
|
+
onClick: () => connect({
|
|
2291
|
+
walletType: "Abstract" /* ABSTRACT */
|
|
2292
|
+
}),
|
|
2293
|
+
children: [
|
|
2294
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2295
|
+
"img",
|
|
2296
|
+
{
|
|
2297
|
+
className: ui.cn("oui-size-[12px]"),
|
|
2298
|
+
src: `${PrivyConnectorImagePath}/abstract.png`,
|
|
2299
|
+
alt: "abstract wallet"
|
|
2300
|
+
}
|
|
2301
|
+
),
|
|
2302
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-text-base-contrast", children: "Abstract" })
|
|
2303
|
+
]
|
|
2304
|
+
}
|
|
2305
|
+
)
|
|
2306
|
+
}
|
|
2199
2307
|
)
|
|
2200
|
-
)
|
|
2308
|
+
] });
|
|
2201
2309
|
}
|
|
2202
2310
|
function AddEvmWallet() {
|
|
2203
2311
|
const { t } = i18n.useTranslation();
|
|
2204
|
-
const [visible, setVisible] =
|
|
2312
|
+
const [visible, setVisible] = React7.useState(false);
|
|
2205
2313
|
const { connect } = useWallet2();
|
|
2206
|
-
const [open, setOpen] =
|
|
2314
|
+
const [open, setOpen] = React7.useState(false);
|
|
2207
2315
|
const { connectors } = useWagmiWallet();
|
|
2208
2316
|
const { targetWalletType } = useWalletConnectorPrivy();
|
|
2209
|
-
|
|
2317
|
+
React7.useEffect(() => {
|
|
2210
2318
|
let timer = 0;
|
|
2211
2319
|
if (targetWalletType === "EVM" /* EVM */) {
|
|
2212
2320
|
timer = window.setTimeout(() => {
|
|
@@ -2219,7 +2327,7 @@ function AddEvmWallet() {
|
|
|
2219
2327
|
}
|
|
2220
2328
|
};
|
|
2221
2329
|
}, [targetWalletType]);
|
|
2222
|
-
|
|
2330
|
+
React7.useEffect(() => {
|
|
2223
2331
|
if (open === false) {
|
|
2224
2332
|
return;
|
|
2225
2333
|
}
|
|
@@ -2232,71 +2340,83 @@ function AddEvmWallet() {
|
|
|
2232
2340
|
}
|
|
2233
2341
|
};
|
|
2234
2342
|
}, [open]);
|
|
2235
|
-
return /* @__PURE__ */
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
className: "oui-z-[65] oui-max-w-[200px] oui-text-warning-darken",
|
|
2239
|
-
open,
|
|
2240
|
-
content: t("connector.privy.addEvmWallet.tips")
|
|
2241
|
-
},
|
|
2242
|
-
/* @__PURE__ */ React19__default.default.createElement("div", { className: "oui-flex oui-items-center oui-justify-center oui-gap-1 " }, /* @__PURE__ */ React19__default.default.createElement("div", { className: "oui-flex oui-items-center oui-justify-center oui-gap-1" }, /* @__PURE__ */ React19__default.default.createElement("div", { className: "oui-relative oui-flex oui-w-[55px] oui-items-center oui-justify-start" }, /* @__PURE__ */ React19__default.default.createElement(
|
|
2243
|
-
"img",
|
|
2244
|
-
{
|
|
2245
|
-
src: "https://oss.orderly.network/static/sdk/chains.png",
|
|
2246
|
-
className: "oui-relative oui-z-0 oui-h-[18px]"
|
|
2247
|
-
}
|
|
2248
|
-
), /* @__PURE__ */ React19__default.default.createElement("div", { className: "oui-absolute oui-right-0 oui-flex oui-size-[18px] oui-items-center oui-justify-center oui-rounded-full oui-bg-base-5" }, /* @__PURE__ */ React19__default.default.createElement(EVMChainPopover, null, /* @__PURE__ */ React19__default.default.createElement(
|
|
2249
|
-
MoreIcon,
|
|
2343
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-rounded-[8px] oui-bg-base-10 oui-px-2 oui-py-[11px]", children: [
|
|
2344
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2345
|
+
ui.Tooltip,
|
|
2250
2346
|
{
|
|
2251
|
-
className: "oui-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2347
|
+
className: "oui-z-[65] oui-max-w-[200px] oui-text-warning-darken",
|
|
2348
|
+
open,
|
|
2349
|
+
content: t("connector.privy.addEvmWallet.tips"),
|
|
2350
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-items-center oui-justify-center oui-gap-1 ", children: [
|
|
2351
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-flex oui-items-center oui-justify-center oui-gap-1", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-relative oui-flex oui-w-[55px] oui-items-center oui-justify-start", children: [
|
|
2352
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2353
|
+
"img",
|
|
2354
|
+
{
|
|
2355
|
+
src: "https://oss.orderly.network/static/sdk/chains.png",
|
|
2356
|
+
className: "oui-relative oui-z-0 oui-h-[18px]"
|
|
2357
|
+
}
|
|
2358
|
+
),
|
|
2359
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-absolute oui-right-0 oui-flex oui-size-[18px] oui-items-center oui-justify-center oui-rounded-full oui-bg-base-5", children: /* @__PURE__ */ jsxRuntime.jsx(EVMChainPopover, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2360
|
+
MoreIcon,
|
|
2361
|
+
{
|
|
2362
|
+
className: "oui-relative oui-z-10 oui-size-3 oui-text-base-contrast-54 hover:oui-text-base-contrast",
|
|
2363
|
+
style: { zIndex: 1 }
|
|
2364
|
+
}
|
|
2365
|
+
) }) })
|
|
2366
|
+
] }) }),
|
|
2367
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-font-semibold oui-text-base-contrast-80", children: t("connector.privy.addEvmWallet") }),
|
|
2368
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { onClick: () => setVisible(!visible), children: visible ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2369
|
+
ui.ChevronDownIcon,
|
|
2370
|
+
{
|
|
2371
|
+
size: 16,
|
|
2372
|
+
opacity: 1,
|
|
2373
|
+
className: "oui-text-base-contrast-36"
|
|
2374
|
+
}
|
|
2375
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2376
|
+
ui.ChevronUpIcon,
|
|
2377
|
+
{
|
|
2378
|
+
size: 16,
|
|
2379
|
+
opacity: 1,
|
|
2380
|
+
className: "oui-text-base-contrast"
|
|
2381
|
+
}
|
|
2382
|
+
) })
|
|
2383
|
+
] })
|
|
2267
2384
|
}
|
|
2268
|
-
)
|
|
2269
|
-
|
|
2270
|
-
"div",
|
|
2271
|
-
{
|
|
2272
|
-
className: ui.cn(
|
|
2273
|
-
"oui-transition-height oui-grid oui-grid-cols-2 oui-gap-2 oui-overflow-hidden oui-duration-150",
|
|
2274
|
-
visible ? "oui-mt-0 oui-max-h-0" : "oui-mt-3 oui-max-h-[400px]"
|
|
2275
|
-
)
|
|
2276
|
-
},
|
|
2277
|
-
connectors.map((item, index) => /* @__PURE__ */ React19__default.default.createElement(
|
|
2385
|
+
),
|
|
2386
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2278
2387
|
"div",
|
|
2279
2388
|
{
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2389
|
+
className: ui.cn(
|
|
2390
|
+
"oui-transition-height oui-grid oui-grid-cols-2 oui-gap-2 oui-overflow-hidden oui-duration-150",
|
|
2391
|
+
visible ? "oui-mt-0 oui-max-h-0" : "oui-mt-3 oui-max-h-[400px]"
|
|
2392
|
+
),
|
|
2393
|
+
children: connectors.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2394
|
+
"div",
|
|
2395
|
+
{
|
|
2396
|
+
className: "oui-flex oui-cursor-pointer oui-items-center oui-justify-center oui-gap-1 oui-bg-base-9 oui-px-2 oui-py-[11px] oui-text-2xs",
|
|
2397
|
+
onClick: () => connect({ walletType: "EVM" /* EVM */, connector: item }),
|
|
2398
|
+
children: [
|
|
2399
|
+
/* @__PURE__ */ jsxRuntime.jsx(RenderWalletIcon, { connector: item }),
|
|
2400
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-base-contrast", children: item.name })
|
|
2401
|
+
]
|
|
2402
|
+
},
|
|
2403
|
+
index
|
|
2404
|
+
))
|
|
2405
|
+
}
|
|
2406
|
+
)
|
|
2407
|
+
] });
|
|
2288
2408
|
}
|
|
2289
2409
|
function AddSolanaWallet() {
|
|
2290
2410
|
const { t } = i18n.useTranslation();
|
|
2291
2411
|
const { wallets } = useSolanaWallet();
|
|
2292
2412
|
const { connect } = useWallet2();
|
|
2293
|
-
const [visible, setVisible] =
|
|
2413
|
+
const [visible, setVisible] = React7.useState(false);
|
|
2294
2414
|
const onToggleVisibility = () => {
|
|
2295
2415
|
setVisible(!visible);
|
|
2296
2416
|
};
|
|
2297
2417
|
const { targetWalletType } = useWalletConnectorPrivy();
|
|
2298
|
-
const [open, setOpen] =
|
|
2299
|
-
|
|
2418
|
+
const [open, setOpen] = React7.useState(false);
|
|
2419
|
+
React7.useEffect(() => {
|
|
2300
2420
|
let timer = 0;
|
|
2301
2421
|
if (targetWalletType === "SOL" /* SOL */) {
|
|
2302
2422
|
timer = window.setTimeout(() => {
|
|
@@ -2309,7 +2429,7 @@ function AddSolanaWallet() {
|
|
|
2309
2429
|
}
|
|
2310
2430
|
};
|
|
2311
2431
|
}, [targetWalletType]);
|
|
2312
|
-
|
|
2432
|
+
React7.useEffect(() => {
|
|
2313
2433
|
if (open === false) {
|
|
2314
2434
|
return;
|
|
2315
2435
|
}
|
|
@@ -2322,62 +2442,69 @@ function AddSolanaWallet() {
|
|
|
2322
2442
|
}
|
|
2323
2443
|
};
|
|
2324
2444
|
}, [open]);
|
|
2325
|
-
return /* @__PURE__ */
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
className: "oui-z-[65] oui-max-w-[200px] oui-text-warning-darken",
|
|
2329
|
-
open,
|
|
2330
|
-
content: t("connector.privy.addSolanaWallet.tips")
|
|
2331
|
-
},
|
|
2332
|
-
/* @__PURE__ */ React19__default.default.createElement("div", { className: "oui-flex oui-items-center oui-justify-center oui-gap-1 " }, /* @__PURE__ */ React19__default.default.createElement(
|
|
2333
|
-
"img",
|
|
2334
|
-
{
|
|
2335
|
-
src: "https://oss.orderly.network/static/sdk/solana-logo.png",
|
|
2336
|
-
className: "oui-size-[15px]"
|
|
2337
|
-
}
|
|
2338
|
-
), /* @__PURE__ */ React19__default.default.createElement("div", { className: "oui-text-2xs oui-font-semibold oui-text-base-contrast-80" }, t("connector.privy.addSolanaWallet")), /* @__PURE__ */ React19__default.default.createElement("button", { onClick: onToggleVisibility }, visible ? /* @__PURE__ */ React19__default.default.createElement(
|
|
2339
|
-
ui.ChevronDownIcon,
|
|
2445
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-rounded-[8px] oui-bg-base-10 oui-px-2 oui-py-[11px]", children: [
|
|
2446
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2447
|
+
ui.Tooltip,
|
|
2340
2448
|
{
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2449
|
+
className: "oui-z-[65] oui-max-w-[200px] oui-text-warning-darken",
|
|
2450
|
+
open,
|
|
2451
|
+
content: t("connector.privy.addSolanaWallet.tips"),
|
|
2452
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-items-center oui-justify-center oui-gap-1 ", children: [
|
|
2453
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2454
|
+
"img",
|
|
2455
|
+
{
|
|
2456
|
+
src: "https://oss.orderly.network/static/sdk/solana-logo.png",
|
|
2457
|
+
className: "oui-size-[15px]"
|
|
2458
|
+
}
|
|
2459
|
+
),
|
|
2460
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-font-semibold oui-text-base-contrast-80", children: t("connector.privy.addSolanaWallet") }),
|
|
2461
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { onClick: onToggleVisibility, children: visible ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2462
|
+
ui.ChevronDownIcon,
|
|
2463
|
+
{
|
|
2464
|
+
size: 16,
|
|
2465
|
+
opacity: 1,
|
|
2466
|
+
className: "oui-text-base-contrast-36"
|
|
2467
|
+
}
|
|
2468
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2469
|
+
ui.ChevronUpIcon,
|
|
2470
|
+
{
|
|
2471
|
+
size: 16,
|
|
2472
|
+
opacity: 1,
|
|
2473
|
+
className: "oui-text-base-contrast"
|
|
2474
|
+
}
|
|
2475
|
+
) })
|
|
2476
|
+
] })
|
|
2351
2477
|
}
|
|
2352
|
-
)
|
|
2353
|
-
|
|
2354
|
-
"div",
|
|
2355
|
-
{
|
|
2356
|
-
className: ui.cn(
|
|
2357
|
-
"oui-transition-height oui-grid oui-grid-cols-2 oui-gap-2 oui-overflow-hidden oui-duration-150",
|
|
2358
|
-
visible ? "oui-mt-0 oui-max-h-0" : "oui-mt-3 oui-max-h-[400px]"
|
|
2359
|
-
)
|
|
2360
|
-
},
|
|
2361
|
-
wallets.map((item, index) => /* @__PURE__ */ React19__default.default.createElement(
|
|
2478
|
+
),
|
|
2479
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2362
2480
|
"div",
|
|
2363
2481
|
{
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2482
|
+
className: ui.cn(
|
|
2483
|
+
"oui-transition-height oui-grid oui-grid-cols-2 oui-gap-2 oui-overflow-hidden oui-duration-150",
|
|
2484
|
+
visible ? "oui-mt-0 oui-max-h-0" : "oui-mt-3 oui-max-h-[400px]"
|
|
2485
|
+
),
|
|
2486
|
+
children: wallets.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2487
|
+
"div",
|
|
2488
|
+
{
|
|
2489
|
+
className: "oui-flex oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-bg-base-9 oui-px-2 oui-py-[11px]",
|
|
2490
|
+
onClick: () => connect({
|
|
2491
|
+
walletType: "SOL" /* SOL */,
|
|
2492
|
+
walletAdapter: item.adapter
|
|
2493
|
+
}),
|
|
2494
|
+
children: [
|
|
2495
|
+
/* @__PURE__ */ jsxRuntime.jsx(RenderWalletIcon, { connector: item.adapter }),
|
|
2496
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-text-base-contrast", children: item.adapter.name })
|
|
2497
|
+
]
|
|
2498
|
+
},
|
|
2499
|
+
index
|
|
2500
|
+
))
|
|
2501
|
+
}
|
|
2502
|
+
)
|
|
2503
|
+
] });
|
|
2375
2504
|
}
|
|
2376
|
-
|
|
2377
|
-
// src/components/renderNonPrivyWallet/index.tsx
|
|
2378
2505
|
function RenderNonPrivyWallet() {
|
|
2379
|
-
const [walletList, setWalletList] =
|
|
2380
|
-
const [addWalletList, setAddWalletList] =
|
|
2506
|
+
const [walletList, setWalletList] = React7.useState([]);
|
|
2507
|
+
const [addWalletList, setAddWalletList] = React7.useState([]);
|
|
2381
2508
|
const { storageChain } = hooks.useStorageChain();
|
|
2382
2509
|
const { connectorWalletType, walletChainTypeConfig } = useWalletConnectorPrivy();
|
|
2383
2510
|
const { wallet: walletInWagmi, isConnected: isConnectedEvm } = useWagmiWallet();
|
|
@@ -2399,14 +2526,14 @@ function RenderNonPrivyWallet() {
|
|
|
2399
2526
|
}
|
|
2400
2527
|
return false;
|
|
2401
2528
|
};
|
|
2402
|
-
const currentConnectWalletType =
|
|
2529
|
+
const currentConnectWalletType = React7.useMemo(() => {
|
|
2403
2530
|
const temp = /* @__PURE__ */ new Set();
|
|
2404
2531
|
walletList.forEach((wallet) => {
|
|
2405
2532
|
temp.add(wallet.type);
|
|
2406
2533
|
});
|
|
2407
2534
|
return temp;
|
|
2408
2535
|
}, [walletList]);
|
|
2409
|
-
|
|
2536
|
+
React7.useEffect(() => {
|
|
2410
2537
|
const tempWalletList = [];
|
|
2411
2538
|
const tempAddWallet = [];
|
|
2412
2539
|
if (!connectorWalletType.disableWagmi && walletChainTypeConfig.hasEvm) {
|
|
@@ -2451,63 +2578,90 @@ function RenderNonPrivyWallet() {
|
|
|
2451
2578
|
walletChainTypeConfig,
|
|
2452
2579
|
connectorWalletType
|
|
2453
2580
|
]);
|
|
2454
|
-
return /* @__PURE__ */
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
{
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2581
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2582
|
+
walletList.length && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2583
|
+
StorageChainNotCurrentWalletType,
|
|
2584
|
+
{
|
|
2585
|
+
currentWalletType: currentConnectWalletType
|
|
2586
|
+
}
|
|
2587
|
+
),
|
|
2588
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-flex oui-flex-col oui-gap-5", children: walletList.map((wallet) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2589
|
+
WalletCard,
|
|
2590
|
+
{
|
|
2591
|
+
type: wallet.type,
|
|
2592
|
+
address: wallet.address,
|
|
2593
|
+
isActive: isActive(wallet.type),
|
|
2594
|
+
onActiveChange: () => {
|
|
2595
|
+
switchWallet(wallet.type);
|
|
2596
|
+
},
|
|
2597
|
+
isPrivy: false,
|
|
2598
|
+
isMulti: walletList.length > 1
|
|
2468
2599
|
},
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
}
|
|
2472
|
-
|
|
2600
|
+
wallet.type
|
|
2601
|
+
)) }),
|
|
2602
|
+
/* @__PURE__ */ jsxRuntime.jsx(RenderAddWallet, { addWalletList })
|
|
2603
|
+
] });
|
|
2473
2604
|
}
|
|
2474
2605
|
function RenderAddWallet({ addWalletList }) {
|
|
2475
2606
|
if (addWalletList.length === 0) {
|
|
2476
2607
|
return null;
|
|
2477
2608
|
}
|
|
2478
|
-
return /* @__PURE__ */
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2609
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2610
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-my-5 oui-h-px oui-bg-line" }),
|
|
2611
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-flex oui-flex-col oui-gap-5", children: addWalletList.map((wallet, index) => {
|
|
2612
|
+
if (wallet === "EVM" /* EVM */) {
|
|
2613
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AddEvmWallet, {}, index);
|
|
2614
|
+
}
|
|
2615
|
+
if (wallet === "SOL" /* SOL */) {
|
|
2616
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AddSolanaWallet, {}, index);
|
|
2617
|
+
}
|
|
2618
|
+
if (wallet === "Abstract" /* ABSTRACT */) {
|
|
2619
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AddAbstractWallet, {}, index);
|
|
2620
|
+
}
|
|
2621
|
+
}) })
|
|
2622
|
+
] });
|
|
2489
2623
|
}
|
|
2490
2624
|
function NoWallet() {
|
|
2491
2625
|
const { walletChainType } = useWalletConnectorPrivy();
|
|
2492
2626
|
const { t } = i18n.useTranslation();
|
|
2493
|
-
return /* @__PURE__ */
|
|
2494
|
-
"
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2627
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-mt-5 oui-flex oui-w-full oui-flex-col oui-items-center oui-justify-center", children: [
|
|
2628
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-w-full oui-flex-col oui-items-center oui-justify-center oui-gap-3", children: [
|
|
2629
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-w-full oui-flex-col oui-items-center oui-justify-center oui-gap-1 oui-rounded-[8px] oui-border oui-border-line-12 oui-px-2 oui-py-[13px] ", children: [
|
|
2630
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2631
|
+
"img",
|
|
2632
|
+
{
|
|
2633
|
+
src: "https://oss.orderly.network/static/sdk/privy/no-wallet.png",
|
|
2634
|
+
className: "oui-size-[64px]"
|
|
2635
|
+
}
|
|
2636
|
+
),
|
|
2637
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-font-semibold oui-text-base-contrast-36", children: t("connector.privy.noWallet") })
|
|
2638
|
+
] }),
|
|
2639
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-items-start oui-gap-1 oui-rounded-[4px] oui-bg-[rgba(var(--oui-color-warning-darken)/0.15)] oui-px-2 oui-py-[6px] ", children: [
|
|
2640
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2641
|
+
ui.ExclamationFillIcon,
|
|
2642
|
+
{
|
|
2643
|
+
size: 10,
|
|
2644
|
+
className: "oui-mt-1 oui-size-[10px] oui-shrink-0 oui-text-warning-darken"
|
|
2645
|
+
}
|
|
2646
|
+
),
|
|
2647
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-text-warning-darken", children: t("connector.privy.noWallet.description") })
|
|
2648
|
+
] })
|
|
2649
|
+
] }),
|
|
2650
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-my-5 oui-h-px oui-w-full oui-bg-line" }),
|
|
2651
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-w-full oui-flex-col oui-gap-2", children: [
|
|
2652
|
+
walletChainType === "EVM_SOL" /* EVM_SOL */ && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2653
|
+
/* @__PURE__ */ jsxRuntime.jsx(CreateEVMWallet, {}),
|
|
2654
|
+
/* @__PURE__ */ jsxRuntime.jsx(CreateSOLWallet, {})
|
|
2655
|
+
] }),
|
|
2656
|
+
walletChainType === "onlyEVM" /* onlyEVM */ && /* @__PURE__ */ jsxRuntime.jsx(CreateEVMWallet, {}),
|
|
2657
|
+
walletChainType === "onlySOL" /* onlySOL */ && /* @__PURE__ */ jsxRuntime.jsx(CreateSOLWallet, {})
|
|
2658
|
+
] })
|
|
2659
|
+
] });
|
|
2506
2660
|
}
|
|
2507
2661
|
function CreateEVMWallet() {
|
|
2508
2662
|
const { t } = i18n.useTranslation();
|
|
2509
2663
|
const { createEvmWallet } = usePrivyWallet();
|
|
2510
|
-
const [loading, setLoading] =
|
|
2664
|
+
const [loading, setLoading] = React7.useState(false);
|
|
2511
2665
|
const doCreate = () => {
|
|
2512
2666
|
if (loading) {
|
|
2513
2667
|
return;
|
|
@@ -2519,34 +2673,40 @@ function CreateEVMWallet() {
|
|
|
2519
2673
|
setLoading(false);
|
|
2520
2674
|
});
|
|
2521
2675
|
};
|
|
2522
|
-
return /* @__PURE__ */
|
|
2523
|
-
"
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
{
|
|
2531
|
-
className: "oui-relative oui-z-10 oui-size-3 oui-text-base-contrast-54 hover:oui-text-base-contrast",
|
|
2532
|
-
style: { zIndex: 1 }
|
|
2533
|
-
}
|
|
2534
|
-
))))), /* @__PURE__ */ React19__default.default.createElement(
|
|
2535
|
-
"div",
|
|
2536
|
-
{
|
|
2537
|
-
className: ui.cn(
|
|
2538
|
-
"oui-cursor-pointer oui-text-2xs oui-font-semibold oui-text-base-contrast-80",
|
|
2539
|
-
loading && "oui-opacity-50"
|
|
2676
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-w-full oui-rounded-[8px] oui-bg-base-10 oui-px-2 oui-py-[11px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-items-center oui-justify-center oui-gap-1 ", children: [
|
|
2677
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-flex oui-items-center oui-justify-center oui-gap-1", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-relative oui-flex oui-w-[55px] oui-items-center oui-justify-start", children: [
|
|
2678
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2679
|
+
"img",
|
|
2680
|
+
{
|
|
2681
|
+
src: "https://oss.orderly.network/static/sdk/chains.png",
|
|
2682
|
+
className: "oui-relative oui-z-0 oui-h-[18px]"
|
|
2683
|
+
}
|
|
2540
2684
|
),
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2685
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-absolute oui-right-0 oui-flex oui-size-[18px] oui-items-center oui-justify-center oui-rounded-full oui-bg-base-5", children: /* @__PURE__ */ jsxRuntime.jsx(EVMChainPopover, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2686
|
+
MoreIcon,
|
|
2687
|
+
{
|
|
2688
|
+
className: "oui-relative oui-z-10 oui-size-3 oui-text-base-contrast-54 hover:oui-text-base-contrast",
|
|
2689
|
+
style: { zIndex: 1 }
|
|
2690
|
+
}
|
|
2691
|
+
) }) })
|
|
2692
|
+
] }) }),
|
|
2693
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2694
|
+
"div",
|
|
2695
|
+
{
|
|
2696
|
+
className: ui.cn(
|
|
2697
|
+
"oui-cursor-pointer oui-text-2xs oui-font-semibold oui-text-base-contrast-80",
|
|
2698
|
+
loading && "oui-opacity-50"
|
|
2699
|
+
),
|
|
2700
|
+
onClick: doCreate,
|
|
2701
|
+
children: t("connector.privy.createEvmWallet")
|
|
2702
|
+
}
|
|
2703
|
+
)
|
|
2704
|
+
] }) });
|
|
2545
2705
|
}
|
|
2546
2706
|
function CreateSOLWallet() {
|
|
2547
2707
|
const { t } = i18n.useTranslation();
|
|
2548
2708
|
const { createSolanaWallet } = usePrivyWallet();
|
|
2549
|
-
const [loading, setLoading] =
|
|
2709
|
+
const [loading, setLoading] = React7.useState(false);
|
|
2550
2710
|
const doCreate = () => {
|
|
2551
2711
|
if (loading) {
|
|
2552
2712
|
return;
|
|
@@ -2558,23 +2718,26 @@ function CreateSOLWallet() {
|
|
|
2558
2718
|
setLoading(false);
|
|
2559
2719
|
});
|
|
2560
2720
|
};
|
|
2561
|
-
return /* @__PURE__ */
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2721
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-w-full oui-rounded-[8px] oui-bg-base-10 oui-px-2 oui-py-[11px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-items-center oui-justify-center oui-gap-1 ", children: [
|
|
2722
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2723
|
+
"img",
|
|
2724
|
+
{
|
|
2725
|
+
src: "https://oss.orderly.network/static/sdk/solana-logo.png",
|
|
2726
|
+
className: "oui-size-[15px]"
|
|
2727
|
+
}
|
|
2728
|
+
),
|
|
2729
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2730
|
+
"div",
|
|
2731
|
+
{
|
|
2732
|
+
className: ui.cn(
|
|
2733
|
+
"oui-cursor-pointer oui-text-2xs oui-font-semibold oui-text-base-contrast-80",
|
|
2734
|
+
loading && "oui-opacity-50"
|
|
2735
|
+
),
|
|
2736
|
+
onClick: doCreate,
|
|
2737
|
+
children: t("connector.privy.createSolanaWallet")
|
|
2738
|
+
}
|
|
2739
|
+
)
|
|
2740
|
+
] }) });
|
|
2578
2741
|
}
|
|
2579
2742
|
function RenderPrivyWallet() {
|
|
2580
2743
|
const { t } = i18n.useTranslation();
|
|
@@ -2594,10 +2757,10 @@ function RenderPrivyWallet() {
|
|
|
2594
2757
|
} = usePrivyWallet();
|
|
2595
2758
|
const { switchWallet, disconnect } = useWallet2();
|
|
2596
2759
|
const { storageChain } = hooks.useStorageChain();
|
|
2597
|
-
const [walletList, setWalletList] =
|
|
2598
|
-
const [addWallet, setAddWallet] =
|
|
2599
|
-
const [loading, setLoading] =
|
|
2600
|
-
const isActive =
|
|
2760
|
+
const [walletList, setWalletList] = React7.useState([]);
|
|
2761
|
+
const [addWallet, setAddWallet] = React7.useState([]);
|
|
2762
|
+
const [loading, setLoading] = React7.useState(true);
|
|
2763
|
+
const isActive = React7.useCallback(
|
|
2601
2764
|
(walletType, address) => {
|
|
2602
2765
|
if (storageChain?.namespace === types.ChainNamespace.evm) {
|
|
2603
2766
|
if (walletType === "EVM" /* EVM */) {
|
|
@@ -2616,7 +2779,7 @@ function RenderPrivyWallet() {
|
|
|
2616
2779
|
},
|
|
2617
2780
|
[storageChain, walletEVM, walletSOL]
|
|
2618
2781
|
);
|
|
2619
|
-
const renderWarning =
|
|
2782
|
+
const renderWarning = React7.useCallback(() => {
|
|
2620
2783
|
let showWarning = false;
|
|
2621
2784
|
if (types.AbstractChains.has(storageChain?.chainId)) {
|
|
2622
2785
|
showWarning = true;
|
|
@@ -2627,50 +2790,58 @@ function RenderPrivyWallet() {
|
|
|
2627
2790
|
if (!showWarning) {
|
|
2628
2791
|
return;
|
|
2629
2792
|
}
|
|
2630
|
-
return /* @__PURE__ */
|
|
2793
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-mt-5 oui-border-b oui-border-line oui-pb-5", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2631
2794
|
"div",
|
|
2632
2795
|
{
|
|
2633
2796
|
className: ui.cn(
|
|
2634
2797
|
"oui-flex oui-items-start oui-justify-center oui-gap-1",
|
|
2635
2798
|
"oui-w-full oui-rounded-[8px] oui-px-2 oui-py-[13px]",
|
|
2636
2799
|
"oui-bg-warning-darken/10"
|
|
2637
|
-
)
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2800
|
+
),
|
|
2801
|
+
children: [
|
|
2802
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2803
|
+
ui.ExclamationFillIcon,
|
|
2804
|
+
{
|
|
2805
|
+
size: 14,
|
|
2806
|
+
className: "oui-mt-[2px] oui-size-[14px] oui-shrink-0 oui-text-warning-darken"
|
|
2807
|
+
}
|
|
2808
|
+
),
|
|
2809
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-2xs oui-leading-[18px] oui-text-warning-darken", children: "Abstract Chain access requires Abstract Global Wallet. Privy connection is currently unsupported." })
|
|
2810
|
+
]
|
|
2811
|
+
}
|
|
2812
|
+
) });
|
|
2648
2813
|
}, [targetWalletType]);
|
|
2649
|
-
const renderWallet =
|
|
2814
|
+
const renderWallet = React7.useCallback(() => {
|
|
2650
2815
|
if (loading) {
|
|
2651
2816
|
return;
|
|
2652
2817
|
}
|
|
2653
2818
|
if (!walletList.length) {
|
|
2654
|
-
return /* @__PURE__ */
|
|
2819
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NoWallet, {});
|
|
2655
2820
|
}
|
|
2656
|
-
return /* @__PURE__ */
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2821
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-mt-5 oui-flex oui-flex-col oui-gap-5", children: [
|
|
2822
|
+
walletList.map((wallet) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2823
|
+
WalletCard,
|
|
2824
|
+
{
|
|
2825
|
+
type: wallet.type,
|
|
2826
|
+
address: wallet.address,
|
|
2827
|
+
isActive: isActive(wallet.type, wallet.address),
|
|
2828
|
+
isPrivy: true,
|
|
2829
|
+
isMulti: walletList.length > 1,
|
|
2830
|
+
onActiveChange: () => {
|
|
2831
|
+
const walletNamespace = wallet.type === "EVM" /* EVM */ ? types.ChainNamespace.evm : types.ChainNamespace.solana;
|
|
2832
|
+
selectWallet(walletNamespace, wallet.address);
|
|
2833
|
+
if (storageChain?.namespace !== walletNamespace) {
|
|
2834
|
+
switchWallet(wallet.type);
|
|
2835
|
+
}
|
|
2670
2836
|
}
|
|
2671
|
-
}
|
|
2672
|
-
|
|
2673
|
-
|
|
2837
|
+
},
|
|
2838
|
+
wallet.address
|
|
2839
|
+
)),
|
|
2840
|
+
addWallet.map((node, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2841
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-my-5 oui-h-px oui-w-full oui-bg-line" }),
|
|
2842
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-flex oui-w-full oui-flex-col oui-gap-2", children: node })
|
|
2843
|
+
] }, index))
|
|
2844
|
+
] });
|
|
2674
2845
|
}, [
|
|
2675
2846
|
walletList,
|
|
2676
2847
|
addWallet,
|
|
@@ -2681,7 +2852,7 @@ function RenderPrivyWallet() {
|
|
|
2681
2852
|
t,
|
|
2682
2853
|
loading
|
|
2683
2854
|
]);
|
|
2684
|
-
|
|
2855
|
+
React7.useEffect(() => {
|
|
2685
2856
|
new Promise(
|
|
2686
2857
|
(resolve) => setTimeout(() => {
|
|
2687
2858
|
setLoading(false);
|
|
@@ -2689,7 +2860,7 @@ function RenderPrivyWallet() {
|
|
|
2689
2860
|
}, 200)
|
|
2690
2861
|
);
|
|
2691
2862
|
}, []);
|
|
2692
|
-
|
|
2863
|
+
React7.useEffect(() => {
|
|
2693
2864
|
const tempWalletList = [];
|
|
2694
2865
|
const tempAddWallet = [];
|
|
2695
2866
|
if (!connectorWalletType.disableWagmi && walletChainTypeConfig.hasEvm) {
|
|
@@ -2701,7 +2872,7 @@ function RenderPrivyWallet() {
|
|
|
2701
2872
|
});
|
|
2702
2873
|
}
|
|
2703
2874
|
} else {
|
|
2704
|
-
tempAddWallet.push(/* @__PURE__ */
|
|
2875
|
+
tempAddWallet.push(/* @__PURE__ */ jsxRuntime.jsx(CreateEVMWallet, {}));
|
|
2705
2876
|
}
|
|
2706
2877
|
}
|
|
2707
2878
|
if (!connectorWalletType.disableSolana && walletChainTypeConfig.hasSol) {
|
|
@@ -2713,7 +2884,7 @@ function RenderPrivyWallet() {
|
|
|
2713
2884
|
});
|
|
2714
2885
|
}
|
|
2715
2886
|
} else {
|
|
2716
|
-
tempAddWallet.push(/* @__PURE__ */
|
|
2887
|
+
tempAddWallet.push(/* @__PURE__ */ jsxRuntime.jsx(CreateSOLWallet, {}));
|
|
2717
2888
|
}
|
|
2718
2889
|
}
|
|
2719
2890
|
setWalletList(tempWalletList);
|
|
@@ -2724,7 +2895,7 @@ function RenderPrivyWallet() {
|
|
|
2724
2895
|
allWalletsEVM,
|
|
2725
2896
|
allWalletsSOL
|
|
2726
2897
|
]);
|
|
2727
|
-
|
|
2898
|
+
React7.useEffect(() => {
|
|
2728
2899
|
if (targetWalletType === "Abstract" /* ABSTRACT */) {
|
|
2729
2900
|
utils.windowGuard(() => {
|
|
2730
2901
|
setTimeout(() => {
|
|
@@ -2733,20 +2904,31 @@ function RenderPrivyWallet() {
|
|
|
2733
2904
|
});
|
|
2734
2905
|
}
|
|
2735
2906
|
}, [targetWalletType, setTargetWalletType]);
|
|
2736
|
-
return /* @__PURE__ */
|
|
2737
|
-
"div",
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2907
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-max-h-[70vh] oui-flex-col oui-overflow-y-auto oui-custom-scrollbar", children: [
|
|
2908
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-items-center oui-justify-between", children: [
|
|
2909
|
+
linkedAccount && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-items-center oui-justify-start oui-gap-2 oui-text-base-contrast", children: [
|
|
2910
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(RenderPrivyTypeIcon, { type: linkedAccount.type, size: 24 }) }),
|
|
2911
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-text-xs", children: linkedAccount.address })
|
|
2912
|
+
] }),
|
|
2913
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2914
|
+
"div",
|
|
2915
|
+
{
|
|
2916
|
+
className: "oui-cursor-pointer oui-text-2xs oui-font-semibold oui-text-primary",
|
|
2917
|
+
onClick: () => disconnect("privy" /* PRIVY */),
|
|
2918
|
+
children: t("connector.privy.logout")
|
|
2919
|
+
}
|
|
2920
|
+
)
|
|
2921
|
+
] }),
|
|
2922
|
+
renderWarning(),
|
|
2923
|
+
renderWallet()
|
|
2924
|
+
] });
|
|
2744
2925
|
}
|
|
2745
|
-
|
|
2746
|
-
// src/components/connectDrawer.tsx
|
|
2747
2926
|
function MyWallet() {
|
|
2748
2927
|
const [connectorKey, setConnectorKey] = hooks.useLocalStorage(types.ConnectorKey, "");
|
|
2749
|
-
return /* @__PURE__ */
|
|
2928
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2929
|
+
connectorKey === "privy" && /* @__PURE__ */ jsxRuntime.jsx(RenderPrivyWallet, {}),
|
|
2930
|
+
connectorKey !== "privy" && /* @__PURE__ */ jsxRuntime.jsx(RenderNonPrivyWallet, {})
|
|
2931
|
+
] });
|
|
2750
2932
|
}
|
|
2751
2933
|
function ConnectDrawer(props) {
|
|
2752
2934
|
const { t } = i18n.useTranslation();
|
|
@@ -2756,7 +2938,7 @@ function ConnectDrawer(props) {
|
|
|
2756
2938
|
const { isConnected: isConnectedAbstract } = useAbstractWallet();
|
|
2757
2939
|
const { termsOfUse } = useWalletConnectorPrivy();
|
|
2758
2940
|
const [connectorKey] = hooks.useLocalStorage(types.ConnectorKey, "");
|
|
2759
|
-
const isConnected =
|
|
2941
|
+
const isConnected = React7.useMemo(() => {
|
|
2760
2942
|
if (connectorKey === "privy" /* PRIVY */ && isConnectedPrivy) {
|
|
2761
2943
|
return true;
|
|
2762
2944
|
}
|
|
@@ -2783,20 +2965,20 @@ function ConnectDrawer(props) {
|
|
|
2783
2965
|
const showPwaDialog = () => {
|
|
2784
2966
|
ui.modal.show(PwaDialog);
|
|
2785
2967
|
};
|
|
2786
|
-
const renderHeader =
|
|
2787
|
-
return /* @__PURE__ */
|
|
2968
|
+
const renderHeader = React7.useCallback(() => {
|
|
2969
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2788
2970
|
"div",
|
|
2789
2971
|
{
|
|
2790
2972
|
className: ui.cn(
|
|
2791
2973
|
"oui-font-semibold oui-text-base-contrast-80 ",
|
|
2792
2974
|
"oui-pb-2 oui-text-[20px]",
|
|
2793
2975
|
"md:oui-py-0 md:oui-text-base"
|
|
2794
|
-
)
|
|
2795
|
-
|
|
2796
|
-
|
|
2976
|
+
),
|
|
2977
|
+
children: isConnected ? t("connector.privy.myWallet") : t("connector.connectWallet")
|
|
2978
|
+
}
|
|
2797
2979
|
);
|
|
2798
2980
|
}, [isConnected]);
|
|
2799
|
-
return /* @__PURE__ */
|
|
2981
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2800
2982
|
ui.SimpleSheet,
|
|
2801
2983
|
{
|
|
2802
2984
|
open: props.open,
|
|
@@ -2809,63 +2991,77 @@ function ConnectDrawer(props) {
|
|
|
2809
2991
|
isMobile ? "oui-inset-y-0 oui-right-0 oui-w-[280px] oui-rounded-none !oui-bg-base-8" : "!oui-bottom-[30px] oui-right-3 oui-top-[48px] !oui-h-auto oui-w-[300px] oui-overflow-hidden oui-rounded-[16px] !oui-bg-base-9 "
|
|
2810
2992
|
)
|
|
2811
2993
|
},
|
|
2812
|
-
contentProps: { side: "right", closeable: false }
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
}
|
|
2822
|
-
}
|
|
2823
|
-
),
|
|
2824
|
-
/* @__PURE__ */ React19__default.default.createElement("div", { className: "oui-relative oui-z-10 oui-flex oui-h-full oui-flex-col oui-gap-4 md:oui-gap-5" }, /* @__PURE__ */ React19__default.default.createElement("div", { className: "oui-flex oui-flex-none oui-items-center oui-justify-between" }, renderHeader(), /* @__PURE__ */ React19__default.default.createElement(
|
|
2825
|
-
ui.CloseSquareFillIcon,
|
|
2826
|
-
{
|
|
2827
|
-
className: "oui-size-5 oui-cursor-pointer oui-text-base-contrast-20 hover:oui-text-base-contrast-80",
|
|
2828
|
-
onClick: () => props.onChangeOpen(false)
|
|
2829
|
-
}
|
|
2830
|
-
)), isConnected ? /* @__PURE__ */ React19__default.default.createElement(MyWallet, null) : /* @__PURE__ */ React19__default.default.createElement(RenderConnector, null), !isConnected && /* @__PURE__ */ React19__default.default.createElement(ui.Flex, { gap: 4, direction: "column" }, isMobile && /* @__PURE__ */ React19__default.default.createElement(
|
|
2831
|
-
ui.Flex,
|
|
2832
|
-
{
|
|
2833
|
-
itemAlign: "center",
|
|
2834
|
-
justify: "between",
|
|
2835
|
-
gap: 4,
|
|
2836
|
-
className: "oui-rounded-[8px] oui-px-3 oui-py-2 oui-text-2xs oui-bg-[linear-gradient(270deg,rgba(var(--oui-gradient-brand-end),0.10)_0%,rgba(var(--oui-gradient-brand-start),0.10)_100%)] oui-w-full",
|
|
2837
|
-
onClick: () => showPwaDialog()
|
|
2838
|
-
},
|
|
2839
|
-
/* @__PURE__ */ React19__default.default.createElement(ui.Text, { className: "oui-bg-[linear-gradient(270deg,rgb(var(--oui-gradient-brand-end))_0%,rgb(var(--oui-gradient-brand-start))_100%)] oui-bg-clip-text oui-text-transparent" }, t("connector.privy.pwa.title")),
|
|
2840
|
-
/* @__PURE__ */ React19__default.default.createElement(
|
|
2841
|
-
ArrowRightLinearGradientIcon,
|
|
2842
|
-
{
|
|
2843
|
-
size: 20,
|
|
2844
|
-
className: "oui-flex-shrink-0"
|
|
2845
|
-
}
|
|
2846
|
-
)
|
|
2847
|
-
), termsOfUse && /* @__PURE__ */ React19__default.default.createElement("div", { className: "oui-flex-none oui-text-center oui-text-2xs oui-font-semibold oui-text-base-contrast-80" }, /* @__PURE__ */ React19__default.default.createElement(
|
|
2848
|
-
i18n.Trans,
|
|
2849
|
-
{
|
|
2850
|
-
i18nKey: "connector.privy.termsOfUse",
|
|
2851
|
-
components: [
|
|
2852
|
-
/* @__PURE__ */ React19__default.default.createElement(
|
|
2853
|
-
"a",
|
|
2854
|
-
{
|
|
2855
|
-
key: "termsOfUse",
|
|
2856
|
-
href: termsOfUse,
|
|
2857
|
-
className: "oui-cursor-pointer oui-text-primary oui-underline",
|
|
2858
|
-
target: "_blank",
|
|
2859
|
-
rel: "noreferrer"
|
|
2994
|
+
contentProps: { side: "right", closeable: false },
|
|
2995
|
+
children: [
|
|
2996
|
+
!isMobile && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2997
|
+
"div",
|
|
2998
|
+
{
|
|
2999
|
+
className: "oui-absolute oui-inset-x-[50px] -oui-top-[calc(100vh/2)] oui-z-0 oui-h-screen",
|
|
3000
|
+
style: {
|
|
3001
|
+
background: "conic-gradient(from -41deg at 40.63% 50.41%, rgba(242, 98, 181, 0.00) 125.17920970916748deg, rgba(95, 197, 255, 0.20) 193.4119462966919deg, rgba(255, 172, 137, 0.20) 216.0206937789917deg, rgba(129, 85, 255, 0.20) 236.0708713531494deg, rgba(120, 157, 255, 0.20) 259.95326042175293deg, rgba(159, 115, 241, 0.00) 311.0780096054077deg)",
|
|
3002
|
+
filter: "blur(50px)"
|
|
2860
3003
|
}
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
3004
|
+
}
|
|
3005
|
+
),
|
|
3006
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-relative oui-z-10 oui-flex oui-h-full oui-flex-col oui-gap-4 md:oui-gap-5", children: [
|
|
3007
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-flex-none oui-items-center oui-justify-between", children: [
|
|
3008
|
+
renderHeader(),
|
|
3009
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3010
|
+
ui.CloseSquareFillIcon,
|
|
3011
|
+
{
|
|
3012
|
+
className: "oui-size-5 oui-cursor-pointer oui-text-base-contrast-20 hover:oui-text-base-contrast-80",
|
|
3013
|
+
onClick: () => props.onChangeOpen(false)
|
|
3014
|
+
}
|
|
3015
|
+
)
|
|
3016
|
+
] }),
|
|
3017
|
+
isConnected ? /* @__PURE__ */ jsxRuntime.jsx(MyWallet, {}) : /* @__PURE__ */ jsxRuntime.jsx(RenderConnector, {}),
|
|
3018
|
+
!isConnected && /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 4, direction: "column", children: [
|
|
3019
|
+
isMobile && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3020
|
+
ui.Flex,
|
|
3021
|
+
{
|
|
3022
|
+
itemAlign: "center",
|
|
3023
|
+
justify: "between",
|
|
3024
|
+
gap: 4,
|
|
3025
|
+
className: "oui-rounded-[8px] oui-px-3 oui-py-2 oui-text-2xs oui-bg-[linear-gradient(270deg,rgba(var(--oui-gradient-brand-end),0.10)_0%,rgba(var(--oui-gradient-brand-start),0.10)_100%)] oui-w-full",
|
|
3026
|
+
onClick: () => showPwaDialog(),
|
|
3027
|
+
children: [
|
|
3028
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "oui-bg-[linear-gradient(270deg,rgb(var(--oui-gradient-brand-end))_0%,rgb(var(--oui-gradient-brand-start))_100%)] oui-bg-clip-text oui-text-transparent", children: t("connector.privy.pwa.title") }),
|
|
3029
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3030
|
+
ArrowRightLinearGradientIcon,
|
|
3031
|
+
{
|
|
3032
|
+
size: 20,
|
|
3033
|
+
className: "oui-flex-shrink-0"
|
|
3034
|
+
}
|
|
3035
|
+
)
|
|
3036
|
+
]
|
|
3037
|
+
}
|
|
3038
|
+
),
|
|
3039
|
+
termsOfUse && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-flex-none oui-text-center oui-text-2xs oui-font-semibold oui-text-base-contrast-80", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3040
|
+
i18n.Trans,
|
|
3041
|
+
{
|
|
3042
|
+
i18nKey: "connector.privy.termsOfUse",
|
|
3043
|
+
components: [
|
|
3044
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3045
|
+
"a",
|
|
3046
|
+
{
|
|
3047
|
+
href: termsOfUse,
|
|
3048
|
+
className: "oui-cursor-pointer oui-text-primary oui-underline",
|
|
3049
|
+
target: "_blank",
|
|
3050
|
+
rel: "noreferrer"
|
|
3051
|
+
},
|
|
3052
|
+
"termsOfUse"
|
|
3053
|
+
)
|
|
3054
|
+
]
|
|
3055
|
+
}
|
|
3056
|
+
) })
|
|
3057
|
+
] })
|
|
3058
|
+
] })
|
|
3059
|
+
]
|
|
3060
|
+
}
|
|
2865
3061
|
);
|
|
2866
3062
|
}
|
|
2867
3063
|
var LinkDeviceMobile = (props) => {
|
|
2868
|
-
const [open, setOpen] =
|
|
3064
|
+
const [open, setOpen] = React7.useState(false);
|
|
2869
3065
|
const { account } = hooks.useAccount();
|
|
2870
3066
|
const { t } = i18n.useTranslation();
|
|
2871
3067
|
const onDisconnect = async () => {
|
|
@@ -2878,52 +3074,64 @@ var LinkDeviceMobile = (props) => {
|
|
|
2878
3074
|
const hideDialog = () => {
|
|
2879
3075
|
setOpen(false);
|
|
2880
3076
|
};
|
|
2881
|
-
return /* @__PURE__ */
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
primary: {
|
|
2896
|
-
label: t("connector.disconnect"),
|
|
2897
|
-
onClick: async () => {
|
|
2898
|
-
await onDisconnect();
|
|
2899
|
-
hideDialog();
|
|
3077
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3078
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3079
|
+
ui.SimpleDialog,
|
|
3080
|
+
{
|
|
3081
|
+
open,
|
|
3082
|
+
onOpenChange: setOpen,
|
|
3083
|
+
title: t("common.tips"),
|
|
3084
|
+
size: "xs",
|
|
3085
|
+
actions: {
|
|
3086
|
+
secondary: {
|
|
3087
|
+
label: t("common.cancel"),
|
|
3088
|
+
onClick: hideDialog,
|
|
3089
|
+
size: "md",
|
|
3090
|
+
fullWidth: true
|
|
2900
3091
|
},
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
3092
|
+
primary: {
|
|
3093
|
+
label: t("connector.disconnect"),
|
|
3094
|
+
onClick: async () => {
|
|
3095
|
+
await onDisconnect();
|
|
3096
|
+
hideDialog();
|
|
3097
|
+
},
|
|
3098
|
+
size: "md",
|
|
3099
|
+
variant: "outlined",
|
|
3100
|
+
color: "danger"
|
|
3101
|
+
}
|
|
3102
|
+
},
|
|
3103
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { intensity: 54, size: "sm", children: t("linkDevice.scanQRCode.connected.description") })
|
|
2905
3104
|
}
|
|
2906
|
-
|
|
2907
|
-
/* @__PURE__ */
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
3105
|
+
),
|
|
3106
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { className: "oui-gap-[6px]", itemAlign: "center", onClick: showDialog, children: [
|
|
3107
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3108
|
+
ui.Flex,
|
|
3109
|
+
{
|
|
3110
|
+
className: "oui-text-base-contrast",
|
|
3111
|
+
intensity: 500,
|
|
3112
|
+
height: 28,
|
|
3113
|
+
r: "md",
|
|
3114
|
+
children: [
|
|
3115
|
+
/* @__PURE__ */ jsxRuntime.jsx(DesktopIcon, {}),
|
|
3116
|
+
/* @__PURE__ */ jsxRuntime.jsx(Dot, {}),
|
|
3117
|
+
/* @__PURE__ */ jsxRuntime.jsx(LinkIcon, {}),
|
|
3118
|
+
/* @__PURE__ */ jsxRuntime.jsx(Dot, {}),
|
|
3119
|
+
/* @__PURE__ */ jsxRuntime.jsx(MobileIcon, {})
|
|
3120
|
+
]
|
|
3121
|
+
}
|
|
3122
|
+
),
|
|
3123
|
+
props.children
|
|
3124
|
+
] })
|
|
3125
|
+
] });
|
|
2922
3126
|
};
|
|
2923
3127
|
var Dot = () => {
|
|
2924
|
-
return /* @__PURE__ */
|
|
3128
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { className: "oui-gap-x-[1px] oui-px-[1px]", children: [
|
|
3129
|
+
/* @__PURE__ */ jsxRuntime.jsx(DotIcon, {}),
|
|
3130
|
+
/* @__PURE__ */ jsxRuntime.jsx(DotIcon, {}),
|
|
3131
|
+
/* @__PURE__ */ jsxRuntime.jsx(DotIcon, {})
|
|
3132
|
+
] });
|
|
2925
3133
|
};
|
|
2926
|
-
var DesktopIcon = (props) => /* @__PURE__ */
|
|
3134
|
+
var DesktopIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2927
3135
|
"svg",
|
|
2928
3136
|
{
|
|
2929
3137
|
width: "18",
|
|
@@ -2931,11 +3139,11 @@ var DesktopIcon = (props) => /* @__PURE__ */ React19__default.default.createElem
|
|
|
2931
3139
|
viewBox: "0 0 18 18",
|
|
2932
3140
|
fill: "currentColor",
|
|
2933
3141
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2934
|
-
...props
|
|
2935
|
-
|
|
2936
|
-
|
|
3142
|
+
...props,
|
|
3143
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4.5 2.93a2.25 2.25 0 0 0-2.25 2.25v5.25a.75.75 0 0 0-.75.75v1.5c0 1.272.93 2.25 2.25 2.25h10.5c1.318 0 2.25-.978 2.25-2.25v-1.5a.75.75 0 0 0-.75-.75V5.18a2.25 2.25 0 0 0-2.25-2.25zm0 1.5h9a.75.75 0 0 1 .75.75v5.25H3.75V5.18a.75.75 0 0 1 .75-.75M3 11.93h12v.75c0 .46-.277.75-.75.75H3.75c-.474 0-.75-.29-.75-.75z" })
|
|
3144
|
+
}
|
|
2937
3145
|
);
|
|
2938
|
-
var MobileIcon = (props) => /* @__PURE__ */
|
|
3146
|
+
var MobileIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2939
3147
|
"svg",
|
|
2940
3148
|
{
|
|
2941
3149
|
width: "18",
|
|
@@ -2943,81 +3151,87 @@ var MobileIcon = (props) => /* @__PURE__ */ React19__default.default.createEleme
|
|
|
2943
3151
|
viewBox: "0 0 18 18",
|
|
2944
3152
|
fill: "currentColor",
|
|
2945
3153
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2946
|
-
...props
|
|
2947
|
-
|
|
2948
|
-
|
|
3154
|
+
...props,
|
|
3155
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13.498 3.715a2.25 2.25 0 0 0-2.25-2.25h-4.5a2.25 2.25 0 0 0-2.25 2.25v10.5a2.25 2.25 0 0 0 2.25 2.25h4.5a2.25 2.25 0 0 0 2.25-2.25zm-1.5 0v9.75h-6v-9.75a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 .75.75m-2.25 11.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0" })
|
|
3156
|
+
}
|
|
2949
3157
|
);
|
|
2950
|
-
var LinkIcon = (props) => /* @__PURE__ */
|
|
3158
|
+
var LinkIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2951
3159
|
"svg",
|
|
2952
3160
|
{
|
|
2953
3161
|
width: "12",
|
|
2954
3162
|
height: "12",
|
|
2955
3163
|
viewBox: "0 0 12 12",
|
|
2956
3164
|
fill: "none",
|
|
2957
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
3165
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3166
|
+
children: [
|
|
3167
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3168
|
+
"path",
|
|
3169
|
+
{
|
|
3170
|
+
fillRule: "evenodd",
|
|
3171
|
+
clipRule: "evenodd",
|
|
3172
|
+
d: "M1.007 6a5 5 0 1 1 10 0 5 5 0 0 1-10 0m7.486-2.344A.6.6 0 0 1 8.91 3.5c.15 0 .305.048.418.156a.55.55 0 0 1 0 .798L5.254 8.337a.62.62 0 0 1-.837 0L2.67 6.673a.55.55 0 0 1 0-.798.62.62 0 0 1 .837 0l1.329 1.266z",
|
|
3173
|
+
fill: "url(#a)"
|
|
3174
|
+
}
|
|
3175
|
+
),
|
|
3176
|
+
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3177
|
+
"linearGradient",
|
|
3178
|
+
{
|
|
3179
|
+
id: "a",
|
|
3180
|
+
x1: "11.007",
|
|
3181
|
+
y1: "5.999",
|
|
3182
|
+
x2: "1.007",
|
|
3183
|
+
y2: "5.999",
|
|
3184
|
+
gradientUnits: "userSpaceOnUse",
|
|
3185
|
+
children: [
|
|
3186
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "rgb(var(--oui-gradient-brand-end))" }),
|
|
3187
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "rgb(var(--oui-gradient-brand-start))" })
|
|
3188
|
+
]
|
|
3189
|
+
}
|
|
3190
|
+
) })
|
|
3191
|
+
]
|
|
3192
|
+
}
|
|
2981
3193
|
);
|
|
2982
|
-
var DotIcon = (props) => /* @__PURE__ */
|
|
3194
|
+
var DotIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2983
3195
|
"svg",
|
|
2984
3196
|
{
|
|
2985
3197
|
width: "2",
|
|
2986
3198
|
height: "2",
|
|
2987
3199
|
viewBox: "0 0 2 2",
|
|
2988
3200
|
fill: "none",
|
|
2989
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3201
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3202
|
+
children: [
|
|
3203
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3204
|
+
"path",
|
|
3205
|
+
{
|
|
3206
|
+
d: "M.667.334a.667.667 0 1 1 0 1.333.667.667 0 0 1 0-1.333",
|
|
3207
|
+
fill: "url(#a)"
|
|
3208
|
+
}
|
|
3209
|
+
),
|
|
3210
|
+
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3211
|
+
"linearGradient",
|
|
3212
|
+
{
|
|
3213
|
+
id: "a",
|
|
3214
|
+
x1: "1.333",
|
|
3215
|
+
y1: "1.001",
|
|
3216
|
+
x2: "0",
|
|
3217
|
+
y2: "1.001",
|
|
3218
|
+
gradientUnits: "userSpaceOnUse",
|
|
3219
|
+
children: [
|
|
3220
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "rgb(var(--oui-gradient-brand-end))" }),
|
|
3221
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "rgb(var(--oui-gradient-brand-start))" })
|
|
3222
|
+
]
|
|
3223
|
+
}
|
|
3224
|
+
) })
|
|
3225
|
+
]
|
|
3226
|
+
}
|
|
3011
3227
|
);
|
|
3012
|
-
|
|
3013
|
-
// src/components/userCenter.tsx
|
|
3014
3228
|
function UserCenter(props) {
|
|
3015
3229
|
const { accountState: state } = props;
|
|
3016
|
-
return /* @__PURE__ */
|
|
3230
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RenderUserCenter, { state, disabledConnect: props.disabledConnect });
|
|
3017
3231
|
}
|
|
3018
3232
|
var MwebUserCenter = (props) => {
|
|
3019
3233
|
const { state } = props;
|
|
3020
|
-
return /* @__PURE__ */
|
|
3234
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RenderUserCenter, { state, disabledConnect: props.disabledConnect });
|
|
3021
3235
|
};
|
|
3022
3236
|
var RenderUserCenter = (props) => {
|
|
3023
3237
|
const { state } = props;
|
|
@@ -3028,24 +3242,24 @@ var RenderUserCenter = (props) => {
|
|
|
3028
3242
|
const { state: accountState, account } = hooks.useAccount();
|
|
3029
3243
|
const { connectedChain } = hooks.useWalletConnector();
|
|
3030
3244
|
const disabled = state.validating || props.disabledConnect;
|
|
3031
|
-
const userAddress =
|
|
3245
|
+
const userAddress = React7.useMemo(() => {
|
|
3032
3246
|
if (connectedChain?.id && types.ABSTRACT_CHAIN_ID_MAP.has(parseInt(connectedChain?.id))) {
|
|
3033
3247
|
return account.getAdditionalInfo()?.AGWAddress;
|
|
3034
3248
|
}
|
|
3035
3249
|
return account.address;
|
|
3036
3250
|
}, [account, connectedChain, accountState]);
|
|
3037
3251
|
if (state.status === types.AccountStatusEnum.EnableTradingWithoutConnected) {
|
|
3038
|
-
return /* @__PURE__ */
|
|
3252
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { className: "oui-bg-base-5 oui-px-[7px] oui-rounded-[6px] oui-gap-[6px]", children: /* @__PURE__ */ jsxRuntime.jsx(LinkDeviceMobile, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3039
3253
|
ui.Text.formatted,
|
|
3040
3254
|
{
|
|
3041
3255
|
rule: "address",
|
|
3042
|
-
className: "oui-text-base-contrast oui-text-xs"
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
)));
|
|
3256
|
+
className: "oui-text-base-contrast oui-text-xs",
|
|
3257
|
+
children: ui.formatAddress(userAddress)
|
|
3258
|
+
}
|
|
3259
|
+
) }) });
|
|
3046
3260
|
}
|
|
3047
3261
|
if (state.status <= types.AccountStatusEnum.NotConnected || disabled) {
|
|
3048
|
-
return /* @__PURE__ */
|
|
3262
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3049
3263
|
ui.Button,
|
|
3050
3264
|
{
|
|
3051
3265
|
"data-testid": "oui-testid-nav-bar-connectWallet-btn",
|
|
@@ -3061,86 +3275,88 @@ var RenderUserCenter = (props) => {
|
|
|
3061
3275
|
onClick: () => {
|
|
3062
3276
|
connect().then((r) => {
|
|
3063
3277
|
}).catch((e) => void 0);
|
|
3064
|
-
}
|
|
3065
|
-
|
|
3066
|
-
|
|
3278
|
+
},
|
|
3279
|
+
children: isMobile ? t("connector.connect") : t("connector.connectWallet")
|
|
3280
|
+
}
|
|
3067
3281
|
);
|
|
3068
3282
|
}
|
|
3069
3283
|
if (!wallet) {
|
|
3070
3284
|
return;
|
|
3071
3285
|
}
|
|
3072
3286
|
if (isMobile) {
|
|
3073
|
-
return /* @__PURE__ */
|
|
3287
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3074
3288
|
uiConnector.AuthGuard,
|
|
3075
3289
|
{
|
|
3076
3290
|
buttonProps: {
|
|
3077
3291
|
size: "md"
|
|
3078
|
-
}
|
|
3079
|
-
},
|
|
3080
|
-
/* @__PURE__ */ React19__default.default.createElement("div", { onClick: () => connect() }, /* @__PURE__ */ React19__default.default.createElement(
|
|
3081
|
-
ui.Button,
|
|
3082
|
-
{
|
|
3083
|
-
size: "md",
|
|
3084
|
-
variant: "gradient",
|
|
3085
|
-
angle: 45,
|
|
3086
|
-
"data-testid": "oui-testid-nav-bar-address-btn",
|
|
3087
|
-
className: "oui-px-2 oui-flex oui-items-center oui-justify-center oui-gap-1"
|
|
3088
3292
|
},
|
|
3089
|
-
|
|
3090
|
-
|
|
3293
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: () => connect(), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3294
|
+
ui.Button,
|
|
3091
3295
|
{
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3296
|
+
size: "md",
|
|
3297
|
+
variant: "gradient",
|
|
3298
|
+
angle: 45,
|
|
3299
|
+
"data-testid": "oui-testid-nav-bar-address-btn",
|
|
3300
|
+
className: "oui-px-2 oui-flex oui-items-center oui-justify-center oui-gap-1",
|
|
3301
|
+
children: [
|
|
3302
|
+
linkedAccount && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3303
|
+
RenderPrivyTypeIcon,
|
|
3304
|
+
{
|
|
3305
|
+
type: linkedAccount.type,
|
|
3306
|
+
size: 14,
|
|
3307
|
+
black: true
|
|
3308
|
+
}
|
|
3309
|
+
),
|
|
3310
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3311
|
+
ui.Text.formatted,
|
|
3312
|
+
{
|
|
3313
|
+
rule: "address",
|
|
3314
|
+
className: "oui-text-[rgba(0,0,0,.88)] oui-font-semibold",
|
|
3315
|
+
children: ui.formatAddress(userAddress)
|
|
3316
|
+
}
|
|
3317
|
+
)
|
|
3318
|
+
]
|
|
3095
3319
|
}
|
|
3096
|
-
)
|
|
3097
|
-
|
|
3098
|
-
ui.Text.formatted,
|
|
3099
|
-
{
|
|
3100
|
-
rule: "address",
|
|
3101
|
-
className: "oui-text-[rgba(0,0,0,.88)] oui-font-semibold"
|
|
3102
|
-
},
|
|
3103
|
-
ui.formatAddress(userAddress)
|
|
3104
|
-
)
|
|
3105
|
-
))
|
|
3320
|
+
) })
|
|
3321
|
+
}
|
|
3106
3322
|
);
|
|
3107
3323
|
}
|
|
3108
|
-
return /* @__PURE__ */
|
|
3324
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: () => connect(), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3109
3325
|
ui.Button,
|
|
3110
3326
|
{
|
|
3111
3327
|
size: "md",
|
|
3112
3328
|
variant: "gradient",
|
|
3113
3329
|
angle: 45,
|
|
3114
3330
|
"data-testid": "oui-testid-nav-bar-address-btn",
|
|
3115
|
-
className: "oui-flex oui-items-center oui-justify-center oui-gap-2"
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3331
|
+
className: "oui-flex oui-items-center oui-justify-center oui-gap-2",
|
|
3332
|
+
children: [
|
|
3333
|
+
linkedAccount && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3334
|
+
RenderPrivyTypeIcon,
|
|
3335
|
+
{
|
|
3336
|
+
type: linkedAccount.type,
|
|
3337
|
+
size: 18,
|
|
3338
|
+
black: true
|
|
3339
|
+
}
|
|
3340
|
+
),
|
|
3341
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text.formatted, { rule: "address", className: "oui-text-[rgba(0,0,0,.88)]", children: ui.formatAddress(userAddress) })
|
|
3342
|
+
]
|
|
3343
|
+
}
|
|
3344
|
+
) });
|
|
3127
3345
|
};
|
|
3128
3346
|
ui.installExtension({
|
|
3129
3347
|
name: "account-menu-privy",
|
|
3130
3348
|
scope: ["*"],
|
|
3131
3349
|
positions: [ui.ExtensionPositionEnum.AccountMenu]
|
|
3132
3350
|
})((props) => {
|
|
3133
|
-
return /* @__PURE__ */
|
|
3351
|
+
return /* @__PURE__ */ jsxRuntime.jsx(UserCenter, { ...props });
|
|
3134
3352
|
});
|
|
3135
3353
|
ui.installExtension({
|
|
3136
3354
|
name: "mobile-account-menu-privy",
|
|
3137
3355
|
scope: ["*"],
|
|
3138
3356
|
positions: [ui.ExtensionPositionEnum.MobileAccountMenu]
|
|
3139
3357
|
})((props) => {
|
|
3140
|
-
return /* @__PURE__ */
|
|
3358
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MwebUserCenter, { ...props });
|
|
3141
3359
|
});
|
|
3142
|
-
|
|
3143
|
-
// src/main.tsx
|
|
3144
3360
|
var Main = (props) => {
|
|
3145
3361
|
const { headerProps, children } = props;
|
|
3146
3362
|
const { wallet, connectedChain, setChain, namespace, onDisconnect } = useWallet2();
|
|
@@ -3155,7 +3371,7 @@ var Main = (props) => {
|
|
|
3155
3371
|
resolve([]);
|
|
3156
3372
|
});
|
|
3157
3373
|
};
|
|
3158
|
-
const memoizedValue =
|
|
3374
|
+
const memoizedValue = React7.useMemo(
|
|
3159
3375
|
() => ({
|
|
3160
3376
|
connect,
|
|
3161
3377
|
disconnect: onDisconnect,
|
|
@@ -3169,29 +3385,30 @@ var Main = (props) => {
|
|
|
3169
3385
|
}),
|
|
3170
3386
|
[connect, setChain, onDisconnect, connectedChain, wallet, namespace]
|
|
3171
3387
|
);
|
|
3172
|
-
return /* @__PURE__ */
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3388
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(hooks.WalletConnectorContext.Provider, { value: memoizedValue, children: [
|
|
3389
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3390
|
+
ConnectDrawer,
|
|
3391
|
+
{
|
|
3392
|
+
open: openConnectDrawer,
|
|
3393
|
+
onChangeOpen: setOpenConnectDrawer,
|
|
3394
|
+
headerProps
|
|
3395
|
+
}
|
|
3396
|
+
),
|
|
3397
|
+
children
|
|
3398
|
+
] });
|
|
3180
3399
|
};
|
|
3181
3400
|
var InitAbstractProvider = (props) => {
|
|
3182
3401
|
const { network } = useWalletConnectorPrivy();
|
|
3183
|
-
const chain =
|
|
3402
|
+
const chain = React7.useMemo(() => {
|
|
3184
3403
|
if (network === "mainnet" /* mainnet */) {
|
|
3185
3404
|
return chains.abstract;
|
|
3186
3405
|
}
|
|
3187
3406
|
return chains.abstractTestnet;
|
|
3188
3407
|
}, [network]);
|
|
3189
|
-
return /* @__PURE__ */
|
|
3408
|
+
return /* @__PURE__ */ jsxRuntime.jsx(agwReact.AbstractWalletProvider, { chain, children: props.children });
|
|
3190
3409
|
};
|
|
3191
|
-
|
|
3192
|
-
// src/providers/abstractWallet/index.tsx
|
|
3193
3410
|
function AbstractWallet({ children }) {
|
|
3194
|
-
return /* @__PURE__ */
|
|
3411
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InitAbstractProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(AbstractWalletProvider, { children }) });
|
|
3195
3412
|
}
|
|
3196
3413
|
function InitPrivyProvider({
|
|
3197
3414
|
privyConfig,
|
|
@@ -3202,7 +3419,7 @@ function InitPrivyProvider({
|
|
|
3202
3419
|
return children;
|
|
3203
3420
|
}
|
|
3204
3421
|
const { network } = useWalletConnectorPrivy();
|
|
3205
|
-
const config =
|
|
3422
|
+
const config = React7.useMemo(() => {
|
|
3206
3423
|
const chains = initChains;
|
|
3207
3424
|
const preferredDefaultChainIds = (network === "mainnet" ? types.defaultMainnetChains : types.defaultTestnetChains).map((c) => c.id);
|
|
3208
3425
|
const preferredDefaultChain = preferredDefaultChainIds.map((id) => chains.find((c) => c.id === id)).find((c) => !!c);
|
|
@@ -3210,29 +3427,59 @@ function InitPrivyProvider({
|
|
|
3210
3427
|
(chain) => !types.SolanaChains.has(chain.id) && !types.AbstractChains.has(chain.id)
|
|
3211
3428
|
);
|
|
3212
3429
|
const defaultEvmChain = preferredDefaultChain ?? firstEvmChain ?? chains[0];
|
|
3430
|
+
const userConfig = privyConfig.config ?? {};
|
|
3431
|
+
const {
|
|
3432
|
+
supportedChains,
|
|
3433
|
+
defaultChain,
|
|
3434
|
+
loginMethods: userLoginMethods,
|
|
3435
|
+
appearance: userAppearance,
|
|
3436
|
+
embeddedWallets: userEmbedded,
|
|
3437
|
+
externalWallets: userExternal,
|
|
3438
|
+
...rest
|
|
3439
|
+
} = userConfig;
|
|
3440
|
+
const defaultEmbedded = {
|
|
3441
|
+
ethereum: {
|
|
3442
|
+
createOnLogin: "all-users"
|
|
3443
|
+
},
|
|
3444
|
+
solana: {
|
|
3445
|
+
createOnLogin: "all-users"
|
|
3446
|
+
}
|
|
3447
|
+
};
|
|
3448
|
+
const defaultExternal = {
|
|
3449
|
+
walletConnect: {
|
|
3450
|
+
enabled: false
|
|
3451
|
+
}
|
|
3452
|
+
};
|
|
3453
|
+
const embeddedWallets = {
|
|
3454
|
+
...defaultEmbedded,
|
|
3455
|
+
...userEmbedded,
|
|
3456
|
+
ethereum: {
|
|
3457
|
+
...defaultEmbedded.ethereum,
|
|
3458
|
+
...userEmbedded?.ethereum
|
|
3459
|
+
},
|
|
3460
|
+
solana: {
|
|
3461
|
+
...defaultEmbedded.solana,
|
|
3462
|
+
...userEmbedded?.solana
|
|
3463
|
+
}
|
|
3464
|
+
};
|
|
3465
|
+
const externalWallets = {
|
|
3466
|
+
...defaultExternal,
|
|
3467
|
+
...userExternal,
|
|
3468
|
+
walletConnect: {
|
|
3469
|
+
...defaultExternal.walletConnect,
|
|
3470
|
+
...userExternal?.walletConnect,
|
|
3471
|
+
enabled: userExternal?.walletConnect?.enabled ?? defaultExternal.walletConnect?.enabled ?? false
|
|
3472
|
+
}
|
|
3473
|
+
};
|
|
3213
3474
|
return {
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
"google",
|
|
3217
|
-
"twitter"
|
|
3218
|
-
],
|
|
3475
|
+
...rest,
|
|
3476
|
+
loginMethods: userLoginMethods || ["email", "google", "twitter"],
|
|
3219
3477
|
appearance: {
|
|
3220
|
-
...
|
|
3478
|
+
...userAppearance,
|
|
3221
3479
|
walletChainType: "ethereum-and-solana"
|
|
3222
3480
|
},
|
|
3223
|
-
embeddedWallets
|
|
3224
|
-
|
|
3225
|
-
createOnLogin: "all-users"
|
|
3226
|
-
},
|
|
3227
|
-
solana: {
|
|
3228
|
-
createOnLogin: "all-users"
|
|
3229
|
-
}
|
|
3230
|
-
},
|
|
3231
|
-
externalWallets: {
|
|
3232
|
-
walletConnect: {
|
|
3233
|
-
enabled: false
|
|
3234
|
-
}
|
|
3235
|
-
},
|
|
3481
|
+
embeddedWallets,
|
|
3482
|
+
externalWallets,
|
|
3236
3483
|
defaultChain: defaultEvmChain,
|
|
3237
3484
|
supportedChains: chains
|
|
3238
3485
|
};
|
|
@@ -3240,18 +3487,16 @@ function InitPrivyProvider({
|
|
|
3240
3487
|
if (!initChains.length) {
|
|
3241
3488
|
return;
|
|
3242
3489
|
}
|
|
3243
|
-
return /* @__PURE__ */
|
|
3490
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactAuth.PrivyProvider, { appId: privyConfig.appid, config, children });
|
|
3244
3491
|
}
|
|
3245
|
-
|
|
3246
|
-
// src/providers/privy/index.tsx
|
|
3247
3492
|
function PrivyWallet(props) {
|
|
3248
|
-
return /* @__PURE__ */
|
|
3493
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3249
3494
|
InitPrivyProvider,
|
|
3250
3495
|
{
|
|
3251
3496
|
privyConfig: props.privyConfig,
|
|
3252
|
-
initChains: props.initChains
|
|
3253
|
-
|
|
3254
|
-
|
|
3497
|
+
initChains: props.initChains,
|
|
3498
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(PrivyWalletProvider, { children: props.children })
|
|
3499
|
+
}
|
|
3255
3500
|
);
|
|
3256
3501
|
}
|
|
3257
3502
|
function InitSolanaProvider({
|
|
@@ -3266,10 +3511,10 @@ function InitSolanaProvider({
|
|
|
3266
3511
|
if (connectorWalletType.disableSolana) {
|
|
3267
3512
|
return children;
|
|
3268
3513
|
}
|
|
3269
|
-
const wallets =
|
|
3514
|
+
const wallets = React7.useMemo(() => {
|
|
3270
3515
|
return walletsProp ?? [new walletAdapterWallets.PhantomWalletAdapter()];
|
|
3271
3516
|
}, [walletsProp]);
|
|
3272
|
-
|
|
3517
|
+
React7.useEffect(() => {
|
|
3273
3518
|
let rpcUrl = null;
|
|
3274
3519
|
if (network === "mainnet") {
|
|
3275
3520
|
rpcUrl = mainnetRpc ?? null;
|
|
@@ -3281,7 +3526,7 @@ function InitSolanaProvider({
|
|
|
3281
3526
|
network: network === "mainnet" ? walletAdapterBase.WalletAdapterNetwork.Mainnet : walletAdapterBase.WalletAdapterNetwork.Devnet
|
|
3282
3527
|
});
|
|
3283
3528
|
}, [network, mainnetRpc, devnetRpc, setSolanaInfo]);
|
|
3284
|
-
const handleOnError =
|
|
3529
|
+
const handleOnError = React7.useCallback(
|
|
3285
3530
|
(error, adapter) => {
|
|
3286
3531
|
if (error.name === "WalletAccountError") {
|
|
3287
3532
|
ee.emit("wallet:connect-error", {
|
|
@@ -3293,18 +3538,16 @@ function InitSolanaProvider({
|
|
|
3293
3538
|
},
|
|
3294
3539
|
[ee, onError]
|
|
3295
3540
|
);
|
|
3296
|
-
return /* @__PURE__ */
|
|
3541
|
+
return /* @__PURE__ */ jsxRuntime.jsx(walletAdapterReact.WalletProvider, { wallets, onError: handleOnError, autoConnect: true, children });
|
|
3297
3542
|
}
|
|
3298
|
-
|
|
3299
|
-
// src/providers/solana/index.tsx
|
|
3300
3543
|
function SolanaWallet(props) {
|
|
3301
|
-
return /* @__PURE__ */
|
|
3544
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3302
3545
|
InitSolanaProvider,
|
|
3303
3546
|
{
|
|
3304
3547
|
...props.solanaConfig ?? { wallets: [], onError: () => {
|
|
3305
|
-
} }
|
|
3306
|
-
|
|
3307
|
-
|
|
3548
|
+
} },
|
|
3549
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SolanaWalletProvider, { children: props.children })
|
|
3550
|
+
}
|
|
3308
3551
|
);
|
|
3309
3552
|
}
|
|
3310
3553
|
function InitWagmiProvider({
|
|
@@ -3317,8 +3560,8 @@ function InitWagmiProvider({
|
|
|
3317
3560
|
if (connectorWalletType.disableWagmi) {
|
|
3318
3561
|
return children;
|
|
3319
3562
|
}
|
|
3320
|
-
const [queryClient] =
|
|
3321
|
-
const [config] =
|
|
3563
|
+
const [queryClient] = React7.useState(() => new reactQuery.QueryClient());
|
|
3564
|
+
const [config] = React7.useState(
|
|
3322
3565
|
() => WagmiExport.createConfig({
|
|
3323
3566
|
chains: initChains && initChains.length ? initChains : [chains.mainnet],
|
|
3324
3567
|
multiInjectedProviderDiscovery: true,
|
|
@@ -3332,22 +3575,18 @@ function InitWagmiProvider({
|
|
|
3332
3575
|
)
|
|
3333
3576
|
})
|
|
3334
3577
|
);
|
|
3335
|
-
return /* @__PURE__ */
|
|
3578
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WagmiExport.WagmiProvider, { config, initialState, children: /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children }) });
|
|
3336
3579
|
}
|
|
3337
|
-
|
|
3338
|
-
// src/providers/wagmi/index.tsx
|
|
3339
3580
|
var WagmiWallet = (props) => {
|
|
3340
|
-
return /* @__PURE__ */
|
|
3581
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3341
3582
|
InitWagmiProvider,
|
|
3342
3583
|
{
|
|
3343
3584
|
initChains: props.initChains,
|
|
3344
|
-
wagmiConfig: props.wagmiConfig ?? types.EMPTY_OBJECT
|
|
3345
|
-
|
|
3346
|
-
|
|
3585
|
+
wagmiConfig: props.wagmiConfig ?? types.EMPTY_OBJECT,
|
|
3586
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(WagmiWalletProvider, { children: props.children })
|
|
3587
|
+
}
|
|
3347
3588
|
);
|
|
3348
3589
|
};
|
|
3349
|
-
|
|
3350
|
-
// src/provider.tsx
|
|
3351
3590
|
var testnetChainFallback = [types.ArbitrumSepoliaChainInfo, types.SolanaDevnetChainInfo];
|
|
3352
3591
|
var processChainInfo = (chainInfo) => chainInfo.map(
|
|
3353
3592
|
(row) => viemExport.defineChain({
|
|
@@ -3368,7 +3607,7 @@ var processChainInfo = (chainInfo) => chainInfo.map(
|
|
|
3368
3607
|
}
|
|
3369
3608
|
})
|
|
3370
3609
|
) || [];
|
|
3371
|
-
var WalletConnectorPrivyContext =
|
|
3610
|
+
var WalletConnectorPrivyContext = React7.createContext({
|
|
3372
3611
|
initChains: [chains.mainnet],
|
|
3373
3612
|
mainnetChains: [],
|
|
3374
3613
|
testnetChains: [],
|
|
@@ -3402,23 +3641,23 @@ var WalletConnectorPrivyContext = React19.createContext({
|
|
|
3402
3641
|
loginMethods: []
|
|
3403
3642
|
}
|
|
3404
3643
|
});
|
|
3405
|
-
var useWalletConnectorPrivy = () =>
|
|
3644
|
+
var useWalletConnectorPrivy = () => React7.useContext(WalletConnectorPrivyContext);
|
|
3406
3645
|
var defaultPrivyLoginMethod = [
|
|
3407
3646
|
"email",
|
|
3408
3647
|
"google",
|
|
3409
3648
|
"twitter"
|
|
3410
3649
|
];
|
|
3411
3650
|
function WalletConnectorPrivyProvider(props) {
|
|
3412
|
-
const [walletChainType, setWalletChainType] =
|
|
3651
|
+
const [walletChainType, setWalletChainType] = React7.useState(
|
|
3413
3652
|
"EVM_SOL" /* EVM_SOL */
|
|
3414
3653
|
);
|
|
3415
|
-
const [termsOfUse] =
|
|
3416
|
-
const [network, setNetwork] =
|
|
3417
|
-
const [initChains, setInitChains] =
|
|
3418
|
-
const [mainnetChains, setMainnetChains] =
|
|
3419
|
-
const [testnetChains, setTestnetChains] =
|
|
3420
|
-
const [mainnetChainInfos, setMainnetChainInfos] =
|
|
3421
|
-
const [testChainInfos, setTestChainInfos] =
|
|
3654
|
+
const [termsOfUse] = React7.useState(props.termsOfUse || "");
|
|
3655
|
+
const [network, setNetwork] = React7.useState(props.network);
|
|
3656
|
+
const [initChains, setInitChains] = React7.useState([]);
|
|
3657
|
+
const [mainnetChains, setMainnetChains] = React7.useState([]);
|
|
3658
|
+
const [testnetChains, setTestnetChains] = React7.useState([]);
|
|
3659
|
+
const [mainnetChainInfos, setMainnetChainInfos] = React7.useState(null);
|
|
3660
|
+
const [testChainInfos, setTestChainInfos] = React7.useState(
|
|
3422
3661
|
null
|
|
3423
3662
|
);
|
|
3424
3663
|
const fetchMainChains = hooks.useMainnetChainsStore((state) => state.fetchData);
|
|
@@ -3432,14 +3671,14 @@ function WalletConnectorPrivyProvider(props) {
|
|
|
3432
3671
|
);
|
|
3433
3672
|
const testChainInfosFromStore = hooks.useTestnetChainsStore((state) => state.data);
|
|
3434
3673
|
const hasCustomChains = Array.isArray(props.customChains) && props.customChains.length > 0;
|
|
3435
|
-
const initRef =
|
|
3436
|
-
const [openConnectDrawer, setOpenConnectDrawer] =
|
|
3437
|
-
const [targetWalletType, setTargetWalletType] =
|
|
3438
|
-
const [privyConfig, setPrivyConfig] =
|
|
3674
|
+
const initRef = React7.useRef(hasCustomChains);
|
|
3675
|
+
const [openConnectDrawer, setOpenConnectDrawer] = React7.useState(false);
|
|
3676
|
+
const [targetWalletType, setTargetWalletType] = React7.useState();
|
|
3677
|
+
const [privyConfig, setPrivyConfig] = React7.useState({
|
|
3439
3678
|
loginMethods: props.privyConfig ? props.privyConfig?.config?.loginMethods ?? defaultPrivyLoginMethod : defaultPrivyLoginMethod
|
|
3440
3679
|
});
|
|
3441
|
-
const [solanaInfo, setSolanaInfo] =
|
|
3442
|
-
const connectorWalletType =
|
|
3680
|
+
const [solanaInfo, setSolanaInfo] = React7.useState(null);
|
|
3681
|
+
const connectorWalletType = React7.useMemo(() => {
|
|
3443
3682
|
const type = {
|
|
3444
3683
|
disableWagmi: false,
|
|
3445
3684
|
disablePrivy: false,
|
|
@@ -3460,7 +3699,7 @@ function WalletConnectorPrivyProvider(props) {
|
|
|
3460
3699
|
}
|
|
3461
3700
|
return type;
|
|
3462
3701
|
}, [props.privyConfig, props.wagmiConfig, props.solanaConfig]);
|
|
3463
|
-
const walletChainTypeConfig =
|
|
3702
|
+
const walletChainTypeConfig = React7.useMemo(() => {
|
|
3464
3703
|
const chainTypeObj = {
|
|
3465
3704
|
hasEvm: false,
|
|
3466
3705
|
hasSol: false,
|
|
@@ -3477,7 +3716,7 @@ function WalletConnectorPrivyProvider(props) {
|
|
|
3477
3716
|
});
|
|
3478
3717
|
return chainTypeObj;
|
|
3479
3718
|
}, [initChains]);
|
|
3480
|
-
|
|
3719
|
+
React7.useEffect(() => {
|
|
3481
3720
|
if (!mainnetChainsHydrated || !testChainsHydrated) return;
|
|
3482
3721
|
if (Array.isArray(hooks.useMainnetChainsStore.getState().data) && hooks.useTestnetChainsStore.getState().data) {
|
|
3483
3722
|
return;
|
|
@@ -3530,7 +3769,7 @@ function WalletConnectorPrivyProvider(props) {
|
|
|
3530
3769
|
const getChainsByNetwork = (network2) => {
|
|
3531
3770
|
return network2 === "mainnet" ? mainnetChains : testnetChains;
|
|
3532
3771
|
};
|
|
3533
|
-
const value =
|
|
3772
|
+
const value = React7.useMemo(
|
|
3534
3773
|
() => ({
|
|
3535
3774
|
initChains,
|
|
3536
3775
|
mainnetChains,
|
|
@@ -3570,7 +3809,7 @@ function WalletConnectorPrivyProvider(props) {
|
|
|
3570
3809
|
privyConfig
|
|
3571
3810
|
]
|
|
3572
3811
|
);
|
|
3573
|
-
|
|
3812
|
+
React7.useEffect(() => {
|
|
3574
3813
|
if (initRef.current) return;
|
|
3575
3814
|
if (hasCustomChains) {
|
|
3576
3815
|
return;
|
|
@@ -3608,7 +3847,7 @@ function WalletConnectorPrivyProvider(props) {
|
|
|
3608
3847
|
mainnetChainInfosFromStore,
|
|
3609
3848
|
testChainInfosFromStore
|
|
3610
3849
|
]);
|
|
3611
|
-
|
|
3850
|
+
React7.useEffect(() => {
|
|
3612
3851
|
if (props.customChains) {
|
|
3613
3852
|
handleCustomerChains();
|
|
3614
3853
|
}
|
|
@@ -3616,7 +3855,7 @@ function WalletConnectorPrivyProvider(props) {
|
|
|
3616
3855
|
if (!initRef.current) {
|
|
3617
3856
|
return null;
|
|
3618
3857
|
}
|
|
3619
|
-
return /* @__PURE__ */
|
|
3858
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WalletConnectorPrivyContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsx(ui.TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsxRuntime.jsx(PrivyWallet, { privyConfig: props.privyConfig, initChains, children: /* @__PURE__ */ jsxRuntime.jsx(WagmiWallet, { wagmiConfig: props.wagmiConfig, initChains, children: /* @__PURE__ */ jsxRuntime.jsx(SolanaWallet, { solanaConfig: props.solanaConfig, children: /* @__PURE__ */ jsxRuntime.jsx(AbstractWallet, { children: /* @__PURE__ */ jsxRuntime.jsx(Main, { headerProps: props.headerProps, children: props.children }) }) }) }) }) }) });
|
|
3620
3859
|
}
|
|
3621
3860
|
|
|
3622
3861
|
// src/index.ts
|