@bze/bze-ui-kit 1.0.5 → 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 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,
@@ -594,6 +595,10 @@ var getChainExplorerURL = (chainName) => {
594
595
  var getLockerAddress = () => {
595
596
  return process.env.NEXT_PUBLIC_LOCKER_ADDRESS || "bze1pc5zjcvhx3e8l305zjl72grytfa30r5mdypmw4";
596
597
  };
598
+ var getGasMultiplier = () => {
599
+ const val = parseFloat(process.env.NEXT_PUBLIC_GAS_MULTIPLIER || "");
600
+ return isNaN(val) || val <= 0 ? 1.5 : val;
601
+ };
597
602
 
598
603
  // src/storage/storage.ts
599
604
  var TTL_NO_EXPIRY = 0;
@@ -1706,6 +1711,114 @@ var isPoolSupportedByValidator = (baseDenom, quoteDenom) => {
1706
1711
  return supportedDenoms.includes(baseDenom) || supportedDenoms.includes(quoteDenom);
1707
1712
  };
1708
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
+
1709
1822
  // src/constants/market.ts
1710
1823
  var EXCLUDED_MARKETS = {
1711
1824
  "factory/bze1f0qgels0eu96ev6a67znu70q7rquy9eragn8nw/ucorey/factory/bze13gzq40che93tgfm9kzmkpjamah5nj0j73pyhqk/uvdl": true,
@@ -4159,7 +4272,6 @@ var useToast = () => {
4159
4272
 
4160
4273
  // src/hooks/useTx.tsx
4161
4274
  var import_tx13 = require("@bze/bzejs/cosmos/tx/v1beta1/tx");
4162
- var import_encoding2 = require("@interchainjs/encoding");
4163
4275
  var import_react15 = require("@interchain-kit/react");
4164
4276
  var import_bignumber13 = __toESM(require("bignumber.js"));
4165
4277
  var import_react16 = require("react");
@@ -4210,7 +4322,7 @@ var useTx = (chainName) => {
4210
4322
  return isSigningClientReady;
4211
4323
  }, [isSigningClientReady, signingClientError]);
4212
4324
  const simulateFee = (0, import_react16.useCallback)(async (messages, memo) => {
4213
- var _a2, _b2;
4325
+ var _a2;
4214
4326
  const gasPrice = 0.02;
4215
4327
  const nativeDenom = getChainNativeAssetDenom();
4216
4328
  const signer = signingClient;
@@ -4221,27 +4333,14 @@ var useTx = (chainName) => {
4221
4333
  return { typeUrl, value: encodedValue };
4222
4334
  });
4223
4335
  const txBody = import_tx13.TxBody.fromPartial({ messages: encodedMessages, memo: memo != null ? memo : "" });
4224
- const authInfo = import_tx13.AuthInfo.fromPartial({
4225
- signerInfos: [import_tx13.SignerInfo.fromPartial({ modeInfo: { single: { mode: 1 } }, sequence: BigInt(0) })],
4226
- fee: { amount: [], gasLimit: BigInt(0), payer: "", granter: "" }
4227
- });
4228
- const tx2 = import_tx13.Tx.fromPartial({ body: txBody, authInfo, signatures: [new Uint8Array(0)] });
4229
- const txBytes = import_tx13.Tx.encode(tx2).finish();
4230
- const restEndpoint = getSettings().endpoints.restEndpoint.replace(/\/$/, "");
4231
- const simResponse = await fetch(`${restEndpoint}/cosmos/tx/v1beta1/simulate`, {
4232
- method: "POST",
4233
- headers: { "Content-Type": "application/json" },
4234
- body: JSON.stringify({ tx_bytes: (0, import_encoding2.toBase64)(txBytes) })
4235
- });
4236
- if (!simResponse.ok) {
4237
- throw new Error(`Simulation request failed with status ${simResponse.status}`);
4238
- }
4239
- const simData = await simResponse.json();
4240
- const gasEstimated = Number((_b2 = (_a2 = simData == null ? void 0 : simData.gas_info) == null ? void 0 : _a2.gas_used) != null ? _b2 : 0);
4336
+ const sequence = await signer.getSequence(address);
4337
+ const signerInfo = import_tx13.SignerInfo.fromPartial({ modeInfo: { single: { mode: 1 } }, sequence });
4338
+ const { gasInfo } = await signer.simulateByTxBody(txBody, [signerInfo]);
4339
+ const gasEstimated = Number((_a2 = gasInfo == null ? void 0 : gasInfo.gasUsed) != null ? _a2 : BigInt(0));
4241
4340
  if (gasEstimated === 0) {
4242
4341
  throw new Error("Gas simulation returned 0");
4243
4342
  }
4244
- const gasAmount = (0, import_bignumber13.default)(gasEstimated).multipliedBy(1.5);
4343
+ const gasAmount = (0, import_bignumber13.default)(gasEstimated).multipliedBy(getGasMultiplier());
4245
4344
  const gasPayment = gasAmount.multipliedBy(gasPrice);
4246
4345
  const nativeFee = {
4247
4346
  amount: coins(gasPayment.toFixed(0).toString(), nativeDenom),
@@ -5681,6 +5780,7 @@ var TestnetBanner = () => {
5681
5780
  shortNumberFormat,
5682
5781
  sleep,
5683
5782
  stringTruncateFromCenter,
5783
+ subscribeToBlockchainEvents,
5684
5784
  toBigNumber,
5685
5785
  toPercentage,
5686
5786
  truncateAddress,