@interchain-kit/react 0.0.1-beta.21 → 0.0.1-beta.22
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/useChain.js +2 -0
- package/esm/hooks/useChainWallet.js +2 -0
- package/esm/utils/chain.js +3 -0
- package/esm/utils/index.js +2 -8
- package/esm/utils/wallet.js +8 -1
- package/hooks/useChain.js +2 -0
- package/hooks/useChainWallet.js +2 -0
- package/package.json +3 -3
- package/types/chain.d.ts +1 -0
- package/utils/chain.d.ts +2 -0
- package/utils/chain.js +7 -0
- package/utils/index.d.ts +2 -7
- package/utils/index.js +16 -10
- package/utils/wallet.d.ts +7 -1
- package/utils/wallet.js +10 -15
package/esm/hooks/useChain.js
CHANGED
|
@@ -4,6 +4,7 @@ import { useActiveWallet } from './useActiveWallet';
|
|
|
4
4
|
import { useInterchainClient } from './useInterchainClient';
|
|
5
5
|
import { useWalletModal } from "../modal";
|
|
6
6
|
import { ChainNameNotExist } from "@interChain-kit/core";
|
|
7
|
+
import { getChainLogoUrl } from "../utils";
|
|
7
8
|
export const useChain = (chainName) => {
|
|
8
9
|
const walletManager = useWalletManager();
|
|
9
10
|
const chainToShow = walletManager.chains.find((c) => c.chainName === chainName);
|
|
@@ -32,6 +33,7 @@ export const useChain = (chainName) => {
|
|
|
32
33
|
getSigningCosmosClient: () => walletManager.getSigningCosmosClient(activeWallet.option.name, chainName),
|
|
33
34
|
};
|
|
34
35
|
return {
|
|
36
|
+
logoUrl: getChainLogoUrl(assetList),
|
|
35
37
|
chain: chainToShow,
|
|
36
38
|
assetList,
|
|
37
39
|
address: account?.address,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useWalletManager } from "./useWalletManager";
|
|
2
2
|
import { useAccount } from "./useAccount";
|
|
3
3
|
import { useInterchainClient } from "./useInterchainClient";
|
|
4
|
+
import { getChainLogoUrl } from "../utils";
|
|
4
5
|
export const useChainWallet = (chainName, walletName) => {
|
|
5
6
|
const walletManager = useWalletManager();
|
|
6
7
|
const chainToShow = walletManager.chains.find((c) => c.chainName === chainName);
|
|
@@ -9,6 +10,7 @@ export const useChainWallet = (chainName, walletName) => {
|
|
|
9
10
|
const account = useAccount(chainName, walletName);
|
|
10
11
|
const interchainClient = useInterchainClient(chainName, walletName);
|
|
11
12
|
return {
|
|
13
|
+
logoUrl: getChainLogoUrl(assetList),
|
|
12
14
|
chain: chainToShow,
|
|
13
15
|
assetList,
|
|
14
16
|
address: account?.address,
|
package/esm/utils/index.js
CHANGED
package/esm/utils/wallet.js
CHANGED
package/hooks/useChain.js
CHANGED
|
@@ -7,6 +7,7 @@ const useActiveWallet_1 = require("./useActiveWallet");
|
|
|
7
7
|
const useInterchainClient_1 = require("./useInterchainClient");
|
|
8
8
|
const modal_1 = require("../modal");
|
|
9
9
|
const core_1 = require("@interChain-kit/core");
|
|
10
|
+
const utils_1 = require("../utils");
|
|
10
11
|
const useChain = (chainName) => {
|
|
11
12
|
const walletManager = (0, useWalletManager_1.useWalletManager)();
|
|
12
13
|
const chainToShow = walletManager.chains.find((c) => c.chainName === chainName);
|
|
@@ -35,6 +36,7 @@ const useChain = (chainName) => {
|
|
|
35
36
|
getSigningCosmosClient: () => walletManager.getSigningCosmosClient(activeWallet.option.name, chainName),
|
|
36
37
|
};
|
|
37
38
|
return {
|
|
39
|
+
logoUrl: (0, utils_1.getChainLogoUrl)(assetList),
|
|
38
40
|
chain: chainToShow,
|
|
39
41
|
assetList,
|
|
40
42
|
address: account?.address,
|
package/hooks/useChainWallet.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.useChainWallet = void 0;
|
|
|
4
4
|
const useWalletManager_1 = require("./useWalletManager");
|
|
5
5
|
const useAccount_1 = require("./useAccount");
|
|
6
6
|
const useInterchainClient_1 = require("./useInterchainClient");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
7
8
|
const useChainWallet = (chainName, walletName) => {
|
|
8
9
|
const walletManager = (0, useWalletManager_1.useWalletManager)();
|
|
9
10
|
const chainToShow = walletManager.chains.find((c) => c.chainName === chainName);
|
|
@@ -12,6 +13,7 @@ const useChainWallet = (chainName, walletName) => {
|
|
|
12
13
|
const account = (0, useAccount_1.useAccount)(chainName, walletName);
|
|
13
14
|
const interchainClient = (0, useInterchainClient_1.useInterchainClient)(chainName, walletName);
|
|
14
15
|
return {
|
|
16
|
+
logoUrl: (0, utils_1.getChainLogoUrl)(assetList),
|
|
15
17
|
chain: chainToShow,
|
|
16
18
|
assetList,
|
|
17
19
|
address: account?.address,
|
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.22",
|
|
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.22",
|
|
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": "4f812e296043ff768200bc125b31b31570257616"
|
|
46
46
|
}
|
package/types/chain.d.ts
CHANGED
package/utils/chain.d.ts
ADDED
package/utils/chain.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getChainLogoUrl = void 0;
|
|
4
|
+
const getChainLogoUrl = (assetList) => {
|
|
5
|
+
return assetList.assets?.[0].logoURIs.png || assetList.assets?.[0].logoURIs.svg || undefined;
|
|
6
|
+
};
|
|
7
|
+
exports.getChainLogoUrl = getChainLogoUrl;
|
package/utils/index.d.ts
CHANGED
package/utils/index.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
15
|
};
|
|
12
|
-
exports
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./wallet"), exports);
|
|
18
|
+
__exportStar(require("./chain"), exports);
|
package/utils/wallet.d.ts
CHANGED
package/utils/wallet.js
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
3
|
+
exports.getWalletInfo = void 0;
|
|
4
|
+
const getWalletInfo = (wallet) => {
|
|
5
|
+
return {
|
|
6
|
+
name: wallet.option.name,
|
|
7
|
+
prettyName: wallet.option.prettyName,
|
|
8
|
+
logo: wallet.option.logo,
|
|
9
|
+
mobileDisabled: true,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.getWalletInfo = getWalletInfo;
|