@bze/bze-ui-kit 1.0.6 → 1.0.8
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 +34 -1
- package/dist/index.d.ts +34 -1
- package/dist/index.js +200 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +189 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -358,6 +358,16 @@ declare const isIbcAsset: (asset: Asset) => boolean;
|
|
|
358
358
|
declare const getMarketOrderBookChangedEvent: (marketId: string) => string;
|
|
359
359
|
declare const getMarketEventKey: (eventType: string, marketId: string) => string;
|
|
360
360
|
declare const mapEventAttributes: (attributes: Attribute[]) => Record<string, string>;
|
|
361
|
+
declare const getEventKeyValue: (event: TendermintEvent, key: string) => string | undefined;
|
|
362
|
+
declare const getEventMarketId: (event: TendermintEvent) => string | undefined;
|
|
363
|
+
declare const isAddressTransfer: (address: string, event: TendermintEvent) => boolean;
|
|
364
|
+
declare const isOrderBookEvent: (event: TendermintEvent) => boolean;
|
|
365
|
+
declare const isOrderExecutedEvent: (event: TendermintEvent) => boolean;
|
|
366
|
+
declare const isSwapEvent: (event: TendermintEvent) => boolean;
|
|
367
|
+
declare const isCoinbaseEvent: (event: TendermintEvent) => boolean;
|
|
368
|
+
declare const isBurnEvent: (event: TendermintEvent) => boolean;
|
|
369
|
+
declare const isEpochStartEvent: (event: TendermintEvent) => boolean;
|
|
370
|
+
declare const getMintedAmount: (event: TendermintEvent) => _bze_bzejs_cosmos_base_v1beta1_coin.Coin[];
|
|
361
371
|
|
|
362
372
|
declare const formatUsdAmount: (priceNum: BigNumber) => string;
|
|
363
373
|
declare function shortNumberFormat(amount: BigNumber): string;
|
|
@@ -425,6 +435,29 @@ declare const getValidatorSupportedDenoms: () => string[];
|
|
|
425
435
|
declare const getValidatorPageUrl: () => string;
|
|
426
436
|
declare const isPoolSupportedByValidator: (baseDenom: string, quoteDenom: string) => boolean;
|
|
427
437
|
|
|
438
|
+
/**
|
|
439
|
+
* Shared WebSocket singleton for CometBFT event subscriptions.
|
|
440
|
+
*
|
|
441
|
+
* One persistent connection is reused across all callers (useBlockchainListener,
|
|
442
|
+
* etc.) so the app opens a single WebSocket to the RPC node instead of one
|
|
443
|
+
* per hook instance.
|
|
444
|
+
*
|
|
445
|
+
* CometBFT sends subscription notifications by reusing the original request ID
|
|
446
|
+
* (not the Ethereum-style params.subscription pattern), so we track active
|
|
447
|
+
* subscriptions by their call ID and dispatch incoming messages accordingly.
|
|
448
|
+
*/
|
|
449
|
+
/**
|
|
450
|
+
* Subscribes to CometBFT events using the shared WebSocket connection.
|
|
451
|
+
* The handler receives `msg.result` for every notification:
|
|
452
|
+
* result.data.value.result_finalize_block.events — NewBlock events
|
|
453
|
+
* result.data.value.txs_results — block Tx results
|
|
454
|
+
* result.data.value.TxResult.result.events — Tx subscription events
|
|
455
|
+
*
|
|
456
|
+
* Returns an unsubscribe function that cleans up the subscription.
|
|
457
|
+
* Active subscriptions are automatically resubscribed after reconnection.
|
|
458
|
+
*/
|
|
459
|
+
declare const subscribeToBlockchainEvents: (rpcEndpoint: string, query: string, handler: (result: unknown) => void) => Promise<() => void>;
|
|
460
|
+
|
|
428
461
|
declare const ASSET_TYPE_FACTORY = "Factory";
|
|
429
462
|
declare const ASSET_TYPE_IBC = "IBC";
|
|
430
463
|
declare const ASSET_TYPE_NATIVE = "Native";
|
|
@@ -1293,4 +1326,4 @@ declare function SettingsToggle({ accentColor }: SettingsToggleProps): react_jsx
|
|
|
1293
1326
|
|
|
1294
1327
|
declare const TestnetBanner: () => react_jsx_runtime.JSX.Element | null;
|
|
1295
1328
|
|
|
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 };
|
|
1329
|
+
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, getEventKeyValue, getEventMarketId, 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, getMintedAmount, 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, isAddressTransfer, isBurnEvent, isCoinbaseEvent, isEpochStartEvent, isFactoryDenom, isIbcAsset, isIbcDenom, isLpDenom, isNativeDenom, isOrderBookEvent, isOrderExecutedEvent, isPoolSupportedByValidator, isSwapEvent, 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
|
@@ -358,6 +358,16 @@ declare const isIbcAsset: (asset: Asset) => boolean;
|
|
|
358
358
|
declare const getMarketOrderBookChangedEvent: (marketId: string) => string;
|
|
359
359
|
declare const getMarketEventKey: (eventType: string, marketId: string) => string;
|
|
360
360
|
declare const mapEventAttributes: (attributes: Attribute[]) => Record<string, string>;
|
|
361
|
+
declare const getEventKeyValue: (event: TendermintEvent, key: string) => string | undefined;
|
|
362
|
+
declare const getEventMarketId: (event: TendermintEvent) => string | undefined;
|
|
363
|
+
declare const isAddressTransfer: (address: string, event: TendermintEvent) => boolean;
|
|
364
|
+
declare const isOrderBookEvent: (event: TendermintEvent) => boolean;
|
|
365
|
+
declare const isOrderExecutedEvent: (event: TendermintEvent) => boolean;
|
|
366
|
+
declare const isSwapEvent: (event: TendermintEvent) => boolean;
|
|
367
|
+
declare const isCoinbaseEvent: (event: TendermintEvent) => boolean;
|
|
368
|
+
declare const isBurnEvent: (event: TendermintEvent) => boolean;
|
|
369
|
+
declare const isEpochStartEvent: (event: TendermintEvent) => boolean;
|
|
370
|
+
declare const getMintedAmount: (event: TendermintEvent) => _bze_bzejs_cosmos_base_v1beta1_coin.Coin[];
|
|
361
371
|
|
|
362
372
|
declare const formatUsdAmount: (priceNum: BigNumber) => string;
|
|
363
373
|
declare function shortNumberFormat(amount: BigNumber): string;
|
|
@@ -425,6 +435,29 @@ declare const getValidatorSupportedDenoms: () => string[];
|
|
|
425
435
|
declare const getValidatorPageUrl: () => string;
|
|
426
436
|
declare const isPoolSupportedByValidator: (baseDenom: string, quoteDenom: string) => boolean;
|
|
427
437
|
|
|
438
|
+
/**
|
|
439
|
+
* Shared WebSocket singleton for CometBFT event subscriptions.
|
|
440
|
+
*
|
|
441
|
+
* One persistent connection is reused across all callers (useBlockchainListener,
|
|
442
|
+
* etc.) so the app opens a single WebSocket to the RPC node instead of one
|
|
443
|
+
* per hook instance.
|
|
444
|
+
*
|
|
445
|
+
* CometBFT sends subscription notifications by reusing the original request ID
|
|
446
|
+
* (not the Ethereum-style params.subscription pattern), so we track active
|
|
447
|
+
* subscriptions by their call ID and dispatch incoming messages accordingly.
|
|
448
|
+
*/
|
|
449
|
+
/**
|
|
450
|
+
* Subscribes to CometBFT events using the shared WebSocket connection.
|
|
451
|
+
* The handler receives `msg.result` for every notification:
|
|
452
|
+
* result.data.value.result_finalize_block.events — NewBlock events
|
|
453
|
+
* result.data.value.txs_results — block Tx results
|
|
454
|
+
* result.data.value.TxResult.result.events — Tx subscription events
|
|
455
|
+
*
|
|
456
|
+
* Returns an unsubscribe function that cleans up the subscription.
|
|
457
|
+
* Active subscriptions are automatically resubscribed after reconnection.
|
|
458
|
+
*/
|
|
459
|
+
declare const subscribeToBlockchainEvents: (rpcEndpoint: string, query: string, handler: (result: unknown) => void) => Promise<() => void>;
|
|
460
|
+
|
|
428
461
|
declare const ASSET_TYPE_FACTORY = "Factory";
|
|
429
462
|
declare const ASSET_TYPE_IBC = "IBC";
|
|
430
463
|
declare const ASSET_TYPE_NATIVE = "Native";
|
|
@@ -1293,4 +1326,4 @@ declare function SettingsToggle({ accentColor }: SettingsToggleProps): react_jsx
|
|
|
1293
1326
|
|
|
1294
1327
|
declare const TestnetBanner: () => react_jsx_runtime.JSX.Element | null;
|
|
1295
1328
|
|
|
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 };
|
|
1329
|
+
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, getEventKeyValue, getEventMarketId, 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, getMintedAmount, 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, isAddressTransfer, isBurnEvent, isCoinbaseEvent, isEpochStartEvent, isFactoryDenom, isIbcAsset, isIbcDenom, isLpDenom, isNativeDenom, isOrderBookEvent, isOrderExecutedEvent, isPoolSupportedByValidator, isSwapEvent, 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
|
@@ -191,6 +191,8 @@ __export(index_exports, {
|
|
|
191
191
|
getEcosystemApps: () => getEcosystemApps,
|
|
192
192
|
getEpochDurationByIdentifier: () => getEpochDurationByIdentifier,
|
|
193
193
|
getEpochsInfo: () => getEpochsInfo,
|
|
194
|
+
getEventKeyValue: () => getEventKeyValue,
|
|
195
|
+
getEventMarketId: () => getEventMarketId,
|
|
194
196
|
getFactoryDenomAdminAddress: () => getFactoryDenomAdminAddress,
|
|
195
197
|
getFromLocalStorage: () => getFromLocalStorage,
|
|
196
198
|
getHardcodedLockAddress: () => getHardcodedLockAddress,
|
|
@@ -216,6 +218,7 @@ __export(index_exports, {
|
|
|
216
218
|
getMarketSellOrders: () => getMarketSellOrders,
|
|
217
219
|
getMarkets: () => getMarkets,
|
|
218
220
|
getMinAmount: () => getMinAmount,
|
|
221
|
+
getMintedAmount: () => getMintedAmount,
|
|
219
222
|
getModuleAddress: () => getModuleAddress,
|
|
220
223
|
getNextBurning: () => getNextBurning,
|
|
221
224
|
getNoOfIntervalsNeeded: () => getNoOfIntervalsNeeded,
|
|
@@ -249,12 +252,19 @@ __export(index_exports, {
|
|
|
249
252
|
getWalletChainsNames: () => getWalletChainsNames,
|
|
250
253
|
getWeekEpochInfo: () => getWeekEpochInfo,
|
|
251
254
|
intlDateFormat: () => intlDateFormat,
|
|
255
|
+
isAddressTransfer: () => isAddressTransfer,
|
|
256
|
+
isBurnEvent: () => isBurnEvent,
|
|
257
|
+
isCoinbaseEvent: () => isCoinbaseEvent,
|
|
258
|
+
isEpochStartEvent: () => isEpochStartEvent,
|
|
252
259
|
isFactoryDenom: () => isFactoryDenom,
|
|
253
260
|
isIbcAsset: () => isIbcAsset,
|
|
254
261
|
isIbcDenom: () => isIbcDenom,
|
|
255
262
|
isLpDenom: () => isLpDenom,
|
|
256
263
|
isNativeDenom: () => isNativeDenom,
|
|
264
|
+
isOrderBookEvent: () => isOrderBookEvent,
|
|
265
|
+
isOrderExecutedEvent: () => isOrderExecutedEvent,
|
|
257
266
|
isPoolSupportedByValidator: () => isPoolSupportedByValidator,
|
|
267
|
+
isSwapEvent: () => isSwapEvent,
|
|
258
268
|
isTestnetChain: () => isTestnetChain,
|
|
259
269
|
keplrSuggestChain: () => keplrSuggestChain,
|
|
260
270
|
mapEventAttributes: () => mapEventAttributes,
|
|
@@ -278,6 +288,7 @@ __export(index_exports, {
|
|
|
278
288
|
shortNumberFormat: () => shortNumberFormat,
|
|
279
289
|
sleep: () => sleep,
|
|
280
290
|
stringTruncateFromCenter: () => stringTruncateFromCenter,
|
|
291
|
+
subscribeToBlockchainEvents: () => subscribeToBlockchainEvents,
|
|
281
292
|
toBigNumber: () => toBigNumber,
|
|
282
293
|
toPercentage: () => toPercentage,
|
|
283
294
|
truncateAddress: () => truncateAddress,
|
|
@@ -894,12 +905,82 @@ function truncateDenom(denom) {
|
|
|
894
905
|
}
|
|
895
906
|
var isIbcAsset = (asset) => asset.type === ASSET_TYPE_IBC;
|
|
896
907
|
|
|
908
|
+
// src/utils/coins.ts
|
|
909
|
+
var coin = (amount, denom) => {
|
|
910
|
+
let outAmount;
|
|
911
|
+
if (typeof amount === "number") {
|
|
912
|
+
if (!Number.isInteger(amount) || amount < 0 || amount > Number.MAX_SAFE_INTEGER) {
|
|
913
|
+
throw new Error("Given amount is not a safe integer. Consider using a string instead to overcome the limitations of JS numbers.");
|
|
914
|
+
}
|
|
915
|
+
outAmount = String(amount);
|
|
916
|
+
} else {
|
|
917
|
+
if (!amount.match(/^[0-9]+$/)) {
|
|
918
|
+
throw new Error("Invalid unsigned integer string format");
|
|
919
|
+
}
|
|
920
|
+
outAmount = amount.replace(/^0*/, "") || "0";
|
|
921
|
+
}
|
|
922
|
+
return { amount: outAmount, denom };
|
|
923
|
+
};
|
|
924
|
+
var coins = (amount, denom) => {
|
|
925
|
+
return [coin(amount, denom)];
|
|
926
|
+
};
|
|
927
|
+
var parseCoins = (input) => {
|
|
928
|
+
return input.replace(/\s/g, "").split(",").filter(Boolean).map((part) => {
|
|
929
|
+
const match = part.match(/^([0-9]+)([a-zA-Z][a-zA-Z0-9/:._-]{2,127})$/);
|
|
930
|
+
if (!match) throw new Error("Got an invalid coin string");
|
|
931
|
+
return {
|
|
932
|
+
amount: match[1].replace(/^0+/, "") || "0",
|
|
933
|
+
denom: match[2]
|
|
934
|
+
};
|
|
935
|
+
});
|
|
936
|
+
};
|
|
937
|
+
|
|
897
938
|
// src/utils/events.ts
|
|
898
939
|
var getMarketOrderBookChangedEvent = (marketId) => getMarketEventKey(ORDER_BOOK_CHANGED_EVENT, marketId);
|
|
899
940
|
var getMarketEventKey = (eventType, marketId) => `${eventType}:${marketId}`;
|
|
900
941
|
var mapEventAttributes = (attributes) => {
|
|
901
942
|
return attributes.reduce((acc, attr) => __spreadProps(__spreadValues({}, acc), { [attr.key]: attr.value.replace('"', "").replace('"', "") }), {});
|
|
902
943
|
};
|
|
944
|
+
var getEventKeyValue = (event, key) => {
|
|
945
|
+
var _a2;
|
|
946
|
+
return (_a2 = event.attributes.find((attribute) => attribute.key === key)) == null ? void 0 : _a2.value;
|
|
947
|
+
};
|
|
948
|
+
var getEventMarketId = (event) => {
|
|
949
|
+
var _a2;
|
|
950
|
+
return (_a2 = getEventKeyValue(event, "market_id")) == null ? void 0 : _a2.replaceAll('"', "");
|
|
951
|
+
};
|
|
952
|
+
var isAddressTransfer = (address, event) => {
|
|
953
|
+
if (address === "" || event.type !== "transfer") return false;
|
|
954
|
+
return event.attributes.find((attribute) => attribute.value === address) !== void 0;
|
|
955
|
+
};
|
|
956
|
+
var isOrderBookEvent = (event) => {
|
|
957
|
+
return event.type.includes("bze.tradebin.Order");
|
|
958
|
+
};
|
|
959
|
+
var isOrderExecutedEvent = (event) => {
|
|
960
|
+
return event.type.includes("bze.tradebin.OrderExecutedEvent");
|
|
961
|
+
};
|
|
962
|
+
var isSwapEvent = (event) => {
|
|
963
|
+
return event.type.includes("bze.tradebin.SwapEvent");
|
|
964
|
+
};
|
|
965
|
+
var isCoinbaseEvent = (event) => {
|
|
966
|
+
return event.type.includes("coinbase");
|
|
967
|
+
};
|
|
968
|
+
var isBurnEvent = (event) => {
|
|
969
|
+
return event.type.includes("burn");
|
|
970
|
+
};
|
|
971
|
+
var isEpochStartEvent = (event) => {
|
|
972
|
+
return event.type.includes("bze.epochs.EpochStartEvent");
|
|
973
|
+
};
|
|
974
|
+
var getMintedAmount = (event) => {
|
|
975
|
+
const defaultCoin = coins(0, getChainNativeAssetDenom());
|
|
976
|
+
try {
|
|
977
|
+
const amountAttribute = event.attributes.find((attribute) => attribute.key === "amount");
|
|
978
|
+
return amountAttribute ? parseCoins(amountAttribute.value) : defaultCoin;
|
|
979
|
+
} catch (e) {
|
|
980
|
+
console.error("Failed to parse minted amount from coinbase event", e);
|
|
981
|
+
return defaultCoin;
|
|
982
|
+
}
|
|
983
|
+
};
|
|
903
984
|
|
|
904
985
|
// src/utils/formatter.ts
|
|
905
986
|
var import_bignumber2 = __toESM(require("bignumber.js"));
|
|
@@ -1014,36 +1095,6 @@ var openExternalLink = (url) => {
|
|
|
1014
1095
|
window.open(url, "_blank", "noopener,noreferrer");
|
|
1015
1096
|
};
|
|
1016
1097
|
|
|
1017
|
-
// src/utils/coins.ts
|
|
1018
|
-
var coin = (amount, denom) => {
|
|
1019
|
-
let outAmount;
|
|
1020
|
-
if (typeof amount === "number") {
|
|
1021
|
-
if (!Number.isInteger(amount) || amount < 0 || amount > Number.MAX_SAFE_INTEGER) {
|
|
1022
|
-
throw new Error("Given amount is not a safe integer. Consider using a string instead to overcome the limitations of JS numbers.");
|
|
1023
|
-
}
|
|
1024
|
-
outAmount = String(amount);
|
|
1025
|
-
} else {
|
|
1026
|
-
if (!amount.match(/^[0-9]+$/)) {
|
|
1027
|
-
throw new Error("Invalid unsigned integer string format");
|
|
1028
|
-
}
|
|
1029
|
-
outAmount = amount.replace(/^0*/, "") || "0";
|
|
1030
|
-
}
|
|
1031
|
-
return { amount: outAmount, denom };
|
|
1032
|
-
};
|
|
1033
|
-
var coins = (amount, denom) => {
|
|
1034
|
-
return [coin(amount, denom)];
|
|
1035
|
-
};
|
|
1036
|
-
var parseCoins = (input) => {
|
|
1037
|
-
return input.replace(/\s/g, "").split(",").filter(Boolean).map((part) => {
|
|
1038
|
-
const match = part.match(/^([0-9]+)([a-zA-Z][a-zA-Z0-9/:._-]{2,127})$/);
|
|
1039
|
-
if (!match) throw new Error("Got an invalid coin string");
|
|
1040
|
-
return {
|
|
1041
|
-
amount: match[1].replace(/^0+/, "") || "0",
|
|
1042
|
-
denom: match[2]
|
|
1043
|
-
};
|
|
1044
|
-
});
|
|
1045
|
-
};
|
|
1046
|
-
|
|
1047
1098
|
// src/utils/ibc.ts
|
|
1048
1099
|
var import_bignumber3 = __toESM(require("bignumber.js"));
|
|
1049
1100
|
var canDepositFromIBC = (ibcData2) => {
|
|
@@ -1710,6 +1761,114 @@ var isPoolSupportedByValidator = (baseDenom, quoteDenom) => {
|
|
|
1710
1761
|
return supportedDenoms.includes(baseDenom) || supportedDenoms.includes(quoteDenom);
|
|
1711
1762
|
};
|
|
1712
1763
|
|
|
1764
|
+
// src/utils/ws_rpc_client.ts
|
|
1765
|
+
var socket = null;
|
|
1766
|
+
var activeUrl = "";
|
|
1767
|
+
var socketConnected = false;
|
|
1768
|
+
var connectingPromise = null;
|
|
1769
|
+
var msgId = 0;
|
|
1770
|
+
var reconnectAttempts = 0;
|
|
1771
|
+
var reconnectTimeout = null;
|
|
1772
|
+
var MAX_RECONNECT_ATTEMPTS = 10;
|
|
1773
|
+
var activeSubscriptions = /* @__PURE__ */ new Map();
|
|
1774
|
+
var handleMessage = (event) => {
|
|
1775
|
+
var _a2;
|
|
1776
|
+
try {
|
|
1777
|
+
const msg = JSON.parse(event.data);
|
|
1778
|
+
const id = String((_a2 = msg == null ? void 0 : msg.id) != null ? _a2 : "");
|
|
1779
|
+
if (id && activeSubscriptions.has(id) && msg.result && Object.keys(msg.result).length > 0) {
|
|
1780
|
+
activeSubscriptions.get(id).handler(msg.result);
|
|
1781
|
+
}
|
|
1782
|
+
} catch (e) {
|
|
1783
|
+
}
|
|
1784
|
+
};
|
|
1785
|
+
var resubscribeAll = () => {
|
|
1786
|
+
for (const [id, sub] of activeSubscriptions) {
|
|
1787
|
+
socket.send(JSON.stringify({
|
|
1788
|
+
jsonrpc: "2.0",
|
|
1789
|
+
method: "subscribe",
|
|
1790
|
+
id,
|
|
1791
|
+
params: { query: sub.query }
|
|
1792
|
+
}));
|
|
1793
|
+
}
|
|
1794
|
+
};
|
|
1795
|
+
var scheduleReconnect = () => {
|
|
1796
|
+
if (reconnectAttempts >= MAX_RECONNECT_ATTEMPTS) {
|
|
1797
|
+
console.error("[WS] Max reconnect attempts reached");
|
|
1798
|
+
return;
|
|
1799
|
+
}
|
|
1800
|
+
reconnectAttempts++;
|
|
1801
|
+
const delay = Math.min(1e3 * Math.pow(2, reconnectAttempts - 1), 3e4);
|
|
1802
|
+
reconnectTimeout = setTimeout(async () => {
|
|
1803
|
+
try {
|
|
1804
|
+
await openSocket(activeUrl);
|
|
1805
|
+
resubscribeAll();
|
|
1806
|
+
reconnectAttempts = 0;
|
|
1807
|
+
} catch (e) {
|
|
1808
|
+
scheduleReconnect();
|
|
1809
|
+
}
|
|
1810
|
+
}, delay);
|
|
1811
|
+
};
|
|
1812
|
+
var openSocket = (url) => {
|
|
1813
|
+
return new Promise((resolve, reject) => {
|
|
1814
|
+
const ws = new WebSocket(url);
|
|
1815
|
+
ws.onopen = () => {
|
|
1816
|
+
socket = ws;
|
|
1817
|
+
socketConnected = true;
|
|
1818
|
+
resolve();
|
|
1819
|
+
};
|
|
1820
|
+
ws.onmessage = handleMessage;
|
|
1821
|
+
ws.onclose = () => {
|
|
1822
|
+
socketConnected = false;
|
|
1823
|
+
scheduleReconnect();
|
|
1824
|
+
};
|
|
1825
|
+
ws.onerror = (err) => {
|
|
1826
|
+
socketConnected = false;
|
|
1827
|
+
reject(err);
|
|
1828
|
+
};
|
|
1829
|
+
});
|
|
1830
|
+
};
|
|
1831
|
+
var getOrCreateSocket = async (rpcEndpoint) => {
|
|
1832
|
+
const url = rpcEndpoint.replace(/\/?$/, "") + "/websocket";
|
|
1833
|
+
if (socket && socketConnected && activeUrl === url) return;
|
|
1834
|
+
if (connectingPromise && activeUrl === url) {
|
|
1835
|
+
return connectingPromise;
|
|
1836
|
+
}
|
|
1837
|
+
if (socket) {
|
|
1838
|
+
socket.onclose = null;
|
|
1839
|
+
socket.close(1e3, "Endpoint changed");
|
|
1840
|
+
socket = null;
|
|
1841
|
+
socketConnected = false;
|
|
1842
|
+
if (reconnectTimeout) {
|
|
1843
|
+
clearTimeout(reconnectTimeout);
|
|
1844
|
+
reconnectTimeout = null;
|
|
1845
|
+
}
|
|
1846
|
+
reconnectAttempts = 0;
|
|
1847
|
+
}
|
|
1848
|
+
activeUrl = url;
|
|
1849
|
+
connectingPromise = openSocket(url).finally(() => {
|
|
1850
|
+
connectingPromise = null;
|
|
1851
|
+
});
|
|
1852
|
+
return connectingPromise;
|
|
1853
|
+
};
|
|
1854
|
+
var subscribeToBlockchainEvents = async (rpcEndpoint, query, handler) => {
|
|
1855
|
+
await getOrCreateSocket(rpcEndpoint);
|
|
1856
|
+
const id = String(++msgId);
|
|
1857
|
+
activeSubscriptions.set(id, { query, handler });
|
|
1858
|
+
socket.send(JSON.stringify({ jsonrpc: "2.0", method: "subscribe", id, params: { query } }));
|
|
1859
|
+
return () => {
|
|
1860
|
+
activeSubscriptions.delete(id);
|
|
1861
|
+
if ((socket == null ? void 0 : socket.readyState) === WebSocket.OPEN) {
|
|
1862
|
+
socket.send(JSON.stringify({
|
|
1863
|
+
jsonrpc: "2.0",
|
|
1864
|
+
method: "unsubscribe",
|
|
1865
|
+
id: String(++msgId),
|
|
1866
|
+
params: { query }
|
|
1867
|
+
}));
|
|
1868
|
+
}
|
|
1869
|
+
};
|
|
1870
|
+
};
|
|
1871
|
+
|
|
1713
1872
|
// src/constants/market.ts
|
|
1714
1873
|
var EXCLUDED_MARKETS = {
|
|
1715
1874
|
"factory/bze1f0qgels0eu96ev6a67znu70q7rquy9eragn8nw/ucorey/factory/bze13gzq40che93tgfm9kzmkpjamah5nj0j73pyhqk/uvdl": true,
|
|
@@ -5584,6 +5743,8 @@ var TestnetBanner = () => {
|
|
|
5584
5743
|
getEcosystemApps,
|
|
5585
5744
|
getEpochDurationByIdentifier,
|
|
5586
5745
|
getEpochsInfo,
|
|
5746
|
+
getEventKeyValue,
|
|
5747
|
+
getEventMarketId,
|
|
5587
5748
|
getFactoryDenomAdminAddress,
|
|
5588
5749
|
getFromLocalStorage,
|
|
5589
5750
|
getHardcodedLockAddress,
|
|
@@ -5609,6 +5770,7 @@ var TestnetBanner = () => {
|
|
|
5609
5770
|
getMarketSellOrders,
|
|
5610
5771
|
getMarkets,
|
|
5611
5772
|
getMinAmount,
|
|
5773
|
+
getMintedAmount,
|
|
5612
5774
|
getModuleAddress,
|
|
5613
5775
|
getNextBurning,
|
|
5614
5776
|
getNoOfIntervalsNeeded,
|
|
@@ -5642,12 +5804,19 @@ var TestnetBanner = () => {
|
|
|
5642
5804
|
getWalletChainsNames,
|
|
5643
5805
|
getWeekEpochInfo,
|
|
5644
5806
|
intlDateFormat,
|
|
5807
|
+
isAddressTransfer,
|
|
5808
|
+
isBurnEvent,
|
|
5809
|
+
isCoinbaseEvent,
|
|
5810
|
+
isEpochStartEvent,
|
|
5645
5811
|
isFactoryDenom,
|
|
5646
5812
|
isIbcAsset,
|
|
5647
5813
|
isIbcDenom,
|
|
5648
5814
|
isLpDenom,
|
|
5649
5815
|
isNativeDenom,
|
|
5816
|
+
isOrderBookEvent,
|
|
5817
|
+
isOrderExecutedEvent,
|
|
5650
5818
|
isPoolSupportedByValidator,
|
|
5819
|
+
isSwapEvent,
|
|
5651
5820
|
isTestnetChain,
|
|
5652
5821
|
keplrSuggestChain,
|
|
5653
5822
|
mapEventAttributes,
|
|
@@ -5671,6 +5840,7 @@ var TestnetBanner = () => {
|
|
|
5671
5840
|
shortNumberFormat,
|
|
5672
5841
|
sleep,
|
|
5673
5842
|
stringTruncateFromCenter,
|
|
5843
|
+
subscribeToBlockchainEvents,
|
|
5674
5844
|
toBigNumber,
|
|
5675
5845
|
toPercentage,
|
|
5676
5846
|
truncateAddress,
|