@bze/bze-ui-kit 1.0.6 → 1.0.7
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/dist/index.d.mts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +110 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +109 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -425,6 +425,29 @@ declare const getValidatorSupportedDenoms: () => string[];
|
|
|
425
425
|
declare const getValidatorPageUrl: () => string;
|
|
426
426
|
declare const isPoolSupportedByValidator: (baseDenom: string, quoteDenom: string) => boolean;
|
|
427
427
|
|
|
428
|
+
/**
|
|
429
|
+
* Shared WebSocket singleton for CometBFT event subscriptions.
|
|
430
|
+
*
|
|
431
|
+
* One persistent connection is reused across all callers (useBlockchainListener,
|
|
432
|
+
* etc.) so the app opens a single WebSocket to the RPC node instead of one
|
|
433
|
+
* per hook instance.
|
|
434
|
+
*
|
|
435
|
+
* CometBFT sends subscription notifications by reusing the original request ID
|
|
436
|
+
* (not the Ethereum-style params.subscription pattern), so we track active
|
|
437
|
+
* subscriptions by their call ID and dispatch incoming messages accordingly.
|
|
438
|
+
*/
|
|
439
|
+
/**
|
|
440
|
+
* Subscribes to CometBFT events using the shared WebSocket connection.
|
|
441
|
+
* The handler receives `msg.result` for every notification:
|
|
442
|
+
* result.data.value.result_finalize_block.events — NewBlock events
|
|
443
|
+
* result.data.value.txs_results — block Tx results
|
|
444
|
+
* result.data.value.TxResult.result.events — Tx subscription events
|
|
445
|
+
*
|
|
446
|
+
* Returns an unsubscribe function that cleans up the subscription.
|
|
447
|
+
* Active subscriptions are automatically resubscribed after reconnection.
|
|
448
|
+
*/
|
|
449
|
+
declare const subscribeToBlockchainEvents: (rpcEndpoint: string, query: string, handler: (result: unknown) => void) => Promise<() => void>;
|
|
450
|
+
|
|
428
451
|
declare const ASSET_TYPE_FACTORY = "Factory";
|
|
429
452
|
declare const ASSET_TYPE_IBC = "IBC";
|
|
430
453
|
declare const ASSET_TYPE_NATIVE = "Native";
|
|
@@ -1293,4 +1316,4 @@ declare function SettingsToggle({ accentColor }: SettingsToggleProps): react_jsx
|
|
|
1293
1316
|
|
|
1294
1317
|
declare const TestnetBanner: () => react_jsx_runtime.JSX.Element | null;
|
|
1295
1318
|
|
|
1296
|
-
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, coins, 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, getDelegatorDelegations, getDelegatorValidators, 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, getValidatorDelegatorRewards, getValidatorPageUrl, getValidatorSupportedDenoms, getValidators, getWalletChainsNames, getWeekEpochInfo, intlDateFormat, isFactoryDenom, isIbcAsset, isIbcDenom, isLpDenom, isNativeDenom, isPoolSupportedByValidator, isTestnetChain, keplrSuggestChain, mapEventAttributes, openExternalLink, parseCoins, 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, useValidatorLogos, validateBZEBech32Address, validateBech32Address, validateEndpoints, validateRestEndpoint, validateRpcEndpoint };
|
|
1319
|
+
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, coins, 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, getDelegatorDelegations, getDelegatorValidators, 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, getValidatorDelegatorRewards, getValidatorPageUrl, getValidatorSupportedDenoms, getValidators, getWalletChainsNames, getWeekEpochInfo, intlDateFormat, isFactoryDenom, isIbcAsset, isIbcDenom, isLpDenom, isNativeDenom, isPoolSupportedByValidator, isTestnetChain, keplrSuggestChain, mapEventAttributes, openExternalLink, parseCoins, parseUnbondingDays, poolIdFromPoolDenom, prettyAmount, prettyError, priceToBigNumberUPrice, priceToUPrice, removeFromLocalStorage, removeLeadingZeros, sanitizeIntegerInput, sanitizeNumberInput, setDefaultTxMemo, setInLocalStorage, setKeyExpiry, setSettings, setStorageKeyVersion, shortNumberFormat, sleep, stringTruncateFromCenter, subscribeToBlockchainEvents, 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, useValidatorLogos, validateBZEBech32Address, validateBech32Address, validateEndpoints, validateRestEndpoint, validateRpcEndpoint };
|
package/dist/index.d.ts
CHANGED
|
@@ -425,6 +425,29 @@ declare const getValidatorSupportedDenoms: () => string[];
|
|
|
425
425
|
declare const getValidatorPageUrl: () => string;
|
|
426
426
|
declare const isPoolSupportedByValidator: (baseDenom: string, quoteDenom: string) => boolean;
|
|
427
427
|
|
|
428
|
+
/**
|
|
429
|
+
* Shared WebSocket singleton for CometBFT event subscriptions.
|
|
430
|
+
*
|
|
431
|
+
* One persistent connection is reused across all callers (useBlockchainListener,
|
|
432
|
+
* etc.) so the app opens a single WebSocket to the RPC node instead of one
|
|
433
|
+
* per hook instance.
|
|
434
|
+
*
|
|
435
|
+
* CometBFT sends subscription notifications by reusing the original request ID
|
|
436
|
+
* (not the Ethereum-style params.subscription pattern), so we track active
|
|
437
|
+
* subscriptions by their call ID and dispatch incoming messages accordingly.
|
|
438
|
+
*/
|
|
439
|
+
/**
|
|
440
|
+
* Subscribes to CometBFT events using the shared WebSocket connection.
|
|
441
|
+
* The handler receives `msg.result` for every notification:
|
|
442
|
+
* result.data.value.result_finalize_block.events — NewBlock events
|
|
443
|
+
* result.data.value.txs_results — block Tx results
|
|
444
|
+
* result.data.value.TxResult.result.events — Tx subscription events
|
|
445
|
+
*
|
|
446
|
+
* Returns an unsubscribe function that cleans up the subscription.
|
|
447
|
+
* Active subscriptions are automatically resubscribed after reconnection.
|
|
448
|
+
*/
|
|
449
|
+
declare const subscribeToBlockchainEvents: (rpcEndpoint: string, query: string, handler: (result: unknown) => void) => Promise<() => void>;
|
|
450
|
+
|
|
428
451
|
declare const ASSET_TYPE_FACTORY = "Factory";
|
|
429
452
|
declare const ASSET_TYPE_IBC = "IBC";
|
|
430
453
|
declare const ASSET_TYPE_NATIVE = "Native";
|
|
@@ -1293,4 +1316,4 @@ declare function SettingsToggle({ accentColor }: SettingsToggleProps): react_jsx
|
|
|
1293
1316
|
|
|
1294
1317
|
declare const TestnetBanner: () => react_jsx_runtime.JSX.Element | null;
|
|
1295
1318
|
|
|
1296
|
-
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, coins, 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, getDelegatorDelegations, getDelegatorValidators, 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, getValidatorDelegatorRewards, getValidatorPageUrl, getValidatorSupportedDenoms, getValidators, getWalletChainsNames, getWeekEpochInfo, intlDateFormat, isFactoryDenom, isIbcAsset, isIbcDenom, isLpDenom, isNativeDenom, isPoolSupportedByValidator, isTestnetChain, keplrSuggestChain, mapEventAttributes, openExternalLink, parseCoins, 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, useValidatorLogos, validateBZEBech32Address, validateBech32Address, validateEndpoints, validateRestEndpoint, validateRpcEndpoint };
|
|
1319
|
+
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, coins, 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, getDelegatorDelegations, getDelegatorValidators, 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, getValidatorDelegatorRewards, getValidatorPageUrl, getValidatorSupportedDenoms, getValidators, getWalletChainsNames, getWeekEpochInfo, intlDateFormat, isFactoryDenom, isIbcAsset, isIbcDenom, isLpDenom, isNativeDenom, isPoolSupportedByValidator, isTestnetChain, keplrSuggestChain, mapEventAttributes, openExternalLink, parseCoins, parseUnbondingDays, poolIdFromPoolDenom, prettyAmount, prettyError, priceToBigNumberUPrice, priceToUPrice, removeFromLocalStorage, removeLeadingZeros, sanitizeIntegerInput, sanitizeNumberInput, setDefaultTxMemo, setInLocalStorage, setKeyExpiry, setSettings, setStorageKeyVersion, shortNumberFormat, sleep, stringTruncateFromCenter, subscribeToBlockchainEvents, 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, useValidatorLogos, validateBZEBech32Address, validateBech32Address, validateEndpoints, validateRestEndpoint, validateRpcEndpoint };
|
package/dist/index.js
CHANGED
|
@@ -278,6 +278,7 @@ __export(index_exports, {
|
|
|
278
278
|
shortNumberFormat: () => shortNumberFormat,
|
|
279
279
|
sleep: () => sleep,
|
|
280
280
|
stringTruncateFromCenter: () => stringTruncateFromCenter,
|
|
281
|
+
subscribeToBlockchainEvents: () => subscribeToBlockchainEvents,
|
|
281
282
|
toBigNumber: () => toBigNumber,
|
|
282
283
|
toPercentage: () => toPercentage,
|
|
283
284
|
truncateAddress: () => truncateAddress,
|
|
@@ -1710,6 +1711,114 @@ var isPoolSupportedByValidator = (baseDenom, quoteDenom) => {
|
|
|
1710
1711
|
return supportedDenoms.includes(baseDenom) || supportedDenoms.includes(quoteDenom);
|
|
1711
1712
|
};
|
|
1712
1713
|
|
|
1714
|
+
// src/utils/ws_rpc_client.ts
|
|
1715
|
+
var socket = null;
|
|
1716
|
+
var activeUrl = "";
|
|
1717
|
+
var socketConnected = false;
|
|
1718
|
+
var connectingPromise = null;
|
|
1719
|
+
var msgId = 0;
|
|
1720
|
+
var reconnectAttempts = 0;
|
|
1721
|
+
var reconnectTimeout = null;
|
|
1722
|
+
var MAX_RECONNECT_ATTEMPTS = 10;
|
|
1723
|
+
var activeSubscriptions = /* @__PURE__ */ new Map();
|
|
1724
|
+
var handleMessage = (event) => {
|
|
1725
|
+
var _a2;
|
|
1726
|
+
try {
|
|
1727
|
+
const msg = JSON.parse(event.data);
|
|
1728
|
+
const id = String((_a2 = msg == null ? void 0 : msg.id) != null ? _a2 : "");
|
|
1729
|
+
if (id && activeSubscriptions.has(id) && msg.result && Object.keys(msg.result).length > 0) {
|
|
1730
|
+
activeSubscriptions.get(id).handler(msg.result);
|
|
1731
|
+
}
|
|
1732
|
+
} catch (e) {
|
|
1733
|
+
}
|
|
1734
|
+
};
|
|
1735
|
+
var resubscribeAll = () => {
|
|
1736
|
+
for (const [id, sub] of activeSubscriptions) {
|
|
1737
|
+
socket.send(JSON.stringify({
|
|
1738
|
+
jsonrpc: "2.0",
|
|
1739
|
+
method: "subscribe",
|
|
1740
|
+
id,
|
|
1741
|
+
params: { query: sub.query }
|
|
1742
|
+
}));
|
|
1743
|
+
}
|
|
1744
|
+
};
|
|
1745
|
+
var scheduleReconnect = () => {
|
|
1746
|
+
if (reconnectAttempts >= MAX_RECONNECT_ATTEMPTS) {
|
|
1747
|
+
console.error("[WS] Max reconnect attempts reached");
|
|
1748
|
+
return;
|
|
1749
|
+
}
|
|
1750
|
+
reconnectAttempts++;
|
|
1751
|
+
const delay = Math.min(1e3 * Math.pow(2, reconnectAttempts - 1), 3e4);
|
|
1752
|
+
reconnectTimeout = setTimeout(async () => {
|
|
1753
|
+
try {
|
|
1754
|
+
await openSocket(activeUrl);
|
|
1755
|
+
resubscribeAll();
|
|
1756
|
+
reconnectAttempts = 0;
|
|
1757
|
+
} catch (e) {
|
|
1758
|
+
scheduleReconnect();
|
|
1759
|
+
}
|
|
1760
|
+
}, delay);
|
|
1761
|
+
};
|
|
1762
|
+
var openSocket = (url) => {
|
|
1763
|
+
return new Promise((resolve, reject) => {
|
|
1764
|
+
const ws = new WebSocket(url);
|
|
1765
|
+
ws.onopen = () => {
|
|
1766
|
+
socket = ws;
|
|
1767
|
+
socketConnected = true;
|
|
1768
|
+
resolve();
|
|
1769
|
+
};
|
|
1770
|
+
ws.onmessage = handleMessage;
|
|
1771
|
+
ws.onclose = () => {
|
|
1772
|
+
socketConnected = false;
|
|
1773
|
+
scheduleReconnect();
|
|
1774
|
+
};
|
|
1775
|
+
ws.onerror = (err) => {
|
|
1776
|
+
socketConnected = false;
|
|
1777
|
+
reject(err);
|
|
1778
|
+
};
|
|
1779
|
+
});
|
|
1780
|
+
};
|
|
1781
|
+
var getOrCreateSocket = async (rpcEndpoint) => {
|
|
1782
|
+
const url = rpcEndpoint.replace(/\/?$/, "") + "/websocket";
|
|
1783
|
+
if (socket && socketConnected && activeUrl === url) return;
|
|
1784
|
+
if (connectingPromise && activeUrl === url) {
|
|
1785
|
+
return connectingPromise;
|
|
1786
|
+
}
|
|
1787
|
+
if (socket) {
|
|
1788
|
+
socket.onclose = null;
|
|
1789
|
+
socket.close(1e3, "Endpoint changed");
|
|
1790
|
+
socket = null;
|
|
1791
|
+
socketConnected = false;
|
|
1792
|
+
if (reconnectTimeout) {
|
|
1793
|
+
clearTimeout(reconnectTimeout);
|
|
1794
|
+
reconnectTimeout = null;
|
|
1795
|
+
}
|
|
1796
|
+
reconnectAttempts = 0;
|
|
1797
|
+
}
|
|
1798
|
+
activeUrl = url;
|
|
1799
|
+
connectingPromise = openSocket(url).finally(() => {
|
|
1800
|
+
connectingPromise = null;
|
|
1801
|
+
});
|
|
1802
|
+
return connectingPromise;
|
|
1803
|
+
};
|
|
1804
|
+
var subscribeToBlockchainEvents = async (rpcEndpoint, query, handler) => {
|
|
1805
|
+
await getOrCreateSocket(rpcEndpoint);
|
|
1806
|
+
const id = String(++msgId);
|
|
1807
|
+
activeSubscriptions.set(id, { query, handler });
|
|
1808
|
+
socket.send(JSON.stringify({ jsonrpc: "2.0", method: "subscribe", id, params: { query } }));
|
|
1809
|
+
return () => {
|
|
1810
|
+
activeSubscriptions.delete(id);
|
|
1811
|
+
if ((socket == null ? void 0 : socket.readyState) === WebSocket.OPEN) {
|
|
1812
|
+
socket.send(JSON.stringify({
|
|
1813
|
+
jsonrpc: "2.0",
|
|
1814
|
+
method: "unsubscribe",
|
|
1815
|
+
id: String(++msgId),
|
|
1816
|
+
params: { query }
|
|
1817
|
+
}));
|
|
1818
|
+
}
|
|
1819
|
+
};
|
|
1820
|
+
};
|
|
1821
|
+
|
|
1713
1822
|
// src/constants/market.ts
|
|
1714
1823
|
var EXCLUDED_MARKETS = {
|
|
1715
1824
|
"factory/bze1f0qgels0eu96ev6a67znu70q7rquy9eragn8nw/ucorey/factory/bze13gzq40che93tgfm9kzmkpjamah5nj0j73pyhqk/uvdl": true,
|
|
@@ -5671,6 +5780,7 @@ var TestnetBanner = () => {
|
|
|
5671
5780
|
shortNumberFormat,
|
|
5672
5781
|
sleep,
|
|
5673
5782
|
stringTruncateFromCenter,
|
|
5783
|
+
subscribeToBlockchainEvents,
|
|
5674
5784
|
toBigNumber,
|
|
5675
5785
|
toPercentage,
|
|
5676
5786
|
truncateAddress,
|