@skip-go/widget 2.4.0 → 2.4.2
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/README.md +2 -220
- package/build/constants/abis.d.ts +60 -1
- package/build/hooks/use-assets.d.ts +3 -4
- package/build/hooks/use-auto-set-address.d.ts +2 -1
- package/build/hooks/use-balances-by-chain.d.ts +4 -3
- package/build/hooks/use-bridges.d.ts +3 -2
- package/build/hooks/use-broadcasted-txs.d.ts +8 -6
- package/build/hooks/use-chains.d.ts +3 -2
- package/build/hooks/use-make-wallets.d.ts +1 -0
- package/build/hooks/use-route.d.ts +3 -2
- package/build/hooks/use-skip-client.d.ts +1 -1
- package/build/hooks/use-usd-value.d.ts +3 -2
- package/build/index.es.js +427 -297
- package/build/index.es.js.map +1 -1
- package/build/lib/wagmi.d.ts +2 -8986
- package/build/provider/index.d.ts +5 -2
- package/build/provider/skip-provider.d.ts +3 -3
- package/build/provider/wallet/evm.d.ts +2 -0
- package/build/ui/WalletModal/WalletListItem.d.ts +2 -1
- package/package.json +6 -2
package/build/index.es.js
CHANGED
|
@@ -9,12 +9,12 @@ import { wallets as wallets$6 } from '@cosmos-kit/vectis';
|
|
|
9
9
|
import { chains as chains$1, assets as assets$1 } from 'chain-registry';
|
|
10
10
|
import { chains as chains$2, assets as assets$2 } from '@initia/initia-registry';
|
|
11
11
|
import { createConfig, WagmiProvider, useAccount as useAccount$1, useDisconnect, useConnect, useSwitchChain } from 'wagmi';
|
|
12
|
-
import { defineChain, http,
|
|
13
|
-
import { arbitrum, avalanche, base, bsc, celo, fantom, filecoin, kava, linea, mainnet, manta, moonbeam, optimism, polygon, polygonMumbai, sepolia, avalancheFuji, baseSepolia, optimismSepolia, arbitrumSepolia, blast, blastSepolia, opBNB } from 'wagmi/chains';
|
|
12
|
+
import { defineChain, http, createPublicClient, formatUnits, erc20Abi, isAddress } from 'viem';
|
|
13
|
+
import { arbitrum, avalanche, base, bsc, celo, fantom, filecoin, kava, linea, mainnet, manta, moonbeam, optimism, polygon, polygonMumbai, sepolia, avalancheFuji, baseSepolia, optimismSepolia, arbitrumSepolia, blast, blastSepolia, sei, opBNB } from 'wagmi/chains';
|
|
14
14
|
import { QueryClient, QueryClientProvider, useQuery, useMutation } from '@tanstack/react-query';
|
|
15
15
|
import { WalletProvider as WalletProvider$1, useWallet } from '@solana/wallet-adapter-react';
|
|
16
16
|
import { PhantomWalletAdapter, SolflareWalletAdapter, CoinbaseWalletAdapter, TrustWalletAdapter, LedgerWalletAdapter } from '@solana/wallet-adapter-wallets';
|
|
17
|
-
import {
|
|
17
|
+
import { SkipClient } from '@skip-go/client';
|
|
18
18
|
import { getWalletClient } from '@wagmi/core';
|
|
19
19
|
import { createContext, useContext, useMemo, useCallback, useRef, useState, useEffect, forwardRef, Fragment as Fragment$1 } from 'react';
|
|
20
20
|
import { create } from 'zustand';
|
|
@@ -24,9 +24,14 @@ import { ArrowTopRightOnSquareIcon, ArrowLeftIcon as ArrowLeftIcon$1, ChevronDow
|
|
|
24
24
|
import { ArrowLeftIcon, FaceFrownIcon, ChevronDownIcon, BackspaceIcon, TrashIcon, CubeIcon, ArrowRightIcon, ArrowTopRightOnSquareIcon as ArrowTopRightOnSquareIcon$1, CheckCircleIcon, ArrowPathIcon, XCircleIcon, CheckIcon, ClipboardDocumentIcon, ChevronRightIcon, ExclamationTriangleIcon, InformationCircleIcon, PencilSquareIcon as PencilSquareIcon$1, FingerPrintIcon, ArrowsUpDownIcon } from '@heroicons/react/20/solid';
|
|
25
25
|
import * as ScrollArea from '@radix-ui/react-scroll-area';
|
|
26
26
|
import toast, { Toaster } from 'react-hot-toast';
|
|
27
|
+
import { createPenumbraClient } from '@penumbra-zone/client';
|
|
28
|
+
import { ViewService } from '@penumbra-zone/protobuf';
|
|
29
|
+
import { bech32mAddress } from '@penumbra-zone/bech32m/penumbra';
|
|
30
|
+
import { bech32CompatAddress } from '@penumbra-zone/bech32m/penumbracompat1';
|
|
31
|
+
import { sei as sei$1 } from 'viem/chains';
|
|
32
|
+
import { styled, useTheme, StyleSheetManager, ThemeProvider } from 'styled-components';
|
|
27
33
|
import { clsx } from 'clsx';
|
|
28
34
|
import { twMerge } from 'tailwind-merge';
|
|
29
|
-
import { styled, useTheme, StyleSheetManager, ThemeProvider } from 'styled-components';
|
|
30
35
|
import { matchSorter } from 'match-sorter';
|
|
31
36
|
import * as Tooltip from '@radix-ui/react-tooltip';
|
|
32
37
|
import { StargateClient, GasPrice } from '@cosmjs/stargate';
|
|
@@ -162,6 +167,7 @@ const config = createConfig({
|
|
|
162
167
|
blastSepolia,
|
|
163
168
|
forma,
|
|
164
169
|
formaTestnet,
|
|
170
|
+
sei,
|
|
165
171
|
],
|
|
166
172
|
transports: {
|
|
167
173
|
[arbitrum.id]: http(),
|
|
@@ -188,14 +194,15 @@ const config = createConfig({
|
|
|
188
194
|
[blastSepolia.id]: http(),
|
|
189
195
|
[forma.id]: http(),
|
|
190
196
|
[formaTestnet.id]: http(),
|
|
197
|
+
[sei.id]: http(),
|
|
191
198
|
},
|
|
192
199
|
ssr: true,
|
|
193
200
|
});
|
|
194
201
|
|
|
195
202
|
const queryClient = new QueryClient();
|
|
196
203
|
|
|
197
|
-
const EVMProvider = ({ children }) => {
|
|
198
|
-
return (jsx(WagmiProvider, { config: config, reconnectOnMount: true, children: jsx(QueryClientProvider, { client: queryClient, children: children }, 'skip-widget') }, 'skip-widget-wagmi-provider'));
|
|
204
|
+
const EVMProvider = ({ children, wagmiConfig, }) => {
|
|
205
|
+
return (jsx(WagmiProvider, { config: !!wagmiConfig ? wagmiConfig : config, reconnectOnMount: true, children: jsx(QueryClientProvider, { client: queryClient, children: children }, 'skip-widget') }, 'skip-widget-wagmi-provider'));
|
|
199
206
|
};
|
|
200
207
|
|
|
201
208
|
const solanaWallets = [
|
|
@@ -311,7 +318,7 @@ const SkipContext = createContext(undefined);
|
|
|
311
318
|
function SkipProvider({ children, apiURL, endpointOptions, makeDestinationWallets, chainIDsToAffiliates, }) {
|
|
312
319
|
const { getWalletRepo } = useManager();
|
|
313
320
|
const { wallets } = useWallet();
|
|
314
|
-
const skipClient = new
|
|
321
|
+
const skipClient = new SkipClient({
|
|
315
322
|
chainIDsToAffiliates,
|
|
316
323
|
getCosmosSigner: async (chainID) => {
|
|
317
324
|
var _a, _b;
|
|
@@ -667,11 +674,13 @@ function isMobile() {
|
|
|
667
674
|
}
|
|
668
675
|
|
|
669
676
|
const useStore = create(() => ({}));
|
|
670
|
-
const WalletListItem = ({ children, chainType, walletName, ...props }) => {
|
|
677
|
+
const WalletListItem = ({ children, chainType, walletName, walletChainType, ...props }) => {
|
|
671
678
|
const Component = useMemo(() => {
|
|
672
679
|
if (walletName === 'prax')
|
|
673
680
|
return PenumbraWalletListItem;
|
|
674
|
-
return
|
|
681
|
+
return walletChainType === 'cosmos'
|
|
682
|
+
? CosmosWalletListItem
|
|
683
|
+
: EvmWalletListItem;
|
|
675
684
|
}, [chainType]);
|
|
676
685
|
return (jsx(Component, { walletName: walletName, ...props, children: children }));
|
|
677
686
|
};
|
|
@@ -724,6 +733,295 @@ const PenumbraWalletListItem = ({ children, walletName, ...props }) => {
|
|
|
724
733
|
const defaultValues$3 = {};
|
|
725
734
|
const useCallbackStore = create()(() => defaultValues$3);
|
|
726
735
|
|
|
736
|
+
const multicall3ABI = [
|
|
737
|
+
{
|
|
738
|
+
inputs: [
|
|
739
|
+
{
|
|
740
|
+
components: [
|
|
741
|
+
{ internalType: 'address', name: 'target', type: 'address' },
|
|
742
|
+
{ internalType: 'bytes', name: 'callData', type: 'bytes' },
|
|
743
|
+
],
|
|
744
|
+
internalType: 'struct Multicall3.Call[]',
|
|
745
|
+
name: 'calls',
|
|
746
|
+
type: 'tuple[]',
|
|
747
|
+
},
|
|
748
|
+
],
|
|
749
|
+
name: 'aggregate',
|
|
750
|
+
outputs: [
|
|
751
|
+
{ internalType: 'uint256', name: 'blockNumber', type: 'uint256' },
|
|
752
|
+
{ internalType: 'bytes[]', name: 'returnData', type: 'bytes[]' },
|
|
753
|
+
],
|
|
754
|
+
stateMutability: 'payable',
|
|
755
|
+
type: 'function',
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
inputs: [
|
|
759
|
+
{
|
|
760
|
+
components: [
|
|
761
|
+
{ internalType: 'address', name: 'target', type: 'address' },
|
|
762
|
+
{ internalType: 'bool', name: 'allowFailure', type: 'bool' },
|
|
763
|
+
{ internalType: 'bytes', name: 'callData', type: 'bytes' },
|
|
764
|
+
],
|
|
765
|
+
internalType: 'struct Multicall3.Call3[]',
|
|
766
|
+
name: 'calls',
|
|
767
|
+
type: 'tuple[]',
|
|
768
|
+
},
|
|
769
|
+
],
|
|
770
|
+
name: 'aggregate3',
|
|
771
|
+
outputs: [
|
|
772
|
+
{
|
|
773
|
+
components: [
|
|
774
|
+
{ internalType: 'bool', name: 'success', type: 'bool' },
|
|
775
|
+
{ internalType: 'bytes', name: 'returnData', type: 'bytes' },
|
|
776
|
+
],
|
|
777
|
+
internalType: 'struct Multicall3.Result[]',
|
|
778
|
+
name: 'returnData',
|
|
779
|
+
type: 'tuple[]',
|
|
780
|
+
},
|
|
781
|
+
],
|
|
782
|
+
stateMutability: 'payable',
|
|
783
|
+
type: 'function',
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
inputs: [
|
|
787
|
+
{
|
|
788
|
+
components: [
|
|
789
|
+
{ internalType: 'address', name: 'target', type: 'address' },
|
|
790
|
+
{ internalType: 'bool', name: 'allowFailure', type: 'bool' },
|
|
791
|
+
{ internalType: 'uint256', name: 'value', type: 'uint256' },
|
|
792
|
+
{ internalType: 'bytes', name: 'callData', type: 'bytes' },
|
|
793
|
+
],
|
|
794
|
+
internalType: 'struct Multicall3.Call3Value[]',
|
|
795
|
+
name: 'calls',
|
|
796
|
+
type: 'tuple[]',
|
|
797
|
+
},
|
|
798
|
+
],
|
|
799
|
+
name: 'aggregate3Value',
|
|
800
|
+
outputs: [
|
|
801
|
+
{
|
|
802
|
+
components: [
|
|
803
|
+
{ internalType: 'bool', name: 'success', type: 'bool' },
|
|
804
|
+
{ internalType: 'bytes', name: 'returnData', type: 'bytes' },
|
|
805
|
+
],
|
|
806
|
+
internalType: 'struct Multicall3.Result[]',
|
|
807
|
+
name: 'returnData',
|
|
808
|
+
type: 'tuple[]',
|
|
809
|
+
},
|
|
810
|
+
],
|
|
811
|
+
stateMutability: 'payable',
|
|
812
|
+
type: 'function',
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
inputs: [
|
|
816
|
+
{
|
|
817
|
+
components: [
|
|
818
|
+
{ internalType: 'address', name: 'target', type: 'address' },
|
|
819
|
+
{ internalType: 'bytes', name: 'callData', type: 'bytes' },
|
|
820
|
+
],
|
|
821
|
+
internalType: 'struct Multicall3.Call[]',
|
|
822
|
+
name: 'calls',
|
|
823
|
+
type: 'tuple[]',
|
|
824
|
+
},
|
|
825
|
+
],
|
|
826
|
+
name: 'blockAndAggregate',
|
|
827
|
+
outputs: [
|
|
828
|
+
{ internalType: 'uint256', name: 'blockNumber', type: 'uint256' },
|
|
829
|
+
{ internalType: 'bytes32', name: 'blockHash', type: 'bytes32' },
|
|
830
|
+
{
|
|
831
|
+
components: [
|
|
832
|
+
{ internalType: 'bool', name: 'success', type: 'bool' },
|
|
833
|
+
{ internalType: 'bytes', name: 'returnData', type: 'bytes' },
|
|
834
|
+
],
|
|
835
|
+
internalType: 'struct Multicall3.Result[]',
|
|
836
|
+
name: 'returnData',
|
|
837
|
+
type: 'tuple[]',
|
|
838
|
+
},
|
|
839
|
+
],
|
|
840
|
+
stateMutability: 'payable',
|
|
841
|
+
type: 'function',
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
inputs: [],
|
|
845
|
+
name: 'getBasefee',
|
|
846
|
+
outputs: [{ internalType: 'uint256', name: 'basefee', type: 'uint256' }],
|
|
847
|
+
stateMutability: 'view',
|
|
848
|
+
type: 'function',
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
inputs: [{ internalType: 'uint256', name: 'blockNumber', type: 'uint256' }],
|
|
852
|
+
name: 'getBlockHash',
|
|
853
|
+
outputs: [{ internalType: 'bytes32', name: 'blockHash', type: 'bytes32' }],
|
|
854
|
+
stateMutability: 'view',
|
|
855
|
+
type: 'function',
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
inputs: [],
|
|
859
|
+
name: 'getBlockNumber',
|
|
860
|
+
outputs: [
|
|
861
|
+
{ internalType: 'uint256', name: 'blockNumber', type: 'uint256' },
|
|
862
|
+
],
|
|
863
|
+
stateMutability: 'view',
|
|
864
|
+
type: 'function',
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
inputs: [],
|
|
868
|
+
name: 'getChainId',
|
|
869
|
+
outputs: [{ internalType: 'uint256', name: 'chainid', type: 'uint256' }],
|
|
870
|
+
stateMutability: 'view',
|
|
871
|
+
type: 'function',
|
|
872
|
+
},
|
|
873
|
+
{
|
|
874
|
+
inputs: [],
|
|
875
|
+
name: 'getCurrentBlockCoinbase',
|
|
876
|
+
outputs: [{ internalType: 'address', name: 'coinbase', type: 'address' }],
|
|
877
|
+
stateMutability: 'view',
|
|
878
|
+
type: 'function',
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
inputs: [],
|
|
882
|
+
name: 'getCurrentBlockDifficulty',
|
|
883
|
+
outputs: [{ internalType: 'uint256', name: 'difficulty', type: 'uint256' }],
|
|
884
|
+
stateMutability: 'view',
|
|
885
|
+
type: 'function',
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
inputs: [],
|
|
889
|
+
name: 'getCurrentBlockGasLimit',
|
|
890
|
+
outputs: [{ internalType: 'uint256', name: 'gaslimit', type: 'uint256' }],
|
|
891
|
+
stateMutability: 'view',
|
|
892
|
+
type: 'function',
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
inputs: [],
|
|
896
|
+
name: 'getCurrentBlockTimestamp',
|
|
897
|
+
outputs: [{ internalType: 'uint256', name: 'timestamp', type: 'uint256' }],
|
|
898
|
+
stateMutability: 'view',
|
|
899
|
+
type: 'function',
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
inputs: [{ internalType: 'address', name: 'addr', type: 'address' }],
|
|
903
|
+
name: 'getEthBalance',
|
|
904
|
+
outputs: [{ internalType: 'uint256', name: 'balance', type: 'uint256' }],
|
|
905
|
+
stateMutability: 'view',
|
|
906
|
+
type: 'function',
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
inputs: [],
|
|
910
|
+
name: 'getLastBlockHash',
|
|
911
|
+
outputs: [{ internalType: 'bytes32', name: 'blockHash', type: 'bytes32' }],
|
|
912
|
+
stateMutability: 'view',
|
|
913
|
+
type: 'function',
|
|
914
|
+
},
|
|
915
|
+
{
|
|
916
|
+
inputs: [
|
|
917
|
+
{ internalType: 'bool', name: 'requireSuccess', type: 'bool' },
|
|
918
|
+
{
|
|
919
|
+
components: [
|
|
920
|
+
{ internalType: 'address', name: 'target', type: 'address' },
|
|
921
|
+
{ internalType: 'bytes', name: 'callData', type: 'bytes' },
|
|
922
|
+
],
|
|
923
|
+
internalType: 'struct Multicall3.Call[]',
|
|
924
|
+
name: 'calls',
|
|
925
|
+
type: 'tuple[]',
|
|
926
|
+
},
|
|
927
|
+
],
|
|
928
|
+
name: 'tryAggregate',
|
|
929
|
+
outputs: [
|
|
930
|
+
{
|
|
931
|
+
components: [
|
|
932
|
+
{ internalType: 'bool', name: 'success', type: 'bool' },
|
|
933
|
+
{ internalType: 'bytes', name: 'returnData', type: 'bytes' },
|
|
934
|
+
],
|
|
935
|
+
internalType: 'struct Multicall3.Result[]',
|
|
936
|
+
name: 'returnData',
|
|
937
|
+
type: 'tuple[]',
|
|
938
|
+
},
|
|
939
|
+
],
|
|
940
|
+
stateMutability: 'payable',
|
|
941
|
+
type: 'function',
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
inputs: [
|
|
945
|
+
{ internalType: 'bool', name: 'requireSuccess', type: 'bool' },
|
|
946
|
+
{
|
|
947
|
+
components: [
|
|
948
|
+
{ internalType: 'address', name: 'target', type: 'address' },
|
|
949
|
+
{ internalType: 'bytes', name: 'callData', type: 'bytes' },
|
|
950
|
+
],
|
|
951
|
+
internalType: 'struct Multicall3.Call[]',
|
|
952
|
+
name: 'calls',
|
|
953
|
+
type: 'tuple[]',
|
|
954
|
+
},
|
|
955
|
+
],
|
|
956
|
+
name: 'tryBlockAndAggregate',
|
|
957
|
+
outputs: [
|
|
958
|
+
{ internalType: 'uint256', name: 'blockNumber', type: 'uint256' },
|
|
959
|
+
{ internalType: 'bytes32', name: 'blockHash', type: 'bytes32' },
|
|
960
|
+
{
|
|
961
|
+
components: [
|
|
962
|
+
{ internalType: 'bool', name: 'success', type: 'bool' },
|
|
963
|
+
{ internalType: 'bytes', name: 'returnData', type: 'bytes' },
|
|
964
|
+
],
|
|
965
|
+
internalType: 'struct Multicall3.Result[]',
|
|
966
|
+
name: 'returnData',
|
|
967
|
+
type: 'tuple[]',
|
|
968
|
+
},
|
|
969
|
+
],
|
|
970
|
+
stateMutability: 'payable',
|
|
971
|
+
type: 'function',
|
|
972
|
+
},
|
|
973
|
+
];
|
|
974
|
+
const seiPrecompileAddrABI = [
|
|
975
|
+
{
|
|
976
|
+
inputs: [
|
|
977
|
+
{ internalType: 'string', name: 'v', type: 'string' },
|
|
978
|
+
{ internalType: 'string', name: 'r', type: 'string' },
|
|
979
|
+
{ internalType: 'string', name: 's', type: 'string' },
|
|
980
|
+
{ internalType: 'string', name: 'customMessage', type: 'string' },
|
|
981
|
+
],
|
|
982
|
+
name: 'associate',
|
|
983
|
+
outputs: [
|
|
984
|
+
{ internalType: 'string', name: 'seiAddr', type: 'string' },
|
|
985
|
+
{ internalType: 'address', name: 'evmAddr', type: 'address' },
|
|
986
|
+
],
|
|
987
|
+
stateMutability: 'nonpayable',
|
|
988
|
+
type: 'function',
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
inputs: [{ internalType: 'address', name: 'addr', type: 'address' }],
|
|
992
|
+
name: 'getSeiAddr',
|
|
993
|
+
outputs: [{ internalType: 'string', name: 'response', type: 'string' }],
|
|
994
|
+
stateMutability: 'view',
|
|
995
|
+
type: 'function',
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
inputs: [{ internalType: 'string', name: 'addr', type: 'string' }],
|
|
999
|
+
name: 'getEvmAddr',
|
|
1000
|
+
outputs: [{ internalType: 'address', name: 'response', type: 'address' }],
|
|
1001
|
+
stateMutability: 'view',
|
|
1002
|
+
type: 'function',
|
|
1003
|
+
},
|
|
1004
|
+
];
|
|
1005
|
+
|
|
1006
|
+
const StyledThemedDiv = styled.div `
|
|
1007
|
+
background-color: ${(props) => props.theme.backgroundColor};
|
|
1008
|
+
color: ${(props) => props.theme.textColor};
|
|
1009
|
+
border-color: ${(props) => props.theme.borderColor};
|
|
1010
|
+
`;
|
|
1011
|
+
const StyledBrandDiv = styled.div `
|
|
1012
|
+
background-color: ${(props) => props.theme.brandColor};
|
|
1013
|
+
`;
|
|
1014
|
+
const StyledBorderDiv = styled.div `
|
|
1015
|
+
border-color: ${(props) => props.theme.borderColor};
|
|
1016
|
+
`;
|
|
1017
|
+
const StyledApproveButton = styled(StyledBrandDiv) `
|
|
1018
|
+
border-color: ${(props) => props.theme.brandColor};
|
|
1019
|
+
`;
|
|
1020
|
+
const StyledCancelButton = styled.button `
|
|
1021
|
+
color: ${(props) => props.theme.brandColor};
|
|
1022
|
+
border-color: ${(props) => props.theme.brandColor};
|
|
1023
|
+
`;
|
|
1024
|
+
|
|
727
1025
|
const useMakeWallets = () => {
|
|
728
1026
|
const { data: chains } = useChains();
|
|
729
1027
|
const { onWalletConnected, onWalletDisconnected } = useCallbackStore.getState();
|
|
@@ -745,13 +1043,63 @@ const useMakeWallets = () => {
|
|
|
745
1043
|
const makeWallets = (chainID) => {
|
|
746
1044
|
var _a;
|
|
747
1045
|
const chainType = (_a = getChain(chainID)) === null || _a === void 0 ? void 0 : _a.chainType;
|
|
1046
|
+
const isSei = chainType === 'cosmos' && chainID === 'pacific-1';
|
|
748
1047
|
let wallets = [];
|
|
749
1048
|
if (chainType === 'cosmos') {
|
|
1049
|
+
if (chainID.includes('penumbra')) {
|
|
1050
|
+
const praxWallet = {
|
|
1051
|
+
walletName: 'prax',
|
|
1052
|
+
walletPrettyName: 'Prax Wallet',
|
|
1053
|
+
walletChainType: 'cosmos',
|
|
1054
|
+
walletInfo: {
|
|
1055
|
+
logo: 'https://raw.githubusercontent.com/prax-wallet/web/e8b18f9b997708eab04f57e7a6c44f18b3cf13a8/apps/extension/public/prax-white-vertical.svg',
|
|
1056
|
+
},
|
|
1057
|
+
connect: async () => {
|
|
1058
|
+
console.error('Prax wallet is not supported for connect');
|
|
1059
|
+
toast.error('Prax wallet is not supported for connect');
|
|
1060
|
+
},
|
|
1061
|
+
getAddress: async ({ praxWallet }) => {
|
|
1062
|
+
const penumbraWalletIndex = praxWallet === null || praxWallet === void 0 ? void 0 : praxWallet.index;
|
|
1063
|
+
const sourceChainID = praxWallet === null || praxWallet === void 0 ? void 0 : praxWallet.sourceChainID;
|
|
1064
|
+
const prax_id = 'lkpmkhpnhknhmibgnmmhdhgdilepfghe';
|
|
1065
|
+
const prax_origin = `chrome-extension://${prax_id}`;
|
|
1066
|
+
const client = createPenumbraClient(prax_origin);
|
|
1067
|
+
try {
|
|
1068
|
+
await client.connect();
|
|
1069
|
+
const viewService = client.service(ViewService);
|
|
1070
|
+
const address = await viewService.addressByIndex({
|
|
1071
|
+
addressIndex: {
|
|
1072
|
+
account: penumbraWalletIndex ? penumbraWalletIndex : 0,
|
|
1073
|
+
},
|
|
1074
|
+
});
|
|
1075
|
+
if (!address.address)
|
|
1076
|
+
throw new Error('No address found');
|
|
1077
|
+
const bech32Address = getPenumbraCompatibleAddress({
|
|
1078
|
+
address: address.address,
|
|
1079
|
+
chainID: sourceChainID,
|
|
1080
|
+
});
|
|
1081
|
+
return bech32Address;
|
|
1082
|
+
}
|
|
1083
|
+
catch (error) {
|
|
1084
|
+
console.error(error);
|
|
1085
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1086
|
+
// @ts-expect-error
|
|
1087
|
+
toast.error(error === null || error === void 0 ? void 0 : error.message);
|
|
1088
|
+
}
|
|
1089
|
+
},
|
|
1090
|
+
disconnect: async () => {
|
|
1091
|
+
console.error('Prax wallet is not supported');
|
|
1092
|
+
},
|
|
1093
|
+
isWalletConnected: false,
|
|
1094
|
+
};
|
|
1095
|
+
return [praxWallet];
|
|
1096
|
+
}
|
|
750
1097
|
const chainName = chainIdToName(chainID);
|
|
751
1098
|
const walletRepo = getWalletRepo(chainName);
|
|
752
1099
|
wallets = walletRepo.wallets.map((wallet) => ({
|
|
753
1100
|
walletName: wallet.walletName,
|
|
754
1101
|
walletPrettyName: wallet.walletPrettyName,
|
|
1102
|
+
walletChainType: 'cosmos',
|
|
755
1103
|
walletInfo: {
|
|
756
1104
|
logo: wallet.walletInfo.logo,
|
|
757
1105
|
},
|
|
@@ -797,7 +1145,7 @@ const useMakeWallets = () => {
|
|
|
797
1145
|
return wallet.address;
|
|
798
1146
|
}
|
|
799
1147
|
catch (error) {
|
|
800
|
-
console.
|
|
1148
|
+
console.error(error);
|
|
801
1149
|
toast.error(jsx("p", { children: jsx("strong", { children: "Failed to get address!" }) }));
|
|
802
1150
|
}
|
|
803
1151
|
},
|
|
@@ -809,15 +1157,26 @@ const useMakeWallets = () => {
|
|
|
809
1157
|
isWalletConnected: wallet.isWalletConnected,
|
|
810
1158
|
}));
|
|
811
1159
|
}
|
|
812
|
-
if (chainType === 'evm') {
|
|
1160
|
+
if (chainType === 'evm' || isSei) {
|
|
813
1161
|
for (const connector of connectors) {
|
|
814
1162
|
if (wallets.findIndex((wallet) => wallet.walletName === connector.id) !==
|
|
815
1163
|
-1) {
|
|
816
1164
|
continue;
|
|
817
1165
|
}
|
|
818
|
-
const
|
|
1166
|
+
const evmGetAddress = async ({ signRequired, }) => {
|
|
1167
|
+
if (connector.id !== (currentConnector === null || currentConnector === void 0 ? void 0 : currentConnector.id)) {
|
|
1168
|
+
await connectAsync({ connector, chainId: Number(chainID) });
|
|
1169
|
+
trackWallet.track('evm', connector.id, chainType);
|
|
1170
|
+
}
|
|
1171
|
+
else if (evmAddress && isEvmConnected && signRequired) {
|
|
1172
|
+
trackWallet.track('evm', connector.id, chainType);
|
|
1173
|
+
}
|
|
1174
|
+
return evmAddress;
|
|
1175
|
+
};
|
|
1176
|
+
let minimalWallet = {
|
|
819
1177
|
walletName: connector.id,
|
|
820
1178
|
walletPrettyName: connector.name,
|
|
1179
|
+
walletChainType: 'evm',
|
|
821
1180
|
walletInfo: {
|
|
822
1181
|
logo: connector.icon,
|
|
823
1182
|
},
|
|
@@ -840,26 +1199,11 @@ const useMakeWallets = () => {
|
|
|
840
1199
|
},
|
|
841
1200
|
getAddress: async ({ signRequired, context }) => {
|
|
842
1201
|
try {
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
trackWallet.track('evm', connector.id, chainType);
|
|
847
|
-
}
|
|
848
|
-
if (context && evmAddress) {
|
|
849
|
-
toast.success(`Successfully retrieved ${context} address from ${connector.name}`);
|
|
850
|
-
}
|
|
851
|
-
return evmAddress;
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
else {
|
|
855
|
-
console.log('connecting');
|
|
856
|
-
await connectAsync({ connector, chainId: Number(chainID) });
|
|
857
|
-
trackWallet.track('evm', connector.id, chainType);
|
|
858
|
-
if (context) {
|
|
859
|
-
toast.success(`Successfully retrieved ${context} address from ${connector.name}`);
|
|
860
|
-
}
|
|
861
|
-
return evmAddress;
|
|
1202
|
+
const address = await evmGetAddress({ signRequired, context });
|
|
1203
|
+
if (address && context) {
|
|
1204
|
+
toast.success(`Successfully retrieved ${context} address from ${connector.name}`);
|
|
862
1205
|
}
|
|
1206
|
+
return address;
|
|
863
1207
|
}
|
|
864
1208
|
catch (error) {
|
|
865
1209
|
console.error(error);
|
|
@@ -873,6 +1217,36 @@ const useMakeWallets = () => {
|
|
|
873
1217
|
},
|
|
874
1218
|
isWalletConnected: connector.id === (currentConnector === null || currentConnector === void 0 ? void 0 : currentConnector.id),
|
|
875
1219
|
};
|
|
1220
|
+
if (isSei) {
|
|
1221
|
+
minimalWallet.getAddress = async ({ signRequired, context }) => {
|
|
1222
|
+
const address = await evmGetAddress({ signRequired, context });
|
|
1223
|
+
if (!address) {
|
|
1224
|
+
toast.error(jsx("p", { children: jsx("strong", { children: "Failed to get address!" }) }));
|
|
1225
|
+
}
|
|
1226
|
+
const publicClient = createPublicClient({
|
|
1227
|
+
chain: sei$1,
|
|
1228
|
+
transport: http(),
|
|
1229
|
+
});
|
|
1230
|
+
try {
|
|
1231
|
+
const seiAddress = await publicClient.readContract({
|
|
1232
|
+
args: [address],
|
|
1233
|
+
address: '0x0000000000000000000000000000000000001004',
|
|
1234
|
+
abi: seiPrecompileAddrABI,
|
|
1235
|
+
functionName: 'getSeiAddr',
|
|
1236
|
+
});
|
|
1237
|
+
if (context) {
|
|
1238
|
+
toast.success(`Successfully retrieved ${context} address from ${connector.name}`);
|
|
1239
|
+
}
|
|
1240
|
+
return seiAddress;
|
|
1241
|
+
}
|
|
1242
|
+
catch (error) {
|
|
1243
|
+
console.error(error);
|
|
1244
|
+
toast(({ id }) => (jsxs("div", { className: "flex flex-col", children: [jsx("h4", { className: "mb-2 font-bold", children: "Failed to get the address" }), jsx(StyledBorderDiv, { as: "pre", className: "mb-4 overflow-auto whitespace-pre-wrap break-all rounded border p-2 text-sm", children: jsxs("p", { children: ["Your EVM address (0x) has not associated on chain yet. Please visit", ' ', jsx("a", { target: "_blank", className: "underline", href: "https://app.sei.io/", children: "https://app.sei.io/" }), ' ', "to associate your SEI address."] }) }), jsx("button", { className: "self-end text-sm font-medium text-red-500 hover:underline", onClick: () => toast.dismiss(id), children: "Clear Notification \u00D7" })] })), {
|
|
1245
|
+
duration: Infinity,
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
};
|
|
1249
|
+
}
|
|
876
1250
|
wallets.push(minimalWallet);
|
|
877
1251
|
}
|
|
878
1252
|
}
|
|
@@ -881,6 +1255,7 @@ const useMakeWallets = () => {
|
|
|
881
1255
|
const minimalWallet = {
|
|
882
1256
|
walletName: wallet.adapter.name,
|
|
883
1257
|
walletPrettyName: wallet.adapter.name,
|
|
1258
|
+
walletChainType: 'svm',
|
|
884
1259
|
walletInfo: {
|
|
885
1260
|
logo: wallet.adapter.icon,
|
|
886
1261
|
},
|
|
@@ -940,30 +1315,19 @@ const useMakeWallets = () => {
|
|
|
940
1315
|
makeWallets,
|
|
941
1316
|
};
|
|
942
1317
|
};
|
|
1318
|
+
const penumbraBech32ChainIDs = ['noble-1', 'grand-1'];
|
|
1319
|
+
const getPenumbraCompatibleAddress = ({ chainID, address, }) => {
|
|
1320
|
+
if (!chainID)
|
|
1321
|
+
return bech32mAddress(address);
|
|
1322
|
+
return penumbraBech32ChainIDs.includes(chainID)
|
|
1323
|
+
? bech32CompatAddress(address)
|
|
1324
|
+
: bech32mAddress(address);
|
|
1325
|
+
};
|
|
943
1326
|
|
|
944
1327
|
function cn(...inputs) {
|
|
945
1328
|
return twMerge(clsx(inputs));
|
|
946
1329
|
}
|
|
947
1330
|
|
|
948
|
-
const StyledThemedDiv = styled.div `
|
|
949
|
-
background-color: ${(props) => props.theme.backgroundColor};
|
|
950
|
-
color: ${(props) => props.theme.textColor};
|
|
951
|
-
border-color: ${(props) => props.theme.borderColor};
|
|
952
|
-
`;
|
|
953
|
-
const StyledBrandDiv = styled.div `
|
|
954
|
-
background-color: ${(props) => props.theme.brandColor};
|
|
955
|
-
`;
|
|
956
|
-
const StyledBorderDiv = styled.div `
|
|
957
|
-
border-color: ${(props) => props.theme.borderColor};
|
|
958
|
-
`;
|
|
959
|
-
const StyledApproveButton = styled(StyledBrandDiv) `
|
|
960
|
-
border-color: ${(props) => props.theme.brandColor};
|
|
961
|
-
`;
|
|
962
|
-
const StyledCancelButton = styled.button `
|
|
963
|
-
color: ${(props) => props.theme.brandColor};
|
|
964
|
-
border-color: ${(props) => props.theme.brandColor};
|
|
965
|
-
`;
|
|
966
|
-
|
|
967
1331
|
function DialogContent({ children, onInteractOutside }) {
|
|
968
1332
|
const { open } = useContext(DialogContext);
|
|
969
1333
|
if (!open)
|
|
@@ -1080,7 +1444,7 @@ function WalletModal({ chainType, onClose, wallets }) {
|
|
|
1080
1444
|
? 'https://solana.com/ecosystem/explore?categories=wallet'
|
|
1081
1445
|
: 'https://ethereum.org/en/wallets/find-wallet', className: "inline-flex items-center gap-1 text-red-500 hover:underline", children: [jsx("span", { children: "Explore available wallets" }), jsx(ArrowTopRightOnSquareIcon, { className: "h-3 w-3" })] })] })] })), jsxs(StyledScrollAreaRoot, { className: cn('relative isolate flex-grow overflow-hidden', 'before:absolute before:inset-x-0 before:bottom-0 before:z-10 before:h-2'), children: [jsx(ScrollArea.Viewport, { className: "h-full w-full py-4", children: wallets.map((wallet) => {
|
|
1082
1446
|
// currently only svm chainType that have isAvailable
|
|
1083
|
-
return (jsxs(WalletListItem, { chainType: chainType, walletName: wallet.walletName, className: cn('group relative mb-2 data-[unsupported=true]:opacity-30', 'data-[unsupported=true]:before:absolute data-[unsupported=true]:before:inset-0 data-[unsupported=true]:before:cursor-not-allowed'), children: [jsxs(StyledThemedButton, { className: cn('flex w-full items-center gap-2 rounded-lg p-2 transition-colors focus:-outline-offset-2'), onClick: () => onWalletConnect(wallet), disabled: chainType === 'svm' && wallet.isAvailable !== true, children: [wallet.walletInfo.logo && (jsx("img", { height: 36, width: 36, alt: wallet.walletPrettyName, className: "h-9 w-9 object-contain", src: typeof wallet.walletInfo.logo === 'string'
|
|
1447
|
+
return (jsxs(WalletListItem, { chainType: chainType, walletChainType: wallet.walletChainType, walletName: wallet.walletName, className: cn('group relative mb-2 data-[unsupported=true]:opacity-30', 'data-[unsupported=true]:before:absolute data-[unsupported=true]:before:inset-0 data-[unsupported=true]:before:cursor-not-allowed'), children: [jsxs(StyledThemedButton, { className: cn('flex w-full items-center gap-2 rounded-lg p-2 transition-colors focus:-outline-offset-2'), onClick: () => onWalletConnect(wallet), disabled: chainType === 'svm' && wallet.isAvailable !== true, children: [wallet.walletInfo.logo && (jsx("img", { height: 36, width: 36, alt: wallet.walletPrettyName, className: "h-9 w-9 object-contain", src: typeof wallet.walletInfo.logo === 'string'
|
|
1084
1448
|
? wallet.walletInfo.logo
|
|
1085
1449
|
: wallet.walletInfo.logo.major, "aria-hidden": "true" })), jsx("p", { className: "flex-1 text-left font-semibold", children: wallet.walletPrettyName === 'Leap Cosmos MetaMask'
|
|
1086
1450
|
? 'Metamask (Leap Snap)'
|
|
@@ -1097,7 +1461,7 @@ function WalletModalWithContext() {
|
|
|
1097
1461
|
const { setIsOpen } = useWalletModal();
|
|
1098
1462
|
const { data: chain } = useChainByID(chainID);
|
|
1099
1463
|
const { makeWallets } = useMakeWallets();
|
|
1100
|
-
const wallets = makeWallets(chainID);
|
|
1464
|
+
const wallets = makeWallets(chainID).filter((wallet) => wallet.walletChainType === (chain === null || chain === void 0 ? void 0 : chain.chainType));
|
|
1101
1465
|
if (!chain) {
|
|
1102
1466
|
return null;
|
|
1103
1467
|
}
|
|
@@ -1116,14 +1480,14 @@ const endpointOptions = {
|
|
|
1116
1480
|
};
|
|
1117
1481
|
const apiURL = `${appUrl}/api/widget/skip`;
|
|
1118
1482
|
|
|
1119
|
-
const WalletProvider = ({ children }) => {
|
|
1120
|
-
return (jsx(SolanaProvider, { children: jsx(CosmosProvider, { children: jsx(EVMProvider, { children: jsx(WalletModalProvider, { children: children }) }) }) }));
|
|
1483
|
+
const WalletProvider = ({ children, wagmiConfig, }) => {
|
|
1484
|
+
return (jsx(SolanaProvider, { children: jsx(CosmosProvider, { children: jsx(EVMProvider, { wagmiConfig: wagmiConfig, children: jsx(WalletModalProvider, { children: children }) }) }) }));
|
|
1121
1485
|
};
|
|
1122
1486
|
const SkipAPIProvider = ({ children, endpointOptions: endpointOptions$1 = endpointOptions, apiURL: apiURL$1 = apiURL, makeDestinationWallets, chainIDsToAffiliates, }) => {
|
|
1123
1487
|
return (jsx(SkipProvider, { apiURL: apiURL$1, endpointOptions: endpointOptions$1, makeDestinationWallets: makeDestinationWallets, chainIDsToAffiliates: chainIDsToAffiliates, children: jsx(AssetsProvider, { children: children }) }));
|
|
1124
1488
|
};
|
|
1125
|
-
const SwapWidgetProvider = ({ children, ...skipApiProviderProps }) => {
|
|
1126
|
-
return (jsx(WalletProvider, { children: jsx(SkipAPIProvider, { ...skipApiProviderProps, children: children }) }));
|
|
1489
|
+
const SwapWidgetProvider = ({ children, wagmiConfig, ...skipApiProviderProps }) => {
|
|
1490
|
+
return (jsx(WalletProvider, { wagmiConfig: wagmiConfig, children: jsx(SkipAPIProvider, { ...skipApiProviderProps, children: children }) }));
|
|
1127
1491
|
};
|
|
1128
1492
|
|
|
1129
1493
|
const defaultValues$2 = {
|
|
@@ -1389,243 +1753,6 @@ function useAccount(chainID) {
|
|
|
1389
1753
|
return account;
|
|
1390
1754
|
}
|
|
1391
1755
|
|
|
1392
|
-
const multicall3ABI = [
|
|
1393
|
-
{
|
|
1394
|
-
inputs: [
|
|
1395
|
-
{
|
|
1396
|
-
components: [
|
|
1397
|
-
{ internalType: "address", name: "target", type: "address" },
|
|
1398
|
-
{ internalType: "bytes", name: "callData", type: "bytes" },
|
|
1399
|
-
],
|
|
1400
|
-
internalType: "struct Multicall3.Call[]",
|
|
1401
|
-
name: "calls",
|
|
1402
|
-
type: "tuple[]",
|
|
1403
|
-
},
|
|
1404
|
-
],
|
|
1405
|
-
name: "aggregate",
|
|
1406
|
-
outputs: [
|
|
1407
|
-
{ internalType: "uint256", name: "blockNumber", type: "uint256" },
|
|
1408
|
-
{ internalType: "bytes[]", name: "returnData", type: "bytes[]" },
|
|
1409
|
-
],
|
|
1410
|
-
stateMutability: "payable",
|
|
1411
|
-
type: "function",
|
|
1412
|
-
},
|
|
1413
|
-
{
|
|
1414
|
-
inputs: [
|
|
1415
|
-
{
|
|
1416
|
-
components: [
|
|
1417
|
-
{ internalType: "address", name: "target", type: "address" },
|
|
1418
|
-
{ internalType: "bool", name: "allowFailure", type: "bool" },
|
|
1419
|
-
{ internalType: "bytes", name: "callData", type: "bytes" },
|
|
1420
|
-
],
|
|
1421
|
-
internalType: "struct Multicall3.Call3[]",
|
|
1422
|
-
name: "calls",
|
|
1423
|
-
type: "tuple[]",
|
|
1424
|
-
},
|
|
1425
|
-
],
|
|
1426
|
-
name: "aggregate3",
|
|
1427
|
-
outputs: [
|
|
1428
|
-
{
|
|
1429
|
-
components: [
|
|
1430
|
-
{ internalType: "bool", name: "success", type: "bool" },
|
|
1431
|
-
{ internalType: "bytes", name: "returnData", type: "bytes" },
|
|
1432
|
-
],
|
|
1433
|
-
internalType: "struct Multicall3.Result[]",
|
|
1434
|
-
name: "returnData",
|
|
1435
|
-
type: "tuple[]",
|
|
1436
|
-
},
|
|
1437
|
-
],
|
|
1438
|
-
stateMutability: "payable",
|
|
1439
|
-
type: "function",
|
|
1440
|
-
},
|
|
1441
|
-
{
|
|
1442
|
-
inputs: [
|
|
1443
|
-
{
|
|
1444
|
-
components: [
|
|
1445
|
-
{ internalType: "address", name: "target", type: "address" },
|
|
1446
|
-
{ internalType: "bool", name: "allowFailure", type: "bool" },
|
|
1447
|
-
{ internalType: "uint256", name: "value", type: "uint256" },
|
|
1448
|
-
{ internalType: "bytes", name: "callData", type: "bytes" },
|
|
1449
|
-
],
|
|
1450
|
-
internalType: "struct Multicall3.Call3Value[]",
|
|
1451
|
-
name: "calls",
|
|
1452
|
-
type: "tuple[]",
|
|
1453
|
-
},
|
|
1454
|
-
],
|
|
1455
|
-
name: "aggregate3Value",
|
|
1456
|
-
outputs: [
|
|
1457
|
-
{
|
|
1458
|
-
components: [
|
|
1459
|
-
{ internalType: "bool", name: "success", type: "bool" },
|
|
1460
|
-
{ internalType: "bytes", name: "returnData", type: "bytes" },
|
|
1461
|
-
],
|
|
1462
|
-
internalType: "struct Multicall3.Result[]",
|
|
1463
|
-
name: "returnData",
|
|
1464
|
-
type: "tuple[]",
|
|
1465
|
-
},
|
|
1466
|
-
],
|
|
1467
|
-
stateMutability: "payable",
|
|
1468
|
-
type: "function",
|
|
1469
|
-
},
|
|
1470
|
-
{
|
|
1471
|
-
inputs: [
|
|
1472
|
-
{
|
|
1473
|
-
components: [
|
|
1474
|
-
{ internalType: "address", name: "target", type: "address" },
|
|
1475
|
-
{ internalType: "bytes", name: "callData", type: "bytes" },
|
|
1476
|
-
],
|
|
1477
|
-
internalType: "struct Multicall3.Call[]",
|
|
1478
|
-
name: "calls",
|
|
1479
|
-
type: "tuple[]",
|
|
1480
|
-
},
|
|
1481
|
-
],
|
|
1482
|
-
name: "blockAndAggregate",
|
|
1483
|
-
outputs: [
|
|
1484
|
-
{ internalType: "uint256", name: "blockNumber", type: "uint256" },
|
|
1485
|
-
{ internalType: "bytes32", name: "blockHash", type: "bytes32" },
|
|
1486
|
-
{
|
|
1487
|
-
components: [
|
|
1488
|
-
{ internalType: "bool", name: "success", type: "bool" },
|
|
1489
|
-
{ internalType: "bytes", name: "returnData", type: "bytes" },
|
|
1490
|
-
],
|
|
1491
|
-
internalType: "struct Multicall3.Result[]",
|
|
1492
|
-
name: "returnData",
|
|
1493
|
-
type: "tuple[]",
|
|
1494
|
-
},
|
|
1495
|
-
],
|
|
1496
|
-
stateMutability: "payable",
|
|
1497
|
-
type: "function",
|
|
1498
|
-
},
|
|
1499
|
-
{
|
|
1500
|
-
inputs: [],
|
|
1501
|
-
name: "getBasefee",
|
|
1502
|
-
outputs: [{ internalType: "uint256", name: "basefee", type: "uint256" }],
|
|
1503
|
-
stateMutability: "view",
|
|
1504
|
-
type: "function",
|
|
1505
|
-
},
|
|
1506
|
-
{
|
|
1507
|
-
inputs: [{ internalType: "uint256", name: "blockNumber", type: "uint256" }],
|
|
1508
|
-
name: "getBlockHash",
|
|
1509
|
-
outputs: [{ internalType: "bytes32", name: "blockHash", type: "bytes32" }],
|
|
1510
|
-
stateMutability: "view",
|
|
1511
|
-
type: "function",
|
|
1512
|
-
},
|
|
1513
|
-
{
|
|
1514
|
-
inputs: [],
|
|
1515
|
-
name: "getBlockNumber",
|
|
1516
|
-
outputs: [{ internalType: "uint256", name: "blockNumber", type: "uint256" }],
|
|
1517
|
-
stateMutability: "view",
|
|
1518
|
-
type: "function",
|
|
1519
|
-
},
|
|
1520
|
-
{
|
|
1521
|
-
inputs: [],
|
|
1522
|
-
name: "getChainId",
|
|
1523
|
-
outputs: [{ internalType: "uint256", name: "chainid", type: "uint256" }],
|
|
1524
|
-
stateMutability: "view",
|
|
1525
|
-
type: "function",
|
|
1526
|
-
},
|
|
1527
|
-
{
|
|
1528
|
-
inputs: [],
|
|
1529
|
-
name: "getCurrentBlockCoinbase",
|
|
1530
|
-
outputs: [{ internalType: "address", name: "coinbase", type: "address" }],
|
|
1531
|
-
stateMutability: "view",
|
|
1532
|
-
type: "function",
|
|
1533
|
-
},
|
|
1534
|
-
{
|
|
1535
|
-
inputs: [],
|
|
1536
|
-
name: "getCurrentBlockDifficulty",
|
|
1537
|
-
outputs: [{ internalType: "uint256", name: "difficulty", type: "uint256" }],
|
|
1538
|
-
stateMutability: "view",
|
|
1539
|
-
type: "function",
|
|
1540
|
-
},
|
|
1541
|
-
{
|
|
1542
|
-
inputs: [],
|
|
1543
|
-
name: "getCurrentBlockGasLimit",
|
|
1544
|
-
outputs: [{ internalType: "uint256", name: "gaslimit", type: "uint256" }],
|
|
1545
|
-
stateMutability: "view",
|
|
1546
|
-
type: "function",
|
|
1547
|
-
},
|
|
1548
|
-
{
|
|
1549
|
-
inputs: [],
|
|
1550
|
-
name: "getCurrentBlockTimestamp",
|
|
1551
|
-
outputs: [{ internalType: "uint256", name: "timestamp", type: "uint256" }],
|
|
1552
|
-
stateMutability: "view",
|
|
1553
|
-
type: "function",
|
|
1554
|
-
},
|
|
1555
|
-
{
|
|
1556
|
-
inputs: [{ internalType: "address", name: "addr", type: "address" }],
|
|
1557
|
-
name: "getEthBalance",
|
|
1558
|
-
outputs: [{ internalType: "uint256", name: "balance", type: "uint256" }],
|
|
1559
|
-
stateMutability: "view",
|
|
1560
|
-
type: "function",
|
|
1561
|
-
},
|
|
1562
|
-
{
|
|
1563
|
-
inputs: [],
|
|
1564
|
-
name: "getLastBlockHash",
|
|
1565
|
-
outputs: [{ internalType: "bytes32", name: "blockHash", type: "bytes32" }],
|
|
1566
|
-
stateMutability: "view",
|
|
1567
|
-
type: "function",
|
|
1568
|
-
},
|
|
1569
|
-
{
|
|
1570
|
-
inputs: [
|
|
1571
|
-
{ internalType: "bool", name: "requireSuccess", type: "bool" },
|
|
1572
|
-
{
|
|
1573
|
-
components: [
|
|
1574
|
-
{ internalType: "address", name: "target", type: "address" },
|
|
1575
|
-
{ internalType: "bytes", name: "callData", type: "bytes" },
|
|
1576
|
-
],
|
|
1577
|
-
internalType: "struct Multicall3.Call[]",
|
|
1578
|
-
name: "calls",
|
|
1579
|
-
type: "tuple[]",
|
|
1580
|
-
},
|
|
1581
|
-
],
|
|
1582
|
-
name: "tryAggregate",
|
|
1583
|
-
outputs: [
|
|
1584
|
-
{
|
|
1585
|
-
components: [
|
|
1586
|
-
{ internalType: "bool", name: "success", type: "bool" },
|
|
1587
|
-
{ internalType: "bytes", name: "returnData", type: "bytes" },
|
|
1588
|
-
],
|
|
1589
|
-
internalType: "struct Multicall3.Result[]",
|
|
1590
|
-
name: "returnData",
|
|
1591
|
-
type: "tuple[]",
|
|
1592
|
-
},
|
|
1593
|
-
],
|
|
1594
|
-
stateMutability: "payable",
|
|
1595
|
-
type: "function",
|
|
1596
|
-
},
|
|
1597
|
-
{
|
|
1598
|
-
inputs: [
|
|
1599
|
-
{ internalType: "bool", name: "requireSuccess", type: "bool" },
|
|
1600
|
-
{
|
|
1601
|
-
components: [
|
|
1602
|
-
{ internalType: "address", name: "target", type: "address" },
|
|
1603
|
-
{ internalType: "bytes", name: "callData", type: "bytes" },
|
|
1604
|
-
],
|
|
1605
|
-
internalType: "struct Multicall3.Call[]",
|
|
1606
|
-
name: "calls",
|
|
1607
|
-
type: "tuple[]",
|
|
1608
|
-
},
|
|
1609
|
-
],
|
|
1610
|
-
name: "tryBlockAndAggregate",
|
|
1611
|
-
outputs: [
|
|
1612
|
-
{ internalType: "uint256", name: "blockNumber", type: "uint256" },
|
|
1613
|
-
{ internalType: "bytes32", name: "blockHash", type: "bytes32" },
|
|
1614
|
-
{
|
|
1615
|
-
components: [
|
|
1616
|
-
{ internalType: "bool", name: "success", type: "bool" },
|
|
1617
|
-
{ internalType: "bytes", name: "returnData", type: "bytes" },
|
|
1618
|
-
],
|
|
1619
|
-
internalType: "struct Multicall3.Result[]",
|
|
1620
|
-
name: "returnData",
|
|
1621
|
-
type: "tuple[]",
|
|
1622
|
-
},
|
|
1623
|
-
],
|
|
1624
|
-
stateMutability: "payable",
|
|
1625
|
-
type: "function",
|
|
1626
|
-
},
|
|
1627
|
-
];
|
|
1628
|
-
|
|
1629
1756
|
const EVM_CHAINS = [
|
|
1630
1757
|
arbitrum,
|
|
1631
1758
|
avalanche,
|
|
@@ -3973,8 +4100,9 @@ const PraxWalletIndex = ({ praxWalletIndex, setPraxWalletIndex, }) => {
|
|
|
3973
4100
|
setPraxWalletIndex(Number(input));
|
|
3974
4101
|
setEditing(false);
|
|
3975
4102
|
};
|
|
3976
|
-
return isEditing ? (jsxs("div", { className: "flex items-center space-x-1 py-2 px-1", children: [jsx(StyledBorderDiv, { as: "input", type: "number", className: cn(`w-16 h-5.5 rounded-md border px-2 text-xs`), value: Number(input),
|
|
4103
|
+
return isEditing ? (jsxs("div", { className: "flex items-center space-x-1 py-2 px-1", children: [jsx(StyledBorderDiv, { as: "input", type: "number", className: cn(`w-16 h-5.5 rounded-md border px-2 text-xs`), value: Number(input), onClick: (e) => {
|
|
3977
4104
|
e.stopPropagation();
|
|
4105
|
+
}, onChange: (e) => {
|
|
3978
4106
|
if (Number(e.target.value) < 0) {
|
|
3979
4107
|
setInput(0);
|
|
3980
4108
|
return;
|
|
@@ -4065,7 +4193,7 @@ const SetAddressDialog = ({ open, onOpen, chain, index, signRequired, isDestinat
|
|
|
4065
4193
|
return (jsx(Dialog, { onOpenChange: (v) => onOpen(v), open: open, children: jsx(DialogContent, { children: jsxs("div", { className: "flex h-full flex-col px-6 pb-2 pt-6 font-diatype", children: [jsxs("div", { className: "relative flex justify-between", children: [jsx(StyledThemedButton, { className: cn('flex h-8 w-8 items-center justify-center rounded-full transition-colors'), onClick: () => onOpen(false), children: jsx(ArrowLeftIcon, { className: "h-6 w-6" }) }), jsxs("p", { className: "text-center text-xl font-bold capitalize", children: ["Set ", isDestination ? 'Destination' : 'Recovery', " Address"] }), jsx("img", { className: "object-contain", src: chain.logoURI || 'https://api.dicebear.com/6.x/shapes/svg', alt: chain.chainName, height: 28, width: 28 })] }), jsxs(StyledScrollAreaRoot, { className: cn('relative isolate flex-grow overflow-hidden', 'before:absolute before:inset-x-0 before:bottom-0 before:z-10 before:h-2'), children: [jsxs(ScrollArea.Viewport, { className: "h-full w-full py-4", children: [chainType &&
|
|
4066
4194
|
wallets.map((wallet) => {
|
|
4067
4195
|
// currently only svm chainType that have isAvailable
|
|
4068
|
-
return (jsxs(WalletListItem, { chainType: chainType, walletName: wallet.walletName, className: cn('group relative mb-2 data-[unsupported=true]:opacity-30', 'data-[unsupported=true]:before:absolute data-[unsupported=true]:before:inset-0 data-[unsupported=true]:before:cursor-not-allowed'), children: [jsxs(StyledThemedButton, { className: cn('flex w-full items-center gap-2 rounded-lg p-2 transition-colors focus:-outline-offset-2'), onClick: async () => {
|
|
4196
|
+
return (jsxs(WalletListItem, { walletChainType: wallet.walletChainType, chainType: chainType, walletName: wallet.walletName, className: cn('group relative mb-2 data-[unsupported=true]:opacity-30', 'data-[unsupported=true]:before:absolute data-[unsupported=true]:before:inset-0 data-[unsupported=true]:before:cursor-not-allowed'), children: [jsxs(StyledThemedButton, { className: cn('flex w-full items-center gap-2 rounded-lg p-2 transition-colors focus:-outline-offset-2'), onClick: async () => {
|
|
4069
4197
|
var _a, _b;
|
|
4070
4198
|
const resAddress = await ((_a = wallet.getAddress) === null || _a === void 0 ? void 0 : _a.call(wallet, {
|
|
4071
4199
|
signRequired,
|
|
@@ -4162,7 +4290,8 @@ const useAutoSetAddress = ({ chain, chainID, index, enabled, signRequired, chain
|
|
|
4162
4290
|
if (index !== 0 &&
|
|
4163
4291
|
signRequired &&
|
|
4164
4292
|
(source === null || source === void 0 ? void 0 : source.chainType) === 'cosmos' &&
|
|
4165
|
-
cosmos
|
|
4293
|
+
cosmos &&
|
|
4294
|
+
!chain.chainID.includes('penumbra')) {
|
|
4166
4295
|
const walletSelected = wallets.find((wallet) => wallet.walletName === (cosmos === null || cosmos === void 0 ? void 0 : cosmos.walletName));
|
|
4167
4296
|
const address = await ((_a = walletSelected === null || walletSelected === void 0 ? void 0 : walletSelected.getAddress) === null || _a === void 0 ? void 0 : _a.call(walletSelected, { signRequired }));
|
|
4168
4297
|
if (walletSelected && address) {
|
|
@@ -4180,7 +4309,8 @@ const useAutoSetAddress = ({ chain, chainID, index, enabled, signRequired, chain
|
|
|
4180
4309
|
(destination === null || destination === void 0 ? void 0 : destination.chainType) === 'cosmos' &&
|
|
4181
4310
|
(destination === null || destination === void 0 ? void 0 : destination.source) !== 'input' &&
|
|
4182
4311
|
index !== 0 &&
|
|
4183
|
-
!signRequired
|
|
4312
|
+
!signRequired &&
|
|
4313
|
+
!chain.chainID.includes('penumbra')) {
|
|
4184
4314
|
const walletName = (_b = destination.source) === null || _b === void 0 ? void 0 : _b.walletName;
|
|
4185
4315
|
const walletSelected = wallets.find((wallet) => wallet.walletName === walletName);
|
|
4186
4316
|
const address = await ((_c = walletSelected === null || walletSelected === void 0 ? void 0 : walletSelected.getAddress) === null || _c === void 0 ? void 0 : _c.call(walletSelected, {}));
|