@bze/bze-ui-kit 0.5.0 → 0.6.1

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 CHANGED
@@ -14,7 +14,7 @@ The consuming app must have these installed (they are **not** bundled):
14
14
 
15
15
  ```sh
16
16
  npm install @bze/bzejs @chakra-ui/react @cosmjs/stargate bignumber.js chain-registry \
17
- @chain-registry/types @chain-registry/utils @chain-registry/v2 \
17
+ @chain-registry/types @chain-registry/utils \
18
18
  @interchain-kit/core @interchain-kit/react @interchainjs/encoding \
19
19
  interchainjs next-themes react react-dom react-icons
20
20
  ```
package/dist/index.d.mts CHANGED
@@ -6,7 +6,6 @@ import * as _bze_bzejs_cosmos_staking_v1beta1_staking from '@bze/bzejs/cosmos/st
6
6
  import { PoolSDKType, DelegationResponseSDKType, UnbondingDelegationSDKType, ValidatorSDKType, BondStatus } from '@bze/bzejs/cosmos/staking/v1beta1/staking';
7
7
  import * as _chain_registry_types from '@chain-registry/types';
8
8
  import { Chain } from '@chain-registry/types';
9
- import * as _chain_registry_v2_types from '@chain-registry/v2-types';
10
9
  import { IconType } from 'react-icons';
11
10
  import * as _bze_bzejs_cosmos_upgrade_v1beta1_query_lcd from '@bze/bzejs/cosmos/upgrade/v1beta1/query.lcd';
12
11
  import * as _bze_bzejs_cosmos_tx_v1beta1_service_lcd from '@bze/bzejs/cosmos/tx/v1beta1/service.lcd';
@@ -435,11 +434,11 @@ declare const getUSDCDenom: () => string;
435
434
  declare const getChainId: () => string;
436
435
  declare const getChainName: () => string;
437
436
  declare const isTestnetChain: () => boolean;
438
- declare const getChains: () => _chain_registry_v2_types.Chain[];
439
- declare const getChainByChainId: (chainId: string) => _chain_registry_v2_types.Chain | undefined;
440
- declare const getChainByName: (name: string) => _chain_registry_v2_types.Chain | undefined;
437
+ declare const getChains: () => Chain[];
438
+ declare const getChainByChainId: (chainId: string) => Chain | undefined;
439
+ declare const getChainByName: (name: string) => Chain | undefined;
441
440
  declare const getWalletChainsNames: () => Chain[];
442
- declare const getAssetLists: () => _chain_registry_v2_types.AssetList[];
441
+ declare const getAssetLists: () => _chain_registry_types.AssetList[];
443
442
  declare const getIBCAssetList: () => _chain_registry_types.Asset[];
444
443
  declare const getChainAddressPrefix: () => string;
445
444
  declare const getChainExplorerURL: (chainName: string) => string;
package/dist/index.d.ts CHANGED
@@ -6,7 +6,6 @@ import * as _bze_bzejs_cosmos_staking_v1beta1_staking from '@bze/bzejs/cosmos/st
6
6
  import { PoolSDKType, DelegationResponseSDKType, UnbondingDelegationSDKType, ValidatorSDKType, BondStatus } from '@bze/bzejs/cosmos/staking/v1beta1/staking';
7
7
  import * as _chain_registry_types from '@chain-registry/types';
8
8
  import { Chain } from '@chain-registry/types';
9
- import * as _chain_registry_v2_types from '@chain-registry/v2-types';
10
9
  import { IconType } from 'react-icons';
11
10
  import * as _bze_bzejs_cosmos_upgrade_v1beta1_query_lcd from '@bze/bzejs/cosmos/upgrade/v1beta1/query.lcd';
12
11
  import * as _bze_bzejs_cosmos_tx_v1beta1_service_lcd from '@bze/bzejs/cosmos/tx/v1beta1/service.lcd';
@@ -435,11 +434,11 @@ declare const getUSDCDenom: () => string;
435
434
  declare const getChainId: () => string;
436
435
  declare const getChainName: () => string;
437
436
  declare const isTestnetChain: () => boolean;
438
- declare const getChains: () => _chain_registry_v2_types.Chain[];
439
- declare const getChainByChainId: (chainId: string) => _chain_registry_v2_types.Chain | undefined;
440
- declare const getChainByName: (name: string) => _chain_registry_v2_types.Chain | undefined;
437
+ declare const getChains: () => Chain[];
438
+ declare const getChainByChainId: (chainId: string) => Chain | undefined;
439
+ declare const getChainByName: (name: string) => Chain | undefined;
441
440
  declare const getWalletChainsNames: () => Chain[];
442
- declare const getAssetLists: () => _chain_registry_v2_types.AssetList[];
441
+ declare const getAssetLists: () => _chain_registry_types.AssetList[];
443
442
  declare const getIBCAssetList: () => _chain_registry_types.Asset[];
444
443
  declare const getChainAddressPrefix: () => string;
445
444
  declare const getChainExplorerURL: (chainName: string) => string;
package/dist/index.js CHANGED
@@ -522,7 +522,7 @@ var BZE_TESTNET_NETWORK = {
522
522
  };
523
523
 
524
524
  // src/constants/chain.ts
525
- var import_v2 = require("@chain-registry/v2");
525
+ var import_chain_registry = require("chain-registry");
526
526
  var getChainId = () => {
527
527
  return process.env.NEXT_PUBLIC_CHAIN_ID || "beezee-1";
528
528
  };
@@ -534,14 +534,14 @@ var isTestnetChain = () => {
534
534
  return isTestnet === "true" || isTestnet === "1";
535
535
  };
536
536
  var getChains = () => {
537
- let localChains = import_v2.chains;
537
+ let localChains = import_chain_registry.chains;
538
538
  if (isTestnetChain()) {
539
539
  localChains = [...import_testnet.chains, BZE_TESTNET_2_SUGGEST_CHAIN];
540
540
  }
541
541
  return localChains;
542
542
  };
543
543
  var getChainByChainId = (chainId) => {
544
- let localChains = import_v2.chains;
544
+ let localChains = import_chain_registry.chains;
545
545
  if (isTestnetChain()) {
546
546
  localChains = [...import_testnet.chains, BZE_TESTNET_2_SUGGEST_CHAIN];
547
547
  }
@@ -551,7 +551,7 @@ var getChainByChainId = (chainId) => {
551
551
  });
552
552
  };
553
553
  var getChainByName = (name) => {
554
- let localChains = import_v2.chains;
554
+ let localChains = import_chain_registry.chains;
555
555
  if (isTestnetChain()) {
556
556
  localChains = [...import_testnet.chains, BZE_TESTNET_2_SUGGEST_CHAIN];
557
557
  }
@@ -570,14 +570,14 @@ var appChainFirst = (chains2) => {
570
570
  return chains2.sort((a, b) => a.chainId === getChainId() ? -1 : b.chainId === getChainId() ? 1 : 0);
571
571
  };
572
572
  var getAssetLists = () => {
573
- let localAssetLists = import_v2.assetLists;
573
+ let localAssetLists = import_chain_registry.assetLists;
574
574
  if (isTestnetChain()) {
575
575
  localAssetLists = BZE_TESTNET_NETWORK.assets;
576
576
  }
577
577
  return localAssetLists;
578
578
  };
579
579
  var getIBCAssetList = () => {
580
- const all = (0, import_utils.getAssetLists)(getChainName(), import_v2.ibcData, getAssetLists());
580
+ const all = (0, import_utils.getAssetLists)(getChainName(), import_chain_registry.ibcData, getAssetLists());
581
581
  return all.length > 0 ? all[0].assets : [];
582
582
  };
583
583
  var getChainAddressPrefix = () => {
@@ -2254,6 +2254,10 @@ var counterpartyChainForChannel = async (channelId, portId = "transfer") => {
2254
2254
 
2255
2255
  // src/service/assets_factory.ts
2256
2256
  var ORIGIN_CHAIN_PLACEHOLDER = "Unknown chain";
2257
+ var getAssetLogo = (asset) => {
2258
+ var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
2259
+ return (_j = (_i = (_f = (_c = (_a2 = asset.logoURIs) == null ? void 0 : _a2.svg) != null ? _c : (_b2 = asset.logoURIs) == null ? void 0 : _b2.png) != null ? _f : (_e = (_d = asset.images) == null ? void 0 : _d[0]) == null ? void 0 : _e.svg) != null ? _i : (_h = (_g = asset.images) == null ? void 0 : _g[0]) == null ? void 0 : _h.png) != null ? _j : TOKEN_LOGO_PLACEHOLDER;
2260
+ };
2257
2261
  var getChainAssets = async () => {
2258
2262
  const [metadata, supply] = await Promise.all([getAllMetadataMap(), getAllSupply()]);
2259
2263
  const result = {
@@ -2301,7 +2305,7 @@ var getChainAssets = async () => {
2301
2305
  return result;
2302
2306
  };
2303
2307
  var populateIBCAsset = async (asset) => {
2304
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
2308
+ var _a2, _b2, _c, _d;
2305
2309
  const ibcList = getIBCAssetList();
2306
2310
  const ibcData2 = ibcList.find((item) => item.base === asset.denom);
2307
2311
  if (ibcData2 && ibcData2.traces && ibcData2.traces.length > 0) {
@@ -2312,7 +2316,7 @@ var populateIBCAsset = async (asset) => {
2312
2316
  asset.name = ibcData2.name;
2313
2317
  asset.ticker = ibcData2.symbol.toUpperCase();
2314
2318
  asset.decimals = (_a2 = (0, import_utils2.getExponentByDenomFromAsset)(ibcData2, ibcData2.display)) != null ? _a2 : 0;
2315
- asset.logo = (_e = (_d = (_b2 = ibcData2.logoURIs) == null ? void 0 : _b2.svg) != null ? _d : (_c = ibcData2.logoURIs) == null ? void 0 : _c.png) != null ? _e : TOKEN_LOGO_PLACEHOLDER;
2319
+ asset.logo = getAssetLogo(ibcData2);
2316
2320
  asset.verified = true;
2317
2321
  asset.IBCData = {
2318
2322
  chain: {
@@ -2322,7 +2326,7 @@ var populateIBCAsset = async (asset) => {
2322
2326
  chainName: firstTrace.counterparty.chain_name,
2323
2327
  channelId: firstTrace.counterparty.channel_id,
2324
2328
  baseDenom: firstTrace.counterparty.base_denom,
2325
- chainPrettyName: (_f = ibcAssetChain.prettyName) != null ? _f : ibcAssetChain.chainName
2329
+ chainPrettyName: (_b2 = ibcAssetChain.prettyName) != null ? _b2 : ibcAssetChain.chainName
2326
2330
  }
2327
2331
  };
2328
2332
  return asset;
@@ -2358,7 +2362,7 @@ var populateIBCAsset = async (asset) => {
2358
2362
  const fullChain = getChainByChainId(counterPartyChain.chainId);
2359
2363
  if (fullChain) {
2360
2364
  asset.IBCData.counterparty.chainName = fullChain.chainName;
2361
- asset.IBCData.counterparty.chainPrettyName = (_g = fullChain.prettyName) != null ? _g : fullChain.chainName;
2365
+ asset.IBCData.counterparty.chainPrettyName = (_c = fullChain.prettyName) != null ? _c : fullChain.chainName;
2362
2366
  }
2363
2367
  }
2364
2368
  const registryAssetChain = getAssetLists().find((item) => {
@@ -2369,8 +2373,8 @@ var populateIBCAsset = async (asset) => {
2369
2373
  const registryAsset = registryAssetChain.assets.find((i) => i.base === ibcTrace.base_denom);
2370
2374
  asset.name = registryAsset.name;
2371
2375
  asset.ticker = registryAsset.symbol.toUpperCase();
2372
- asset.decimals = (_h = (0, import_utils2.getExponentByDenomFromAsset)(registryAsset, registryAsset.display)) != null ? _h : 0;
2373
- asset.logo = (_l = (_k = (_i = registryAsset.logoURIs) == null ? void 0 : _i.svg) != null ? _k : (_j = registryAsset.logoURIs) == null ? void 0 : _j.png) != null ? _l : TOKEN_LOGO_PLACEHOLDER;
2376
+ asset.decimals = (_d = (0, import_utils2.getExponentByDenomFromAsset)(registryAsset, registryAsset.display)) != null ? _d : 0;
2377
+ asset.logo = getAssetLogo(registryAsset);
2374
2378
  asset.verified = true;
2375
2379
  return asset;
2376
2380
  }
@@ -2400,7 +2404,7 @@ var populateAssetFromChainRegistry = async (asset) => {
2400
2404
  return void 0;
2401
2405
  };
2402
2406
  var populateAssetFromBZEChainRegistryAssetList = async (asset) => {
2403
- var _a2, _b2, _c, _d, _e;
2407
+ var _a2;
2404
2408
  const data = getAssetLists().find((item) => item.chainName.toLowerCase() === getChainName().toLowerCase());
2405
2409
  if (!data) {
2406
2410
  return void 0;
@@ -2412,7 +2416,7 @@ var populateAssetFromBZEChainRegistryAssetList = async (asset) => {
2412
2416
  asset.decimals = (_a2 = (0, import_utils2.getExponentByDenomFromAsset)(assetData, assetData.display)) != null ? _a2 : 0;
2413
2417
  asset.name = assetData.name;
2414
2418
  asset.ticker = assetData.display.toUpperCase();
2415
- asset.logo = isNativeDenom(asset.denom) ? BZE_CIRCLE_LOGO : (_e = (_d = (_b2 = assetData.logoURIs) == null ? void 0 : _b2.svg) != null ? _d : (_c = assetData.logoURIs) == null ? void 0 : _c.png) != null ? _e : TOKEN_LOGO_PLACEHOLDER;
2419
+ asset.logo = isNativeDenom(asset.denom) ? BZE_CIRCLE_LOGO : getAssetLogo(assetData);
2416
2420
  return asset;
2417
2421
  };
2418
2422
  var populateAssetFromBlockchainMetadata = (asset, meta) => {