@bze/bze-ui-kit 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +37 -3
- package/dist/index.d.ts +37 -3
- package/dist/index.js +222 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +252 -65
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1036,6 +1036,7 @@ declare function useEpochs(): {
|
|
|
1036
1036
|
declare function useLiquidityPools(): {
|
|
1037
1037
|
pools: LiquidityPoolSDKType[];
|
|
1038
1038
|
poolsMap: Map<string, LiquidityPoolSDKType>;
|
|
1039
|
+
poolsData: Map<string, LiquidityPoolData>;
|
|
1039
1040
|
poolsDataMap: Map<string, LiquidityPoolData>;
|
|
1040
1041
|
isLoading: boolean;
|
|
1041
1042
|
updateLiquidityPools: () => Promise<void>;
|
|
@@ -1046,11 +1047,28 @@ declare function useLiquidityPools(): {
|
|
|
1046
1047
|
declare function useAssetLiquidityPools(denom: string): {
|
|
1047
1048
|
assetPools: LiquidityPoolSDKType[];
|
|
1048
1049
|
poolsDataMap: Map<string, LiquidityPoolData>;
|
|
1050
|
+
isLoading: boolean;
|
|
1051
|
+
asset24HoursVolume: BigNumber;
|
|
1052
|
+
assetPoolsData: Map<string, LiquidityPoolData>;
|
|
1053
|
+
};
|
|
1054
|
+
declare function useLiquidityPool(poolId: string): {
|
|
1055
|
+
isLoading: boolean;
|
|
1056
|
+
pool: LiquidityPoolSDKType | undefined;
|
|
1057
|
+
poolData: LiquidityPoolData | undefined;
|
|
1058
|
+
userShares: BigNumber;
|
|
1059
|
+
totalShares: BigNumber;
|
|
1060
|
+
userSharesPercentage: string | BigNumber;
|
|
1061
|
+
userReserveBase: BigNumber;
|
|
1062
|
+
userReserveQuote: BigNumber;
|
|
1063
|
+
calculateOppositeAmount: (amount: string | BigNumber, isBase: boolean) => BigNumber;
|
|
1064
|
+
calculateSharesFromAmounts: (baseAmount: string | BigNumber, quoteAmount: string | BigNumber) => BigNumber;
|
|
1049
1065
|
};
|
|
1050
1066
|
|
|
1051
1067
|
declare function useAssetsValue(): {
|
|
1052
|
-
totalUsdValue: BigNumber;
|
|
1068
|
+
totalUsdValue: (prettyBalances: PrettyBalance[]) => BigNumber;
|
|
1069
|
+
walletTotalUsdValue: BigNumber;
|
|
1053
1070
|
denomUsdValue: (denom: string, uAmount: BigNumber) => BigNumber;
|
|
1071
|
+
compareValues: (a: PrettyBalance, b: PrettyBalance) => 0 | 1 | -1;
|
|
1054
1072
|
isLoading: boolean;
|
|
1055
1073
|
};
|
|
1056
1074
|
|
|
@@ -1062,19 +1080,35 @@ declare function useFeeTokens(): {
|
|
|
1062
1080
|
|
|
1063
1081
|
declare function useMarkets(): {
|
|
1064
1082
|
markets: _bze_bzejs_bze_tradebin_store.MarketSDKType[];
|
|
1083
|
+
marketsData: MarketData[];
|
|
1065
1084
|
marketsMap: Map<string, _bze_bzejs_bze_tradebin_store.MarketSDKType>;
|
|
1066
1085
|
marketsDataMap: Map<string, MarketData>;
|
|
1067
1086
|
isLoading: boolean;
|
|
1068
1087
|
updateMarkets: () => void;
|
|
1088
|
+
marketExists: (marketId: string) => boolean;
|
|
1089
|
+
getMarketData: (marketId: string) => MarketData | undefined;
|
|
1090
|
+
getMarket: (marketId: string) => Market | undefined;
|
|
1069
1091
|
};
|
|
1070
1092
|
declare function useAssetMarkets(denom: string): {
|
|
1093
|
+
isLoading: boolean;
|
|
1071
1094
|
assetMarkets: _bze_bzejs_bze_tradebin_store.MarketSDKType[];
|
|
1095
|
+
assetMarketsData: MarketData[];
|
|
1096
|
+
asset24hTradedVolume: BigNumber;
|
|
1072
1097
|
};
|
|
1073
|
-
|
|
1098
|
+
/**
|
|
1099
|
+
* Hook to get a market by its ID string.
|
|
1100
|
+
*/
|
|
1101
|
+
declare function useMarket(marketId: string): {
|
|
1102
|
+
isLoading: boolean;
|
|
1074
1103
|
market: _bze_bzejs_bze_tradebin_store.MarketSDKType | undefined;
|
|
1075
1104
|
marketData: MarketData | undefined;
|
|
1105
|
+
marketSymbol: string;
|
|
1106
|
+
marketId: string;
|
|
1076
1107
|
marketExists: boolean;
|
|
1077
1108
|
volume24h: BigNumber;
|
|
1109
|
+
};
|
|
1110
|
+
declare function useMarketsManager(): {
|
|
1111
|
+
updateMarkets: () => void;
|
|
1078
1112
|
isLoading: boolean;
|
|
1079
1113
|
};
|
|
1080
1114
|
|
|
@@ -1169,4 +1203,4 @@ interface SettingsToggleProps {
|
|
|
1169
1203
|
}
|
|
1170
1204
|
declare function SettingsToggle({ accentColor }: SettingsToggleProps): react_jsx_runtime.JSX.Element;
|
|
1171
1205
|
|
|
1172
|
-
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, 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, 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, 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, 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, getBurnerParams, getBurnerParamsWithClient, getChainAddressPrefix, getChainAssets, getChainByChainId, getChainByName, getChainExplorerURL, getChainId, getChainName, getChainNativeAssetDenom, getChains, getChartIntervalsLimit, getChartMinutes, getCurrentEpoch, getCurrentWeekEpochEndTime, getDefaultTxMemo, getDenomType, getDistributionParams, getEcosystemApps, getEpochDurationByIdentifier, getEpochsInfo, getFactoryDenomAdminAddress, getFromLocalStorage, getHashIBCTrace, getHourEpochInfo, getIBCAssetList, getIBCTraces, getIbcTransferTimeout, getJackalRestURL, getJackalRpcUrl, getKeyExpiry, getLiquidityPool, getLiquidityPools, getLockedBalances, getLockerAddress, getMarketBuyOrders, getMarketEventKey, getMarketHistory, getMarketOrder, getMarketOrderBookChangedEvent, getMarketOrders, getMarketOrdersHistory, getMarketSellOrders, getMarkets, getMinAmount, getNoOfIntervalsNeeded, getNobleRestURL, getNobleRpcUrl, getOmniFlixRestURL, getOmniFlixRpcUrl, getOsmosisRestURL, getOsmosisRpcUrl, getPageRequestWithLimit, getPendingUnlockParticipants, getPeriodicEpochEndTime, getPeriodicWeekEpochEndTime, getRestClient, getRestURL, getRpcURL, getSettings, getStakingParams, getStakingPool, getStakingRewardParticipantByAddress, getStakingRewards, getTradingViewIntervals, getUSDCDenom, getValidatorPageUrl, getValidatorSupportedDenoms, getWalletChainsNames, getWeekEpochInfo, intlDateFormat, isFactoryDenom, isIbcAsset, isIbcDenom, isLpDenom, isNativeDenom, isPoolSupportedByValidator, isTestnetChain, keplrSuggestChain, mapEventAttributes, openExternalLink, parseUnbondingDays, poolIdFromPoolDenom, prettyAmount, prettyError, priceToBigNumberUPrice, priceToUPrice, removeFromLocalStorage, removeLeadingZeros, sanitizeIntegerInput, sanitizeNumberInput, setDefaultTxMemo, setInLocalStorage, setKeyExpiry, setSettings, setStorageKeyVersion, shortNumberFormat, sleep, stringTruncateFromCenter, toBigNumber, toPercentage, truncateAddress, truncateDenom, uAmountToAmount, uAmountToBigNumberAmount, uPriceToBigNumberPrice, uPriceToPrice, useAsset, useAssetLiquidityPools, useAssetMarkets, useAssetPrice, useAssets, useAssetsContext, useAssetsManager, useAssetsValue, useBZETx, useBalance, useBalances, useConnectionType, useEpochs, useFeeTokens, useIBCChains, useIBCTx, useLiquidityPools, useMarket, useMarkets, useSDKTx, useSettings, useSigningClient, useToast, validateBZEBech32Address, validateBech32Address, validateEndpoints, validateRestEndpoint, validateRpcEndpoint };
|
|
1206
|
+
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, 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, 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, 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, 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, getBurnerParams, getBurnerParamsWithClient, getChainAddressPrefix, getChainAssets, getChainByChainId, getChainByName, getChainExplorerURL, getChainId, getChainName, getChainNativeAssetDenom, getChains, getChartIntervalsLimit, getChartMinutes, getCurrentEpoch, getCurrentWeekEpochEndTime, getDefaultTxMemo, getDenomType, getDistributionParams, getEcosystemApps, getEpochDurationByIdentifier, getEpochsInfo, getFactoryDenomAdminAddress, getFromLocalStorage, getHashIBCTrace, getHourEpochInfo, getIBCAssetList, getIBCTraces, getIbcTransferTimeout, getJackalRestURL, getJackalRpcUrl, getKeyExpiry, getLiquidityPool, getLiquidityPools, getLockedBalances, getLockerAddress, getMarketBuyOrders, getMarketEventKey, getMarketHistory, getMarketOrder, getMarketOrderBookChangedEvent, getMarketOrders, getMarketOrdersHistory, getMarketSellOrders, getMarkets, getMinAmount, getNoOfIntervalsNeeded, getNobleRestURL, getNobleRpcUrl, getOmniFlixRestURL, getOmniFlixRpcUrl, getOsmosisRestURL, getOsmosisRpcUrl, getPageRequestWithLimit, getPendingUnlockParticipants, getPeriodicEpochEndTime, getPeriodicWeekEpochEndTime, getRestClient, getRestURL, getRpcURL, getSettings, getStakingParams, getStakingPool, getStakingRewardParticipantByAddress, getStakingRewards, getTradingViewIntervals, getUSDCDenom, getValidatorPageUrl, getValidatorSupportedDenoms, getWalletChainsNames, getWeekEpochInfo, intlDateFormat, isFactoryDenom, isIbcAsset, isIbcDenom, isLpDenom, isNativeDenom, isPoolSupportedByValidator, isTestnetChain, keplrSuggestChain, mapEventAttributes, openExternalLink, parseUnbondingDays, poolIdFromPoolDenom, prettyAmount, prettyError, priceToBigNumberUPrice, priceToUPrice, removeFromLocalStorage, removeLeadingZeros, sanitizeIntegerInput, sanitizeNumberInput, setDefaultTxMemo, setInLocalStorage, setKeyExpiry, setSettings, setStorageKeyVersion, shortNumberFormat, sleep, stringTruncateFromCenter, toBigNumber, toPercentage, truncateAddress, truncateDenom, uAmountToAmount, uAmountToBigNumberAmount, uPriceToBigNumberPrice, uPriceToPrice, useAsset, useAssetLiquidityPools, useAssetMarkets, useAssetPrice, useAssets, useAssetsContext, useAssetsManager, useAssetsValue, useBZETx, useBalance, useBalances, useConnectionType, useEpochs, useFeeTokens, useIBCChains, useIBCTx, useLiquidityPool, useLiquidityPools, useMarket, useMarkets, useMarketsManager, useSDKTx, useSettings, useSigningClient, useToast, validateBZEBech32Address, validateBech32Address, validateEndpoints, validateRestEndpoint, validateRpcEndpoint };
|
package/dist/index.d.ts
CHANGED
|
@@ -1036,6 +1036,7 @@ declare function useEpochs(): {
|
|
|
1036
1036
|
declare function useLiquidityPools(): {
|
|
1037
1037
|
pools: LiquidityPoolSDKType[];
|
|
1038
1038
|
poolsMap: Map<string, LiquidityPoolSDKType>;
|
|
1039
|
+
poolsData: Map<string, LiquidityPoolData>;
|
|
1039
1040
|
poolsDataMap: Map<string, LiquidityPoolData>;
|
|
1040
1041
|
isLoading: boolean;
|
|
1041
1042
|
updateLiquidityPools: () => Promise<void>;
|
|
@@ -1046,11 +1047,28 @@ declare function useLiquidityPools(): {
|
|
|
1046
1047
|
declare function useAssetLiquidityPools(denom: string): {
|
|
1047
1048
|
assetPools: LiquidityPoolSDKType[];
|
|
1048
1049
|
poolsDataMap: Map<string, LiquidityPoolData>;
|
|
1050
|
+
isLoading: boolean;
|
|
1051
|
+
asset24HoursVolume: BigNumber;
|
|
1052
|
+
assetPoolsData: Map<string, LiquidityPoolData>;
|
|
1053
|
+
};
|
|
1054
|
+
declare function useLiquidityPool(poolId: string): {
|
|
1055
|
+
isLoading: boolean;
|
|
1056
|
+
pool: LiquidityPoolSDKType | undefined;
|
|
1057
|
+
poolData: LiquidityPoolData | undefined;
|
|
1058
|
+
userShares: BigNumber;
|
|
1059
|
+
totalShares: BigNumber;
|
|
1060
|
+
userSharesPercentage: string | BigNumber;
|
|
1061
|
+
userReserveBase: BigNumber;
|
|
1062
|
+
userReserveQuote: BigNumber;
|
|
1063
|
+
calculateOppositeAmount: (amount: string | BigNumber, isBase: boolean) => BigNumber;
|
|
1064
|
+
calculateSharesFromAmounts: (baseAmount: string | BigNumber, quoteAmount: string | BigNumber) => BigNumber;
|
|
1049
1065
|
};
|
|
1050
1066
|
|
|
1051
1067
|
declare function useAssetsValue(): {
|
|
1052
|
-
totalUsdValue: BigNumber;
|
|
1068
|
+
totalUsdValue: (prettyBalances: PrettyBalance[]) => BigNumber;
|
|
1069
|
+
walletTotalUsdValue: BigNumber;
|
|
1053
1070
|
denomUsdValue: (denom: string, uAmount: BigNumber) => BigNumber;
|
|
1071
|
+
compareValues: (a: PrettyBalance, b: PrettyBalance) => 0 | 1 | -1;
|
|
1054
1072
|
isLoading: boolean;
|
|
1055
1073
|
};
|
|
1056
1074
|
|
|
@@ -1062,19 +1080,35 @@ declare function useFeeTokens(): {
|
|
|
1062
1080
|
|
|
1063
1081
|
declare function useMarkets(): {
|
|
1064
1082
|
markets: _bze_bzejs_bze_tradebin_store.MarketSDKType[];
|
|
1083
|
+
marketsData: MarketData[];
|
|
1065
1084
|
marketsMap: Map<string, _bze_bzejs_bze_tradebin_store.MarketSDKType>;
|
|
1066
1085
|
marketsDataMap: Map<string, MarketData>;
|
|
1067
1086
|
isLoading: boolean;
|
|
1068
1087
|
updateMarkets: () => void;
|
|
1088
|
+
marketExists: (marketId: string) => boolean;
|
|
1089
|
+
getMarketData: (marketId: string) => MarketData | undefined;
|
|
1090
|
+
getMarket: (marketId: string) => Market | undefined;
|
|
1069
1091
|
};
|
|
1070
1092
|
declare function useAssetMarkets(denom: string): {
|
|
1093
|
+
isLoading: boolean;
|
|
1071
1094
|
assetMarkets: _bze_bzejs_bze_tradebin_store.MarketSDKType[];
|
|
1095
|
+
assetMarketsData: MarketData[];
|
|
1096
|
+
asset24hTradedVolume: BigNumber;
|
|
1072
1097
|
};
|
|
1073
|
-
|
|
1098
|
+
/**
|
|
1099
|
+
* Hook to get a market by its ID string.
|
|
1100
|
+
*/
|
|
1101
|
+
declare function useMarket(marketId: string): {
|
|
1102
|
+
isLoading: boolean;
|
|
1074
1103
|
market: _bze_bzejs_bze_tradebin_store.MarketSDKType | undefined;
|
|
1075
1104
|
marketData: MarketData | undefined;
|
|
1105
|
+
marketSymbol: string;
|
|
1106
|
+
marketId: string;
|
|
1076
1107
|
marketExists: boolean;
|
|
1077
1108
|
volume24h: BigNumber;
|
|
1109
|
+
};
|
|
1110
|
+
declare function useMarketsManager(): {
|
|
1111
|
+
updateMarkets: () => void;
|
|
1078
1112
|
isLoading: boolean;
|
|
1079
1113
|
};
|
|
1080
1114
|
|
|
@@ -1169,4 +1203,4 @@ interface SettingsToggleProps {
|
|
|
1169
1203
|
}
|
|
1170
1204
|
declare function SettingsToggle({ accentColor }: SettingsToggleProps): react_jsx_runtime.JSX.Element;
|
|
1171
1205
|
|
|
1172
|
-
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, 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, 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, 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, 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, getBurnerParams, getBurnerParamsWithClient, getChainAddressPrefix, getChainAssets, getChainByChainId, getChainByName, getChainExplorerURL, getChainId, getChainName, getChainNativeAssetDenom, getChains, getChartIntervalsLimit, getChartMinutes, getCurrentEpoch, getCurrentWeekEpochEndTime, getDefaultTxMemo, getDenomType, getDistributionParams, getEcosystemApps, getEpochDurationByIdentifier, getEpochsInfo, getFactoryDenomAdminAddress, getFromLocalStorage, getHashIBCTrace, getHourEpochInfo, getIBCAssetList, getIBCTraces, getIbcTransferTimeout, getJackalRestURL, getJackalRpcUrl, getKeyExpiry, getLiquidityPool, getLiquidityPools, getLockedBalances, getLockerAddress, getMarketBuyOrders, getMarketEventKey, getMarketHistory, getMarketOrder, getMarketOrderBookChangedEvent, getMarketOrders, getMarketOrdersHistory, getMarketSellOrders, getMarkets, getMinAmount, getNoOfIntervalsNeeded, getNobleRestURL, getNobleRpcUrl, getOmniFlixRestURL, getOmniFlixRpcUrl, getOsmosisRestURL, getOsmosisRpcUrl, getPageRequestWithLimit, getPendingUnlockParticipants, getPeriodicEpochEndTime, getPeriodicWeekEpochEndTime, getRestClient, getRestURL, getRpcURL, getSettings, getStakingParams, getStakingPool, getStakingRewardParticipantByAddress, getStakingRewards, getTradingViewIntervals, getUSDCDenom, getValidatorPageUrl, getValidatorSupportedDenoms, getWalletChainsNames, getWeekEpochInfo, intlDateFormat, isFactoryDenom, isIbcAsset, isIbcDenom, isLpDenom, isNativeDenom, isPoolSupportedByValidator, isTestnetChain, keplrSuggestChain, mapEventAttributes, openExternalLink, parseUnbondingDays, poolIdFromPoolDenom, prettyAmount, prettyError, priceToBigNumberUPrice, priceToUPrice, removeFromLocalStorage, removeLeadingZeros, sanitizeIntegerInput, sanitizeNumberInput, setDefaultTxMemo, setInLocalStorage, setKeyExpiry, setSettings, setStorageKeyVersion, shortNumberFormat, sleep, stringTruncateFromCenter, toBigNumber, toPercentage, truncateAddress, truncateDenom, uAmountToAmount, uAmountToBigNumberAmount, uPriceToBigNumberPrice, uPriceToPrice, useAsset, useAssetLiquidityPools, useAssetMarkets, useAssetPrice, useAssets, useAssetsContext, useAssetsManager, useAssetsValue, useBZETx, useBalance, useBalances, useConnectionType, useEpochs, useFeeTokens, useIBCChains, useIBCTx, useLiquidityPools, useMarket, useMarkets, useSDKTx, useSettings, useSigningClient, useToast, validateBZEBech32Address, validateBech32Address, validateEndpoints, validateRestEndpoint, validateRpcEndpoint };
|
|
1206
|
+
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, 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, 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, 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, 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, getBurnerParams, getBurnerParamsWithClient, getChainAddressPrefix, getChainAssets, getChainByChainId, getChainByName, getChainExplorerURL, getChainId, getChainName, getChainNativeAssetDenom, getChains, getChartIntervalsLimit, getChartMinutes, getCurrentEpoch, getCurrentWeekEpochEndTime, getDefaultTxMemo, getDenomType, getDistributionParams, getEcosystemApps, getEpochDurationByIdentifier, getEpochsInfo, getFactoryDenomAdminAddress, getFromLocalStorage, getHashIBCTrace, getHourEpochInfo, getIBCAssetList, getIBCTraces, getIbcTransferTimeout, getJackalRestURL, getJackalRpcUrl, getKeyExpiry, getLiquidityPool, getLiquidityPools, getLockedBalances, getLockerAddress, getMarketBuyOrders, getMarketEventKey, getMarketHistory, getMarketOrder, getMarketOrderBookChangedEvent, getMarketOrders, getMarketOrdersHistory, getMarketSellOrders, getMarkets, getMinAmount, getNoOfIntervalsNeeded, getNobleRestURL, getNobleRpcUrl, getOmniFlixRestURL, getOmniFlixRpcUrl, getOsmosisRestURL, getOsmosisRpcUrl, getPageRequestWithLimit, getPendingUnlockParticipants, getPeriodicEpochEndTime, getPeriodicWeekEpochEndTime, getRestClient, getRestURL, getRpcURL, getSettings, getStakingParams, getStakingPool, getStakingRewardParticipantByAddress, getStakingRewards, getTradingViewIntervals, getUSDCDenom, getValidatorPageUrl, getValidatorSupportedDenoms, getWalletChainsNames, getWeekEpochInfo, intlDateFormat, isFactoryDenom, isIbcAsset, isIbcDenom, isLpDenom, isNativeDenom, isPoolSupportedByValidator, isTestnetChain, keplrSuggestChain, mapEventAttributes, openExternalLink, parseUnbondingDays, poolIdFromPoolDenom, prettyAmount, prettyError, priceToBigNumberUPrice, priceToUPrice, removeFromLocalStorage, removeLeadingZeros, sanitizeIntegerInput, sanitizeNumberInput, setDefaultTxMemo, setInLocalStorage, setKeyExpiry, setSettings, setStorageKeyVersion, shortNumberFormat, sleep, stringTruncateFromCenter, toBigNumber, toPercentage, truncateAddress, truncateDenom, uAmountToAmount, uAmountToBigNumberAmount, uPriceToBigNumberPrice, uPriceToPrice, useAsset, useAssetLiquidityPools, useAssetMarkets, useAssetPrice, useAssets, useAssetsContext, useAssetsManager, useAssetsValue, useBZETx, useBalance, useBalances, useConnectionType, useEpochs, useFeeTokens, useIBCChains, useIBCTx, useLiquidityPool, useLiquidityPools, useMarket, useMarkets, useMarketsManager, useSDKTx, useSettings, useSigningClient, useToast, validateBZEBech32Address, validateBech32Address, validateEndpoints, validateRestEndpoint, validateRpcEndpoint };
|
package/dist/index.js
CHANGED
|
@@ -284,9 +284,11 @@ __export(index_exports, {
|
|
|
284
284
|
useFeeTokens: () => useFeeTokens,
|
|
285
285
|
useIBCChains: () => useIBCChains,
|
|
286
286
|
useIBCTx: () => useIBCTx,
|
|
287
|
+
useLiquidityPool: () => useLiquidityPool,
|
|
287
288
|
useLiquidityPools: () => useLiquidityPools,
|
|
288
289
|
useMarket: () => useMarket,
|
|
289
290
|
useMarkets: () => useMarkets,
|
|
291
|
+
useMarketsManager: () => useMarketsManager,
|
|
290
292
|
useSDKTx: () => useSDKTx,
|
|
291
293
|
useSettings: () => useSettings,
|
|
292
294
|
useSigningClient: () => useSigningClient,
|
|
@@ -3235,6 +3237,7 @@ function useEpochs() {
|
|
|
3235
3237
|
|
|
3236
3238
|
// src/hooks/useLiquidityPools.ts
|
|
3237
3239
|
var import_react9 = require("react");
|
|
3240
|
+
var import_bignumber9 = __toESM(require("bignumber.js"));
|
|
3238
3241
|
function useLiquidityPools() {
|
|
3239
3242
|
const { poolsMap, poolsDataMap, updateLiquidityPools, isLoading, assetsMap } = useAssetsContext();
|
|
3240
3243
|
const pools = (0, import_react9.useMemo)(() => {
|
|
@@ -3260,6 +3263,7 @@ function useLiquidityPools() {
|
|
|
3260
3263
|
return {
|
|
3261
3264
|
pools,
|
|
3262
3265
|
poolsMap,
|
|
3266
|
+
poolsData: poolsDataMap,
|
|
3263
3267
|
poolsDataMap,
|
|
3264
3268
|
isLoading,
|
|
3265
3269
|
updateLiquidityPools,
|
|
@@ -3269,23 +3273,135 @@ function useLiquidityPools() {
|
|
|
3269
3273
|
};
|
|
3270
3274
|
}
|
|
3271
3275
|
function useAssetLiquidityPools(denom) {
|
|
3272
|
-
const { poolsMap, poolsDataMap } = useAssetsContext();
|
|
3276
|
+
const { poolsMap, poolsDataMap, isLoading } = useAssetsContext();
|
|
3273
3277
|
const assetPools = (0, import_react9.useMemo)(() => {
|
|
3274
3278
|
return Array.from(poolsMap.values()).filter(
|
|
3275
3279
|
(pool) => pool.base === denom || pool.quote === denom
|
|
3276
3280
|
);
|
|
3277
3281
|
}, [poolsMap, denom]);
|
|
3282
|
+
const assetPoolsData = (0, import_react9.useMemo)(() => {
|
|
3283
|
+
const newMap = /* @__PURE__ */ new Map();
|
|
3284
|
+
if (isLoading || denom === "") return newMap;
|
|
3285
|
+
assetPools.forEach((pool) => {
|
|
3286
|
+
const poolData = poolsDataMap.get(pool.id);
|
|
3287
|
+
if (poolData) {
|
|
3288
|
+
newMap.set(pool.id, poolData);
|
|
3289
|
+
}
|
|
3290
|
+
});
|
|
3291
|
+
return newMap;
|
|
3292
|
+
}, [assetPools, poolsDataMap, isLoading, denom]);
|
|
3293
|
+
const asset24HoursVolume = (0, import_react9.useMemo)(() => {
|
|
3294
|
+
let volume = (0, import_bignumber9.default)(0);
|
|
3295
|
+
if (isLoading || denom === "") return volume;
|
|
3296
|
+
assetPoolsData.forEach((poolData) => {
|
|
3297
|
+
if (poolData.base === denom) {
|
|
3298
|
+
volume = volume.plus(poolData.baseVolume);
|
|
3299
|
+
} else if (poolData.quote === denom) {
|
|
3300
|
+
volume = volume.plus(poolData.quoteVolume);
|
|
3301
|
+
}
|
|
3302
|
+
});
|
|
3303
|
+
return volume;
|
|
3304
|
+
}, [isLoading, assetPoolsData, denom]);
|
|
3278
3305
|
return {
|
|
3279
3306
|
assetPools,
|
|
3280
|
-
poolsDataMap
|
|
3307
|
+
poolsDataMap,
|
|
3308
|
+
isLoading,
|
|
3309
|
+
asset24HoursVolume,
|
|
3310
|
+
assetPoolsData
|
|
3311
|
+
};
|
|
3312
|
+
}
|
|
3313
|
+
function useLiquidityPool(poolId) {
|
|
3314
|
+
const { balancesMap, assetsMap, poolsMap, poolsDataMap, isLoading } = useAssetsContext();
|
|
3315
|
+
const pool = (0, import_react9.useMemo)(() => poolsMap.get(poolId), [poolsMap, poolId]);
|
|
3316
|
+
const poolData = (0, import_react9.useMemo)(() => poolsDataMap.get(poolId), [poolsDataMap, poolId]);
|
|
3317
|
+
const userShares = (0, import_react9.useMemo)(() => {
|
|
3318
|
+
if (!pool) return toBigNumber(0);
|
|
3319
|
+
const balance = balancesMap.get(pool.lp_denom);
|
|
3320
|
+
if (!balance) return toBigNumber(0);
|
|
3321
|
+
return toBigNumber(balance.amount);
|
|
3322
|
+
}, [balancesMap, pool]);
|
|
3323
|
+
const totalShares = (0, import_react9.useMemo)(() => {
|
|
3324
|
+
if (!assetsMap || !pool) return toBigNumber(0);
|
|
3325
|
+
const sharesAsset = assetsMap.get(pool.lp_denom);
|
|
3326
|
+
if (!sharesAsset) return toBigNumber(0);
|
|
3327
|
+
return toBigNumber((sharesAsset == null ? void 0 : sharesAsset.supply) || 0);
|
|
3328
|
+
}, [assetsMap, pool]);
|
|
3329
|
+
const userSharesPercentage = (0, import_react9.useMemo)(() => {
|
|
3330
|
+
if (!userShares || !totalShares || totalShares.isZero()) {
|
|
3331
|
+
return toBigNumber(0);
|
|
3332
|
+
}
|
|
3333
|
+
return userShares.dividedBy(totalShares).multipliedBy(100).toFixed(2);
|
|
3334
|
+
}, [userShares, totalShares]);
|
|
3335
|
+
const userReserveBase = (0, import_react9.useMemo)(() => {
|
|
3336
|
+
if (!pool || !userShares || !totalShares || totalShares.isZero()) {
|
|
3337
|
+
return toBigNumber(0);
|
|
3338
|
+
}
|
|
3339
|
+
const reserveBase = toBigNumber(pool.reserve_base);
|
|
3340
|
+
return userShares.dividedBy(totalShares).multipliedBy(reserveBase);
|
|
3341
|
+
}, [pool, userShares, totalShares]);
|
|
3342
|
+
const userReserveQuote = (0, import_react9.useMemo)(() => {
|
|
3343
|
+
if (!pool || !userShares || !totalShares || totalShares.isZero()) {
|
|
3344
|
+
return toBigNumber(0);
|
|
3345
|
+
}
|
|
3346
|
+
const reserveQuote = toBigNumber(pool.reserve_quote);
|
|
3347
|
+
return userShares.dividedBy(totalShares).multipliedBy(reserveQuote);
|
|
3348
|
+
}, [pool, userShares, totalShares]);
|
|
3349
|
+
const calculateOppositeAmount = (0, import_react9.useCallback)((amount, isBase) => {
|
|
3350
|
+
if (!pool) {
|
|
3351
|
+
return toBigNumber(0);
|
|
3352
|
+
}
|
|
3353
|
+
return calculatePoolOppositeAmount(pool, amount, isBase);
|
|
3354
|
+
}, [pool]);
|
|
3355
|
+
const calculateSharesFromAmounts = (0, import_react9.useCallback)((baseAmount, quoteAmount) => {
|
|
3356
|
+
if (!pool || !totalShares) {
|
|
3357
|
+
return toBigNumber(0);
|
|
3358
|
+
}
|
|
3359
|
+
const baseAmountBN = toBigNumber(baseAmount);
|
|
3360
|
+
const quoteAmountBN = toBigNumber(quoteAmount);
|
|
3361
|
+
if (baseAmountBN.isZero() || baseAmountBN.isNaN() || quoteAmountBN.isZero() || quoteAmountBN.isNaN()) {
|
|
3362
|
+
return toBigNumber(0);
|
|
3363
|
+
}
|
|
3364
|
+
const reserveBase = toBigNumber(pool.reserve_base);
|
|
3365
|
+
const reserveQuote = toBigNumber(pool.reserve_quote);
|
|
3366
|
+
if (reserveBase.isZero() || reserveQuote.isZero() || totalShares.isZero()) {
|
|
3367
|
+
return toBigNumber(0);
|
|
3368
|
+
}
|
|
3369
|
+
const baseRatio = baseAmountBN.dividedBy(reserveBase);
|
|
3370
|
+
const quoteRatio = quoteAmountBN.dividedBy(reserveQuote);
|
|
3371
|
+
const mintRatio = import_bignumber9.default.minimum(baseRatio, quoteRatio);
|
|
3372
|
+
const tokensToMint = mintRatio.multipliedBy(totalShares);
|
|
3373
|
+
return tokensToMint.integerValue(import_bignumber9.default.ROUND_DOWN);
|
|
3374
|
+
}, [pool, totalShares]);
|
|
3375
|
+
return {
|
|
3376
|
+
isLoading,
|
|
3377
|
+
pool,
|
|
3378
|
+
poolData,
|
|
3379
|
+
userShares,
|
|
3380
|
+
totalShares,
|
|
3381
|
+
userSharesPercentage,
|
|
3382
|
+
userReserveBase,
|
|
3383
|
+
userReserveQuote,
|
|
3384
|
+
calculateOppositeAmount,
|
|
3385
|
+
calculateSharesFromAmounts
|
|
3281
3386
|
};
|
|
3282
3387
|
}
|
|
3283
3388
|
|
|
3284
3389
|
// src/hooks/useAssetsValue.ts
|
|
3285
3390
|
var import_react10 = require("react");
|
|
3391
|
+
var import_bignumber10 = __toESM(require("bignumber.js"));
|
|
3286
3392
|
function useAssetsValue() {
|
|
3287
|
-
const { assetsMap, usdPricesMap, balancesMap, isLoading } = useAssetsContext();
|
|
3288
|
-
const totalUsdValue = (0, import_react10.
|
|
3393
|
+
const { assetsMap, usdPricesMap, balancesMap, isLoading: isLoadingPrices } = useAssetsContext();
|
|
3394
|
+
const totalUsdValue = (0, import_react10.useCallback)((prettyBalances) => {
|
|
3395
|
+
let usdValue = (0, import_bignumber10.default)(0);
|
|
3396
|
+
prettyBalances.map((denomBalance) => {
|
|
3397
|
+
const assetPrice = usdPricesMap.get(denomBalance.denom);
|
|
3398
|
+
if (assetPrice && assetPrice.gt(0)) {
|
|
3399
|
+
usdValue = usdValue.plus(assetPrice.multipliedBy(denomBalance.amount));
|
|
3400
|
+
}
|
|
3401
|
+
});
|
|
3402
|
+
return usdValue;
|
|
3403
|
+
}, [usdPricesMap]);
|
|
3404
|
+
const walletTotalUsdValue = (0, import_react10.useMemo)(() => {
|
|
3289
3405
|
let total = toBigNumber(0);
|
|
3290
3406
|
balancesMap.forEach((balance, denom) => {
|
|
3291
3407
|
const price = usdPricesMap.get(denom);
|
|
@@ -3296,17 +3412,33 @@ function useAssetsValue() {
|
|
|
3296
3412
|
});
|
|
3297
3413
|
return total;
|
|
3298
3414
|
}, [balancesMap, usdPricesMap, assetsMap]);
|
|
3299
|
-
const denomUsdValue = (denom, uAmount) => {
|
|
3415
|
+
const denomUsdValue = (0, import_react10.useCallback)((denom, uAmount) => {
|
|
3300
3416
|
const price = usdPricesMap.get(denom);
|
|
3301
3417
|
if (!price || !price.gt(0)) return toBigNumber(0);
|
|
3302
3418
|
const asset = assetsMap.get(denom);
|
|
3303
3419
|
if (!asset) return toBigNumber(0);
|
|
3304
3420
|
return price.multipliedBy(uAmountToBigNumberAmount(uAmount, asset.decimals));
|
|
3305
|
-
};
|
|
3421
|
+
}, [usdPricesMap, assetsMap]);
|
|
3422
|
+
const compareValues = (0, import_react10.useCallback)((a, b) => {
|
|
3423
|
+
var _a2;
|
|
3424
|
+
let aValue = (0, import_bignumber10.default)(0);
|
|
3425
|
+
const aPrice = usdPricesMap.get(a.denom);
|
|
3426
|
+
if (aPrice) {
|
|
3427
|
+
aValue = aPrice.multipliedBy(a.amount);
|
|
3428
|
+
}
|
|
3429
|
+
let bValue = (0, import_bignumber10.default)(0);
|
|
3430
|
+
const bPrice = usdPricesMap.get(b.denom);
|
|
3431
|
+
if (bPrice) {
|
|
3432
|
+
bValue = bPrice.multipliedBy(b.amount);
|
|
3433
|
+
}
|
|
3434
|
+
return (_a2 = aValue.comparedTo(bValue)) != null ? _a2 : 0;
|
|
3435
|
+
}, [usdPricesMap]);
|
|
3306
3436
|
return {
|
|
3307
3437
|
totalUsdValue,
|
|
3438
|
+
walletTotalUsdValue,
|
|
3308
3439
|
denomUsdValue,
|
|
3309
|
-
|
|
3440
|
+
compareValues,
|
|
3441
|
+
isLoading: isLoadingPrices
|
|
3310
3442
|
};
|
|
3311
3443
|
}
|
|
3312
3444
|
|
|
@@ -3348,51 +3480,106 @@ function useFeeTokens() {
|
|
|
3348
3480
|
|
|
3349
3481
|
// src/hooks/useMarkets.ts
|
|
3350
3482
|
var import_react12 = require("react");
|
|
3483
|
+
var import_bignumber11 = __toESM(require("bignumber.js"));
|
|
3351
3484
|
function useMarkets() {
|
|
3352
3485
|
const { marketsMap, marketsDataMap, updateMarkets, isLoading } = useAssetsContext();
|
|
3353
3486
|
const markets = (0, import_react12.useMemo)(() => {
|
|
3354
3487
|
return Array.from(marketsMap.values());
|
|
3355
3488
|
}, [marketsMap]);
|
|
3489
|
+
const marketsData = (0, import_react12.useMemo)(() => Array.from(marketsDataMap.values()), [marketsDataMap]);
|
|
3490
|
+
const marketExists = (0, import_react12.useCallback)((marketId) => marketsMap.has(marketId), [marketsMap]);
|
|
3491
|
+
const getMarketData = (0, import_react12.useCallback)((marketId) => marketsDataMap.get(marketId), [marketsDataMap]);
|
|
3492
|
+
const getMarket = (0, import_react12.useCallback)((marketId) => marketsMap.get(marketId), [marketsMap]);
|
|
3356
3493
|
return {
|
|
3357
3494
|
markets,
|
|
3495
|
+
marketsData,
|
|
3358
3496
|
marketsMap,
|
|
3359
3497
|
marketsDataMap,
|
|
3360
3498
|
isLoading,
|
|
3361
|
-
updateMarkets
|
|
3499
|
+
updateMarkets,
|
|
3500
|
+
marketExists,
|
|
3501
|
+
getMarketData,
|
|
3502
|
+
getMarket
|
|
3362
3503
|
};
|
|
3363
3504
|
}
|
|
3364
3505
|
function useAssetMarkets(denom) {
|
|
3365
|
-
const { marketsMap } = useAssetsContext();
|
|
3506
|
+
const { isLoading, marketsMap, marketsDataMap } = useAssetsContext();
|
|
3507
|
+
const markets = (0, import_react12.useMemo)(() => Array.from(marketsMap.values()), [marketsMap]);
|
|
3508
|
+
const marketsData = (0, import_react12.useMemo)(() => Array.from(marketsDataMap.values()), [marketsDataMap]);
|
|
3366
3509
|
const assetMarkets = (0, import_react12.useMemo)(() => {
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
)
|
|
3370
|
-
|
|
3510
|
+
const baseMatches = [];
|
|
3511
|
+
const quoteMatches = [];
|
|
3512
|
+
for (const market of markets) {
|
|
3513
|
+
if (market.base === denom) baseMatches.push(market);
|
|
3514
|
+
else if (market.quote === denom) quoteMatches.push(market);
|
|
3515
|
+
}
|
|
3516
|
+
return [...baseMatches, ...quoteMatches];
|
|
3517
|
+
}, [markets, denom]);
|
|
3518
|
+
const assetMarketsData = (0, import_react12.useMemo)(() => {
|
|
3519
|
+
const baseMatches = [];
|
|
3520
|
+
const quoteMatches = [];
|
|
3521
|
+
for (const market of marketsData) {
|
|
3522
|
+
if (market.base === denom) baseMatches.push(market);
|
|
3523
|
+
else if (market.quote === denom) quoteMatches.push(market);
|
|
3524
|
+
}
|
|
3525
|
+
return [...baseMatches, ...quoteMatches];
|
|
3526
|
+
}, [marketsData, denom]);
|
|
3527
|
+
const asset24hTradedVolume = (0, import_react12.useMemo)(() => {
|
|
3528
|
+
return assetMarketsData.reduce((acc, market) => {
|
|
3529
|
+
if (denom === market.base) {
|
|
3530
|
+
return acc.plus(market.base_volume || 0);
|
|
3531
|
+
} else if (denom === market.quote) {
|
|
3532
|
+
return acc.plus(market.quote_volume || 0);
|
|
3533
|
+
}
|
|
3534
|
+
return acc;
|
|
3535
|
+
}, new import_bignumber11.default(0));
|
|
3536
|
+
}, [assetMarketsData, denom]);
|
|
3371
3537
|
return {
|
|
3372
|
-
|
|
3538
|
+
isLoading,
|
|
3539
|
+
assetMarkets,
|
|
3540
|
+
assetMarketsData,
|
|
3541
|
+
asset24hTradedVolume
|
|
3373
3542
|
};
|
|
3374
3543
|
}
|
|
3375
|
-
function useMarket(
|
|
3376
|
-
const { marketsMap, marketsDataMap,
|
|
3377
|
-
const
|
|
3378
|
-
const
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3544
|
+
function useMarket(marketId) {
|
|
3545
|
+
const { marketsMap, marketsDataMap, isLoading, assetsMap } = useAssetsContext();
|
|
3546
|
+
const market = (0, import_react12.useMemo)(() => marketsMap.get(marketId), [marketsMap, marketId]);
|
|
3547
|
+
const marketSymbol = (0, import_react12.useMemo)(() => {
|
|
3548
|
+
var _a2, _b2;
|
|
3549
|
+
if (isLoading) return "";
|
|
3550
|
+
if (!market) return "";
|
|
3551
|
+
let base = (_a2 = assetsMap.get(market.base)) == null ? void 0 : _a2.ticker;
|
|
3552
|
+
if (!base) {
|
|
3553
|
+
base = truncateDenom(market.base);
|
|
3554
|
+
}
|
|
3555
|
+
let quote = (_b2 = assetsMap.get(market.quote)) == null ? void 0 : _b2.ticker;
|
|
3556
|
+
if (!quote) {
|
|
3557
|
+
quote = truncateDenom(market.quote);
|
|
3558
|
+
}
|
|
3559
|
+
return `${base}/${quote}`;
|
|
3560
|
+
}, [market, isLoading, assetsMap]);
|
|
3561
|
+
const marketData = (0, import_react12.useMemo)(() => marketsDataMap.get(marketId), [marketsDataMap, marketId]);
|
|
3384
3562
|
const marketExists = (0, import_react12.useMemo)(() => !!market, [market]);
|
|
3385
3563
|
const volume24h = (0, import_react12.useMemo)(() => {
|
|
3386
|
-
if (!marketData) return toBigNumber(0);
|
|
3387
|
-
const quoteAsset = assetsMap.get(quote);
|
|
3564
|
+
if (!marketData || !market) return toBigNumber(0);
|
|
3565
|
+
const quoteAsset = assetsMap.get(market.quote);
|
|
3388
3566
|
if (!quoteAsset) return toBigNumber(0);
|
|
3389
3567
|
return uAmountToBigNumberAmount(toBigNumber(marketData.quote_volume), quoteAsset.decimals);
|
|
3390
|
-
}, [marketData, assetsMap,
|
|
3568
|
+
}, [marketData, assetsMap, market]);
|
|
3391
3569
|
return {
|
|
3570
|
+
isLoading,
|
|
3392
3571
|
market,
|
|
3393
3572
|
marketData,
|
|
3573
|
+
marketSymbol,
|
|
3574
|
+
marketId,
|
|
3394
3575
|
marketExists,
|
|
3395
|
-
volume24h
|
|
3576
|
+
volume24h
|
|
3577
|
+
};
|
|
3578
|
+
}
|
|
3579
|
+
function useMarketsManager() {
|
|
3580
|
+
const { updateMarkets, isLoading } = useAssetsContext();
|
|
3581
|
+
return {
|
|
3582
|
+
updateMarkets,
|
|
3396
3583
|
isLoading
|
|
3397
3584
|
};
|
|
3398
3585
|
}
|
|
@@ -3496,7 +3683,7 @@ var useToast = () => {
|
|
|
3496
3683
|
// src/hooks/useTx.tsx
|
|
3497
3684
|
var import_stargate = require("@cosmjs/stargate");
|
|
3498
3685
|
var import_react15 = require("@interchain-kit/react");
|
|
3499
|
-
var
|
|
3686
|
+
var import_bignumber12 = __toESM(require("bignumber.js"));
|
|
3500
3687
|
var import_react16 = require("react");
|
|
3501
3688
|
var TxStatus = /* @__PURE__ */ ((TxStatus2) => {
|
|
3502
3689
|
TxStatus2["Failed"] = "Transaction Failed";
|
|
@@ -3548,7 +3735,7 @@ var useTx = (chainName, isCosmos, isIBC) => {
|
|
|
3548
3735
|
const gasPrice = 0.02;
|
|
3549
3736
|
const nativeDenom = getChainNativeAssetDenom();
|
|
3550
3737
|
const gasEstimated = await signingClient.simulate(address, messages, memo);
|
|
3551
|
-
const gasAmount = (0,
|
|
3738
|
+
const gasAmount = (0, import_bignumber12.default)(gasEstimated).multipliedBy(1.5);
|
|
3552
3739
|
const gasPayment = gasAmount.multipliedBy(gasPrice);
|
|
3553
3740
|
const nativeFee = {
|
|
3554
3741
|
amount: (0, import_stargate.coins)(gasPayment.toFixed(0).toString(), nativeDenom),
|
|
@@ -3565,9 +3752,9 @@ var useTx = (chainName, isCosmos, isIBC) => {
|
|
|
3565
3752
|
if (!expectedAmount.isPositive()) {
|
|
3566
3753
|
return nativeFee;
|
|
3567
3754
|
}
|
|
3568
|
-
expectedAmount = expectedAmount.multipliedBy(1.5).integerValue(
|
|
3755
|
+
expectedAmount = expectedAmount.multipliedBy(1.5).integerValue(import_bignumber12.default.ROUND_FLOOR);
|
|
3569
3756
|
if (expectedAmount.multipliedBy(pool.fee).lt(1)) {
|
|
3570
|
-
expectedAmount = toBigNumber(1).dividedBy(pool.fee).integerValue(
|
|
3757
|
+
expectedAmount = toBigNumber(1).dividedBy(pool.fee).integerValue(import_bignumber12.default.ROUND_CEIL);
|
|
3571
3758
|
}
|
|
3572
3759
|
return {
|
|
3573
3760
|
amount: (0, import_stargate.coins)(expectedAmount.toFixed(0).toString(), feeDenom),
|
|
@@ -4088,13 +4275,13 @@ var import_react25 = require("@chakra-ui/react");
|
|
|
4088
4275
|
var import_lu3 = require("react-icons/lu");
|
|
4089
4276
|
var import_react26 = require("react");
|
|
4090
4277
|
var import_core = require("@interchain-kit/core");
|
|
4091
|
-
var
|
|
4278
|
+
var import_bignumber13 = __toESM(require("bignumber.js"));
|
|
4092
4279
|
var import_bzejs5 = require("@bze/bzejs");
|
|
4093
4280
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
4094
4281
|
var validateAmount = (amount, coin, onError) => {
|
|
4095
4282
|
if (!coin) return;
|
|
4096
4283
|
if (amount === "") return;
|
|
4097
|
-
const amountNumber = (0,
|
|
4284
|
+
const amountNumber = (0, import_bignumber13.default)(amount);
|
|
4098
4285
|
if (amountNumber.isNaN()) {
|
|
4099
4286
|
onError("Invalid amount");
|
|
4100
4287
|
return;
|
|
@@ -4873,9 +5060,11 @@ function SettingsToggle({ accentColor }) {
|
|
|
4873
5060
|
useFeeTokens,
|
|
4874
5061
|
useIBCChains,
|
|
4875
5062
|
useIBCTx,
|
|
5063
|
+
useLiquidityPool,
|
|
4876
5064
|
useLiquidityPools,
|
|
4877
5065
|
useMarket,
|
|
4878
5066
|
useMarkets,
|
|
5067
|
+
useMarketsManager,
|
|
4879
5068
|
useSDKTx,
|
|
4880
5069
|
useSettings,
|
|
4881
5070
|
useSigningClient,
|