@interchain-kit/react 0.3.48 → 0.3.50
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/esm/hooks/index.js +3 -2
- package/esm/hooks/useAsync.js +1 -1
- package/esm/hooks/useChains.js +8 -0
- package/esm/hooks/useSigningClient.js +9 -1
- package/esm/modal/modal.js +8 -8
- package/esm/modal/views/Connected.js +9 -9
- package/esm/modal/views/Connecting.js +3 -3
- package/esm/modal/views/Error.js +3 -3
- package/esm/modal/views/NotExist.js +14 -14
- package/esm/modal/views/QRCode.js +3 -3
- package/esm/modal/views/Reject.js +3 -3
- package/esm/modal/views/WalletList.js +1 -1
- package/esm/modal/views/index.js +5 -5
- package/esm/provider.js +5 -5
- package/esm/utils/decorateWallet.js +1 -1
- package/esm/utils/index.js +1 -1
- package/esm/utils/wallet.js +3 -3
- package/hooks/index.d.ts +3 -2
- package/hooks/index.js +3 -2
- package/hooks/useChains.d.ts +3 -0
- package/hooks/useChains.js +12 -0
- package/hooks/useSigningClient.js +9 -1
- package/modal/modal.d.ts +4 -4
- package/modal/modal.js +2 -2
- package/modal/views/Connected.d.ts +1 -1
- package/modal/views/Connected.js +6 -6
- package/modal/views/Connecting.d.ts +1 -1
- package/modal/views/Connecting.js +2 -2
- package/modal/views/Error.d.ts +1 -1
- package/modal/views/Error.js +1 -1
- package/modal/views/NotExist.d.ts +2 -2
- package/modal/views/NotExist.js +8 -8
- package/modal/views/QRCode.d.ts +1 -1
- package/modal/views/QRCode.js +2 -2
- package/modal/views/Reject.d.ts +1 -1
- package/modal/views/Reject.js +1 -1
- package/modal/views/WalletList.d.ts +1 -1
- package/modal/views/index.d.ts +5 -5
- package/modal/views/index.js +5 -5
- package/package.json +4 -4
- package/provider.d.ts +5 -5
- package/provider.js +1 -1
- package/types/chain.d.ts +3 -3
- package/types/sign-client.d.ts +1 -1
- package/utils/decorateWallet.d.ts +1 -1
- package/utils/decorateWallet.js +1 -1
- package/utils/index.d.ts +1 -1
- package/utils/index.js +1 -1
- package/utils/restoreAccount.d.ts +1 -1
- package/utils/wallet.d.ts +2 -1
- package/utils/wallet.js +3 -3
package/esm/hooks/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './useAsync';
|
|
2
2
|
export * from './useChain';
|
|
3
|
+
export * from './useChains';
|
|
3
4
|
export * from './useChainWallet';
|
|
4
5
|
export * from './useSigningClient';
|
|
5
|
-
export * from './
|
|
6
|
+
export * from './useWalletManager';
|
|
6
7
|
export * from './useWalletModal';
|
package/esm/hooks/useAsync.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
2
|
export const cache = new Map();
|
|
3
3
|
export const activeRequests = new Map();
|
|
4
4
|
export function useAsync({ queryKey, queryFn, enabled = true, disableCache = false, }) {
|
|
@@ -2,7 +2,15 @@ import { WalletState } from '@interchain-kit/core';
|
|
|
2
2
|
import { useAsync } from './useAsync';
|
|
3
3
|
import { useWalletManager } from './useWalletManager';
|
|
4
4
|
export const useSigningClient = (chainName, walletName) => {
|
|
5
|
-
const { getSigningClient, getChainWalletState, getRpcEndpoint, isReady } = useWalletManager();
|
|
5
|
+
const { getSigningClient, getChainWalletState, getRpcEndpoint, isReady, getChainByName } = useWalletManager();
|
|
6
|
+
const chain = getChainByName(chainName);
|
|
7
|
+
if (chain.chainType !== 'cosmos') {
|
|
8
|
+
return {
|
|
9
|
+
signingClient: null,
|
|
10
|
+
isLoading: false,
|
|
11
|
+
error: null,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
6
14
|
const chainWalletState = getChainWalletState(walletName, chainName);
|
|
7
15
|
const { data, isLoading, error } = useAsync({
|
|
8
16
|
queryKey: `signing-client-${chainName}-${walletName}`,
|
package/esm/modal/modal.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { WalletState } from
|
|
3
|
-
import { ConnectModal, ThemeProvider, } from
|
|
4
|
-
import { useMemo, useState } from
|
|
5
|
-
import { useWalletManager } from
|
|
6
|
-
import { transferToWalletUISchema } from
|
|
7
|
-
import { ConnectedContent, ConnectedHeader, ConnectingContent, ConnectingHeader, ErrorContent, ErrorHeader, NotExistContent, NotExistHeader, QRCodeContent, QRCodeHeader, RejectContent, RejectHeader, WalletListContent, WalletListHeader, } from
|
|
2
|
+
import { WalletState } from '@interchain-kit/core';
|
|
3
|
+
import { ConnectModal, ThemeProvider, } from '@interchain-ui/react';
|
|
4
|
+
import { useMemo, useState } from 'react';
|
|
5
|
+
import { useWalletManager } from '../hooks';
|
|
6
|
+
import { transferToWalletUISchema } from '../utils';
|
|
7
|
+
import { ConnectedContent, ConnectedHeader, ConnectingContent, ConnectingHeader, ErrorContent, ErrorHeader, NotExistContent, NotExistHeader, QRCodeContent, QRCodeHeader, RejectContent, RejectHeader, WalletListContent, WalletListHeader, } from './views';
|
|
8
8
|
export const InterchainWalletModal = ({
|
|
9
9
|
// ==== Custom modal styles
|
|
10
10
|
modalContainerClassName, modalContentClassName, modalChildrenClassName, modalContentStyles, modalThemeProviderProps, }) => {
|
|
@@ -38,7 +38,7 @@ modalContainerClassName, modalContentClassName, modalChildrenClassName, modalCon
|
|
|
38
38
|
export const WalletModalElement = ({ shouldShowList, isOpen, walletConnectQRCodeUri, wallets, username, address, currentWallet, isConnecting, isConnected, isRejected, isDisconnected, isNotExist, errorMessage, open, close, disconnect, onSelectWallet, onBack, onReconnect, getDownloadLink, getEnv, modalThemeProviderProps, modalContainerClassName, modalContentClassName, modalChildrenClassName, modalContentStyles, }) => {
|
|
39
39
|
const { header, content } = useMemo(() => {
|
|
40
40
|
if (shouldShowList ||
|
|
41
|
-
(isDisconnected && currentWallet.errorMessage ===
|
|
41
|
+
(isDisconnected && currentWallet.errorMessage === '')) {
|
|
42
42
|
return {
|
|
43
43
|
header: _jsx(WalletListHeader, { close: close }),
|
|
44
44
|
content: (_jsx(WalletListContent, { onSelectWallet: onSelectWallet, wallets: wallets })),
|
|
@@ -46,7 +46,7 @@ export const WalletModalElement = ({ shouldShowList, isOpen, walletConnectQRCode
|
|
|
46
46
|
}
|
|
47
47
|
if (currentWallet &&
|
|
48
48
|
walletConnectQRCodeUri &&
|
|
49
|
-
currentWallet.info.name ===
|
|
49
|
+
currentWallet.info.name === 'WalletConnect') {
|
|
50
50
|
return {
|
|
51
51
|
header: (_jsx(QRCodeHeader, { wallet: currentWallet, close: close, onBack: onBack })),
|
|
52
52
|
content: (_jsx(QRCodeContent, { walletConnectQRCodeUri: walletConnectQRCodeUri, errorMessage: errorMessage, onReconnect: onReconnect })),
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ConnectModalHead, ConnectModalStatus } from
|
|
3
|
-
import { getWalletInfo } from
|
|
4
|
-
import { AstronautSvg } from
|
|
2
|
+
import { ConnectModalHead, ConnectModalStatus } from '@interchain-ui/react';
|
|
3
|
+
import { getWalletInfo } from '../../utils';
|
|
4
|
+
import { AstronautSvg } from './Astronaut';
|
|
5
5
|
export const ConnectedHeader = ({ wallet, close, onBack, }) => {
|
|
6
|
-
return (_jsx(ConnectModalHead, { title: wallet?.info?.prettyName ||
|
|
6
|
+
return (_jsx(ConnectModalHead, { title: wallet?.info?.prettyName || '', hasBackButton: true, onClose: close, onBack: onBack, closeButtonProps: { onClick: close } }));
|
|
7
7
|
};
|
|
8
8
|
export const ConnectedContent = ({ address, username, wallet, disconnect, }) => {
|
|
9
|
-
return (_jsx(ConnectModalStatus, { wallet: getWalletInfo(wallet), status:
|
|
10
|
-
name: username ||
|
|
9
|
+
return (_jsx(ConnectModalStatus, { wallet: getWalletInfo(wallet), status: 'Connected', connectedInfo: {
|
|
10
|
+
name: username || 'Wallet',
|
|
11
11
|
avatar: (_jsx(AstronautSvg, { style: {
|
|
12
|
-
fontSize:
|
|
13
|
-
width:
|
|
14
|
-
height:
|
|
12
|
+
fontSize: 'inherit',
|
|
13
|
+
width: '100%',
|
|
14
|
+
height: '100%',
|
|
15
15
|
} })),
|
|
16
16
|
address: address,
|
|
17
17
|
}, onDisconnect: disconnect }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ConnectModalHead, ConnectModalStatus } from
|
|
2
|
+
import { ConnectModalHead, ConnectModalStatus } from '@interchain-ui/react';
|
|
3
3
|
export const ConnectingHeader = ({ wallet, close, onBack, }) => {
|
|
4
4
|
return (_jsx(ConnectModalHead, { title: wallet.info.prettyName, hasBackButton: true, onClose: close, onBack: onBack, closeButtonProps: {
|
|
5
5
|
onClick: close,
|
|
@@ -7,8 +7,8 @@ export const ConnectingHeader = ({ wallet, close, onBack, }) => {
|
|
|
7
7
|
};
|
|
8
8
|
export const ConnectingContent = ({ wallet }) => {
|
|
9
9
|
const { info: { prettyName, mode }, } = wallet;
|
|
10
|
-
let title =
|
|
11
|
-
let desc = mode ===
|
|
10
|
+
let title = 'Requesting Connection';
|
|
11
|
+
let desc = mode === 'wallet-connect'
|
|
12
12
|
? `Approve ${prettyName} connection request on your mobile.`
|
|
13
13
|
: `Open the ${prettyName} browser extension to connect your wallet.`;
|
|
14
14
|
if (!wallet)
|
package/esm/modal/views/Error.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ConnectModalHead, ConnectModalStatus } from
|
|
3
|
-
import { getWalletInfo } from
|
|
2
|
+
import { ConnectModalHead, ConnectModalStatus } from '@interchain-ui/react';
|
|
3
|
+
import { getWalletInfo } from '../../utils';
|
|
4
4
|
export const ErrorHeader = ({ wallet, close, onBack, }) => {
|
|
5
5
|
return (_jsx(ConnectModalHead, { title: wallet.info.prettyName, hasBackButton: true, onClose: close, onBack: onBack, closeButtonProps: { onClick: close } }));
|
|
6
6
|
};
|
|
7
7
|
export const ErrorContent = ({ wallet, onBack, }) => {
|
|
8
|
-
return (_jsx(ConnectModalStatus, { status: "Error", wallet: getWalletInfo(wallet), contentHeader:
|
|
8
|
+
return (_jsx(ConnectModalStatus, { status: "Error", wallet: getWalletInfo(wallet), contentHeader: 'Oops! Something wrong...', contentDesc: wallet.errorMessage, onChangeWallet: onBack }));
|
|
9
9
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ConnectModalHead, ConnectModalStatus } from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { ConnectModalHead, ConnectModalStatus } from '@interchain-ui/react';
|
|
3
|
+
import { FaAndroid } from '@react-icons/all-files/fa/FaAndroid';
|
|
4
|
+
import { GoDesktopDownload } from '@react-icons/all-files/go/GoDesktopDownload';
|
|
5
|
+
import { GrFirefox } from '@react-icons/all-files/gr/GrFirefox';
|
|
6
|
+
import { RiAppStoreFill } from '@react-icons/all-files/ri/RiAppStoreFill';
|
|
7
|
+
import { RiChromeFill } from '@react-icons/all-files/ri/RiChromeFill';
|
|
8
|
+
import { useMemo } from 'react';
|
|
9
9
|
export const NotExistHeader = ({ wallet, close, onBack, }) => {
|
|
10
|
-
return (_jsx(ConnectModalHead, { title: wallet?.info?.prettyName ||
|
|
10
|
+
return (_jsx(ConnectModalHead, { title: wallet?.info?.prettyName || '', hasBackButton: true, onClose: close, onBack: onBack, closeButtonProps: { onClick: close } }));
|
|
11
11
|
};
|
|
12
12
|
export const NotExistContent = ({ wallet, getDownloadLink, getEnv, }) => {
|
|
13
13
|
const downloadLink = useMemo(() => {
|
|
@@ -15,26 +15,26 @@ export const NotExistContent = ({ wallet, getDownloadLink, getEnv, }) => {
|
|
|
15
15
|
}, [wallet?.info?.name]);
|
|
16
16
|
const onInstall = () => {
|
|
17
17
|
if (downloadLink) {
|
|
18
|
-
window.open(downloadLink.link,
|
|
18
|
+
window.open(downloadLink.link, '_blank');
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
const IconComp = getIcon(getEnv());
|
|
22
22
|
return (_jsx(ConnectModalStatus, { status: "NotExist", wallet: {
|
|
23
23
|
name: wallet?.info?.prettyName,
|
|
24
|
-
logo: typeof wallet?.info?.logo ===
|
|
24
|
+
logo: typeof wallet?.info?.logo === 'string' ? wallet?.info?.logo : '',
|
|
25
25
|
mobileDisabled: true,
|
|
26
26
|
}, contentHeader: `${wallet?.info?.prettyName} Not Installed`, contentDesc: true
|
|
27
27
|
? `If ${wallet?.info?.prettyName.toLowerCase()} is installed on your device, please refresh this page or follow the browser instruction.`
|
|
28
28
|
: `Download link not provided. Try searching it or consulting the developer team.`, onInstall: onInstall, installIcon: _jsx(IconComp, {}), disableInstall: downloadLink === null }));
|
|
29
29
|
};
|
|
30
30
|
function getIcon(env) {
|
|
31
|
-
if (env?.browser ===
|
|
31
|
+
if (env?.browser === 'chrome')
|
|
32
32
|
return RiChromeFill;
|
|
33
|
-
if (env?.browser ===
|
|
33
|
+
if (env?.browser === 'firefox')
|
|
34
34
|
return GrFirefox;
|
|
35
|
-
if (env?.os ===
|
|
35
|
+
if (env?.os === 'android')
|
|
36
36
|
return FaAndroid;
|
|
37
|
-
if (env?.os ===
|
|
37
|
+
if (env?.os === 'ios')
|
|
38
38
|
return RiAppStoreFill;
|
|
39
39
|
return GoDesktopDownload;
|
|
40
40
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ConnectModalHead, ConnectModalQRCode } from
|
|
2
|
+
import { ConnectModalHead, ConnectModalQRCode } from '@interchain-ui/react';
|
|
3
3
|
export const QRCodeHeader = ({ wallet, close, onBack, }) => {
|
|
4
|
-
return (_jsx(ConnectModalHead, { title: wallet?.info?.prettyName ||
|
|
4
|
+
return (_jsx(ConnectModalHead, { title: wallet?.info?.prettyName || '', hasBackButton: true, onClose: () => void 0, onBack: onBack, closeButtonProps: { onClick: close } }));
|
|
5
5
|
};
|
|
6
6
|
export const QRCodeContent = ({ errorMessage, walletConnectQRCodeUri, onReconnect, }) => {
|
|
7
|
-
return (_jsx(ConnectModalQRCode, { status: walletConnectQRCodeUri ?
|
|
7
|
+
return (_jsx(ConnectModalQRCode, { status: walletConnectQRCodeUri ? 'Done' : 'Pending', link: walletConnectQRCodeUri, description: 'Open App to connect', errorTitle: 'errorTitle', errorDesc: errorMessage || '', onRefresh: onReconnect }));
|
|
8
8
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ConnectModalHead, ConnectModalStatus } from
|
|
3
|
-
import { getWalletInfo } from
|
|
2
|
+
import { ConnectModalHead, ConnectModalStatus } from '@interchain-ui/react';
|
|
3
|
+
import { getWalletInfo } from '../../utils';
|
|
4
4
|
export const RejectHeader = ({ wallet, close, onBack, }) => {
|
|
5
5
|
return (_jsx(ConnectModalHead, { title: wallet?.info?.prettyName, hasBackButton: true, onClose: close, onBack: onBack, closeButtonProps: { onClick: close } }));
|
|
6
6
|
};
|
|
7
7
|
export const RejectContent = ({ wallet, onReconnect, }) => {
|
|
8
|
-
return (_jsx(ConnectModalStatus, { status: "Rejected", wallet: getWalletInfo(wallet), contentHeader:
|
|
8
|
+
return (_jsx(ConnectModalStatus, { status: "Rejected", wallet: getWalletInfo(wallet), contentHeader: 'Request Rejected', contentDesc: wallet.errorMessage || 'Connection permission is denied.', onConnect: onReconnect }));
|
|
9
9
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ConnectModalHead, ConnectModalWalletList } from
|
|
2
|
+
import { ConnectModalHead, ConnectModalWalletList } from '@interchain-ui/react';
|
|
3
3
|
export const WalletListHeader = ({ close }) => {
|
|
4
4
|
return (_jsx(ConnectModalHead, { title: "Select your wallet", hasBackButton: false, onClose: close, closeButtonProps: { onClick: close } }));
|
|
5
5
|
};
|
package/esm/modal/views/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './Connecting';
|
|
2
|
-
export * from './WalletList';
|
|
3
1
|
export * from './Connected';
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './QRCode';
|
|
6
|
-
export * from './NotExist';
|
|
2
|
+
export * from './Connecting';
|
|
7
3
|
export * from './Error';
|
|
4
|
+
export * from './NotExist';
|
|
5
|
+
export * from './QRCode';
|
|
6
|
+
export * from './Reject';
|
|
7
|
+
export * from './WalletList';
|
package/esm/provider.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { WalletManagerStore } from
|
|
3
|
-
import { useEffect, useRef } from
|
|
4
|
-
import { createContext, useContext } from
|
|
5
|
-
import { ModalRenderer } from
|
|
2
|
+
import { WalletManagerStore } from '@interchain-kit/store';
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
import { createContext, useContext } from 'react';
|
|
5
|
+
import { ModalRenderer } from './modal';
|
|
6
6
|
const InterchainWalletContext = createContext(null);
|
|
7
7
|
export const ChainProvider = ({ chains, assetLists, wallets, signerOptions, endpointOptions, children, walletModal: ProviderWalletModal, }) => {
|
|
8
8
|
const store = useRef(null);
|
|
@@ -17,7 +17,7 @@ export const ChainProvider = ({ chains, assetLists, wallets, signerOptions, endp
|
|
|
17
17
|
export const useInterchainWalletContext = () => {
|
|
18
18
|
const context = useContext(InterchainWalletContext);
|
|
19
19
|
if (!context) {
|
|
20
|
-
throw new Error(
|
|
20
|
+
throw new Error('useInterChainWalletContext must be used within a InterChainProvider');
|
|
21
21
|
}
|
|
22
22
|
return context;
|
|
23
23
|
};
|
|
@@ -3,7 +3,7 @@ export const decorateWallet = (wallet, decorateMethods) => {
|
|
|
3
3
|
get(target, prop, receiver) {
|
|
4
4
|
if (prop in decorateMethods) {
|
|
5
5
|
const value = decorateMethods[prop];
|
|
6
|
-
if (typeof value ===
|
|
6
|
+
if (typeof value === 'function') {
|
|
7
7
|
return value.bind(target);
|
|
8
8
|
}
|
|
9
9
|
return value;
|
package/esm/utils/index.js
CHANGED
package/esm/utils/wallet.js
CHANGED
|
@@ -7,7 +7,7 @@ export const getWalletInfo = (wallet) => {
|
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
9
|
export const transferToWalletUISchema = (w) => {
|
|
10
|
-
if (w.info.mode ===
|
|
10
|
+
if (w.info.mode === 'wallet-connect') {
|
|
11
11
|
const wc = w;
|
|
12
12
|
if (wc.session) {
|
|
13
13
|
return {
|
|
@@ -15,7 +15,7 @@ export const transferToWalletUISchema = (w) => {
|
|
|
15
15
|
prettyName: `${wc.session?.peer.metadata?.name} - Mobile`,
|
|
16
16
|
logo: wc.session?.peer.metadata?.icons?.[0],
|
|
17
17
|
mobileDisabled: true,
|
|
18
|
-
shape:
|
|
18
|
+
shape: 'list',
|
|
19
19
|
originalWallet: { ...w, session: wc.session },
|
|
20
20
|
subLogo: w.info.logo,
|
|
21
21
|
};
|
|
@@ -26,7 +26,7 @@ export const transferToWalletUISchema = (w) => {
|
|
|
26
26
|
prettyName: w.info.prettyName,
|
|
27
27
|
logo: w.info.logo,
|
|
28
28
|
mobileDisabled: true,
|
|
29
|
-
shape:
|
|
29
|
+
shape: 'list',
|
|
30
30
|
originalWallet: w,
|
|
31
31
|
};
|
|
32
32
|
};
|
package/hooks/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './useAsync';
|
|
2
2
|
export * from './useChain';
|
|
3
|
+
export * from './useChains';
|
|
3
4
|
export * from './useChainWallet';
|
|
4
5
|
export * from './useSigningClient';
|
|
5
|
-
export * from './
|
|
6
|
+
export * from './useWalletManager';
|
|
6
7
|
export * from './useWalletModal';
|
package/hooks/index.js
CHANGED
|
@@ -14,9 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./useAsync"), exports);
|
|
18
18
|
__exportStar(require("./useChain"), exports);
|
|
19
|
+
__exportStar(require("./useChains"), exports);
|
|
19
20
|
__exportStar(require("./useChainWallet"), exports);
|
|
20
21
|
__exportStar(require("./useSigningClient"), exports);
|
|
21
|
-
__exportStar(require("./
|
|
22
|
+
__exportStar(require("./useWalletManager"), exports);
|
|
22
23
|
__exportStar(require("./useWalletModal"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useChains = void 0;
|
|
4
|
+
const useChain_1 = require("./useChain");
|
|
5
|
+
const useChains = (chainNames) => {
|
|
6
|
+
const results = {};
|
|
7
|
+
chainNames.forEach(chainName => {
|
|
8
|
+
results[chainName] = (0, useChain_1.useChain)(chainName);
|
|
9
|
+
});
|
|
10
|
+
return results;
|
|
11
|
+
};
|
|
12
|
+
exports.useChains = useChains;
|
|
@@ -5,7 +5,15 @@ const core_1 = require("@interchain-kit/core");
|
|
|
5
5
|
const useAsync_1 = require("./useAsync");
|
|
6
6
|
const useWalletManager_1 = require("./useWalletManager");
|
|
7
7
|
const useSigningClient = (chainName, walletName) => {
|
|
8
|
-
const { getSigningClient, getChainWalletState, getRpcEndpoint, isReady } = (0, useWalletManager_1.useWalletManager)();
|
|
8
|
+
const { getSigningClient, getChainWalletState, getRpcEndpoint, isReady, getChainByName } = (0, useWalletManager_1.useWalletManager)();
|
|
9
|
+
const chain = getChainByName(chainName);
|
|
10
|
+
if (chain.chainType !== 'cosmos') {
|
|
11
|
+
return {
|
|
12
|
+
signingClient: null,
|
|
13
|
+
isLoading: false,
|
|
14
|
+
error: null,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
9
17
|
const chainWalletState = getChainWalletState(walletName, chainName);
|
|
10
18
|
const { data, isLoading, error } = (0, useAsync_1.useAsync)({
|
|
11
19
|
queryKey: `signing-client-${chainName}-${walletName}`,
|
package/modal/modal.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DownloadInfo } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { DownloadInfo } from '@interchain-kit/core';
|
|
2
|
+
import { WalletStore } from '@interchain-kit/store/wallet-manager/wallet-store';
|
|
3
|
+
import { ThemeProviderProps, Wallet as InterchainUIWalletType } from '@interchain-ui/react';
|
|
4
|
+
import { ReactElement } from 'react';
|
|
5
5
|
export type WalletModalProps = {
|
|
6
6
|
isOpen: boolean;
|
|
7
7
|
wallets: WalletStore[];
|
package/modal/modal.js
CHANGED
|
@@ -42,7 +42,7 @@ exports.InterchainWalletModal = InterchainWalletModal;
|
|
|
42
42
|
const WalletModalElement = ({ shouldShowList, isOpen, walletConnectQRCodeUri, wallets, username, address, currentWallet, isConnecting, isConnected, isRejected, isDisconnected, isNotExist, errorMessage, open, close, disconnect, onSelectWallet, onBack, onReconnect, getDownloadLink, getEnv, modalThemeProviderProps, modalContainerClassName, modalContentClassName, modalChildrenClassName, modalContentStyles, }) => {
|
|
43
43
|
const { header, content } = (0, react_2.useMemo)(() => {
|
|
44
44
|
if (shouldShowList ||
|
|
45
|
-
(isDisconnected && currentWallet.errorMessage ===
|
|
45
|
+
(isDisconnected && currentWallet.errorMessage === '')) {
|
|
46
46
|
return {
|
|
47
47
|
header: (0, jsx_runtime_1.jsx)(views_1.WalletListHeader, { close: close }),
|
|
48
48
|
content: ((0, jsx_runtime_1.jsx)(views_1.WalletListContent, { onSelectWallet: onSelectWallet, wallets: wallets })),
|
|
@@ -50,7 +50,7 @@ const WalletModalElement = ({ shouldShowList, isOpen, walletConnectQRCodeUri, wa
|
|
|
50
50
|
}
|
|
51
51
|
if (currentWallet &&
|
|
52
52
|
walletConnectQRCodeUri &&
|
|
53
|
-
currentWallet.info.name ===
|
|
53
|
+
currentWallet.info.name === 'WalletConnect') {
|
|
54
54
|
return {
|
|
55
55
|
header: ((0, jsx_runtime_1.jsx)(views_1.QRCodeHeader, { wallet: currentWallet, close: close, onBack: onBack })),
|
|
56
56
|
content: ((0, jsx_runtime_1.jsx)(views_1.QRCodeContent, { walletConnectQRCodeUri: walletConnectQRCodeUri, errorMessage: errorMessage, onReconnect: onReconnect })),
|
package/modal/views/Connected.js
CHANGED
|
@@ -6,16 +6,16 @@ const react_1 = require("@interchain-ui/react");
|
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
7
|
const Astronaut_1 = require("./Astronaut");
|
|
8
8
|
const ConnectedHeader = ({ wallet, close, onBack, }) => {
|
|
9
|
-
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalHead, { title: wallet?.info?.prettyName ||
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalHead, { title: wallet?.info?.prettyName || '', hasBackButton: true, onClose: close, onBack: onBack, closeButtonProps: { onClick: close } }));
|
|
10
10
|
};
|
|
11
11
|
exports.ConnectedHeader = ConnectedHeader;
|
|
12
12
|
const ConnectedContent = ({ address, username, wallet, disconnect, }) => {
|
|
13
|
-
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalStatus, { wallet: (0, utils_1.getWalletInfo)(wallet), status:
|
|
14
|
-
name: username ||
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalStatus, { wallet: (0, utils_1.getWalletInfo)(wallet), status: 'Connected', connectedInfo: {
|
|
14
|
+
name: username || 'Wallet',
|
|
15
15
|
avatar: ((0, jsx_runtime_1.jsx)(Astronaut_1.AstronautSvg, { style: {
|
|
16
|
-
fontSize:
|
|
17
|
-
width:
|
|
18
|
-
height:
|
|
16
|
+
fontSize: 'inherit',
|
|
17
|
+
width: '100%',
|
|
18
|
+
height: '100%',
|
|
19
19
|
} })),
|
|
20
20
|
address: address,
|
|
21
21
|
}, onDisconnect: disconnect }));
|
|
@@ -11,8 +11,8 @@ const ConnectingHeader = ({ wallet, close, onBack, }) => {
|
|
|
11
11
|
exports.ConnectingHeader = ConnectingHeader;
|
|
12
12
|
const ConnectingContent = ({ wallet }) => {
|
|
13
13
|
const { info: { prettyName, mode }, } = wallet;
|
|
14
|
-
let title =
|
|
15
|
-
let desc = mode ===
|
|
14
|
+
let title = 'Requesting Connection';
|
|
15
|
+
let desc = mode === 'wallet-connect'
|
|
16
16
|
? `Approve ${prettyName} connection request on your mobile.`
|
|
17
17
|
: `Open the ${prettyName} browser extension to connect your wallet.`;
|
|
18
18
|
if (!wallet)
|
package/modal/views/Error.d.ts
CHANGED
package/modal/views/Error.js
CHANGED
|
@@ -9,6 +9,6 @@ const ErrorHeader = ({ wallet, close, onBack, }) => {
|
|
|
9
9
|
};
|
|
10
10
|
exports.ErrorHeader = ErrorHeader;
|
|
11
11
|
const ErrorContent = ({ wallet, onBack, }) => {
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalStatus, { status: "Error", wallet: (0, utils_1.getWalletInfo)(wallet), contentHeader:
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalStatus, { status: "Error", wallet: (0, utils_1.getWalletInfo)(wallet), contentHeader: 'Oops! Something wrong...', contentDesc: wallet.errorMessage, onChangeWallet: onBack }));
|
|
13
13
|
};
|
|
14
14
|
exports.ErrorContent = ErrorContent;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DownloadInfo } from
|
|
2
|
-
import { WalletStore } from
|
|
1
|
+
import { DownloadInfo } from '@interchain-kit/core';
|
|
2
|
+
import { WalletStore } from '@interchain-kit/store';
|
|
3
3
|
export declare const NotExistHeader: ({ wallet, close, onBack, }: {
|
|
4
4
|
wallet: WalletStore;
|
|
5
5
|
close: () => void;
|
package/modal/views/NotExist.js
CHANGED
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NotExistContent = exports.NotExistHeader = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("@interchain-ui/react");
|
|
6
|
-
const react_2 = require("react");
|
|
7
6
|
const FaAndroid_1 = require("@react-icons/all-files/fa/FaAndroid");
|
|
8
7
|
const GoDesktopDownload_1 = require("@react-icons/all-files/go/GoDesktopDownload");
|
|
9
8
|
const GrFirefox_1 = require("@react-icons/all-files/gr/GrFirefox");
|
|
10
9
|
const RiAppStoreFill_1 = require("@react-icons/all-files/ri/RiAppStoreFill");
|
|
11
10
|
const RiChromeFill_1 = require("@react-icons/all-files/ri/RiChromeFill");
|
|
11
|
+
const react_2 = require("react");
|
|
12
12
|
const NotExistHeader = ({ wallet, close, onBack, }) => {
|
|
13
|
-
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalHead, { title: wallet?.info?.prettyName ||
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalHead, { title: wallet?.info?.prettyName || '', hasBackButton: true, onClose: close, onBack: onBack, closeButtonProps: { onClick: close } }));
|
|
14
14
|
};
|
|
15
15
|
exports.NotExistHeader = NotExistHeader;
|
|
16
16
|
const NotExistContent = ({ wallet, getDownloadLink, getEnv, }) => {
|
|
@@ -19,13 +19,13 @@ const NotExistContent = ({ wallet, getDownloadLink, getEnv, }) => {
|
|
|
19
19
|
}, [wallet?.info?.name]);
|
|
20
20
|
const onInstall = () => {
|
|
21
21
|
if (downloadLink) {
|
|
22
|
-
window.open(downloadLink.link,
|
|
22
|
+
window.open(downloadLink.link, '_blank');
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
const IconComp = getIcon(getEnv());
|
|
26
26
|
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalStatus, { status: "NotExist", wallet: {
|
|
27
27
|
name: wallet?.info?.prettyName,
|
|
28
|
-
logo: typeof wallet?.info?.logo ===
|
|
28
|
+
logo: typeof wallet?.info?.logo === 'string' ? wallet?.info?.logo : '',
|
|
29
29
|
mobileDisabled: true,
|
|
30
30
|
}, contentHeader: `${wallet?.info?.prettyName} Not Installed`, contentDesc: true
|
|
31
31
|
? `If ${wallet?.info?.prettyName.toLowerCase()} is installed on your device, please refresh this page or follow the browser instruction.`
|
|
@@ -33,13 +33,13 @@ const NotExistContent = ({ wallet, getDownloadLink, getEnv, }) => {
|
|
|
33
33
|
};
|
|
34
34
|
exports.NotExistContent = NotExistContent;
|
|
35
35
|
function getIcon(env) {
|
|
36
|
-
if (env?.browser ===
|
|
36
|
+
if (env?.browser === 'chrome')
|
|
37
37
|
return RiChromeFill_1.RiChromeFill;
|
|
38
|
-
if (env?.browser ===
|
|
38
|
+
if (env?.browser === 'firefox')
|
|
39
39
|
return GrFirefox_1.GrFirefox;
|
|
40
|
-
if (env?.os ===
|
|
40
|
+
if (env?.os === 'android')
|
|
41
41
|
return FaAndroid_1.FaAndroid;
|
|
42
|
-
if (env?.os ===
|
|
42
|
+
if (env?.os === 'ios')
|
|
43
43
|
return RiAppStoreFill_1.RiAppStoreFill;
|
|
44
44
|
return GoDesktopDownload_1.GoDesktopDownload;
|
|
45
45
|
}
|
package/modal/views/QRCode.d.ts
CHANGED
package/modal/views/QRCode.js
CHANGED
|
@@ -4,10 +4,10 @@ exports.QRCodeContent = exports.QRCodeHeader = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("@interchain-ui/react");
|
|
6
6
|
const QRCodeHeader = ({ wallet, close, onBack, }) => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalHead, { title: wallet?.info?.prettyName ||
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalHead, { title: wallet?.info?.prettyName || '', hasBackButton: true, onClose: () => void 0, onBack: onBack, closeButtonProps: { onClick: close } }));
|
|
8
8
|
};
|
|
9
9
|
exports.QRCodeHeader = QRCodeHeader;
|
|
10
10
|
const QRCodeContent = ({ errorMessage, walletConnectQRCodeUri, onReconnect, }) => {
|
|
11
|
-
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalQRCode, { status: walletConnectQRCodeUri ?
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalQRCode, { status: walletConnectQRCodeUri ? 'Done' : 'Pending', link: walletConnectQRCodeUri, description: 'Open App to connect', errorTitle: 'errorTitle', errorDesc: errorMessage || '', onRefresh: onReconnect }));
|
|
12
12
|
};
|
|
13
13
|
exports.QRCodeContent = QRCodeContent;
|
package/modal/views/Reject.d.ts
CHANGED
package/modal/views/Reject.js
CHANGED
|
@@ -9,6 +9,6 @@ const RejectHeader = ({ wallet, close, onBack, }) => {
|
|
|
9
9
|
};
|
|
10
10
|
exports.RejectHeader = RejectHeader;
|
|
11
11
|
const RejectContent = ({ wallet, onReconnect, }) => {
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalStatus, { status: "Rejected", wallet: (0, utils_1.getWalletInfo)(wallet), contentHeader:
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalStatus, { status: "Rejected", wallet: (0, utils_1.getWalletInfo)(wallet), contentHeader: 'Request Rejected', contentDesc: wallet.errorMessage || 'Connection permission is denied.', onConnect: onReconnect }));
|
|
13
13
|
};
|
|
14
14
|
exports.RejectContent = RejectContent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Wallet as InterchainUIWalletType } from
|
|
1
|
+
import { Wallet as InterchainUIWalletType } from '@interchain-ui/react';
|
|
2
2
|
export declare const WalletListHeader: ({ close }: {
|
|
3
3
|
close: () => void;
|
|
4
4
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/modal/views/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './Connecting';
|
|
2
|
-
export * from './WalletList';
|
|
3
1
|
export * from './Connected';
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './QRCode';
|
|
6
|
-
export * from './NotExist';
|
|
2
|
+
export * from './Connecting';
|
|
7
3
|
export * from './Error';
|
|
4
|
+
export * from './NotExist';
|
|
5
|
+
export * from './QRCode';
|
|
6
|
+
export * from './Reject';
|
|
7
|
+
export * from './WalletList';
|
package/modal/views/index.js
CHANGED
|
@@ -14,10 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Connecting"), exports);
|
|
18
|
-
__exportStar(require("./WalletList"), exports);
|
|
19
17
|
__exportStar(require("./Connected"), exports);
|
|
20
|
-
__exportStar(require("./
|
|
21
|
-
__exportStar(require("./QRCode"), exports);
|
|
22
|
-
__exportStar(require("./NotExist"), exports);
|
|
18
|
+
__exportStar(require("./Connecting"), exports);
|
|
23
19
|
__exportStar(require("./Error"), exports);
|
|
20
|
+
__exportStar(require("./NotExist"), exports);
|
|
21
|
+
__exportStar(require("./QRCode"), exports);
|
|
22
|
+
__exportStar(require("./Reject"), exports);
|
|
23
|
+
__exportStar(require("./WalletList"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interchain-kit/react",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.50",
|
|
4
4
|
"author": "Hyperweb <developers@hyperweb.io>",
|
|
5
5
|
"description": "interchain-kit wallet connector react package",
|
|
6
6
|
"main": "index.js",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"keywords": [],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@chain-registry/types": "^2.0.1",
|
|
38
|
-
"@interchain-kit/core": "0.3.
|
|
39
|
-
"@interchain-kit/store": "0.3.
|
|
38
|
+
"@interchain-kit/core": "0.3.50",
|
|
39
|
+
"@interchain-kit/store": "0.3.50",
|
|
40
40
|
"@interchain-ui/react": "^1.26.3",
|
|
41
41
|
"@interchainjs/cosmos": "1.17.3",
|
|
42
42
|
"@interchainjs/cosmos-types": "1.17.3",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"react": "^19.0.0",
|
|
71
71
|
"react-dom": "^19.0.0"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "2b3813f0fb8f9c6beb7259845acbc0a0d52c72c0"
|
|
74
74
|
}
|
package/provider.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AssetList, Chain } from
|
|
2
|
-
import { BaseWallet, EndpointOptions, SignerOptions } from
|
|
3
|
-
import { WalletManagerStore } from
|
|
4
|
-
import React, { ReactElement } from
|
|
5
|
-
import { WalletModalProps } from
|
|
1
|
+
import { AssetList, Chain } from '@chain-registry/types';
|
|
2
|
+
import { BaseWallet, EndpointOptions, SignerOptions } from '@interchain-kit/core';
|
|
3
|
+
import { WalletManagerStore } from '@interchain-kit/store';
|
|
4
|
+
import React, { ReactElement } from 'react';
|
|
5
|
+
import { WalletModalProps } from './modal';
|
|
6
6
|
type InterchainWalletProviderProps = {
|
|
7
7
|
chains: Chain[];
|
|
8
8
|
assetLists: AssetList[];
|
package/provider.js
CHANGED
|
@@ -21,7 +21,7 @@ exports.ChainProvider = ChainProvider;
|
|
|
21
21
|
const useInterchainWalletContext = () => {
|
|
22
22
|
const context = (0, react_2.useContext)(InterchainWalletContext);
|
|
23
23
|
if (!context) {
|
|
24
|
-
throw new Error(
|
|
24
|
+
throw new Error('useInterChainWalletContext must be used within a InterChainProvider');
|
|
25
25
|
}
|
|
26
26
|
return context;
|
|
27
27
|
};
|
package/types/chain.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Chain, AssetList } from '@chain-registry/types';
|
|
1
|
+
import { AssetList, Chain } from '@chain-registry/types';
|
|
3
2
|
import { WalletState } from '@interchain-kit/core';
|
|
4
|
-
import { SigningClient } from './sign-client';
|
|
5
3
|
import { ChainWalletStore } from '@interchain-kit/store';
|
|
4
|
+
import { HttpEndpoint } from '@interchainjs/types';
|
|
5
|
+
import { SigningClient } from './sign-client';
|
|
6
6
|
export type CosmosKitUseChainReturnType = {
|
|
7
7
|
connect: () => void;
|
|
8
8
|
disconnect: () => void;
|
package/types/sign-client.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WalletManager } from
|
|
1
|
+
import { WalletManager } from '@interchain-kit/core';
|
|
2
2
|
export type SigningClient = Awaited<ReturnType<WalletManager['getSigningClient']>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BaseWallet } from
|
|
1
|
+
import { BaseWallet } from '@interchain-kit/core';
|
|
2
2
|
export declare const decorateWallet: <T extends BaseWallet>(wallet: T, decorateMethods: Partial<T>) => T;
|
package/utils/decorateWallet.js
CHANGED
|
@@ -6,7 +6,7 @@ const decorateWallet = (wallet, decorateMethods) => {
|
|
|
6
6
|
get(target, prop, receiver) {
|
|
7
7
|
if (prop in decorateMethods) {
|
|
8
8
|
const value = decorateMethods[prop];
|
|
9
|
-
if (typeof value ===
|
|
9
|
+
if (typeof value === 'function') {
|
|
10
10
|
return value.bind(target);
|
|
11
11
|
}
|
|
12
12
|
return value;
|
package/utils/index.d.ts
CHANGED
package/utils/index.js
CHANGED
|
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./wallet"), exports);
|
|
18
17
|
__exportStar(require("./dedupeAsync"), exports);
|
|
19
18
|
__exportStar(require("./restoreAccount"), exports);
|
|
19
|
+
__exportStar(require("./wallet"), exports);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WalletAccount } from
|
|
1
|
+
import { WalletAccount } from '@interchain-kit/core';
|
|
2
2
|
export declare const restoreAccountFromLocalStorage: (walletAccount: WalletAccount) => WalletAccount;
|
package/utils/wallet.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseWallet } from
|
|
1
|
+
import { BaseWallet } from '@interchain-kit/core';
|
|
2
2
|
export declare const getWalletInfo: (wallet: BaseWallet) => {
|
|
3
3
|
name: string;
|
|
4
4
|
prettyName: string;
|
|
@@ -16,6 +16,7 @@ export declare const transferToWalletUISchema: (w: BaseWallet) => {
|
|
|
16
16
|
info: import("@interchain-kit/core").Wallet;
|
|
17
17
|
events: import("events")<import("@interchain-kit/core").WalletEvents>;
|
|
18
18
|
chainMap: Map<import("@chain-registry/types").Chain["chainId"], import("@chain-registry/types").Chain>;
|
|
19
|
+
chainNameMap: Map<import("@chain-registry/types").Chain["chainName"], import("@chain-registry/types").Chain>;
|
|
19
20
|
assetLists: import("@chain-registry/types").AssetList[];
|
|
20
21
|
client: any;
|
|
21
22
|
};
|
package/utils/wallet.js
CHANGED
|
@@ -11,7 +11,7 @@ const getWalletInfo = (wallet) => {
|
|
|
11
11
|
};
|
|
12
12
|
exports.getWalletInfo = getWalletInfo;
|
|
13
13
|
const transferToWalletUISchema = (w) => {
|
|
14
|
-
if (w.info.mode ===
|
|
14
|
+
if (w.info.mode === 'wallet-connect') {
|
|
15
15
|
const wc = w;
|
|
16
16
|
if (wc.session) {
|
|
17
17
|
return {
|
|
@@ -19,7 +19,7 @@ const transferToWalletUISchema = (w) => {
|
|
|
19
19
|
prettyName: `${wc.session?.peer.metadata?.name} - Mobile`,
|
|
20
20
|
logo: wc.session?.peer.metadata?.icons?.[0],
|
|
21
21
|
mobileDisabled: true,
|
|
22
|
-
shape:
|
|
22
|
+
shape: 'list',
|
|
23
23
|
originalWallet: { ...w, session: wc.session },
|
|
24
24
|
subLogo: w.info.logo,
|
|
25
25
|
};
|
|
@@ -30,7 +30,7 @@ const transferToWalletUISchema = (w) => {
|
|
|
30
30
|
prettyName: w.info.prettyName,
|
|
31
31
|
logo: w.info.logo,
|
|
32
32
|
mobileDisabled: true,
|
|
33
|
-
shape:
|
|
33
|
+
shape: 'list',
|
|
34
34
|
originalWallet: w,
|
|
35
35
|
};
|
|
36
36
|
};
|