@orderly.network/hooks 2.0.6 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +36 -18
- package/dist/index.d.ts +36 -18
- package/dist/index.js +24 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.mjs
CHANGED
|
@@ -33,9 +33,9 @@ var __export = (target, all) => {
|
|
|
33
33
|
// src/version.ts
|
|
34
34
|
if (typeof window !== "undefined") {
|
|
35
35
|
window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
|
|
36
|
-
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.0.
|
|
36
|
+
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.0.7";
|
|
37
37
|
}
|
|
38
|
-
var version_default = "2.0.
|
|
38
|
+
var version_default = "2.0.7";
|
|
39
39
|
var fetcher = (url, init2 = {}, queryOptions) => get(url, init2, queryOptions?.formatter);
|
|
40
40
|
var OrderlyContext = createContext({
|
|
41
41
|
// configStore: new MemoryConfigStore(),
|
|
@@ -330,7 +330,7 @@ var useBoolean = (initialValue = false) => {
|
|
|
330
330
|
var usePreLoadData = () => {
|
|
331
331
|
const [timestampOffsetInitialized, setTimestampOffsetInitialized] = useState(false);
|
|
332
332
|
const { error: tokenError, data: tokenData } = useQuery(
|
|
333
|
-
"https://api
|
|
333
|
+
"https://api.orderly.org/v1/public/token",
|
|
334
334
|
{
|
|
335
335
|
revalidateOnFocus: false
|
|
336
336
|
}
|
|
@@ -3737,21 +3737,21 @@ function useChains(networkId, options = {}) {
|
|
|
3737
3737
|
...swrOptions
|
|
3738
3738
|
};
|
|
3739
3739
|
const { data: tokenChainsRes, error: tokenError } = useQuery(
|
|
3740
|
-
"https://api
|
|
3740
|
+
"https://api.orderly.org/v1/public/token",
|
|
3741
3741
|
{ ...commonSwrOpts }
|
|
3742
3742
|
);
|
|
3743
3743
|
const { data: testTokenChainsRes } = useQuery(
|
|
3744
|
-
"https://testnet-api
|
|
3744
|
+
"https://testnet-api.orderly.org/v1/public/token",
|
|
3745
3745
|
{ ...commonSwrOpts }
|
|
3746
3746
|
);
|
|
3747
3747
|
const brokerId = configStore.get("brokerId");
|
|
3748
3748
|
const needFetchFromAPI = options.forceAPI || !customChains;
|
|
3749
3749
|
const { data: chainInfos, error: chainInfoErr } = useQuery(
|
|
3750
|
-
needFetchFromAPI ? `https://api
|
|
3750
|
+
needFetchFromAPI ? `https://api.orderly.org/v1/public/chain_info${brokerId !== "orderly" ? `?broker_id=${brokerId}` : ""}` : null,
|
|
3751
3751
|
{ ...commonSwrOpts }
|
|
3752
3752
|
);
|
|
3753
3753
|
const { data: testChainInfos } = useQuery(
|
|
3754
|
-
needFetchFromAPI ? `https://testnet-api
|
|
3754
|
+
needFetchFromAPI ? `https://testnet-api.orderly.org/v1/public/chain_info${brokerId !== "orderly" ? `?broker_id=${brokerId}` : ""}` : null,
|
|
3755
3755
|
{ ...commonSwrOpts }
|
|
3756
3756
|
);
|
|
3757
3757
|
const chains = useMemo(() => {
|
|
@@ -7643,7 +7643,7 @@ var DataPaint = class extends BasePaint {
|
|
|
7643
7643
|
let prevElementBoundingBox = {};
|
|
7644
7644
|
if (typeof options.data?.position.side !== "undefined") {
|
|
7645
7645
|
prevElementBoundingBox = this._drawText(options.data.position.side, {
|
|
7646
|
-
color: options.data?.position.side.toUpperCase() === "LONG" ? this.DEFAULT_PROFIT_COLOR : this.DEFAULT_LOSS_COLOR,
|
|
7646
|
+
color: options.data?.position.side.toUpperCase() === "LONG" ? options.profitColor || this.DEFAULT_PROFIT_COLOR : options.lossColor || this.DEFAULT_LOSS_COLOR,
|
|
7647
7647
|
left,
|
|
7648
7648
|
top: this._ratio(top),
|
|
7649
7649
|
fontSize: this._ratio(fontSize),
|
|
@@ -13446,17 +13446,15 @@ var ENVType2 = /* @__PURE__ */ ((ENVType3) => {
|
|
|
13446
13446
|
})(ENVType2 || {});
|
|
13447
13447
|
var useGetEnv = () => {
|
|
13448
13448
|
const { configStore } = useContext(OrderlyContext);
|
|
13449
|
-
const
|
|
13450
|
-
|
|
13451
|
-
|
|
13452
|
-
|
|
13453
|
-
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
return "qa" /* qa */;
|
|
13457
|
-
default:
|
|
13458
|
-
return "prod" /* prod */;
|
|
13449
|
+
const env = configStore.get("env");
|
|
13450
|
+
const networkId = configStore.get("networkId");
|
|
13451
|
+
if (networkId === "mainnet") {
|
|
13452
|
+
return "prod" /* prod */;
|
|
13453
|
+
}
|
|
13454
|
+
if (networkId === "testnet" && env === "prod") {
|
|
13455
|
+
return "staging" /* staging */;
|
|
13459
13456
|
}
|
|
13457
|
+
return env ?? "staging" /* staging */;
|
|
13460
13458
|
};
|
|
13461
13459
|
|
|
13462
13460
|
// src/trading-rewards/abis/contrast.ts
|
|
@@ -14496,13 +14494,13 @@ var useOrderEntity = (order, options) => {
|
|
|
14496
14494
|
symbolInfo
|
|
14497
14495
|
};
|
|
14498
14496
|
};
|
|
14499
|
-
var
|
|
14497
|
+
var useRestrictedInfo = (options) => {
|
|
14500
14498
|
const {
|
|
14501
14499
|
enableDefault = false,
|
|
14502
14500
|
customRestrictedIps = [],
|
|
14503
14501
|
customRestrictedRegions = [],
|
|
14504
|
-
|
|
14505
|
-
} =
|
|
14502
|
+
content
|
|
14503
|
+
} = options || {};
|
|
14506
14504
|
const apiBaseUrl = useConfig("apiBaseUrl");
|
|
14507
14505
|
const [invalidWebCity, setInvalidWebCity] = useState([]);
|
|
14508
14506
|
const [invalidWebCountry, setInvalidWebCountry] = useState([]);
|
|
@@ -14511,7 +14509,7 @@ var useRestrictedAreas = (params) => {
|
|
|
14511
14509
|
const [city, setCity] = useState("");
|
|
14512
14510
|
const [region, setRegion] = useState("");
|
|
14513
14511
|
const [ip, setIp] = useState("");
|
|
14514
|
-
const [
|
|
14512
|
+
const [restrictedOpen, setRestrictedOpen] = useState(false);
|
|
14515
14513
|
useEffect(() => {
|
|
14516
14514
|
const fetchData = async () => {
|
|
14517
14515
|
try {
|
|
@@ -14545,7 +14543,7 @@ var useRestrictedAreas = (params) => {
|
|
|
14545
14543
|
) || combinedInvalidRegions.includes(
|
|
14546
14544
|
ipData?.data?.region?.replace(/\s+/g, "").toLocaleLowerCase()
|
|
14547
14545
|
) || customRestrictedIps.includes(ipData?.data?.ip)) {
|
|
14548
|
-
|
|
14546
|
+
setRestrictedOpen(true);
|
|
14549
14547
|
}
|
|
14550
14548
|
}
|
|
14551
14549
|
} catch (error) {
|
|
@@ -14556,11 +14554,11 @@ var useRestrictedAreas = (params) => {
|
|
|
14556
14554
|
return {
|
|
14557
14555
|
ip,
|
|
14558
14556
|
invalidRegions: allInvalidAreas,
|
|
14559
|
-
|
|
14560
|
-
|
|
14557
|
+
restrictedOpen,
|
|
14558
|
+
content
|
|
14561
14559
|
};
|
|
14562
14560
|
};
|
|
14563
14561
|
|
|
14564
|
-
export { AssetHistoryStatusEnum, DefaultLayoutConfig, DistributionId, ENVType2 as ENVType, ExtendedConfigStore, MarketsStorageKey, MarketsType, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, OrderlyTrackerProvider, StatusContext, StatusProvider, TWType, WalletConnectorContext, WsNetworkStatus, checkNotional, cleanStringStyle, parseJSON, useAccount, useAccountInfo2 as useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAssetsHistory, useBoolean, useChain, useChains, useCheckReferralCode, useCollateral, useCommission, useConfig, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEventEmitter, useFundingFeeHistory, useFundingRate, useFundingRateHistory, useFundingRates, useGetClaimed, useGetEnv, useGetReferralCode, useHoldingStream, useIndexPrice, useKeyStore, useLazyQuery, useLeverage, useLocalStorage, useMaintenanceStatus, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxQty, useMediaQuery, useMutation, useNetworkInfo, useOrderEntity, useOrderEntry2 as useOrderEntry, useOrderEntry as useOrderEntry_deprecated, useOrderStore2 as useOrderStore, useOrderStream, useOrderbookStream, usePositionActions, usePositionStream, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary,
|
|
14562
|
+
export { AssetHistoryStatusEnum, DefaultLayoutConfig, DistributionId, ENVType2 as ENVType, ExtendedConfigStore, MarketsStorageKey, MarketsType, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, OrderlyTrackerProvider, StatusContext, StatusProvider, TWType, WalletConnectorContext, WsNetworkStatus, checkNotional, cleanStringStyle, parseJSON, useAccount, useAccountInfo2 as useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAssetsHistory, useBoolean, useChain, useChains, useCheckReferralCode, useCollateral, useCommission, useConfig, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEventEmitter, useFundingFeeHistory, useFundingRate, useFundingRateHistory, useFundingRates, useGetClaimed, useGetEnv, useGetReferralCode, useHoldingStream, useIndexPrice, useKeyStore, useLazyQuery, useLeverage, useLocalStorage, useMaintenanceStatus, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxQty, useMediaQuery, useMutation, useNetworkInfo, useOrderEntity, useOrderEntry2 as useOrderEntry, useOrderEntry as useOrderEntry_deprecated, useOrderStore2 as useOrderStore, useOrderStream, useOrderbookStream, usePositionActions, usePositionStream, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedInfo, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageLedgerAddress, useSymbolLeverage, useSymbolPriceRange, useSymbolsInfo, useTPSLOrder, useTickerStream, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWithdraw, useWsStatus, utils_exports as utils, version_default as version };
|
|
14565
14563
|
//# sourceMappingURL=out.js.map
|
|
14566
14564
|
//# sourceMappingURL=index.mjs.map
|