@bze/bze-ui-kit 0.3.1 → 0.4.0
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 +11 -11
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @bze/bze-ui-kit
|
|
2
2
|
|
|
3
|
-
Shared
|
|
3
|
+
Shared hooks, utilities, query clients, services, UI components, and types for BZE ecosystem frontend apps.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -13,10 +13,10 @@ npm install @bze/bze-ui-kit
|
|
|
13
13
|
The consuming app must have these installed (they are **not** bundled):
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
|
-
npm install @bze/bzejs @cosmjs/stargate bignumber.js chain-registry \
|
|
16
|
+
npm install @bze/bzejs @chakra-ui/react @cosmjs/stargate bignumber.js chain-registry \
|
|
17
17
|
@chain-registry/types @chain-registry/utils @chain-registry/v2 \
|
|
18
18
|
@interchain-kit/core @interchain-kit/react @interchainjs/encoding \
|
|
19
|
-
react react-dom
|
|
19
|
+
interchainjs next-themes react react-dom react-icons
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
## Usage
|
|
@@ -67,14 +67,15 @@ The library exports the `AssetsContext` and `AssetsContextType` but each app mus
|
|
|
67
67
|
|
|
68
68
|
| Module | Description |
|
|
69
69
|
|--------|-------------|
|
|
70
|
-
| `types/` | TypeScript interfaces for assets, balances, markets, pools, staking, IBC, events, settings |
|
|
70
|
+
| `types/` | TypeScript interfaces for assets, balances, markets, pools, staking, IBC, events, settings, burn, block |
|
|
71
71
|
| `utils/` | Pure functions: amount math, denom helpers, formatting, address validation, staking APR, chart periods |
|
|
72
|
-
| `constants/` | Chain config, RPC/REST endpoints, asset lists, keplr fallbacks, testnet
|
|
72
|
+
| `constants/` | Chain config, RPC/REST endpoints, asset lists, keplr fallbacks, testnet, ecosystem navigation |
|
|
73
73
|
| `storage/` | localStorage wrapper with TTL + app settings persistence |
|
|
74
74
|
| `service/` | AmmRouter (Dijkstra swap routing), BlockchainEventManager (pub-sub), assets_factory, keplr suggest chain |
|
|
75
|
-
| `query/` | REST clients for bank, staking, markets, liquidity pools, epochs, IBC, burner, rewards, aggregator, prices |
|
|
76
|
-
| `hooks/` | React hooks: useAssets, useBalances, useMarkets, useLiquidityPools, usePrices, useEpochs, useSigningClient, useSettings, useFeeTokens, useAssetsValue, useConnectionType |
|
|
75
|
+
| `query/` | REST clients for bank, staking, markets, liquidity pools, epochs, IBC, burner, raffle, block, module, rewards, aggregator, prices |
|
|
76
|
+
| `hooks/` | React hooks: useAssets, useBalances, useMarkets, useLiquidityPools, useLiquidityPool, usePrices, useEpochs, useSigningClient, useSettings, useFeeTokens, useAssetsValue, useConnectionType, useToast, useSDKTx/useBZETx/useIBCTx |
|
|
77
77
|
| `contexts/` | Base `AssetsContextType` interface + `AssetsContext` React context |
|
|
78
|
+
| `components/` | Sidebar, WalletSidebarContent, SettingsSidebarContent, SettingsToggle, Toaster, HighlightText |
|
|
78
79
|
|
|
79
80
|
## Required environment variables
|
|
80
81
|
|
|
@@ -133,12 +134,11 @@ The library reads these `NEXT_PUBLIC_*` env vars at build time (inlined by Next.
|
|
|
133
134
|
|
|
134
135
|
These are **not** in the library — each app keeps its own:
|
|
135
136
|
|
|
136
|
-
- **useToast / useTx** — depend on app-specific Chakra UI toaster component
|
|
137
137
|
- **useBlockchainListener** — different WebSocket event subscriptions per app
|
|
138
138
|
- **useNavigation** — completely different route structures
|
|
139
|
-
- **AssetsProvider** — each app composes the shared base with app-specific state
|
|
140
|
-
- **Burner-only**:
|
|
141
|
-
- **Dex-only**:
|
|
139
|
+
- **AssetsProvider** (`contexts/assets_context.tsx`) — each app composes the shared base `AssetsContextType` with app-specific state
|
|
140
|
+
- **Burner-only**: `useBurnerContext` (typed wrapper for extended context), `useBurningHistory`, `useNextBurning`, `useRaffles`
|
|
141
|
+
- **Dex-only**: `useLockedLiquidity`, `useNativeStakingData`, `useRewardsStakingData`
|
|
142
142
|
|
|
143
143
|
## Development
|
|
144
144
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1258,4 +1258,6 @@ interface SettingsToggleProps {
|
|
|
1258
1258
|
}
|
|
1259
1259
|
declare function SettingsToggle({ accentColor }: SettingsToggleProps): react_jsx_runtime.JSX.Element;
|
|
1260
1260
|
|
|
1261
|
-
|
|
1261
|
+
declare const TestnetBanner: () => react_jsx_runtime.JSX.Element | null;
|
|
1262
|
+
|
|
1263
|
+
export { ASSET_TYPE_FACTORY, ASSET_TYPE_IBC, ASSET_TYPE_LP, ASSET_TYPE_NATIVE, type ActiveOrders, type AddressRewardsStaking, type AddressValidationResult, type AppSettings, type Asset, type AssetBalance, AssetsContext, type AssetsContextType, type Attribute, BZE_CIRCLE_LOGO, BZE_TESTNET_2_SUGGEST_CHAIN, BZE_TESTNET_NETWORK, type Balance, type BeeZeeEndpoints, type BlockResults, type BurnHistoryItem, CHART_1D, CHART_1Y, CHART_30D, CHART_4H, CHART_7D, CONNECTION_TYPE_NONE, CONNECTION_TYPE_POLLING, CONNECTION_TYPE_WS, CURRENT_WALLET_BALANCE_EVENT, type ChainAssets, type ConnectionType, type CounterpartyChainForChannel, DEFAULT_SETTINGS, DEFAULT_TX_MEMO, type DenomTrace, ECOSYSTEM_MENU_LABEL, EPOCH_START_EVENT, EXCLUDED_ASSETS, EXCLUDED_MARKETS, type EcosystemApp, type EndpointValidationResults, type EventCallback, type ExtendedPendingUnlockParticipantSDKType, HighlightText, type HistoryOrder, type IBCCounterparty, type IBCData, type IbcTransitionMock, type InternalEvent, LOCK_CHANGED_EVENT, LP_ASSETS_DECIMALS, type LiquidityPoolData, MAINNET_CHAIN_INFO_FALLBACK, type Market, type MarketData, NEXT_BURN_CHANGED_EVENT, type NativeStakingData, type NativeUnbondingSummary, type NextBurn, ORDER_BOOK_CHANGED_EVENT, ORDER_EXECUTED_EVENT, ORDER_TYPE_BUY, ORDER_TYPE_SELL, type PrettyBalance, type PriceApiResponse, RAFFLE_CHANGED_EVENT, SETTINGS_STORAGE_KEY, STABLE_COINS, SUPPLY_CHANGED_EVENT, SWAP_EXECUTED_EVENT, SettingsSidebarContent, SettingsToggle, Sidebar, type SwapHistory, type SwapRouteResult, TESTNET_CHAIN_INFO_FALLBACK, TOKEN_LOGO_PLACEHOLDER, TTL_NO_EXPIRY, type TendermintEvent, TestnetBanner, Toaster, type TradeViewChart, type TxOptions, TxStatus, type UserNativeStakingData, type UserNativeStakingRewards, type UserPoolData, VALIDATION_ERRORS, VERIFIED_ASSETS, type ValidationResult, WalletSidebarContent, addDebounce, addMultipleDebounce, ammRouter, amountToBigNumberUAmount, amountToUAmount, blockchainEventManager, calcNativeStakingApr, calculateAmountFromPrice, calculatePoolOppositeAmount, calculatePoolPrice, calculatePricePerUnit, calculateRewardsStakingApr, calculateRewardsStakingPendingRewards, calculateTotalAmount, calculateUserPoolData, canDepositFromIBC, canSendToIBC, cancelDebounce, checkAddressWonRaffle, convertToWebSocketUrl, counterpartyChainForChannel, createMarketId, createPoolId, createRestClient, denomOnFirstHopChainFromTrace, formatDate, formatTimeRemaining, formatTimeRemainingFromEpochs, formatUsdAmount, getAddressBalances, getAddressDelegations, getAddressFullMarketOrders, getAddressHistory, getAddressMarketOrders, getAddressNativeDelegatedBalance, getAddressNativeTotalRewards, getAddressPendingUnlock, getAddressRewards, getAddressStakingRewards, getAddressSwapHistory, getAddressUnbondingDelegations, getAddressUnbondingDelegationsSummary, getAggregatorHost, getAllBurnedCoins, getAllSupply, getAllSupplyMetadata, getAllTickers, getAnnualProvisions, getAppName, getArchwayRestURL, getArchwayRpcURL, getAssetLists, getAtomOneRestURL, getAtomOneRpcUrl, getBZEUSDPrice, getBlockDetailsByHeight, getBlockResults, getBlockTimeByHeight, getBurnerModuleAddress, getBurnerParams, getBurnerParamsWithClient, getChainAddressPrefix, getChainAssets, getChainByChainId, getChainByName, getChainExplorerURL, getChainId, getChainName, getChainNativeAssetDenom, getChains, getChartIntervalsLimit, getChartMinutes, getCurrentEpoch, getCurrentWeekEpochEndTime, getDefaultTxMemo, getDenomType, getDistributionParams, getEcosystemApps, getEpochDurationByIdentifier, getEpochsInfo, getFactoryDenomAdminAddress, getFromLocalStorage, getHardcodedLockAddress, getHashIBCTrace, getHourEpochInfo, getIBCAssetList, getIBCTraces, getIbcTransferTimeout, getJackalRestURL, getJackalRpcUrl, getKeyExpiry, getLiquidityPool, getLiquidityPools, getLockedBalances, getLockerAddress, getMarketBuyOrders, getMarketEventKey, getMarketHistory, getMarketOrder, getMarketOrderBookChangedEvent, getMarketOrders, getMarketOrdersHistory, getMarketSellOrders, getMarkets, getMinAmount, getModuleAddress, getNextBurning, getNoOfIntervalsNeeded, getNobleRestURL, getNobleRpcUrl, getOmniFlixRestURL, getOmniFlixRpcUrl, getOsmosisRestURL, getOsmosisRpcUrl, getPageRequestWithLimit, getPendingUnlockParticipants, getPeriodicEpochEndTime, getPeriodicWeekEpochEndTime, getRaffleModuleAddress, getRaffleWinners, getRaffles, getRestClient, getRestURL, getRpcURL, getSettings, getStakingParams, getStakingPool, getStakingRewardParticipantByAddress, getStakingRewards, getTradingViewIntervals, getUSDCDenom, getValidatorPageUrl, getValidatorSupportedDenoms, getWalletChainsNames, getWeekEpochInfo, intlDateFormat, isFactoryDenom, isIbcAsset, isIbcDenom, isLpDenom, isNativeDenom, isPoolSupportedByValidator, isTestnetChain, keplrSuggestChain, mapEventAttributes, openExternalLink, parseUnbondingDays, poolIdFromPoolDenom, prettyAmount, prettyError, priceToBigNumberUPrice, priceToUPrice, removeFromLocalStorage, removeLeadingZeros, sanitizeIntegerInput, sanitizeNumberInput, setDefaultTxMemo, setInLocalStorage, setKeyExpiry, setSettings, setStorageKeyVersion, shortNumberFormat, sleep, stringTruncateFromCenter, toBigNumber, toPercentage, truncateAddress, truncateDenom, uAmountToAmount, uAmountToBigNumberAmount, uPriceToBigNumberPrice, uPriceToPrice, useAsset, useAssetLiquidityPools, useAssetMarkets, useAssetPrice, useAssets, useAssetsContext, useAssetsManager, useAssetsValue, useBZETx, useBalance, useBalances, useConnectionType, useEpochs, useEpochsManager, useFeeTokens, useIBCChains, useIBCTx, useLiquidityPool, useLiquidityPools, useMarket, useMarkets, useMarketsManager, useSDKTx, useSettings, useSigningClient, useToast, validateBZEBech32Address, validateBech32Address, validateEndpoints, validateRestEndpoint, validateRpcEndpoint };
|
package/dist/index.d.ts
CHANGED
|
@@ -1258,4 +1258,6 @@ interface SettingsToggleProps {
|
|
|
1258
1258
|
}
|
|
1259
1259
|
declare function SettingsToggle({ accentColor }: SettingsToggleProps): react_jsx_runtime.JSX.Element;
|
|
1260
1260
|
|
|
1261
|
-
|
|
1261
|
+
declare const TestnetBanner: () => react_jsx_runtime.JSX.Element | null;
|
|
1262
|
+
|
|
1263
|
+
export { ASSET_TYPE_FACTORY, ASSET_TYPE_IBC, ASSET_TYPE_LP, ASSET_TYPE_NATIVE, type ActiveOrders, type AddressRewardsStaking, type AddressValidationResult, type AppSettings, type Asset, type AssetBalance, AssetsContext, type AssetsContextType, type Attribute, BZE_CIRCLE_LOGO, BZE_TESTNET_2_SUGGEST_CHAIN, BZE_TESTNET_NETWORK, type Balance, type BeeZeeEndpoints, type BlockResults, type BurnHistoryItem, CHART_1D, CHART_1Y, CHART_30D, CHART_4H, CHART_7D, CONNECTION_TYPE_NONE, CONNECTION_TYPE_POLLING, CONNECTION_TYPE_WS, CURRENT_WALLET_BALANCE_EVENT, type ChainAssets, type ConnectionType, type CounterpartyChainForChannel, DEFAULT_SETTINGS, DEFAULT_TX_MEMO, type DenomTrace, ECOSYSTEM_MENU_LABEL, EPOCH_START_EVENT, EXCLUDED_ASSETS, EXCLUDED_MARKETS, type EcosystemApp, type EndpointValidationResults, type EventCallback, type ExtendedPendingUnlockParticipantSDKType, HighlightText, type HistoryOrder, type IBCCounterparty, type IBCData, type IbcTransitionMock, type InternalEvent, LOCK_CHANGED_EVENT, LP_ASSETS_DECIMALS, type LiquidityPoolData, MAINNET_CHAIN_INFO_FALLBACK, type Market, type MarketData, NEXT_BURN_CHANGED_EVENT, type NativeStakingData, type NativeUnbondingSummary, type NextBurn, ORDER_BOOK_CHANGED_EVENT, ORDER_EXECUTED_EVENT, ORDER_TYPE_BUY, ORDER_TYPE_SELL, type PrettyBalance, type PriceApiResponse, RAFFLE_CHANGED_EVENT, SETTINGS_STORAGE_KEY, STABLE_COINS, SUPPLY_CHANGED_EVENT, SWAP_EXECUTED_EVENT, SettingsSidebarContent, SettingsToggle, Sidebar, type SwapHistory, type SwapRouteResult, TESTNET_CHAIN_INFO_FALLBACK, TOKEN_LOGO_PLACEHOLDER, TTL_NO_EXPIRY, type TendermintEvent, TestnetBanner, Toaster, type TradeViewChart, type TxOptions, TxStatus, type UserNativeStakingData, type UserNativeStakingRewards, type UserPoolData, VALIDATION_ERRORS, VERIFIED_ASSETS, type ValidationResult, WalletSidebarContent, addDebounce, addMultipleDebounce, ammRouter, amountToBigNumberUAmount, amountToUAmount, blockchainEventManager, calcNativeStakingApr, calculateAmountFromPrice, calculatePoolOppositeAmount, calculatePoolPrice, calculatePricePerUnit, calculateRewardsStakingApr, calculateRewardsStakingPendingRewards, calculateTotalAmount, calculateUserPoolData, canDepositFromIBC, canSendToIBC, cancelDebounce, checkAddressWonRaffle, convertToWebSocketUrl, counterpartyChainForChannel, createMarketId, createPoolId, createRestClient, denomOnFirstHopChainFromTrace, formatDate, formatTimeRemaining, formatTimeRemainingFromEpochs, formatUsdAmount, getAddressBalances, getAddressDelegations, getAddressFullMarketOrders, getAddressHistory, getAddressMarketOrders, getAddressNativeDelegatedBalance, getAddressNativeTotalRewards, getAddressPendingUnlock, getAddressRewards, getAddressStakingRewards, getAddressSwapHistory, getAddressUnbondingDelegations, getAddressUnbondingDelegationsSummary, getAggregatorHost, getAllBurnedCoins, getAllSupply, getAllSupplyMetadata, getAllTickers, getAnnualProvisions, getAppName, getArchwayRestURL, getArchwayRpcURL, getAssetLists, getAtomOneRestURL, getAtomOneRpcUrl, getBZEUSDPrice, getBlockDetailsByHeight, getBlockResults, getBlockTimeByHeight, getBurnerModuleAddress, getBurnerParams, getBurnerParamsWithClient, getChainAddressPrefix, getChainAssets, getChainByChainId, getChainByName, getChainExplorerURL, getChainId, getChainName, getChainNativeAssetDenom, getChains, getChartIntervalsLimit, getChartMinutes, getCurrentEpoch, getCurrentWeekEpochEndTime, getDefaultTxMemo, getDenomType, getDistributionParams, getEcosystemApps, getEpochDurationByIdentifier, getEpochsInfo, getFactoryDenomAdminAddress, getFromLocalStorage, getHardcodedLockAddress, getHashIBCTrace, getHourEpochInfo, getIBCAssetList, getIBCTraces, getIbcTransferTimeout, getJackalRestURL, getJackalRpcUrl, getKeyExpiry, getLiquidityPool, getLiquidityPools, getLockedBalances, getLockerAddress, getMarketBuyOrders, getMarketEventKey, getMarketHistory, getMarketOrder, getMarketOrderBookChangedEvent, getMarketOrders, getMarketOrdersHistory, getMarketSellOrders, getMarkets, getMinAmount, getModuleAddress, getNextBurning, getNoOfIntervalsNeeded, getNobleRestURL, getNobleRpcUrl, getOmniFlixRestURL, getOmniFlixRpcUrl, getOsmosisRestURL, getOsmosisRpcUrl, getPageRequestWithLimit, getPendingUnlockParticipants, getPeriodicEpochEndTime, getPeriodicWeekEpochEndTime, getRaffleModuleAddress, getRaffleWinners, getRaffles, getRestClient, getRestURL, getRpcURL, getSettings, getStakingParams, getStakingPool, getStakingRewardParticipantByAddress, getStakingRewards, getTradingViewIntervals, getUSDCDenom, getValidatorPageUrl, getValidatorSupportedDenoms, getWalletChainsNames, getWeekEpochInfo, intlDateFormat, isFactoryDenom, isIbcAsset, isIbcDenom, isLpDenom, isNativeDenom, isPoolSupportedByValidator, isTestnetChain, keplrSuggestChain, mapEventAttributes, openExternalLink, parseUnbondingDays, poolIdFromPoolDenom, prettyAmount, prettyError, priceToBigNumberUPrice, priceToUPrice, removeFromLocalStorage, removeLeadingZeros, sanitizeIntegerInput, sanitizeNumberInput, setDefaultTxMemo, setInLocalStorage, setKeyExpiry, setSettings, setStorageKeyVersion, shortNumberFormat, sleep, stringTruncateFromCenter, toBigNumber, toPercentage, truncateAddress, truncateDenom, uAmountToAmount, uAmountToBigNumberAmount, uPriceToBigNumberPrice, uPriceToPrice, useAsset, useAssetLiquidityPools, useAssetMarkets, useAssetPrice, useAssets, useAssetsContext, useAssetsManager, useAssetsValue, useBZETx, useBalance, useBalances, useConnectionType, useEpochs, useEpochsManager, useFeeTokens, useIBCChains, useIBCTx, useLiquidityPool, useLiquidityPools, useMarket, useMarkets, useMarketsManager, useSDKTx, useSettings, useSigningClient, useToast, validateBZEBech32Address, validateBech32Address, validateEndpoints, validateRestEndpoint, validateRpcEndpoint };
|
package/dist/index.js
CHANGED
|
@@ -102,6 +102,7 @@ __export(index_exports, {
|
|
|
102
102
|
TESTNET_CHAIN_INFO_FALLBACK: () => TESTNET_CHAIN_INFO_FALLBACK,
|
|
103
103
|
TOKEN_LOGO_PLACEHOLDER: () => TOKEN_LOGO_PLACEHOLDER,
|
|
104
104
|
TTL_NO_EXPIRY: () => TTL_NO_EXPIRY,
|
|
105
|
+
TestnetBanner: () => TestnetBanner,
|
|
105
106
|
Toaster: () => Toaster,
|
|
106
107
|
TxStatus: () => TxStatus,
|
|
107
108
|
VALIDATION_ERRORS: () => VALIDATION_ERRORS,
|
|
@@ -5119,6 +5120,33 @@ function SettingsToggle({ accentColor }) {
|
|
|
5119
5120
|
}
|
|
5120
5121
|
);
|
|
5121
5122
|
}
|
|
5123
|
+
|
|
5124
|
+
// src/components/testnet-banner.tsx
|
|
5125
|
+
var import_react28 = require("@chakra-ui/react");
|
|
5126
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5127
|
+
var TestnetBanner = () => {
|
|
5128
|
+
if (!isTestnetChain()) {
|
|
5129
|
+
return null;
|
|
5130
|
+
}
|
|
5131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5132
|
+
import_react28.Box,
|
|
5133
|
+
{
|
|
5134
|
+
position: "fixed",
|
|
5135
|
+
bottom: "0",
|
|
5136
|
+
left: "0",
|
|
5137
|
+
right: "0",
|
|
5138
|
+
bg: "red.600",
|
|
5139
|
+
color: "white",
|
|
5140
|
+
textAlign: "center",
|
|
5141
|
+
py: "1",
|
|
5142
|
+
zIndex: "banner",
|
|
5143
|
+
fontSize: "xs",
|
|
5144
|
+
fontWeight: "bold",
|
|
5145
|
+
letterSpacing: "wide",
|
|
5146
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react28.Text, { children: "YOU ARE ON TESTNET" })
|
|
5147
|
+
}
|
|
5148
|
+
);
|
|
5149
|
+
};
|
|
5122
5150
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5123
5151
|
0 && (module.exports = {
|
|
5124
5152
|
ASSET_TYPE_FACTORY,
|
|
@@ -5164,6 +5192,7 @@ function SettingsToggle({ accentColor }) {
|
|
|
5164
5192
|
TESTNET_CHAIN_INFO_FALLBACK,
|
|
5165
5193
|
TOKEN_LOGO_PLACEHOLDER,
|
|
5166
5194
|
TTL_NO_EXPIRY,
|
|
5195
|
+
TestnetBanner,
|
|
5167
5196
|
Toaster,
|
|
5168
5197
|
TxStatus,
|
|
5169
5198
|
VALIDATION_ERRORS,
|