@interchain-kit/react 0.0.1-beta.22 → 0.0.1-beta.24
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 +43 -7
- package/esm/hooks/index.js +1 -1
- package/esm/hooks/useAccount.js +1 -1
- package/esm/hooks/useChain.js +12 -12
- package/esm/hooks/{useActiveWallet.js → useCurrentWallet.js} +4 -4
- package/esm/hooks/useInterchainClient.js +1 -1
- package/esm/modal/modal.js +12 -9
- package/esm/modal/views/Connected.js +12 -12
- package/esm/modal/views/Connecting.js +17 -17
- package/esm/modal/views/QRCode.js +11 -7
- package/esm/modal/views/Reject.js +5 -5
- package/esm/provider.js +1 -1
- package/hooks/index.d.ts +1 -1
- package/hooks/index.js +1 -1
- package/hooks/useAccount.d.ts +1 -1
- package/hooks/useAccount.js +1 -1
- package/hooks/useChain.js +12 -12
- package/hooks/useConfig.d.ts +1 -1
- package/hooks/useCurrentWallet.d.ts +1 -0
- package/hooks/{useActiveWallet.js → useCurrentWallet.js} +6 -6
- package/hooks/useInterchainClient.js +1 -1
- package/modal/modal.js +11 -8
- package/modal/views/Connected.js +11 -11
- package/modal/views/Connecting.js +14 -14
- package/modal/views/QRCode.d.ts +3 -1
- package/modal/views/QRCode.js +10 -6
- package/modal/views/Reject.js +4 -4
- package/package.json +3 -3
- package/provider.d.ts +1 -1
- package/provider.js +1 -1
- package/types/wallet.d.ts +1 -1
- package/utils/wallet.d.ts +1 -1
- package/hooks/useActiveWallet.d.ts +0 -1
package/README.md
CHANGED
|
@@ -15,17 +15,19 @@ yarn add @interchain-kit/react
|
|
|
15
15
|
|
|
16
16
|
## Usage
|
|
17
17
|
### Setup
|
|
18
|
+
#### import chain registry info that you need
|
|
18
19
|
```js
|
|
19
20
|
import { ChainProvider, useChain } from "@interchain-kit/react";
|
|
20
|
-
import { assetLists, chains } from "@chain-registry/v2";
|
|
21
21
|
import { keplrWallet } from "@interchain-kit/keplr-extension";
|
|
22
22
|
import { ThemeProvider } from "@interchain-ui/react";
|
|
23
23
|
import "@interchain-ui/react/styles";
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
import { chain as junoChain, assetList as junoAssetList } from "@chain-registry/v2/mainnet/juno";
|
|
26
|
+
import { chain as osmosisChain,assetList as osmosisAssetList } from "@chain-registry/v2/mainnet/osmosis";
|
|
27
|
+
import { chain as cosmoshubChain, assetList as cosmoshubAssetList } from "@chain-registry/v2/mainnet/cosmoshub";
|
|
26
28
|
|
|
27
29
|
const Show = () => {
|
|
28
|
-
const {address} = useChain(
|
|
30
|
+
const {address} = useChain('osmosis');
|
|
29
31
|
// will show cosmoshub address from what you selected wallet in modal
|
|
30
32
|
return <div>{address}</div>;
|
|
31
33
|
};
|
|
@@ -34,8 +36,42 @@ function App() {
|
|
|
34
36
|
return (
|
|
35
37
|
<ThemeProvider>
|
|
36
38
|
<ChainProvider
|
|
37
|
-
chains={
|
|
38
|
-
assetLists={
|
|
39
|
+
chains={[osmosisChain, junoChain, cosmoshubChain]}
|
|
40
|
+
assetLists={[osmosisAssetList, junoAssetList, cosmoshubAssetList]}
|
|
41
|
+
wallets={[keplrWallet]}
|
|
42
|
+
signerOptions={{}}
|
|
43
|
+
endpointOptions={{}}
|
|
44
|
+
>
|
|
45
|
+
<Show />
|
|
46
|
+
</ChainProvider>
|
|
47
|
+
</ThemeProvider>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default App;
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### or import all chain registry
|
|
55
|
+
```js
|
|
56
|
+
import { ChainProvider, useChain } from "@interchain-kit/react";
|
|
57
|
+
import { keplrWallet } from "@interchain-kit/keplr-extension";
|
|
58
|
+
import { ThemeProvider } from "@interchain-ui/react";
|
|
59
|
+
import "@interchain-ui/react/styles";
|
|
60
|
+
import { chains, assetLists } from '@chain-registry/v2/mainnet'
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
const Show = () => {
|
|
64
|
+
const {address} = useChain('osmosis');
|
|
65
|
+
// will show cosmoshub address from what you selected wallet in modal
|
|
66
|
+
return <div>{address}</div>;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
function App() {
|
|
70
|
+
return (
|
|
71
|
+
<ThemeProvider>
|
|
72
|
+
<ChainProvider
|
|
73
|
+
chains={chains}
|
|
74
|
+
assetLists={assetLists}
|
|
39
75
|
wallets={[keplrWallet]}
|
|
40
76
|
signerOptions={{}}
|
|
41
77
|
endpointOptions={{}}
|
|
@@ -103,9 +139,9 @@ function App() {
|
|
|
103
139
|
export default App;
|
|
104
140
|
```
|
|
105
141
|
|
|
106
|
-
###
|
|
142
|
+
### useCurrentWallet
|
|
107
143
|
```js
|
|
108
|
-
const wallet =
|
|
144
|
+
const wallet = useCurrentWallet()
|
|
109
145
|
|
|
110
146
|
console.log(wallet) // current connected wallet
|
|
111
147
|
|
package/esm/hooks/index.js
CHANGED
package/esm/hooks/useAccount.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
|
-
import { WalletState } from "@
|
|
2
|
+
import { WalletState } from "@interchain-kit/core";
|
|
3
3
|
import { useWalletManager } from './useWalletManager';
|
|
4
4
|
export const useAccount = (chainName, walletName) => {
|
|
5
5
|
const walletManager = useWalletManager();
|
package/esm/hooks/useChain.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import { useWalletManager } from "./useWalletManager";
|
|
2
2
|
import { useAccount } from "./useAccount";
|
|
3
|
-
import {
|
|
3
|
+
import { useCurrentWallet } from './useCurrentWallet';
|
|
4
4
|
import { useInterchainClient } from './useInterchainClient';
|
|
5
5
|
import { useWalletModal } from "../modal";
|
|
6
|
-
import { ChainNameNotExist } from "@
|
|
6
|
+
import { ChainNameNotExist } from "@interchain-kit/core";
|
|
7
7
|
import { getChainLogoUrl } from "../utils";
|
|
8
8
|
export const useChain = (chainName) => {
|
|
9
9
|
const walletManager = useWalletManager();
|
|
10
10
|
const chainToShow = walletManager.chains.find((c) => c.chainName === chainName);
|
|
11
11
|
const assetList = walletManager.assetLists.find((a) => a.chainName === chainName);
|
|
12
|
-
const
|
|
13
|
-
const account = useAccount(chainName,
|
|
14
|
-
const interchainClient = useInterchainClient(chainName,
|
|
12
|
+
const currentWallet = useCurrentWallet();
|
|
13
|
+
const account = useAccount(chainName, currentWallet?.option?.name);
|
|
14
|
+
const interchainClient = useInterchainClient(chainName, currentWallet?.option?.name);
|
|
15
15
|
if (!chainToShow) {
|
|
16
16
|
throw new ChainNameNotExist(chainName);
|
|
17
17
|
}
|
|
18
18
|
const { open, close } = useWalletModal();
|
|
19
19
|
const cosmosKitUserChainReturnType = {
|
|
20
20
|
connect: () => {
|
|
21
|
-
if (
|
|
21
|
+
if (currentWallet) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
open();
|
|
25
25
|
},
|
|
26
26
|
openView: open,
|
|
27
27
|
closeView: close,
|
|
28
|
-
getRpcEndpoint: () => walletManager.getRpcEndpoint(
|
|
29
|
-
status:
|
|
28
|
+
getRpcEndpoint: () => walletManager.getRpcEndpoint(currentWallet, chainName),
|
|
29
|
+
status: currentWallet?.walletState,
|
|
30
30
|
username: account?.username,
|
|
31
|
-
message:
|
|
32
|
-
getSigningCosmWasmClient: () => walletManager.getSigningCosmwasmClient(
|
|
33
|
-
getSigningCosmosClient: () => walletManager.getSigningCosmosClient(
|
|
31
|
+
message: currentWallet?.errorMessage,
|
|
32
|
+
getSigningCosmWasmClient: () => walletManager.getSigningCosmwasmClient(currentWallet.option.name, chainName),
|
|
33
|
+
getSigningCosmosClient: () => walletManager.getSigningCosmosClient(currentWallet.option.name, chainName),
|
|
34
34
|
};
|
|
35
35
|
return {
|
|
36
36
|
logoUrl: getChainLogoUrl(assetList),
|
|
37
37
|
chain: chainToShow,
|
|
38
38
|
assetList,
|
|
39
39
|
address: account?.address,
|
|
40
|
-
wallet:
|
|
40
|
+
wallet: currentWallet,
|
|
41
41
|
...cosmosKitUserChainReturnType, //for migration cosmos kit
|
|
42
42
|
...interchainClient
|
|
43
43
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
2
|
import { useWalletManager } from "./useWalletManager";
|
|
3
3
|
import { useWalletModal } from "../modal";
|
|
4
|
-
export const
|
|
4
|
+
export const useCurrentWallet = () => {
|
|
5
5
|
const walletManager = useWalletManager();
|
|
6
6
|
const { open } = useWalletModal();
|
|
7
7
|
useEffect(() => {
|
|
8
|
-
if (!walletManager.
|
|
8
|
+
if (!walletManager.currentWalletName) {
|
|
9
9
|
open();
|
|
10
10
|
}
|
|
11
|
-
}, [walletManager.
|
|
12
|
-
return walletManager.
|
|
11
|
+
}, [walletManager.currentWalletName]);
|
|
12
|
+
return walletManager.getCurrentWallet();
|
|
13
13
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
2
|
import { useWalletManager } from './useWalletManager';
|
|
3
3
|
import { useAccount } from './useAccount';
|
|
4
|
-
import { WalletState } from '@
|
|
4
|
+
import { WalletState } from '@interchain-kit/core';
|
|
5
5
|
export const useInterchainClient = (chainName, walletName) => {
|
|
6
6
|
const [rpcEndpoint, setRpcEndpoint] = useState();
|
|
7
7
|
//query
|
package/esm/modal/modal.js
CHANGED
|
@@ -2,36 +2,39 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { ConnectModal } from "@interchain-ui/react";
|
|
3
3
|
import { ConnectedContent, ConnectedHeader, ConnectingContent, ConnectingHeader, QRCodeContent, QRCodeHeader, RejectContent, RejectHeader, WalletListContent, WalletListHeader, } from "./views";
|
|
4
4
|
import { useWalletModal } from "./provider";
|
|
5
|
-
import {
|
|
5
|
+
import { useCurrentWallet } from "../hooks";
|
|
6
6
|
import { useEffect, useState } from "react";
|
|
7
|
-
import { WalletState } from "@
|
|
7
|
+
import { WalletState } from "@interchain-kit/core";
|
|
8
8
|
const defaultModalView = {
|
|
9
9
|
header: _jsx(WalletListHeader, {}),
|
|
10
10
|
content: _jsx(WalletListContent, {}),
|
|
11
11
|
};
|
|
12
12
|
export const WalletModal = () => {
|
|
13
13
|
const { modalIsOpen, open, close } = useWalletModal();
|
|
14
|
-
const
|
|
14
|
+
const currentWallet = useCurrentWallet();
|
|
15
15
|
const [modalView, setModalView] = useState(defaultModalView);
|
|
16
16
|
const gotoWalletList = () => setModalView(defaultModalView);
|
|
17
17
|
useEffect(() => {
|
|
18
18
|
switch (true) {
|
|
19
|
-
case
|
|
20
|
-
setModalView({
|
|
19
|
+
case currentWallet?.option?.mode === "wallet-connect":
|
|
20
|
+
setModalView({
|
|
21
|
+
header: _jsx(QRCodeHeader, { onBack: gotoWalletList }),
|
|
22
|
+
content: _jsx(QRCodeContent, {}),
|
|
23
|
+
});
|
|
21
24
|
break;
|
|
22
|
-
case
|
|
25
|
+
case currentWallet?.walletState === WalletState.Connecting:
|
|
23
26
|
setModalView({
|
|
24
27
|
header: _jsx(ConnectingHeader, { onBack: gotoWalletList }),
|
|
25
28
|
content: _jsx(ConnectingContent, {}),
|
|
26
29
|
});
|
|
27
30
|
break;
|
|
28
|
-
case
|
|
31
|
+
case currentWallet?.walletState === WalletState.Connected:
|
|
29
32
|
setModalView({
|
|
30
33
|
header: _jsx(ConnectedHeader, { onBack: gotoWalletList }),
|
|
31
34
|
content: _jsx(ConnectedContent, {}),
|
|
32
35
|
});
|
|
33
36
|
break;
|
|
34
|
-
case
|
|
37
|
+
case currentWallet?.walletState === WalletState.Reject:
|
|
35
38
|
setModalView({
|
|
36
39
|
header: _jsx(RejectHeader, { onBack: gotoWalletList }),
|
|
37
40
|
content: _jsx(RejectContent, {}),
|
|
@@ -40,6 +43,6 @@ export const WalletModal = () => {
|
|
|
40
43
|
default:
|
|
41
44
|
setModalView(defaultModalView);
|
|
42
45
|
}
|
|
43
|
-
}, [
|
|
46
|
+
}, [currentWallet, currentWallet?.walletState]);
|
|
44
47
|
return (_jsx(ConnectModal, { isOpen: modalIsOpen, header: modalView.header, onOpen: open, onClose: close, children: modalView.content }));
|
|
45
48
|
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ConnectModalHead, ConnectModalStatus } from "@interchain-ui/react";
|
|
3
|
-
import { useAccount,
|
|
3
|
+
import { useAccount, useCurrentWallet, useWalletManager } from "../../hooks";
|
|
4
4
|
import { useWalletModal } from "../provider";
|
|
5
5
|
import { getWalletInfo } from "../../utils";
|
|
6
6
|
import { AstronautSvg } from "./Astronaut";
|
|
7
7
|
export const ConnectedHeader = ({ onBack }) => {
|
|
8
|
-
const
|
|
8
|
+
const currentWallet = useCurrentWallet();
|
|
9
9
|
const { close } = useWalletModal();
|
|
10
|
-
return (_jsx(ConnectModalHead, { title:
|
|
10
|
+
return (_jsx(ConnectModalHead, { title: currentWallet?.option?.prettyName || "", hasBackButton: true, onClose: close, onBack: onBack, closeButtonProps: { onClick: close } }));
|
|
11
11
|
};
|
|
12
12
|
export const ConnectedContent = () => {
|
|
13
|
-
const
|
|
13
|
+
const currentWallet = useCurrentWallet();
|
|
14
14
|
const walletManager = useWalletManager();
|
|
15
|
-
const account = useAccount(walletManager.chains[0].chainName,
|
|
15
|
+
const account = useAccount(walletManager.chains[0].chainName, currentWallet?.option?.name);
|
|
16
16
|
const { close } = useWalletModal();
|
|
17
|
-
if (!
|
|
17
|
+
if (!currentWallet) {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
-
return (_jsx(ConnectModalStatus, { wallet: getWalletInfo(
|
|
21
|
-
name: account?.username ||
|
|
20
|
+
return (_jsx(ConnectModalStatus, { wallet: getWalletInfo(currentWallet), status: "Connected", connectedInfo: {
|
|
21
|
+
name: account?.username || "Wallet",
|
|
22
22
|
avatar: (_jsx(AstronautSvg, { style: {
|
|
23
|
-
fontSize:
|
|
24
|
-
width:
|
|
25
|
-
height:
|
|
23
|
+
fontSize: "inherit",
|
|
24
|
+
width: "100%",
|
|
25
|
+
height: "100%",
|
|
26
26
|
} })),
|
|
27
27
|
address: account?.address,
|
|
28
28
|
}, onDisconnect: async () => {
|
|
29
|
-
await walletManager.disconnect(
|
|
29
|
+
await walletManager.disconnect(currentWallet?.option?.name);
|
|
30
30
|
close();
|
|
31
31
|
} }));
|
|
32
32
|
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ConnectModalHead, ConnectModalStatus } from
|
|
3
|
-
import {
|
|
4
|
-
import { useWalletModal } from
|
|
2
|
+
import { ConnectModalHead, ConnectModalStatus } from "@interchain-ui/react";
|
|
3
|
+
import { useCurrentWallet, useWalletManager } from "../../hooks";
|
|
4
|
+
import { useWalletModal } from "../provider";
|
|
5
5
|
export const ConnectingHeader = ({ onBack }) => {
|
|
6
|
-
const
|
|
6
|
+
const currentWallet = useCurrentWallet();
|
|
7
7
|
const { close } = useWalletModal();
|
|
8
8
|
const walletManager = useWalletManager();
|
|
9
|
-
if (!
|
|
9
|
+
if (!currentWallet)
|
|
10
10
|
return null;
|
|
11
|
-
return (_jsx(ConnectModalHead, { title:
|
|
11
|
+
return (_jsx(ConnectModalHead, { title: currentWallet.option.prettyName, hasBackButton: true, onClose: close, onBack: onBack, closeButtonProps: {
|
|
12
12
|
onClick: async () => {
|
|
13
|
-
await walletManager.disconnect(
|
|
13
|
+
await walletManager.disconnect(currentWallet.option.name);
|
|
14
14
|
close();
|
|
15
|
-
}
|
|
15
|
+
},
|
|
16
16
|
} }));
|
|
17
17
|
};
|
|
18
18
|
export const ConnectingContent = () => {
|
|
19
|
-
const
|
|
20
|
-
const { option: { prettyName, mode } } =
|
|
21
|
-
let title =
|
|
22
|
-
let desc = mode ===
|
|
19
|
+
const currentWallet = useCurrentWallet();
|
|
20
|
+
const { option: { prettyName, mode }, } = currentWallet;
|
|
21
|
+
let title = "Requesting Connection";
|
|
22
|
+
let desc = mode === "wallet-connect"
|
|
23
23
|
? `Approve ${prettyName} connection request on your mobile.`
|
|
24
24
|
: `Open the ${prettyName} browser extension to connect your wallet.`;
|
|
25
|
-
if (!
|
|
25
|
+
if (!currentWallet)
|
|
26
26
|
return null;
|
|
27
27
|
return (_jsx(ConnectModalStatus, { wallet: {
|
|
28
|
-
name:
|
|
29
|
-
prettyName:
|
|
30
|
-
logo:
|
|
28
|
+
name: currentWallet.option.name,
|
|
29
|
+
prettyName: currentWallet.option.prettyName,
|
|
30
|
+
logo: currentWallet.option.logo,
|
|
31
31
|
mobileDisabled: true,
|
|
32
|
-
}, status:
|
|
32
|
+
}, status: "Connecting", contentHeader: title, contentDesc: desc }));
|
|
33
33
|
};
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ConnectModalHead, ConnectModalQRCode } from "@interchain-ui/react";
|
|
3
|
-
import {
|
|
3
|
+
import { useCurrentWallet, useWalletManager } from "../../hooks";
|
|
4
4
|
import { useWalletModal } from "../provider";
|
|
5
|
-
export const QRCodeHeader = () => {
|
|
6
|
-
const
|
|
5
|
+
export const QRCodeHeader = ({ onBack }) => {
|
|
6
|
+
const currentWallet = useCurrentWallet();
|
|
7
|
+
const walletManager = useWalletManager();
|
|
7
8
|
const { close } = useWalletModal();
|
|
8
|
-
return (_jsx(ConnectModalHead, { title:
|
|
9
|
+
return (_jsx(ConnectModalHead, { title: currentWallet?.option?.prettyName || "", hasBackButton: true, onClose: () => void 0, onBack: async () => {
|
|
10
|
+
await walletManager.disconnect(currentWallet?.option?.name || "");
|
|
11
|
+
onBack();
|
|
12
|
+
}, closeButtonProps: { onClick: close } }));
|
|
9
13
|
};
|
|
10
14
|
export const QRCodeContent = () => {
|
|
11
|
-
const
|
|
15
|
+
const currentWallet = useCurrentWallet();
|
|
12
16
|
const walletManager = useWalletManager();
|
|
13
|
-
const data =
|
|
14
|
-
return (_jsx(ConnectModalQRCode, { status: data ? "Done" : "Pending", link: data, description: "Open App to connect", errorTitle: "errorTitle", errorDesc:
|
|
17
|
+
const data = currentWallet.pairingUri;
|
|
18
|
+
return (_jsx(ConnectModalQRCode, { status: data ? "Done" : "Pending", link: data, description: "Open App to connect", errorTitle: "errorTitle", errorDesc: currentWallet.errorMessage || "", onRefresh: () => walletManager.connect(currentWallet?.option?.name || "") }));
|
|
15
19
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ConnectModalHead, ConnectModalStatus } from "@interchain-ui/react";
|
|
3
3
|
import { useWalletModal } from "../provider";
|
|
4
|
-
import {
|
|
4
|
+
import { useCurrentWallet, useWalletManager } from "../../hooks";
|
|
5
5
|
import { getWalletInfo } from "../../utils";
|
|
6
6
|
export const RejectHeader = ({ onBack }) => {
|
|
7
7
|
const { close } = useWalletModal();
|
|
8
|
-
const
|
|
9
|
-
return (_jsx(ConnectModalHead, { title:
|
|
8
|
+
const currentWallet = useCurrentWallet();
|
|
9
|
+
return (_jsx(ConnectModalHead, { title: currentWallet.option.prettyName, hasBackButton: true, onClose: close, onBack: onBack, closeButtonProps: { onClick: close } }));
|
|
10
10
|
};
|
|
11
11
|
export const RejectContent = () => {
|
|
12
|
-
const
|
|
12
|
+
const currentWallet = useCurrentWallet();
|
|
13
13
|
const walletManager = useWalletManager();
|
|
14
14
|
const { close } = useWalletModal();
|
|
15
|
-
return (_jsx(ConnectModalStatus, { status: "Rejected", wallet: getWalletInfo(
|
|
15
|
+
return (_jsx(ConnectModalStatus, { status: "Rejected", wallet: getWalletInfo(currentWallet), contentHeader: "Request Rejected", contentDesc: currentWallet.errorMessage || "Connection permission is denied.", onConnect: () => walletManager.connect(currentWallet.option.name).then(close) }));
|
|
16
16
|
};
|
package/esm/provider.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { createContext, useContext } from "react";
|
|
4
|
-
import { WalletManager, } from "@
|
|
4
|
+
import { WalletManager, } from "@interchain-kit/core";
|
|
5
5
|
import { WalletModalProvider } from "./modal";
|
|
6
6
|
const InterchainWalletContext = createContext(null);
|
|
7
7
|
export const ChainProvider = ({ chains, assetLists, wallets, signerOptions, endpointOptions, children, }) => {
|
package/hooks/index.d.ts
CHANGED
package/hooks/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./useWalletManager"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./useCurrentWallet"), exports);
|
|
19
19
|
__exportStar(require("./useAccount"), exports);
|
|
20
20
|
__exportStar(require("./useChain"), exports);
|
|
21
21
|
__exportStar(require("./useConnect"), exports);
|
package/hooks/useAccount.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WalletAccount } from "@
|
|
1
|
+
import { WalletAccount } from "@interchain-kit/core";
|
|
2
2
|
export declare const useAccount: (chainName: string, walletName: string) => WalletAccount | null;
|
package/hooks/useAccount.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useAccount = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const core_1 = require("@
|
|
5
|
+
const core_1 = require("@interchain-kit/core");
|
|
6
6
|
const useWalletManager_1 = require("./useWalletManager");
|
|
7
7
|
const useAccount = (chainName, walletName) => {
|
|
8
8
|
const walletManager = (0, useWalletManager_1.useWalletManager)();
|
package/hooks/useChain.js
CHANGED
|
@@ -3,44 +3,44 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useChain = void 0;
|
|
4
4
|
const useWalletManager_1 = require("./useWalletManager");
|
|
5
5
|
const useAccount_1 = require("./useAccount");
|
|
6
|
-
const
|
|
6
|
+
const useCurrentWallet_1 = require("./useCurrentWallet");
|
|
7
7
|
const useInterchainClient_1 = require("./useInterchainClient");
|
|
8
8
|
const modal_1 = require("../modal");
|
|
9
|
-
const core_1 = require("@
|
|
9
|
+
const core_1 = require("@interchain-kit/core");
|
|
10
10
|
const utils_1 = require("../utils");
|
|
11
11
|
const useChain = (chainName) => {
|
|
12
12
|
const walletManager = (0, useWalletManager_1.useWalletManager)();
|
|
13
13
|
const chainToShow = walletManager.chains.find((c) => c.chainName === chainName);
|
|
14
14
|
const assetList = walletManager.assetLists.find((a) => a.chainName === chainName);
|
|
15
|
-
const
|
|
16
|
-
const account = (0, useAccount_1.useAccount)(chainName,
|
|
17
|
-
const interchainClient = (0, useInterchainClient_1.useInterchainClient)(chainName,
|
|
15
|
+
const currentWallet = (0, useCurrentWallet_1.useCurrentWallet)();
|
|
16
|
+
const account = (0, useAccount_1.useAccount)(chainName, currentWallet?.option?.name);
|
|
17
|
+
const interchainClient = (0, useInterchainClient_1.useInterchainClient)(chainName, currentWallet?.option?.name);
|
|
18
18
|
if (!chainToShow) {
|
|
19
19
|
throw new core_1.ChainNameNotExist(chainName);
|
|
20
20
|
}
|
|
21
21
|
const { open, close } = (0, modal_1.useWalletModal)();
|
|
22
22
|
const cosmosKitUserChainReturnType = {
|
|
23
23
|
connect: () => {
|
|
24
|
-
if (
|
|
24
|
+
if (currentWallet) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
open();
|
|
28
28
|
},
|
|
29
29
|
openView: open,
|
|
30
30
|
closeView: close,
|
|
31
|
-
getRpcEndpoint: () => walletManager.getRpcEndpoint(
|
|
32
|
-
status:
|
|
31
|
+
getRpcEndpoint: () => walletManager.getRpcEndpoint(currentWallet, chainName),
|
|
32
|
+
status: currentWallet?.walletState,
|
|
33
33
|
username: account?.username,
|
|
34
|
-
message:
|
|
35
|
-
getSigningCosmWasmClient: () => walletManager.getSigningCosmwasmClient(
|
|
36
|
-
getSigningCosmosClient: () => walletManager.getSigningCosmosClient(
|
|
34
|
+
message: currentWallet?.errorMessage,
|
|
35
|
+
getSigningCosmWasmClient: () => walletManager.getSigningCosmwasmClient(currentWallet.option.name, chainName),
|
|
36
|
+
getSigningCosmosClient: () => walletManager.getSigningCosmosClient(currentWallet.option.name, chainName),
|
|
37
37
|
};
|
|
38
38
|
return {
|
|
39
39
|
logoUrl: (0, utils_1.getChainLogoUrl)(assetList),
|
|
40
40
|
chain: chainToShow,
|
|
41
41
|
assetList,
|
|
42
42
|
address: account?.address,
|
|
43
|
-
wallet:
|
|
43
|
+
wallet: currentWallet,
|
|
44
44
|
...cosmosKitUserChainReturnType, //for migration cosmos kit
|
|
45
45
|
...interchainClient
|
|
46
46
|
};
|
package/hooks/useConfig.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AssetList, Chain } from "@chain-registry/v2-types";
|
|
2
|
-
import { EndpointOptions, SignerOptions } from "@
|
|
2
|
+
import { EndpointOptions, SignerOptions } from "@interchain-kit/core";
|
|
3
3
|
export declare const useConfig: () => {
|
|
4
4
|
updateChains: (chains: Chain[]) => Chain[];
|
|
5
5
|
updateAssetLists: (assetLists: AssetList[]) => AssetList[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useCurrentWallet: () => import("@interchain-kit/core").BaseWallet;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useCurrentWallet = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const useWalletManager_1 = require("./useWalletManager");
|
|
6
6
|
const modal_1 = require("../modal");
|
|
7
|
-
const
|
|
7
|
+
const useCurrentWallet = () => {
|
|
8
8
|
const walletManager = (0, useWalletManager_1.useWalletManager)();
|
|
9
9
|
const { open } = (0, modal_1.useWalletModal)();
|
|
10
10
|
(0, react_1.useEffect)(() => {
|
|
11
|
-
if (!walletManager.
|
|
11
|
+
if (!walletManager.currentWalletName) {
|
|
12
12
|
open();
|
|
13
13
|
}
|
|
14
|
-
}, [walletManager.
|
|
15
|
-
return walletManager.
|
|
14
|
+
}, [walletManager.currentWalletName]);
|
|
15
|
+
return walletManager.getCurrentWallet();
|
|
16
16
|
};
|
|
17
|
-
exports.
|
|
17
|
+
exports.useCurrentWallet = useCurrentWallet;
|
|
@@ -4,7 +4,7 @@ exports.useInterchainClient = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const useWalletManager_1 = require("./useWalletManager");
|
|
6
6
|
const useAccount_1 = require("./useAccount");
|
|
7
|
-
const core_1 = require("@
|
|
7
|
+
const core_1 = require("@interchain-kit/core");
|
|
8
8
|
const useInterchainClient = (chainName, walletName) => {
|
|
9
9
|
const [rpcEndpoint, setRpcEndpoint] = (0, react_1.useState)();
|
|
10
10
|
//query
|
package/modal/modal.js
CHANGED
|
@@ -7,34 +7,37 @@ const views_1 = require("./views");
|
|
|
7
7
|
const provider_1 = require("./provider");
|
|
8
8
|
const hooks_1 = require("../hooks");
|
|
9
9
|
const react_2 = require("react");
|
|
10
|
-
const core_1 = require("@
|
|
10
|
+
const core_1 = require("@interchain-kit/core");
|
|
11
11
|
const defaultModalView = {
|
|
12
12
|
header: (0, jsx_runtime_1.jsx)(views_1.WalletListHeader, {}),
|
|
13
13
|
content: (0, jsx_runtime_1.jsx)(views_1.WalletListContent, {}),
|
|
14
14
|
};
|
|
15
15
|
const WalletModal = () => {
|
|
16
16
|
const { modalIsOpen, open, close } = (0, provider_1.useWalletModal)();
|
|
17
|
-
const
|
|
17
|
+
const currentWallet = (0, hooks_1.useCurrentWallet)();
|
|
18
18
|
const [modalView, setModalView] = (0, react_2.useState)(defaultModalView);
|
|
19
19
|
const gotoWalletList = () => setModalView(defaultModalView);
|
|
20
20
|
(0, react_2.useEffect)(() => {
|
|
21
21
|
switch (true) {
|
|
22
|
-
case
|
|
23
|
-
setModalView({
|
|
22
|
+
case currentWallet?.option?.mode === "wallet-connect":
|
|
23
|
+
setModalView({
|
|
24
|
+
header: (0, jsx_runtime_1.jsx)(views_1.QRCodeHeader, { onBack: gotoWalletList }),
|
|
25
|
+
content: (0, jsx_runtime_1.jsx)(views_1.QRCodeContent, {}),
|
|
26
|
+
});
|
|
24
27
|
break;
|
|
25
|
-
case
|
|
28
|
+
case currentWallet?.walletState === core_1.WalletState.Connecting:
|
|
26
29
|
setModalView({
|
|
27
30
|
header: (0, jsx_runtime_1.jsx)(views_1.ConnectingHeader, { onBack: gotoWalletList }),
|
|
28
31
|
content: (0, jsx_runtime_1.jsx)(views_1.ConnectingContent, {}),
|
|
29
32
|
});
|
|
30
33
|
break;
|
|
31
|
-
case
|
|
34
|
+
case currentWallet?.walletState === core_1.WalletState.Connected:
|
|
32
35
|
setModalView({
|
|
33
36
|
header: (0, jsx_runtime_1.jsx)(views_1.ConnectedHeader, { onBack: gotoWalletList }),
|
|
34
37
|
content: (0, jsx_runtime_1.jsx)(views_1.ConnectedContent, {}),
|
|
35
38
|
});
|
|
36
39
|
break;
|
|
37
|
-
case
|
|
40
|
+
case currentWallet?.walletState === core_1.WalletState.Reject:
|
|
38
41
|
setModalView({
|
|
39
42
|
header: (0, jsx_runtime_1.jsx)(views_1.RejectHeader, { onBack: gotoWalletList }),
|
|
40
43
|
content: (0, jsx_runtime_1.jsx)(views_1.RejectContent, {}),
|
|
@@ -43,7 +46,7 @@ const WalletModal = () => {
|
|
|
43
46
|
default:
|
|
44
47
|
setModalView(defaultModalView);
|
|
45
48
|
}
|
|
46
|
-
}, [
|
|
49
|
+
}, [currentWallet, currentWallet?.walletState]);
|
|
47
50
|
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModal, { isOpen: modalIsOpen, header: modalView.header, onOpen: open, onClose: close, children: modalView.content }));
|
|
48
51
|
};
|
|
49
52
|
exports.WalletModal = WalletModal;
|
package/modal/views/Connected.js
CHANGED
|
@@ -8,29 +8,29 @@ const provider_1 = require("../provider");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const Astronaut_1 = require("./Astronaut");
|
|
10
10
|
const ConnectedHeader = ({ onBack }) => {
|
|
11
|
-
const
|
|
11
|
+
const currentWallet = (0, hooks_1.useCurrentWallet)();
|
|
12
12
|
const { close } = (0, provider_1.useWalletModal)();
|
|
13
|
-
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalHead, { title:
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalHead, { title: currentWallet?.option?.prettyName || "", hasBackButton: true, onClose: close, onBack: onBack, closeButtonProps: { onClick: close } }));
|
|
14
14
|
};
|
|
15
15
|
exports.ConnectedHeader = ConnectedHeader;
|
|
16
16
|
const ConnectedContent = () => {
|
|
17
|
-
const
|
|
17
|
+
const currentWallet = (0, hooks_1.useCurrentWallet)();
|
|
18
18
|
const walletManager = (0, hooks_1.useWalletManager)();
|
|
19
|
-
const account = (0, hooks_1.useAccount)(walletManager.chains[0].chainName,
|
|
19
|
+
const account = (0, hooks_1.useAccount)(walletManager.chains[0].chainName, currentWallet?.option?.name);
|
|
20
20
|
const { close } = (0, provider_1.useWalletModal)();
|
|
21
|
-
if (!
|
|
21
|
+
if (!currentWallet) {
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalStatus, { wallet: (0, utils_1.getWalletInfo)(
|
|
25
|
-
name: account?.username ||
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalStatus, { wallet: (0, utils_1.getWalletInfo)(currentWallet), status: "Connected", connectedInfo: {
|
|
25
|
+
name: account?.username || "Wallet",
|
|
26
26
|
avatar: ((0, jsx_runtime_1.jsx)(Astronaut_1.AstronautSvg, { style: {
|
|
27
|
-
fontSize:
|
|
28
|
-
width:
|
|
29
|
-
height:
|
|
27
|
+
fontSize: "inherit",
|
|
28
|
+
width: "100%",
|
|
29
|
+
height: "100%",
|
|
30
30
|
} })),
|
|
31
31
|
address: account?.address,
|
|
32
32
|
}, onDisconnect: async () => {
|
|
33
|
-
await walletManager.disconnect(
|
|
33
|
+
await walletManager.disconnect(currentWallet?.option?.name);
|
|
34
34
|
close();
|
|
35
35
|
} }));
|
|
36
36
|
};
|
|
@@ -6,33 +6,33 @@ const react_1 = require("@interchain-ui/react");
|
|
|
6
6
|
const hooks_1 = require("../../hooks");
|
|
7
7
|
const provider_1 = require("../provider");
|
|
8
8
|
const ConnectingHeader = ({ onBack }) => {
|
|
9
|
-
const
|
|
9
|
+
const currentWallet = (0, hooks_1.useCurrentWallet)();
|
|
10
10
|
const { close } = (0, provider_1.useWalletModal)();
|
|
11
11
|
const walletManager = (0, hooks_1.useWalletManager)();
|
|
12
|
-
if (!
|
|
12
|
+
if (!currentWallet)
|
|
13
13
|
return null;
|
|
14
|
-
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalHead, { title:
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalHead, { title: currentWallet.option.prettyName, hasBackButton: true, onClose: close, onBack: onBack, closeButtonProps: {
|
|
15
15
|
onClick: async () => {
|
|
16
|
-
await walletManager.disconnect(
|
|
16
|
+
await walletManager.disconnect(currentWallet.option.name);
|
|
17
17
|
close();
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
19
|
} }));
|
|
20
20
|
};
|
|
21
21
|
exports.ConnectingHeader = ConnectingHeader;
|
|
22
22
|
const ConnectingContent = () => {
|
|
23
|
-
const
|
|
24
|
-
const { option: { prettyName, mode } } =
|
|
25
|
-
let title =
|
|
26
|
-
let desc = mode ===
|
|
23
|
+
const currentWallet = (0, hooks_1.useCurrentWallet)();
|
|
24
|
+
const { option: { prettyName, mode }, } = currentWallet;
|
|
25
|
+
let title = "Requesting Connection";
|
|
26
|
+
let desc = mode === "wallet-connect"
|
|
27
27
|
? `Approve ${prettyName} connection request on your mobile.`
|
|
28
28
|
: `Open the ${prettyName} browser extension to connect your wallet.`;
|
|
29
|
-
if (!
|
|
29
|
+
if (!currentWallet)
|
|
30
30
|
return null;
|
|
31
31
|
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalStatus, { wallet: {
|
|
32
|
-
name:
|
|
33
|
-
prettyName:
|
|
34
|
-
logo:
|
|
32
|
+
name: currentWallet.option.name,
|
|
33
|
+
prettyName: currentWallet.option.prettyName,
|
|
34
|
+
logo: currentWallet.option.logo,
|
|
35
35
|
mobileDisabled: true,
|
|
36
|
-
}, status:
|
|
36
|
+
}, status: "Connecting", contentHeader: title, contentDesc: desc }));
|
|
37
37
|
};
|
|
38
38
|
exports.ConnectingContent = ConnectingContent;
|
package/modal/views/QRCode.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export declare const QRCodeHeader: (
|
|
1
|
+
export declare const QRCodeHeader: ({ onBack }: {
|
|
2
|
+
onBack: () => void;
|
|
3
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
2
4
|
export declare const QRCodeContent: () => import("react/jsx-runtime").JSX.Element;
|
package/modal/views/QRCode.js
CHANGED
|
@@ -5,16 +5,20 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("@interchain-ui/react");
|
|
6
6
|
const hooks_1 = require("../../hooks");
|
|
7
7
|
const provider_1 = require("../provider");
|
|
8
|
-
const QRCodeHeader = () => {
|
|
9
|
-
const
|
|
8
|
+
const QRCodeHeader = ({ onBack }) => {
|
|
9
|
+
const currentWallet = (0, hooks_1.useCurrentWallet)();
|
|
10
|
+
const walletManager = (0, hooks_1.useWalletManager)();
|
|
10
11
|
const { close } = (0, provider_1.useWalletModal)();
|
|
11
|
-
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalHead, { title:
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalHead, { title: currentWallet?.option?.prettyName || "", hasBackButton: true, onClose: () => void 0, onBack: async () => {
|
|
13
|
+
await walletManager.disconnect(currentWallet?.option?.name || "");
|
|
14
|
+
onBack();
|
|
15
|
+
}, closeButtonProps: { onClick: close } }));
|
|
12
16
|
};
|
|
13
17
|
exports.QRCodeHeader = QRCodeHeader;
|
|
14
18
|
const QRCodeContent = () => {
|
|
15
|
-
const
|
|
19
|
+
const currentWallet = (0, hooks_1.useCurrentWallet)();
|
|
16
20
|
const walletManager = (0, hooks_1.useWalletManager)();
|
|
17
|
-
const data =
|
|
18
|
-
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalQRCode, { status: data ? "Done" : "Pending", link: data, description: "Open App to connect", errorTitle: "errorTitle", errorDesc:
|
|
21
|
+
const data = currentWallet.pairingUri;
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalQRCode, { status: data ? "Done" : "Pending", link: data, description: "Open App to connect", errorTitle: "errorTitle", errorDesc: currentWallet.errorMessage || "", onRefresh: () => walletManager.connect(currentWallet?.option?.name || "") }));
|
|
19
23
|
};
|
|
20
24
|
exports.QRCodeContent = QRCodeContent;
|
package/modal/views/Reject.js
CHANGED
|
@@ -8,14 +8,14 @@ const hooks_1 = require("../../hooks");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const RejectHeader = ({ onBack }) => {
|
|
10
10
|
const { close } = (0, provider_1.useWalletModal)();
|
|
11
|
-
const
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalHead, { title:
|
|
11
|
+
const currentWallet = (0, hooks_1.useCurrentWallet)();
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalHead, { title: currentWallet.option.prettyName, hasBackButton: true, onClose: close, onBack: onBack, closeButtonProps: { onClick: close } }));
|
|
13
13
|
};
|
|
14
14
|
exports.RejectHeader = RejectHeader;
|
|
15
15
|
const RejectContent = () => {
|
|
16
|
-
const
|
|
16
|
+
const currentWallet = (0, hooks_1.useCurrentWallet)();
|
|
17
17
|
const walletManager = (0, hooks_1.useWalletManager)();
|
|
18
18
|
const { close } = (0, provider_1.useWalletModal)();
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalStatus, { status: "Rejected", wallet: (0, utils_1.getWalletInfo)(
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(react_1.ConnectModalStatus, { status: "Rejected", wallet: (0, utils_1.getWalletInfo)(currentWallet), contentHeader: "Request Rejected", contentDesc: currentWallet.errorMessage || "Connection permission is denied.", onConnect: () => walletManager.connect(currentWallet.option.name).then(close) }));
|
|
20
20
|
};
|
|
21
21
|
exports.RejectContent = RejectContent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interchain-kit/react",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.24",
|
|
4
4
|
"author": "cosmology-tech <developers@cosmology.zone>",
|
|
5
5
|
"description": "interchain-kit wallet connector react package",
|
|
6
6
|
"main": "index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"keywords": [],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@chain-registry/v2-types": "^0.49.6",
|
|
35
|
-
"@interchain-kit/core": "0.0.1-beta.
|
|
35
|
+
"@interchain-kit/core": "0.0.1-beta.24",
|
|
36
36
|
"@interchain-ui/react": "1.24.0",
|
|
37
37
|
"@interchainjs/cosmos-types": "0.0.1-beta.9",
|
|
38
38
|
"@interchainjs/injective": "0.0.1-beta.13",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"react": "^18.3.1",
|
|
43
43
|
"react-dom": "^18.3.1"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "0c66e771b9fb5e32d4f13f0e62ce65542ecbaeff"
|
|
46
46
|
}
|
package/provider.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { BaseWallet, SignerOptions, WalletManager, EndpointOptions } from "@
|
|
2
|
+
import { BaseWallet, SignerOptions, WalletManager, EndpointOptions } from "@interchain-kit/core";
|
|
3
3
|
import { AssetList, Chain } from "@chain-registry/v2-types";
|
|
4
4
|
type InterchainWalletContextType = {
|
|
5
5
|
walletManager: WalletManager;
|
package/provider.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.useInterchainWalletContext = exports.ChainProvider = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const react_2 = require("react");
|
|
7
|
-
const core_1 = require("@
|
|
7
|
+
const core_1 = require("@interchain-kit/core");
|
|
8
8
|
const modal_1 = require("./modal");
|
|
9
9
|
const InterchainWalletContext = (0, react_2.createContext)(null);
|
|
10
10
|
const ChainProvider = ({ chains, assetLists, wallets, signerOptions, endpointOptions, children, }) => {
|
package/types/wallet.d.ts
CHANGED
package/utils/wallet.d.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useActiveWallet: () => import("@interChain-kit/core").BaseWallet;
|