@interchain-kit/react 0.0.1-beta.15 → 0.0.1-beta.16
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/useAccount.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
|
+
import { WalletState } from "@interChain-kit/core";
|
|
2
3
|
import { useWalletManager } from './useWalletManager';
|
|
3
4
|
export const useAccount = (chainName, walletName) => {
|
|
4
5
|
const walletManager = useWalletManager();
|
|
@@ -7,11 +8,11 @@ export const useAccount = (chainName, walletName) => {
|
|
|
7
8
|
const chain = walletManager.chains.find(c => c.chainName === chainName);
|
|
8
9
|
const getAccount = async () => {
|
|
9
10
|
if (wallet && chain) {
|
|
10
|
-
if (wallet.walletState ===
|
|
11
|
+
if (wallet.walletState === WalletState.Connected) {
|
|
11
12
|
const account = await wallet.getAccount(chain.chainId);
|
|
12
13
|
setAccount(account);
|
|
13
14
|
}
|
|
14
|
-
if (wallet.walletState ===
|
|
15
|
+
if (wallet.walletState === WalletState.Disconnected) {
|
|
15
16
|
setAccount(null);
|
|
16
17
|
}
|
|
17
18
|
}
|
|
@@ -1,6 +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 '@interChain-kit/core';
|
|
4
5
|
export const useInterchainClient = (chainName, walletName) => {
|
|
5
6
|
const [rpcEndpoint, setRpcEndpoint] = useState();
|
|
6
7
|
//query
|
|
@@ -17,7 +18,7 @@ export const useInterchainClient = (chainName, walletName) => {
|
|
|
17
18
|
const wallet = walletManager.wallets.find((w) => w.option.name === walletName);
|
|
18
19
|
const chainToShow = walletManager.chains.find((c) => c.chainName === chainName);
|
|
19
20
|
const initialize = async () => {
|
|
20
|
-
if (wallet && chainToShow && wallet?.walletState ===
|
|
21
|
+
if (wallet && chainToShow && wallet?.walletState === WalletState.Connected) {
|
|
21
22
|
try {
|
|
22
23
|
setIsLoading(true);
|
|
23
24
|
const rpcEndpoint = await walletManager.getRpcEndpoint(wallet, chainName);
|
package/esm/modal/modal.js
CHANGED
|
@@ -4,7 +4,7 @@ import { ConnectedContent, ConnectedHeader, ConnectingContent, ConnectingHeader,
|
|
|
4
4
|
import { useWalletModal } from "./provider";
|
|
5
5
|
import { useActiveWallet } from "../hooks";
|
|
6
6
|
import { useEffect, useState } from "react";
|
|
7
|
-
import { WCWallet } from "@interChain-kit/core";
|
|
7
|
+
import { WalletState, WCWallet } from "@interChain-kit/core";
|
|
8
8
|
const defaultModalView = {
|
|
9
9
|
header: _jsx(WalletListHeader, {}), content: _jsx(WalletListContent, {})
|
|
10
10
|
};
|
|
@@ -18,13 +18,13 @@ export const WalletModal = () => {
|
|
|
18
18
|
case activeWallet instanceof WCWallet && !activeWallet.session:
|
|
19
19
|
setModalView({ header: _jsx(QRCodeHeader, {}), content: _jsx(QRCodeContent, {}) });
|
|
20
20
|
break;
|
|
21
|
-
case activeWallet?.walletState ===
|
|
21
|
+
case activeWallet?.walletState === WalletState.Connecting:
|
|
22
22
|
setModalView({ header: _jsx(ConnectingHeader, { onBack: gotoWalletList }), content: _jsx(ConnectingContent, {}) });
|
|
23
23
|
break;
|
|
24
|
-
case activeWallet?.walletState ===
|
|
24
|
+
case activeWallet?.walletState === WalletState.Connected:
|
|
25
25
|
setModalView({ header: _jsx(ConnectedHeader, { onBack: gotoWalletList }), content: _jsx(ConnectedContent, {}) });
|
|
26
26
|
break;
|
|
27
|
-
case activeWallet?.walletState ===
|
|
27
|
+
case activeWallet?.walletState === WalletState.Reject:
|
|
28
28
|
setModalView({ header: _jsx(RejectHeader, { onBack: gotoWalletList }), content: _jsx(RejectContent, {}) });
|
|
29
29
|
break;
|
|
30
30
|
default:
|
package/hooks/useAccount.js
CHANGED
|
@@ -2,6 +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("@interChain-kit/core");
|
|
5
6
|
const useWalletManager_1 = require("./useWalletManager");
|
|
6
7
|
const useAccount = (chainName, walletName) => {
|
|
7
8
|
const walletManager = (0, useWalletManager_1.useWalletManager)();
|
|
@@ -10,11 +11,11 @@ const useAccount = (chainName, walletName) => {
|
|
|
10
11
|
const chain = walletManager.chains.find(c => c.chainName === chainName);
|
|
11
12
|
const getAccount = async () => {
|
|
12
13
|
if (wallet && chain) {
|
|
13
|
-
if (wallet.walletState ===
|
|
14
|
+
if (wallet.walletState === core_1.WalletState.Connected) {
|
|
14
15
|
const account = await wallet.getAccount(chain.chainId);
|
|
15
16
|
setAccount(account);
|
|
16
17
|
}
|
|
17
|
-
if (wallet.walletState ===
|
|
18
|
+
if (wallet.walletState === core_1.WalletState.Disconnected) {
|
|
18
19
|
setAccount(null);
|
|
19
20
|
}
|
|
20
21
|
}
|
|
@@ -4,6 +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("@interChain-kit/core");
|
|
7
8
|
const useInterchainClient = (chainName, walletName) => {
|
|
8
9
|
const [rpcEndpoint, setRpcEndpoint] = (0, react_1.useState)();
|
|
9
10
|
//query
|
|
@@ -20,7 +21,7 @@ const useInterchainClient = (chainName, walletName) => {
|
|
|
20
21
|
const wallet = walletManager.wallets.find((w) => w.option.name === walletName);
|
|
21
22
|
const chainToShow = walletManager.chains.find((c) => c.chainName === chainName);
|
|
22
23
|
const initialize = async () => {
|
|
23
|
-
if (wallet && chainToShow && wallet?.walletState ===
|
|
24
|
+
if (wallet && chainToShow && wallet?.walletState === core_1.WalletState.Connected) {
|
|
24
25
|
try {
|
|
25
26
|
setIsLoading(true);
|
|
26
27
|
const rpcEndpoint = await walletManager.getRpcEndpoint(wallet, chainName);
|
package/modal/modal.js
CHANGED
|
@@ -21,13 +21,13 @@ const WalletModal = () => {
|
|
|
21
21
|
case activeWallet instanceof core_1.WCWallet && !activeWallet.session:
|
|
22
22
|
setModalView({ header: (0, jsx_runtime_1.jsx)(views_1.QRCodeHeader, {}), content: (0, jsx_runtime_1.jsx)(views_1.QRCodeContent, {}) });
|
|
23
23
|
break;
|
|
24
|
-
case activeWallet?.walletState ===
|
|
24
|
+
case activeWallet?.walletState === core_1.WalletState.Connecting:
|
|
25
25
|
setModalView({ header: (0, jsx_runtime_1.jsx)(views_1.ConnectingHeader, { onBack: gotoWalletList }), content: (0, jsx_runtime_1.jsx)(views_1.ConnectingContent, {}) });
|
|
26
26
|
break;
|
|
27
|
-
case activeWallet?.walletState ===
|
|
27
|
+
case activeWallet?.walletState === core_1.WalletState.Connected:
|
|
28
28
|
setModalView({ header: (0, jsx_runtime_1.jsx)(views_1.ConnectedHeader, { onBack: gotoWalletList }), content: (0, jsx_runtime_1.jsx)(views_1.ConnectedContent, {}) });
|
|
29
29
|
break;
|
|
30
|
-
case activeWallet?.walletState ===
|
|
30
|
+
case activeWallet?.walletState === core_1.WalletState.Reject:
|
|
31
31
|
setModalView({ header: (0, jsx_runtime_1.jsx)(views_1.RejectHeader, { onBack: gotoWalletList }), content: (0, jsx_runtime_1.jsx)(views_1.RejectContent, {}) });
|
|
32
32
|
break;
|
|
33
33
|
default:
|
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.16",
|
|
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.16",
|
|
36
36
|
"@interchain-ui/react": "^1.23.31",
|
|
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": "5e02fba12543ed2cc2bc7ce714225021f888d9a2"
|
|
46
46
|
}
|