@skip-go/widget 2.4.1-alpha.0 → 2.4.3

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/build/index.es.js CHANGED
@@ -9,8 +9,8 @@ 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, formatUnits, createPublicClient, 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, 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';
@@ -28,9 +28,10 @@ import { createPenumbraClient } from '@penumbra-zone/client';
28
28
  import { ViewService } from '@penumbra-zone/protobuf';
29
29
  import { bech32mAddress } from '@penumbra-zone/bech32m/penumbra';
30
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';
31
33
  import { clsx } from 'clsx';
32
34
  import { twMerge } from 'tailwind-merge';
33
- import { styled, useTheme, StyleSheetManager, ThemeProvider } from 'styled-components';
34
35
  import { matchSorter } from 'match-sorter';
35
36
  import * as Tooltip from '@radix-ui/react-tooltip';
36
37
  import { StargateClient, GasPrice } from '@cosmjs/stargate';
@@ -166,6 +167,7 @@ const config = createConfig({
166
167
  blastSepolia,
167
168
  forma,
168
169
  formaTestnet,
170
+ sei,
169
171
  ],
170
172
  transports: {
171
173
  [arbitrum.id]: http(),
@@ -192,14 +194,15 @@ const config = createConfig({
192
194
  [blastSepolia.id]: http(),
193
195
  [forma.id]: http(),
194
196
  [formaTestnet.id]: http(),
197
+ [sei.id]: http(),
195
198
  },
196
199
  ssr: true,
197
200
  });
198
201
 
199
202
  const queryClient = new QueryClient();
200
203
 
201
- const EVMProvider = ({ children }) => {
202
- 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'));
203
206
  };
204
207
 
205
208
  const solanaWallets = [
@@ -671,11 +674,13 @@ function isMobile() {
671
674
  }
672
675
 
673
676
  const useStore = create(() => ({}));
674
- const WalletListItem = ({ children, chainType, walletName, ...props }) => {
677
+ const WalletListItem = ({ children, chainType, walletName, walletChainType, ...props }) => {
675
678
  const Component = useMemo(() => {
676
679
  if (walletName === 'prax')
677
680
  return PenumbraWalletListItem;
678
- return chainType === 'cosmos' ? CosmosWalletListItem : EvmWalletListItem;
681
+ return walletChainType === 'cosmos'
682
+ ? CosmosWalletListItem
683
+ : EvmWalletListItem;
679
684
  }, [chainType]);
680
685
  return (jsx(Component, { walletName: walletName, ...props, children: children }));
681
686
  };
@@ -728,14 +733,294 @@ const PenumbraWalletListItem = ({ children, walletName, ...props }) => {
728
733
  const defaultValues$3 = {};
729
734
  const useCallbackStore = create()(() => defaultValues$3);
730
735
 
731
- const penumbraBech32ChainIDs = ['noble-1', 'grand-1'];
732
- const getPenumbraCompatibleAddress = ({ chainID, address, }) => {
733
- if (!chainID)
734
- return bech32mAddress(address);
735
- return penumbraBech32ChainIDs.includes(chainID)
736
- ? bech32CompatAddress(address)
737
- : bech32mAddress(address);
738
- };
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
+ `;
739
1024
 
740
1025
  const useMakeWallets = () => {
741
1026
  const { data: chains } = useChains();
@@ -758,12 +1043,14 @@ const useMakeWallets = () => {
758
1043
  const makeWallets = (chainID) => {
759
1044
  var _a;
760
1045
  const chainType = (_a = getChain(chainID)) === null || _a === void 0 ? void 0 : _a.chainType;
1046
+ const isSei = chainType === 'cosmos' && chainID === 'pacific-1';
761
1047
  let wallets = [];
762
1048
  if (chainType === 'cosmos') {
763
1049
  if (chainID.includes('penumbra')) {
764
1050
  const praxWallet = {
765
1051
  walletName: 'prax',
766
1052
  walletPrettyName: 'Prax Wallet',
1053
+ walletChainType: 'cosmos',
767
1054
  walletInfo: {
768
1055
  logo: 'https://raw.githubusercontent.com/prax-wallet/web/e8b18f9b997708eab04f57e7a6c44f18b3cf13a8/apps/extension/public/prax-white-vertical.svg',
769
1056
  },
@@ -772,13 +1059,11 @@ const useMakeWallets = () => {
772
1059
  toast.error('Prax wallet is not supported for connect');
773
1060
  },
774
1061
  getAddress: async ({ praxWallet }) => {
775
- console.log('praxWallet', praxWallet);
776
1062
  const penumbraWalletIndex = praxWallet === null || praxWallet === void 0 ? void 0 : praxWallet.index;
777
1063
  const sourceChainID = praxWallet === null || praxWallet === void 0 ? void 0 : praxWallet.sourceChainID;
778
1064
  const prax_id = 'lkpmkhpnhknhmibgnmmhdhgdilepfghe';
779
1065
  const prax_origin = `chrome-extension://${prax_id}`;
780
1066
  const client = createPenumbraClient(prax_origin);
781
- console.log(penumbraWalletIndex);
782
1067
  try {
783
1068
  await client.connect();
784
1069
  const viewService = client.service(ViewService);
@@ -814,6 +1099,7 @@ const useMakeWallets = () => {
814
1099
  wallets = walletRepo.wallets.map((wallet) => ({
815
1100
  walletName: wallet.walletName,
816
1101
  walletPrettyName: wallet.walletPrettyName,
1102
+ walletChainType: 'cosmos',
817
1103
  walletInfo: {
818
1104
  logo: wallet.walletInfo.logo,
819
1105
  },
@@ -859,7 +1145,7 @@ const useMakeWallets = () => {
859
1145
  return wallet.address;
860
1146
  }
861
1147
  catch (error) {
862
- console.log(error);
1148
+ console.error(error);
863
1149
  toast.error(jsx("p", { children: jsx("strong", { children: "Failed to get address!" }) }));
864
1150
  }
865
1151
  },
@@ -871,15 +1157,26 @@ const useMakeWallets = () => {
871
1157
  isWalletConnected: wallet.isWalletConnected,
872
1158
  }));
873
1159
  }
874
- if (chainType === 'evm') {
1160
+ if (chainType === 'evm' || isSei) {
875
1161
  for (const connector of connectors) {
876
1162
  if (wallets.findIndex((wallet) => wallet.walletName === connector.id) !==
877
1163
  -1) {
878
1164
  continue;
879
1165
  }
880
- const minimalWallet = {
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 = {
881
1177
  walletName: connector.id,
882
1178
  walletPrettyName: connector.name,
1179
+ walletChainType: 'evm',
883
1180
  walletInfo: {
884
1181
  logo: connector.icon,
885
1182
  },
@@ -902,26 +1199,11 @@ const useMakeWallets = () => {
902
1199
  },
903
1200
  getAddress: async ({ signRequired, context }) => {
904
1201
  try {
905
- if (connector.id === (currentConnector === null || currentConnector === void 0 ? void 0 : currentConnector.id)) {
906
- if (isEvmConnected && evmAddress) {
907
- if (signRequired) {
908
- trackWallet.track('evm', connector.id, chainType);
909
- }
910
- if (context && evmAddress) {
911
- toast.success(`Successfully retrieved ${context} address from ${connector.name}`);
912
- }
913
- return evmAddress;
914
- }
915
- }
916
- else {
917
- console.log('connecting');
918
- await connectAsync({ connector, chainId: Number(chainID) });
919
- trackWallet.track('evm', connector.id, chainType);
920
- if (context) {
921
- toast.success(`Successfully retrieved ${context} address from ${connector.name}`);
922
- }
923
- return evmAddress;
1202
+ const address = await evmGetAddress({ signRequired, context });
1203
+ if (address && context) {
1204
+ toast.success(`Successfully retrieved ${context} address from ${connector.name}`);
924
1205
  }
1206
+ return address;
925
1207
  }
926
1208
  catch (error) {
927
1209
  console.error(error);
@@ -935,6 +1217,36 @@ const useMakeWallets = () => {
935
1217
  },
936
1218
  isWalletConnected: connector.id === (currentConnector === null || currentConnector === void 0 ? void 0 : currentConnector.id),
937
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
+ }
938
1250
  wallets.push(minimalWallet);
939
1251
  }
940
1252
  }
@@ -943,6 +1255,7 @@ const useMakeWallets = () => {
943
1255
  const minimalWallet = {
944
1256
  walletName: wallet.adapter.name,
945
1257
  walletPrettyName: wallet.adapter.name,
1258
+ walletChainType: 'svm',
946
1259
  walletInfo: {
947
1260
  logo: wallet.adapter.icon,
948
1261
  },
@@ -1002,30 +1315,19 @@ const useMakeWallets = () => {
1002
1315
  makeWallets,
1003
1316
  };
1004
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
+ };
1005
1326
 
1006
1327
  function cn(...inputs) {
1007
1328
  return twMerge(clsx(inputs));
1008
1329
  }
1009
1330
 
1010
- const StyledThemedDiv = styled.div `
1011
- background-color: ${(props) => props.theme.backgroundColor};
1012
- color: ${(props) => props.theme.textColor};
1013
- border-color: ${(props) => props.theme.borderColor};
1014
- `;
1015
- const StyledBrandDiv = styled.div `
1016
- background-color: ${(props) => props.theme.brandColor};
1017
- `;
1018
- const StyledBorderDiv = styled.div `
1019
- border-color: ${(props) => props.theme.borderColor};
1020
- `;
1021
- const StyledApproveButton = styled(StyledBrandDiv) `
1022
- border-color: ${(props) => props.theme.brandColor};
1023
- `;
1024
- const StyledCancelButton = styled.button `
1025
- color: ${(props) => props.theme.brandColor};
1026
- border-color: ${(props) => props.theme.brandColor};
1027
- `;
1028
-
1029
1331
  function DialogContent({ children, onInteractOutside }) {
1030
1332
  const { open } = useContext(DialogContext);
1031
1333
  if (!open)
@@ -1142,7 +1444,7 @@ function WalletModal({ chainType, onClose, wallets }) {
1142
1444
  ? 'https://solana.com/ecosystem/explore?categories=wallet'
1143
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) => {
1144
1446
  // currently only svm chainType that have isAvailable
1145
- 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'
1146
1448
  ? wallet.walletInfo.logo
1147
1449
  : wallet.walletInfo.logo.major, "aria-hidden": "true" })), jsx("p", { className: "flex-1 text-left font-semibold", children: wallet.walletPrettyName === 'Leap Cosmos MetaMask'
1148
1450
  ? 'Metamask (Leap Snap)'
@@ -1159,7 +1461,7 @@ function WalletModalWithContext() {
1159
1461
  const { setIsOpen } = useWalletModal();
1160
1462
  const { data: chain } = useChainByID(chainID);
1161
1463
  const { makeWallets } = useMakeWallets();
1162
- const wallets = makeWallets(chainID);
1464
+ const wallets = makeWallets(chainID).filter((wallet) => wallet.walletChainType === (chain === null || chain === void 0 ? void 0 : chain.chainType));
1163
1465
  if (!chain) {
1164
1466
  return null;
1165
1467
  }
@@ -1178,14 +1480,14 @@ const endpointOptions = {
1178
1480
  };
1179
1481
  const apiURL = `${appUrl}/api/widget/skip`;
1180
1482
 
1181
- const WalletProvider = ({ children }) => {
1182
- 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 }) }) }) }));
1183
1485
  };
1184
1486
  const SkipAPIProvider = ({ children, endpointOptions: endpointOptions$1 = endpointOptions, apiURL: apiURL$1 = apiURL, makeDestinationWallets, chainIDsToAffiliates, }) => {
1185
1487
  return (jsx(SkipProvider, { apiURL: apiURL$1, endpointOptions: endpointOptions$1, makeDestinationWallets: makeDestinationWallets, chainIDsToAffiliates: chainIDsToAffiliates, children: jsx(AssetsProvider, { children: children }) }));
1186
1488
  };
1187
- const SwapWidgetProvider = ({ children, ...skipApiProviderProps }) => {
1188
- 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 }) }));
1189
1491
  };
1190
1492
 
1191
1493
  const defaultValues$2 = {
@@ -1451,243 +1753,6 @@ function useAccount(chainID) {
1451
1753
  return account;
1452
1754
  }
1453
1755
 
1454
- const multicall3ABI = [
1455
- {
1456
- inputs: [
1457
- {
1458
- components: [
1459
- { internalType: "address", name: "target", type: "address" },
1460
- { internalType: "bytes", name: "callData", type: "bytes" },
1461
- ],
1462
- internalType: "struct Multicall3.Call[]",
1463
- name: "calls",
1464
- type: "tuple[]",
1465
- },
1466
- ],
1467
- name: "aggregate",
1468
- outputs: [
1469
- { internalType: "uint256", name: "blockNumber", type: "uint256" },
1470
- { internalType: "bytes[]", name: "returnData", type: "bytes[]" },
1471
- ],
1472
- stateMutability: "payable",
1473
- type: "function",
1474
- },
1475
- {
1476
- inputs: [
1477
- {
1478
- components: [
1479
- { internalType: "address", name: "target", type: "address" },
1480
- { internalType: "bool", name: "allowFailure", type: "bool" },
1481
- { internalType: "bytes", name: "callData", type: "bytes" },
1482
- ],
1483
- internalType: "struct Multicall3.Call3[]",
1484
- name: "calls",
1485
- type: "tuple[]",
1486
- },
1487
- ],
1488
- name: "aggregate3",
1489
- outputs: [
1490
- {
1491
- components: [
1492
- { internalType: "bool", name: "success", type: "bool" },
1493
- { internalType: "bytes", name: "returnData", type: "bytes" },
1494
- ],
1495
- internalType: "struct Multicall3.Result[]",
1496
- name: "returnData",
1497
- type: "tuple[]",
1498
- },
1499
- ],
1500
- stateMutability: "payable",
1501
- type: "function",
1502
- },
1503
- {
1504
- inputs: [
1505
- {
1506
- components: [
1507
- { internalType: "address", name: "target", type: "address" },
1508
- { internalType: "bool", name: "allowFailure", type: "bool" },
1509
- { internalType: "uint256", name: "value", type: "uint256" },
1510
- { internalType: "bytes", name: "callData", type: "bytes" },
1511
- ],
1512
- internalType: "struct Multicall3.Call3Value[]",
1513
- name: "calls",
1514
- type: "tuple[]",
1515
- },
1516
- ],
1517
- name: "aggregate3Value",
1518
- outputs: [
1519
- {
1520
- components: [
1521
- { internalType: "bool", name: "success", type: "bool" },
1522
- { internalType: "bytes", name: "returnData", type: "bytes" },
1523
- ],
1524
- internalType: "struct Multicall3.Result[]",
1525
- name: "returnData",
1526
- type: "tuple[]",
1527
- },
1528
- ],
1529
- stateMutability: "payable",
1530
- type: "function",
1531
- },
1532
- {
1533
- inputs: [
1534
- {
1535
- components: [
1536
- { internalType: "address", name: "target", type: "address" },
1537
- { internalType: "bytes", name: "callData", type: "bytes" },
1538
- ],
1539
- internalType: "struct Multicall3.Call[]",
1540
- name: "calls",
1541
- type: "tuple[]",
1542
- },
1543
- ],
1544
- name: "blockAndAggregate",
1545
- outputs: [
1546
- { internalType: "uint256", name: "blockNumber", type: "uint256" },
1547
- { internalType: "bytes32", name: "blockHash", type: "bytes32" },
1548
- {
1549
- components: [
1550
- { internalType: "bool", name: "success", type: "bool" },
1551
- { internalType: "bytes", name: "returnData", type: "bytes" },
1552
- ],
1553
- internalType: "struct Multicall3.Result[]",
1554
- name: "returnData",
1555
- type: "tuple[]",
1556
- },
1557
- ],
1558
- stateMutability: "payable",
1559
- type: "function",
1560
- },
1561
- {
1562
- inputs: [],
1563
- name: "getBasefee",
1564
- outputs: [{ internalType: "uint256", name: "basefee", type: "uint256" }],
1565
- stateMutability: "view",
1566
- type: "function",
1567
- },
1568
- {
1569
- inputs: [{ internalType: "uint256", name: "blockNumber", type: "uint256" }],
1570
- name: "getBlockHash",
1571
- outputs: [{ internalType: "bytes32", name: "blockHash", type: "bytes32" }],
1572
- stateMutability: "view",
1573
- type: "function",
1574
- },
1575
- {
1576
- inputs: [],
1577
- name: "getBlockNumber",
1578
- outputs: [{ internalType: "uint256", name: "blockNumber", type: "uint256" }],
1579
- stateMutability: "view",
1580
- type: "function",
1581
- },
1582
- {
1583
- inputs: [],
1584
- name: "getChainId",
1585
- outputs: [{ internalType: "uint256", name: "chainid", type: "uint256" }],
1586
- stateMutability: "view",
1587
- type: "function",
1588
- },
1589
- {
1590
- inputs: [],
1591
- name: "getCurrentBlockCoinbase",
1592
- outputs: [{ internalType: "address", name: "coinbase", type: "address" }],
1593
- stateMutability: "view",
1594
- type: "function",
1595
- },
1596
- {
1597
- inputs: [],
1598
- name: "getCurrentBlockDifficulty",
1599
- outputs: [{ internalType: "uint256", name: "difficulty", type: "uint256" }],
1600
- stateMutability: "view",
1601
- type: "function",
1602
- },
1603
- {
1604
- inputs: [],
1605
- name: "getCurrentBlockGasLimit",
1606
- outputs: [{ internalType: "uint256", name: "gaslimit", type: "uint256" }],
1607
- stateMutability: "view",
1608
- type: "function",
1609
- },
1610
- {
1611
- inputs: [],
1612
- name: "getCurrentBlockTimestamp",
1613
- outputs: [{ internalType: "uint256", name: "timestamp", type: "uint256" }],
1614
- stateMutability: "view",
1615
- type: "function",
1616
- },
1617
- {
1618
- inputs: [{ internalType: "address", name: "addr", type: "address" }],
1619
- name: "getEthBalance",
1620
- outputs: [{ internalType: "uint256", name: "balance", type: "uint256" }],
1621
- stateMutability: "view",
1622
- type: "function",
1623
- },
1624
- {
1625
- inputs: [],
1626
- name: "getLastBlockHash",
1627
- outputs: [{ internalType: "bytes32", name: "blockHash", type: "bytes32" }],
1628
- stateMutability: "view",
1629
- type: "function",
1630
- },
1631
- {
1632
- inputs: [
1633
- { internalType: "bool", name: "requireSuccess", type: "bool" },
1634
- {
1635
- components: [
1636
- { internalType: "address", name: "target", type: "address" },
1637
- { internalType: "bytes", name: "callData", type: "bytes" },
1638
- ],
1639
- internalType: "struct Multicall3.Call[]",
1640
- name: "calls",
1641
- type: "tuple[]",
1642
- },
1643
- ],
1644
- name: "tryAggregate",
1645
- outputs: [
1646
- {
1647
- components: [
1648
- { internalType: "bool", name: "success", type: "bool" },
1649
- { internalType: "bytes", name: "returnData", type: "bytes" },
1650
- ],
1651
- internalType: "struct Multicall3.Result[]",
1652
- name: "returnData",
1653
- type: "tuple[]",
1654
- },
1655
- ],
1656
- stateMutability: "payable",
1657
- type: "function",
1658
- },
1659
- {
1660
- inputs: [
1661
- { internalType: "bool", name: "requireSuccess", type: "bool" },
1662
- {
1663
- components: [
1664
- { internalType: "address", name: "target", type: "address" },
1665
- { internalType: "bytes", name: "callData", type: "bytes" },
1666
- ],
1667
- internalType: "struct Multicall3.Call[]",
1668
- name: "calls",
1669
- type: "tuple[]",
1670
- },
1671
- ],
1672
- name: "tryBlockAndAggregate",
1673
- outputs: [
1674
- { internalType: "uint256", name: "blockNumber", type: "uint256" },
1675
- { internalType: "bytes32", name: "blockHash", type: "bytes32" },
1676
- {
1677
- components: [
1678
- { internalType: "bool", name: "success", type: "bool" },
1679
- { internalType: "bytes", name: "returnData", type: "bytes" },
1680
- ],
1681
- internalType: "struct Multicall3.Result[]",
1682
- name: "returnData",
1683
- type: "tuple[]",
1684
- },
1685
- ],
1686
- stateMutability: "payable",
1687
- type: "function",
1688
- },
1689
- ];
1690
-
1691
1756
  const EVM_CHAINS = [
1692
1757
  arbitrum,
1693
1758
  avalanche,
@@ -4128,9 +4193,8 @@ const SetAddressDialog = ({ open, onOpen, chain, index, signRequired, isDestinat
4128
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 &&
4129
4194
  wallets.map((wallet) => {
4130
4195
  // currently only svm chainType that have isAvailable
4131
- 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 () => {
4132
4197
  var _a, _b;
4133
- console.log('walletclicked', praxWalletIndex);
4134
4198
  const resAddress = await ((_a = wallet.getAddress) === null || _a === void 0 ? void 0 : _a.call(wallet, {
4135
4199
  signRequired,
4136
4200
  context: isDestination ? 'destination' : 'recovery',
@@ -4802,7 +4866,7 @@ const PreviewRoute = ({ route, disclosure, isAmountError, }) => {
4802
4866
  const { data: chains } = useChains();
4803
4867
  const getChain = (chainID) => chains === null || chains === void 0 ? void 0 : chains.find((chain) => chain.chainID === chainID);
4804
4868
  const { makeWallets } = useMakeWallets();
4805
- const { onTransactionBroadcasted, onTransactionComplete, onTransactionFailed } = useCallbackStore.getState();
4869
+ const { onTransactionBroadcasted, onTransactionComplete, onTransactionFailed, } = useCallbackStore.getState();
4806
4870
  const [isExpanded, setIsExpanded] = useState(() => route.chainIDs.length === 2 ? true : false);
4807
4871
  const [isOpen, control] = disclosure;
4808
4872
  const [indexSetAddressDialogOpen, setIndexIsSetAddressDialogOpen] = useState();
@@ -4956,9 +5020,7 @@ const PreviewRoute = ({ route, disclosure, isAmountError, }) => {
4956
5020
  throw new Error('User rejected request');
4957
5021
  }
4958
5022
  onTransactionFailed === null || onTransactionFailed === void 0 ? void 0 : onTransactionFailed({
4959
- error: err instanceof Error
4960
- ? `${err.name}: ${err.message}`
4961
- : String(err)
5023
+ error: err instanceof Error ? `${err.name}: ${err.message}` : String(err),
4962
5024
  });
4963
5025
  throw err;
4964
5026
  }
@@ -4972,9 +5034,7 @@ const PreviewRoute = ({ route, disclosure, isAmountError, }) => {
4972
5034
  onError: (err) => {
4973
5035
  console.error(err);
4974
5036
  onTransactionFailed === null || onTransactionFailed === void 0 ? void 0 : onTransactionFailed({
4975
- error: err instanceof Error
4976
- ? `${err.name}: ${err.message}`
4977
- : String(err)
5037
+ error: err instanceof Error ? `${err.name}: ${err.message}` : String(err),
4978
5038
  });
4979
5039
  toast(({ createdAt, id }) => (jsxs("div", { className: "flex flex-col", children: [jsx("h4", { className: "mb-2 font-bold", children: "Transaction Failed!" }), jsxs(StyledBorderDiv, { as: "pre", className: "mb-4 overflow-auto whitespace-pre-wrap break-all rounded border p-2 font-diatypeMono text-xs", children: [err instanceof Error
4980
5040
  ? `${err.name}: ${err.message}`
@@ -5073,7 +5133,8 @@ const PreviewRoute = ({ route, disclosure, isAmountError, }) => {
5073
5133
  !submitMutation.isPending &&
5074
5134
  !submitMutation.isSuccess && (jsx("p", { className: "text-balance text-center text-sm font-medium text-red-500", children: typeof isAmountError === 'string'
5075
5135
  ? isAmountError
5076
- : 'Insufficient balance.' }))] }), jsxs("div", { className: "space-y-4", children: [!submitMutation.isError && !submitMutation.isSuccess && (jsx("div", { className: "flex w-full items-center justify-center space-x-2 text-sm font-medium", children: route.txsRequired > 1 ? (jsxs(Fragment, { children: [jsxs("div", { className: "relative rounded-full bg-[#FF486E] p-[4px]", children: [jsx("div", { className: "absolute h-6 w-6 animate-ping rounded-full bg-[#FF486E]" }), jsx(FingerPrintIcon, { className: "relative h-6 w-6 text-white" })] }), jsxs("p", { children: [route.txsRequired - broadcastedTxs.length, " SIGNATURES", ' ', submitMutation.isPending ? 'REMAINING' : 'REQUIRED'] })] })) : null })), submitMutation.isPending || submitMutation.isSuccess ? (jsx(StyledBrandDiv, { as: "button", className: cn('w-full rounded-md py-4 font-semibold text-white', 'outline-none transition-transform', 'enabled:hover:rotate-1 enabled:hover:scale-105', 'disabled:cursor-not-allowed disabled:opacity-75'), onClick: control.close, disabled: route.txsRequired !== broadcastedTxs.length, children: route.txsRequired !== broadcastedTxs.length &&
5136
+ : 'Insufficient balance.' }))] }), jsxs("div", { className: "space-y-4", children: [!submitMutation.isError && !submitMutation.isSuccess && (jsx("div", { className: "flex w-full items-center justify-center space-x-2 text-sm font-medium", children: route.txsRequired > 1 &&
5137
+ route.txsRequired - broadcastedTxs.length !== 0 ? (jsxs(Fragment, { children: [jsxs("div", { className: "relative rounded-full bg-[#FF486E] p-[4px]", children: [jsx("div", { className: "absolute h-6 w-6 animate-ping rounded-full bg-[#FF486E]" }), jsx(FingerPrintIcon, { className: "relative h-6 w-6 text-white" })] }), jsxs("p", { children: [route.txsRequired - broadcastedTxs.length, " SIGNATURES", ' ', submitMutation.isPending ? 'REMAINING' : 'REQUIRED'] })] })) : null })), submitMutation.isPending || submitMutation.isSuccess ? (jsx(StyledBrandDiv, { as: "button", className: cn('w-full rounded-md py-4 font-semibold text-white', 'outline-none transition-transform', 'enabled:hover:rotate-1 enabled:hover:scale-105', 'disabled:cursor-not-allowed disabled:opacity-75'), onClick: control.close, disabled: route.txsRequired !== broadcastedTxs.length, children: route.txsRequired !== broadcastedTxs.length &&
5077
5138
  !submitMutation.isSuccess ? (jsxs("svg", { className: "inline-block h-4 w-4 animate-spin text-white", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [jsx("circle", { className: "opacity-25", cx: 12, cy: 12, r: 10, stroke: "currentColor", strokeWidth: 4 }), jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] })) : (jsxs("span", { className: "text-white", children: ["Create New ", route.doesSwap ? 'Swap' : 'Transfer'] })) })) : (jsx(SubmitButton, {})), jsx(CraftedBySkip, {})] })] }) }));
5078
5139
  };
5079
5140
  const HREF_COMMON_FINALITY_TIMES = `https://docs.axelar.dev/learn/txduration#common-finality-time-for-interchain-transactions`;