@interchain-kit/react 0.0.1-beta.21 → 0.0.1-beta.23

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.
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useState } from "react";
2
- import { WalletState } from "@interChain-kit/core";
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();
@@ -3,7 +3,8 @@ import { useAccount } from "./useAccount";
3
3
  import { useActiveWallet } from './useActiveWallet';
4
4
  import { useInterchainClient } from './useInterchainClient';
5
5
  import { useWalletModal } from "../modal";
6
- import { ChainNameNotExist } from "@interChain-kit/core";
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,
@@ -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 '@interChain-kit/core';
4
+ import { WalletState } from '@interchain-kit/core';
5
5
  export const useInterchainClient = (chainName, walletName) => {
6
6
  const [rpcEndpoint, setRpcEndpoint] = useState();
7
7
  //query
@@ -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 { WalletState } from "@interChain-kit/core";
7
+ import { WalletState } from "@interchain-kit/core";
8
8
  const defaultModalView = {
9
9
  header: _jsx(WalletListHeader, {}),
10
10
  content: _jsx(WalletListContent, {}),
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 "@interChain-kit/core";
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, }) => {
@@ -0,0 +1,3 @@
1
+ export const getChainLogoUrl = (assetList) => {
2
+ return assetList.assets?.[0].logoURIs.png || assetList.assets?.[0].logoURIs.svg || undefined;
3
+ };
@@ -1,8 +1,2 @@
1
- export const getWalletInfo = (wallet) => {
2
- return {
3
- name: wallet.option.name,
4
- prettyName: wallet.option.prettyName,
5
- logo: wallet.option.logo,
6
- mobileDisabled: true,
7
- };
8
- };
1
+ export * from './wallet';
2
+ export * from './chain';
@@ -1 +1,8 @@
1
- export * from './wallet';
1
+ export const getWalletInfo = (wallet) => {
2
+ return {
3
+ name: wallet.option.name,
4
+ prettyName: wallet.option.prettyName,
5
+ logo: wallet.option.logo,
6
+ mobileDisabled: true,
7
+ };
8
+ };
@@ -1,2 +1,2 @@
1
- import { WalletAccount } from "@interChain-kit/core";
1
+ import { WalletAccount } from "@interchain-kit/core";
2
2
  export declare const useAccount: (chainName: string, walletName: string) => WalletAccount | null;
@@ -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("@interChain-kit/core");
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)();
@@ -1 +1 @@
1
- export declare const useActiveWallet: () => import("@interChain-kit/core").BaseWallet;
1
+ export declare const useActiveWallet: () => import("@interchain-kit/core").BaseWallet;
package/hooks/useChain.js CHANGED
@@ -6,7 +6,8 @@ const useAccount_1 = require("./useAccount");
6
6
  const useActiveWallet_1 = require("./useActiveWallet");
7
7
  const useInterchainClient_1 = require("./useInterchainClient");
8
8
  const modal_1 = require("../modal");
9
- const core_1 = require("@interChain-kit/core");
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,
@@ -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,
@@ -1,5 +1,5 @@
1
1
  import { AssetList, Chain } from "@chain-registry/v2-types";
2
- import { EndpointOptions, SignerOptions } from "@interChain-kit/core";
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[];
@@ -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("@interChain-kit/core");
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,7 +7,7 @@ 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("@interChain-kit/core");
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, {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interchain-kit/react",
3
- "version": "0.0.1-beta.21",
3
+ "version": "0.0.1-beta.23",
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.21",
35
+ "@interchain-kit/core": "0.0.1-beta.23",
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": "22afa31597fcf85bd39d424294eb4a6eb9b63811"
45
+ "gitHead": "b683ebf8ba399f308a4a46ffe1e8c1a1eebc5947"
46
46
  }
package/provider.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { BaseWallet, SignerOptions, WalletManager, EndpointOptions } from "@interChain-kit/core";
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("@interChain-kit/core");
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/chain.d.ts CHANGED
@@ -17,6 +17,7 @@ export type CosmosKitUseChainReturnType = {
17
17
  getSigningCosmosClient: () => Promise<CosmosSigningClient>;
18
18
  };
19
19
  export type UseChainReturnType = {
20
+ logoUrl: string | undefined;
20
21
  chain: Chain;
21
22
  assetList: AssetList;
22
23
  address: string;
package/types/wallet.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BaseWallet } from "@interChain-kit/core";
1
+ import { BaseWallet } from "@interchain-kit/core";
2
2
  import { ConnectState } from "../enum";
3
3
  export type UseWalletReturnType = {
4
4
  wallet: BaseWallet;
@@ -0,0 +1,2 @@
1
+ import { AssetList } from "@chain-registry/v2-types";
2
+ export declare const getChainLogoUrl: (assetList: AssetList) => string | undefined;
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
@@ -1,7 +1,2 @@
1
- import { BaseWallet } from "@interChain-kit/core";
2
- export declare const getWalletInfo: (wallet: BaseWallet) => {
3
- name: string;
4
- prettyName: string;
5
- logo: string;
6
- mobileDisabled: boolean;
7
- };
1
+ export * from './wallet';
2
+ export * from './chain';
package/utils/index.js CHANGED
@@ -1,12 +1,18 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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
- };
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.getWalletInfo = getWalletInfo;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./wallet"), exports);
18
+ __exportStar(require("./chain"), exports);
package/utils/wallet.d.ts CHANGED
@@ -1 +1,7 @@
1
- export * from './wallet';
1
+ import { BaseWallet } from "@interchain-kit/core";
2
+ export declare const getWalletInfo: (wallet: BaseWallet) => {
3
+ name: string;
4
+ prettyName: string;
5
+ logo: string;
6
+ mobileDisabled: boolean;
7
+ };
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
- __exportStar(require("./wallet"), exports);
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;