@orderly.network/hooks 1.5.13 → 2.0.0-alpha.0
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 +1371 -0
- package/dist/index.d.ts +1371 -0
- package/dist/index.js +12063 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +11937 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +33 -16
- package/esm/configProvider.d.ts +0 -24
- package/esm/configProvider.d.ts.map +0 -1
- package/esm/configProvider.js +0 -82
- package/esm/configProvider.js.map +0 -1
- package/esm/dataProvider.d.ts +0 -11
- package/esm/dataProvider.d.ts.map +0 -1
- package/esm/dataProvider.js +0 -37
- package/esm/dataProvider.js.map +0 -1
- package/esm/dev/proxyConfigStore.d.ts +0 -15
- package/esm/dev/proxyConfigStore.d.ts.map +0 -1
- package/esm/dev/proxyConfigStore.js +0 -41
- package/esm/dev/proxyConfigStore.js.map +0 -1
- package/esm/index.d.ts +0 -38
- package/esm/index.d.ts.map +0 -1
- package/esm/index.js +0 -37
- package/esm/index.js.map +0 -1
- package/esm/middleware/signatureMiddleware.d.ts +0 -3
- package/esm/middleware/signatureMiddleware.d.ts.map +0 -1
- package/esm/middleware/signatureMiddleware.js +0 -34
- package/esm/middleware/signatureMiddleware.js.map +0 -1
- package/esm/orderly/orderbook.service.d.ts +0 -33
- package/esm/orderly/orderbook.service.d.ts.map +0 -1
- package/esm/orderly/orderbook.service.js +0 -129
- package/esm/orderly/orderbook.service.js.map +0 -1
- package/esm/orderly/orderlyHooks.d.ts +0 -36
- package/esm/orderly/orderlyHooks.d.ts.map +0 -1
- package/esm/orderly/orderlyHooks.js +0 -32
- package/esm/orderly/orderlyHooks.js.map +0 -1
- package/esm/orderly/useAccountInfo.d.ts +0 -3
- package/esm/orderly/useAccountInfo.d.ts.map +0 -1
- package/esm/orderly/useAccountInfo.js +0 -6
- package/esm/orderly/useAccountInfo.js.map +0 -1
- package/esm/orderly/useChain.d.ts +0 -6
- package/esm/orderly/useChain.d.ts.map +0 -1
- package/esm/orderly/useChain.js +0 -29
- package/esm/orderly/useChain.js.map +0 -1
- package/esm/orderly/useChains.d.ts +0 -33
- package/esm/orderly/useChains.d.ts.map +0 -1
- package/esm/orderly/useChains.js +0 -183
- package/esm/orderly/useChains.js.map +0 -1
- package/esm/orderly/useCollateral.d.ts +0 -15
- package/esm/orderly/useCollateral.d.ts.map +0 -1
- package/esm/orderly/useCollateral.js +0 -104
- package/esm/orderly/useCollateral.js.map +0 -1
- package/esm/orderly/useDeposit.d.ts +0 -38
- package/esm/orderly/useDeposit.d.ts.map +0 -1
- package/esm/orderly/useDeposit.js +0 -268
- package/esm/orderly/useDeposit.js.map +0 -1
- package/esm/orderly/useFundingRate.d.ts +0 -11
- package/esm/orderly/useFundingRate.d.ts.map +0 -1
- package/esm/orderly/useFundingRate.js +0 -41
- package/esm/orderly/useFundingRate.js.map +0 -1
- package/esm/orderly/useFundingRates.d.ts +0 -7
- package/esm/orderly/useFundingRates.d.ts.map +0 -1
- package/esm/orderly/useFundingRates.js +0 -22
- package/esm/orderly/useFundingRates.js.map +0 -1
- package/esm/orderly/useHoldingStream.d.ts +0 -7
- package/esm/orderly/useHoldingStream.d.ts.map +0 -1
- package/esm/orderly/useHoldingStream.js +0 -51
- package/esm/orderly/useHoldingStream.js.map +0 -1
- package/esm/orderly/useIndexPrice.d.ts +0 -2
- package/esm/orderly/useIndexPrice.d.ts.map +0 -1
- package/esm/orderly/useIndexPrice.js +0 -19
- package/esm/orderly/useIndexPrice.js.map +0 -1
- package/esm/orderly/useLeverage.d.ts +0 -2
- package/esm/orderly/useLeverage.d.ts.map +0 -1
- package/esm/orderly/useLeverage.js +0 -31
- package/esm/orderly/useLeverage.js.map +0 -1
- package/esm/orderly/useMaintenanceStatus.d.ts +0 -7
- package/esm/orderly/useMaintenanceStatus.d.ts.map +0 -1
- package/esm/orderly/useMaintenanceStatus.js +0 -61
- package/esm/orderly/useMaintenanceStatus.js.map +0 -1
- package/esm/orderly/useMarginRatio.d.ts +0 -7
- package/esm/orderly/useMarginRatio.d.ts.map +0 -1
- package/esm/orderly/useMarginRatio.js +0 -55
- package/esm/orderly/useMarginRatio.js.map +0 -1
- package/esm/orderly/useMarkPrice.d.ts +0 -4
- package/esm/orderly/useMarkPrice.d.ts.map +0 -1
- package/esm/orderly/useMarkPrice.js +0 -35
- package/esm/orderly/useMarkPrice.js.map +0 -1
- package/esm/orderly/useMarkPricesStream.d.ts +0 -2
- package/esm/orderly/useMarkPricesStream.d.ts.map +0 -1
- package/esm/orderly/useMarkPricesStream.js +0 -27
- package/esm/orderly/useMarkPricesStream.js.map +0 -1
- package/esm/orderly/useMarketTradeStream.d.ts +0 -9
- package/esm/orderly/useMarketTradeStream.d.ts.map +0 -1
- package/esm/orderly/useMarketTradeStream.js +0 -66
- package/esm/orderly/useMarketTradeStream.js.map +0 -1
- package/esm/orderly/useMarkets.d.ts +0 -36
- package/esm/orderly/useMarkets.d.ts.map +0 -1
- package/esm/orderly/useMarkets.js +0 -331
- package/esm/orderly/useMarkets.js.map +0 -1
- package/esm/orderly/useMarketsStream.d.ts +0 -5
- package/esm/orderly/useMarketsStream.d.ts.map +0 -1
- package/esm/orderly/useMarketsStream.js +0 -53
- package/esm/orderly/useMarketsStream.js.map +0 -1
- package/esm/orderly/useMaxQty.d.ts +0 -9
- package/esm/orderly/useMaxQty.d.ts.map +0 -1
- package/esm/orderly/useMaxQty.js +0 -109
- package/esm/orderly/useMaxQty.js.map +0 -1
- package/esm/orderly/useOpenInterest.d.ts +0 -2
- package/esm/orderly/useOpenInterest.d.ts.map +0 -1
- package/esm/orderly/useOpenInterest.js +0 -17
- package/esm/orderly/useOpenInterest.js.map +0 -1
- package/esm/orderly/useOrderEntry.d.ts +0 -63
- package/esm/orderly/useOrderEntry.d.ts.map +0 -1
- package/esm/orderly/useOrderEntry.js +0 -544
- package/esm/orderly/useOrderEntry.js.map +0 -1
- package/esm/orderly/useOrderEntryNext/index.d.ts +0 -1
- package/esm/orderly/useOrderEntryNext/index.d.ts.map +0 -1
- package/esm/orderly/useOrderEntryNext/index.js +0 -2
- package/esm/orderly/useOrderEntryNext/index.js.map +0 -1
- package/esm/orderly/useOrderStream/useOrderStream.d.ts +0 -55
- package/esm/orderly/useOrderStream/useOrderStream.d.ts.map +0 -1
- package/esm/orderly/useOrderStream/useOrderStream.js +0 -278
- package/esm/orderly/useOrderStream/useOrderStream.js.map +0 -1
- package/esm/orderly/useOrderbookStream.d.ts +0 -52
- package/esm/orderly/useOrderbookStream.d.ts.map +0 -1
- package/esm/orderly/useOrderbookStream.js +0 -367
- package/esm/orderly/useOrderbookStream.js.map +0 -1
- package/esm/orderly/usePositionStream/usePositionStream.d.ts +0 -42
- package/esm/orderly/usePositionStream/usePositionStream.d.ts.map +0 -1
- package/esm/orderly/usePositionStream/usePositionStream.js +0 -269
- package/esm/orderly/usePositionStream/usePositionStream.js.map +0 -1
- package/esm/orderly/usePositionStream/utils.d.ts +0 -8
- package/esm/orderly/usePositionStream/utils.d.ts.map +0 -1
- package/esm/orderly/usePositionStream/utils.js +0 -34
- package/esm/orderly/usePositionStream/utils.js.map +0 -1
- package/esm/orderly/usePrivateDataObserver.d.ts +0 -5
- package/esm/orderly/usePrivateDataObserver.d.ts.map +0 -1
- package/esm/orderly/usePrivateDataObserver.js +0 -130
- package/esm/orderly/usePrivateDataObserver.js.map +0 -1
- package/esm/orderly/useSettleSubscription.d.ts +0 -4
- package/esm/orderly/useSettleSubscription.d.ts.map +0 -1
- package/esm/orderly/useSettleSubscription.js +0 -22
- package/esm/orderly/useSettleSubscription.js.map +0 -1
- package/esm/orderly/useSymbolLeverage.d.ts +0 -2
- package/esm/orderly/useSymbolLeverage.d.ts.map +0 -1
- package/esm/orderly/useSymbolLeverage.js +0 -31
- package/esm/orderly/useSymbolLeverage.js.map +0 -1
- package/esm/orderly/useSymbolPriceRange.d.ts +0 -13
- package/esm/orderly/useSymbolPriceRange.d.ts.map +0 -1
- package/esm/orderly/useSymbolPriceRange.js +0 -45
- package/esm/orderly/useSymbolPriceRange.js.map +0 -1
- package/esm/orderly/useSymbolsInfo.d.ts +0 -7
- package/esm/orderly/useSymbolsInfo.d.ts.map +0 -1
- package/esm/orderly/useSymbolsInfo.js +0 -35
- package/esm/orderly/useSymbolsInfo.js.map +0 -1
- package/esm/orderly/useTakeProfitAndStopLoss/__test__/useTakeProfitAndStopLoss.test.d.ts +0 -1
- package/esm/orderly/useTakeProfitAndStopLoss/__test__/useTakeProfitAndStopLoss.test.d.ts.map +0 -1
- package/esm/orderly/useTakeProfitAndStopLoss/__test__/utils.test.d.ts +0 -2
- package/esm/orderly/useTakeProfitAndStopLoss/__test__/utils.test.d.ts.map +0 -1
- package/esm/orderly/useTakeProfitAndStopLoss/index.d.ts +0 -30
- package/esm/orderly/useTakeProfitAndStopLoss/index.d.ts.map +0 -1
- package/esm/orderly/useTakeProfitAndStopLoss/index.js +0 -23
- package/esm/orderly/useTakeProfitAndStopLoss/index.js.map +0 -1
- package/esm/orderly/useTakeProfitAndStopLoss/useTPSL.d.ts +0 -57
- package/esm/orderly/useTakeProfitAndStopLoss/useTPSL.d.ts.map +0 -1
- package/esm/orderly/useTakeProfitAndStopLoss/useTPSL.js +0 -211
- package/esm/orderly/useTakeProfitAndStopLoss/useTPSL.js.map +0 -1
- package/esm/orderly/useTakeProfitAndStopLoss/utils.d.ts +0 -70
- package/esm/orderly/useTakeProfitAndStopLoss/utils.d.ts.map +0 -1
- package/esm/orderly/useTakeProfitAndStopLoss/utils.js +0 -239
- package/esm/orderly/useTakeProfitAndStopLoss/utils.js.map +0 -1
- package/esm/orderly/useTickerStream.d.ts +0 -7
- package/esm/orderly/useTickerStream.d.ts.map +0 -1
- package/esm/orderly/useTickerStream.js +0 -83
- package/esm/orderly/useTickerStream.js.map +0 -1
- package/esm/orderly/useWalletSubscription.d.ts +0 -4
- package/esm/orderly/useWalletSubscription.d.ts.map +0 -1
- package/esm/orderly/useWalletSubscription.js +0 -22
- package/esm/orderly/useWalletSubscription.js.map +0 -1
- package/esm/orderly/useWithdraw.d.ts +0 -24
- package/esm/orderly/useWithdraw.d.ts.map +0 -1
- package/esm/orderly/useWithdraw.js +0 -111
- package/esm/orderly/useWithdraw.js.map +0 -1
- package/esm/orderlyContext.d.ts +0 -24
- package/esm/orderlyContext.d.ts.map +0 -1
- package/esm/orderlyContext.js +0 -6
- package/esm/orderlyContext.js.map +0 -1
- package/esm/referral/api.d.ts +0 -87
- package/esm/referral/api.d.ts.map +0 -1
- package/esm/referral/api.js +0 -3
- package/esm/referral/api.js.map +0 -1
- package/esm/referral/format.d.ts +0 -2
- package/esm/referral/format.d.ts.map +0 -1
- package/esm/referral/format.js +0 -8
- package/esm/referral/format.js.map +0 -1
- package/esm/referral/index.d.ts +0 -12
- package/esm/referral/index.d.ts.map +0 -1
- package/esm/referral/index.js +0 -13
- package/esm/referral/index.js.map +0 -1
- package/esm/referral/swr.d.ts +0 -7
- package/esm/referral/swr.d.ts.map +0 -1
- package/esm/referral/swr.js +0 -24
- package/esm/referral/swr.js.map +0 -1
- package/esm/referral/useCheckReferralCode.d.ts +0 -6
- package/esm/referral/useCheckReferralCode.d.ts.map +0 -1
- package/esm/referral/useCheckReferralCode.js +0 -18
- package/esm/referral/useCheckReferralCode.js.map +0 -1
- package/esm/referral/useCommission.d.ts +0 -4
- package/esm/referral/useCommission.d.ts.map +0 -1
- package/esm/referral/useCommission.js +0 -59
- package/esm/referral/useCommission.js.map +0 -1
- package/esm/referral/useDaily.d.ts +0 -9
- package/esm/referral/useDaily.d.ts.map +0 -1
- package/esm/referral/useDaily.js +0 -20
- package/esm/referral/useDaily.js.map +0 -1
- package/esm/referral/useDistribution.d.ts +0 -9
- package/esm/referral/useDistribution.d.ts.map +0 -1
- package/esm/referral/useDistribution.js +0 -53
- package/esm/referral/useDistribution.js.map +0 -1
- package/esm/referral/useGetReferralCode.d.ts +0 -6
- package/esm/referral/useGetReferralCode.d.ts.map +0 -1
- package/esm/referral/useGetReferralCode.js +0 -18
- package/esm/referral/useGetReferralCode.js.map +0 -1
- package/esm/referral/useRefereeHistory.d.ts +0 -9
- package/esm/referral/useRefereeHistory.d.ts.map +0 -1
- package/esm/referral/useRefereeHistory.js +0 -47
- package/esm/referral/useRefereeHistory.js.map +0 -1
- package/esm/referral/useRefereeInfo.d.ts +0 -9
- package/esm/referral/useRefereeInfo.d.ts.map +0 -1
- package/esm/referral/useRefereeInfo.js +0 -47
- package/esm/referral/useRefereeInfo.js.map +0 -1
- package/esm/referral/useRefereeRebateSummary.d.ts +0 -12
- package/esm/referral/useRefereeRebateSummary.d.ts.map +0 -1
- package/esm/referral/useRefereeRebateSummary.js +0 -31
- package/esm/referral/useRefereeRebateSummary.js.map +0 -1
- package/esm/referral/useReferralInfo.d.ts +0 -10
- package/esm/referral/useReferralInfo.d.ts.map +0 -1
- package/esm/referral/useReferralInfo.js +0 -56
- package/esm/referral/useReferralInfo.js.map +0 -1
- package/esm/referral/useReferralRebateSummary.d.ts +0 -9
- package/esm/referral/useReferralRebateSummary.d.ts.map +0 -1
- package/esm/referral/useReferralRebateSummary.js +0 -47
- package/esm/referral/useReferralRebateSummary.js.map +0 -1
- package/esm/services/dataCenter.d.ts +0 -2
- package/esm/services/dataCenter.d.ts.map +0 -1
- package/esm/services/dataCenter.js +0 -15
- package/esm/services/dataCenter.js.map +0 -1
- package/esm/services/orderCreator/__test__/limitOrderCreator.test.d.ts +0 -2
- package/esm/services/orderCreator/__test__/limitOrderCreator.test.d.ts.map +0 -1
- package/esm/services/orderCreator/__test__/orderCreator.test.d.ts +0 -2
- package/esm/services/orderCreator/__test__/orderCreator.test.d.ts.map +0 -1
- package/esm/services/orderCreator/__test__/stopLimitOrderCreator.test.d.ts +0 -2
- package/esm/services/orderCreator/__test__/stopLimitOrderCreator.test.d.ts.map +0 -1
- package/esm/services/orderCreator/__test__/stopMarketOrderCreator.test.d.ts +0 -2
- package/esm/services/orderCreator/__test__/stopMarketOrderCreator.test.d.ts.map +0 -1
- package/esm/services/orderCreator/__test__/tpslOrderCreator.test.d.ts +0 -2
- package/esm/services/orderCreator/__test__/tpslOrderCreator.test.d.ts.map +0 -1
- package/esm/services/orderCreator/__test__/tpslPositionOrderCreator.test.d.ts +0 -2
- package/esm/services/orderCreator/__test__/tpslPositionOrderCreator.test.d.ts.map +0 -1
- package/esm/services/orderCreator/baseAlgoCreator.d.ts +0 -22
- package/esm/services/orderCreator/baseAlgoCreator.d.ts.map +0 -1
- package/esm/services/orderCreator/baseAlgoCreator.js +0 -57
- package/esm/services/orderCreator/baseAlgoCreator.js.map +0 -1
- package/esm/services/orderCreator/baseCreator.d.ts +0 -14
- package/esm/services/orderCreator/baseCreator.d.ts.map +0 -1
- package/esm/services/orderCreator/baseCreator.js +0 -98
- package/esm/services/orderCreator/baseCreator.js.map +0 -1
- package/esm/services/orderCreator/factory.d.ts +0 -7
- package/esm/services/orderCreator/factory.d.ts.map +0 -1
- package/esm/services/orderCreator/factory.js +0 -45
- package/esm/services/orderCreator/factory.js.map +0 -1
- package/esm/services/orderCreator/fokCreator.d.ts +0 -4
- package/esm/services/orderCreator/fokCreator.d.ts.map +0 -1
- package/esm/services/orderCreator/fokCreator.js +0 -5
- package/esm/services/orderCreator/fokCreator.js.map +0 -1
- package/esm/services/orderCreator/generalCreator.d.ts +0 -8
- package/esm/services/orderCreator/generalCreator.d.ts.map +0 -1
- package/esm/services/orderCreator/generalCreator.js +0 -15
- package/esm/services/orderCreator/generalCreator.js.map +0 -1
- package/esm/services/orderCreator/interface.d.ts +0 -23
- package/esm/services/orderCreator/interface.d.ts.map +0 -1
- package/esm/services/orderCreator/interface.js +0 -3
- package/esm/services/orderCreator/interface.js.map +0 -1
- package/esm/services/orderCreator/iocCreator.d.ts +0 -4
- package/esm/services/orderCreator/iocCreator.d.ts.map +0 -1
- package/esm/services/orderCreator/iocCreator.js +0 -5
- package/esm/services/orderCreator/iocCreator.js.map +0 -1
- package/esm/services/orderCreator/limitOrderCreator.d.ts +0 -8
- package/esm/services/orderCreator/limitOrderCreator.d.ts.map +0 -1
- package/esm/services/orderCreator/limitOrderCreator.js +0 -69
- package/esm/services/orderCreator/limitOrderCreator.js.map +0 -1
- package/esm/services/orderCreator/marketOrderCreator.d.ts +0 -24
- package/esm/services/orderCreator/marketOrderCreator.d.ts.map +0 -1
- package/esm/services/orderCreator/marketOrderCreator.js +0 -18
- package/esm/services/orderCreator/marketOrderCreator.js.map +0 -1
- package/esm/services/orderCreator/postOnlyCreator.d.ts +0 -4
- package/esm/services/orderCreator/postOnlyCreator.d.ts.map +0 -1
- package/esm/services/orderCreator/postOnlyCreator.js +0 -5
- package/esm/services/orderCreator/postOnlyCreator.js.map +0 -1
- package/esm/services/orderCreator/stopLimitOrderCreator.d.ts +0 -11
- package/esm/services/orderCreator/stopLimitOrderCreator.d.ts.map +0 -1
- package/esm/services/orderCreator/stopLimitOrderCreator.js +0 -84
- package/esm/services/orderCreator/stopLimitOrderCreator.js.map +0 -1
- package/esm/services/orderCreator/stopMarketOrderCreator.d.ts +0 -30
- package/esm/services/orderCreator/stopMarketOrderCreator.d.ts.map +0 -1
- package/esm/services/orderCreator/stopMarketOrderCreator.js +0 -46
- package/esm/services/orderCreator/stopMarketOrderCreator.js.map +0 -1
- package/esm/services/orderCreator/tpslOrderCreator.d.ts +0 -32
- package/esm/services/orderCreator/tpslOrderCreator.d.ts.map +0 -1
- package/esm/services/orderCreator/tpslOrderCreator.js +0 -88
- package/esm/services/orderCreator/tpslOrderCreator.js.map +0 -1
- package/esm/services/orderCreator/tpslPositionOrderCreator.d.ts +0 -33
- package/esm/services/orderCreator/tpslPositionOrderCreator.d.ts.map +0 -1
- package/esm/services/orderCreator/tpslPositionOrderCreator.js +0 -74
- package/esm/services/orderCreator/tpslPositionOrderCreator.js.map +0 -1
- package/esm/services/orderMerge/algoOrderMergeHandler.d.ts +0 -10
- package/esm/services/orderMerge/algoOrderMergeHandler.d.ts.map +0 -1
- package/esm/services/orderMerge/algoOrderMergeHandler.js +0 -46
- package/esm/services/orderMerge/algoOrderMergeHandler.js.map +0 -1
- package/esm/services/orderMerge/baseMergeHandler.d.ts +0 -23
- package/esm/services/orderMerge/baseMergeHandler.d.ts.map +0 -1
- package/esm/services/orderMerge/baseMergeHandler.js +0 -160
- package/esm/services/orderMerge/baseMergeHandler.js.map +0 -1
- package/esm/services/orderMerge/interface.d.ts +0 -8
- package/esm/services/orderMerge/interface.d.ts.map +0 -1
- package/esm/services/orderMerge/interface.js +0 -3
- package/esm/services/orderMerge/interface.js.map +0 -1
- package/esm/services/orderMerge/regularOrderMergeHandler.d.ts +0 -9
- package/esm/services/orderMerge/regularOrderMergeHandler.d.ts.map +0 -1
- package/esm/services/orderMerge/regularOrderMergeHandler.js +0 -18
- package/esm/services/orderMerge/regularOrderMergeHandler.js.map +0 -1
- package/esm/services/painter/backgroundPaint.d.ts +0 -9
- package/esm/services/painter/backgroundPaint.d.ts.map +0 -1
- package/esm/services/painter/backgroundPaint.js +0 -38
- package/esm/services/painter/backgroundPaint.js.map +0 -1
- package/esm/services/painter/basePaint.d.ts +0 -104
- package/esm/services/painter/basePaint.d.ts.map +0 -1
- package/esm/services/painter/basePaint.js +0 -10
- package/esm/services/painter/basePaint.js.map +0 -1
- package/esm/services/painter/dataPaint.d.ts +0 -20
- package/esm/services/painter/dataPaint.d.ts.map +0 -1
- package/esm/services/painter/dataPaint.js +0 -315
- package/esm/services/painter/dataPaint.js.map +0 -1
- package/esm/services/painter/layout.config.d.ts +0 -3
- package/esm/services/painter/layout.config.d.ts.map +0 -1
- package/esm/services/painter/layout.config.js +0 -59
- package/esm/services/painter/layout.config.js.map +0 -1
- package/esm/services/painter/painter.d.ts +0 -14
- package/esm/services/painter/painter.d.ts.map +0 -1
- package/esm/services/painter/painter.js +0 -48
- package/esm/services/painter/painter.js.map +0 -1
- package/esm/services/painter/qrPaint.d.ts +0 -8
- package/esm/services/painter/qrPaint.d.ts.map +0 -1
- package/esm/services/painter/qrPaint.js +0 -39
- package/esm/services/painter/qrPaint.js.map +0 -1
- package/esm/services/painter/resource.d.ts +0 -7
- package/esm/services/painter/resource.d.ts.map +0 -1
- package/esm/services/painter/resource.js +0 -17
- package/esm/services/painter/resource.js.map +0 -1
- package/esm/statusProvider.d.ts +0 -8
- package/esm/statusProvider.d.ts.map +0 -1
- package/esm/statusProvider.js +0 -15
- package/esm/statusProvider.js.map +0 -1
- package/esm/unuse/apiPrefixMiddleware.d.ts +0 -3
- package/esm/unuse/apiPrefixMiddleware.d.ts.map +0 -1
- package/esm/unuse/apiPrefixMiddleware.js +0 -29
- package/esm/unuse/apiPrefixMiddleware.js.map +0 -1
- package/esm/unuse/fn.d.ts +0 -2
- package/esm/unuse/fn.d.ts.map +0 -1
- package/esm/unuse/fn.js +0 -8
- package/esm/unuse/fn.js.map +0 -1
- package/esm/unuse/useBalance.d.ts +0 -2
- package/esm/unuse/useBalance.d.ts.map +0 -1
- package/esm/unuse/useBalance.js +0 -14
- package/esm/unuse/useBalance.js.map +0 -1
- package/esm/unuse/useFetures.d.ts +0 -11
- package/esm/unuse/useFetures.d.ts.map +0 -1
- package/esm/unuse/useFetures.js +0 -47
- package/esm/unuse/useFetures.js.map +0 -1
- package/esm/unuse/useRunOnce.d.ts +0 -7
- package/esm/unuse/useRunOnce.d.ts.map +0 -1
- package/esm/unuse/useRunOnce.js +0 -20
- package/esm/unuse/useRunOnce.js.map +0 -1
- package/esm/unuse/useSyncEnd.d.ts +0 -2
- package/esm/unuse/useSyncEnd.d.ts.map +0 -1
- package/esm/unuse/useSyncEnd.js +0 -11
- package/esm/unuse/useSyncEnd.js.map +0 -1
- package/esm/unuse/useTokenInfo.d.ts +0 -7
- package/esm/unuse/useTokenInfo.d.ts.map +0 -1
- package/esm/unuse/useTokenInfo.js +0 -22
- package/esm/unuse/useTokenInfo.js.map +0 -1
- package/esm/unuse/useUnsettlementPnL.d.ts +0 -2
- package/esm/unuse/useUnsettlementPnL.d.ts.map +0 -1
- package/esm/unuse/useUnsettlementPnL.js +0 -24
- package/esm/unuse/useUnsettlementPnL.js.map +0 -1
- package/esm/useAccount.d.ts +0 -8
- package/esm/useAccount.d.ts.map +0 -1
- package/esm/useAccount.js +0 -56
- package/esm/useAccount.js.map +0 -1
- package/esm/useAccountInstance.d.ts +0 -3
- package/esm/useAccountInstance.d.ts.map +0 -1
- package/esm/useAccountInstance.js +0 -22
- package/esm/useAccountInstance.js.map +0 -1
- package/esm/useBoolean.d.ts +0 -6
- package/esm/useBoolean.d.ts.map +0 -1
- package/esm/useBoolean.js +0 -17
- package/esm/useBoolean.js.map +0 -1
- package/esm/useConfig.d.ts +0 -4
- package/esm/useConfig.d.ts.map +0 -1
- package/esm/useConfig.js +0 -14
- package/esm/useConfig.js.map +0 -1
- package/esm/useEventEmitter.d.ts +0 -3
- package/esm/useEventEmitter.d.ts.map +0 -1
- package/esm/useEventEmitter.js +0 -14
- package/esm/useEventEmitter.js.map +0 -1
- package/esm/useLazyQuery.d.ts +0 -13
- package/esm/useLazyQuery.d.ts.map +0 -1
- package/esm/useLazyQuery.js +0 -34
- package/esm/useLazyQuery.js.map +0 -1
- package/esm/useLocalStorage.d.ts +0 -2
- package/esm/useLocalStorage.d.ts.map +0 -1
- package/esm/useLocalStorage.js +0 -82
- package/esm/useLocalStorage.js.map +0 -1
- package/esm/useMediaQuery.d.ts +0 -2
- package/esm/useMediaQuery.d.ts.map +0 -1
- package/esm/useMediaQuery.js +0 -38
- package/esm/useMediaQuery.js.map +0 -1
- package/esm/useMutation.d.ts +0 -13
- package/esm/useMutation.d.ts.map +0 -1
- package/esm/useMutation.js +0 -81
- package/esm/useMutation.js.map +0 -1
- package/esm/useObserve.d.ts +0 -6
- package/esm/useObserve.d.ts.map +0 -1
- package/esm/useObserve.js +0 -8
- package/esm/useObserve.js.map +0 -1
- package/esm/useParamsCheck.d.ts +0 -4
- package/esm/useParamsCheck.d.ts.map +0 -1
- package/esm/useParamsCheck.js +0 -12
- package/esm/useParamsCheck.js.map +0 -1
- package/esm/usePoster.d.ts +0 -44
- package/esm/usePoster.d.ts.map +0 -1
- package/esm/usePoster.js +0 -140
- package/esm/usePoster.js.map +0 -1
- package/esm/usePreloadData.d.ts +0 -5
- package/esm/usePreloadData.d.ts.map +0 -1
- package/esm/usePreloadData.js +0 -38
- package/esm/usePreloadData.js.map +0 -1
- package/esm/usePrivateInfiniteQuery.d.ts +0 -5
- package/esm/usePrivateInfiniteQuery.d.ts.map +0 -1
- package/esm/usePrivateInfiniteQuery.js +0 -31
- package/esm/usePrivateInfiniteQuery.js.map +0 -1
- package/esm/usePrivateQuery.d.ts +0 -10
- package/esm/usePrivateQuery.d.ts.map +0 -1
- package/esm/usePrivateQuery.js +0 -33
- package/esm/usePrivateQuery.js.map +0 -1
- package/esm/useQuery.d.ts +0 -10
- package/esm/useQuery.d.ts.map +0 -1
- package/esm/useQuery.js +0 -21
- package/esm/useQuery.js.map +0 -1
- package/esm/useSessionStorage.d.ts +0 -2
- package/esm/useSessionStorage.d.ts.map +0 -1
- package/esm/useSessionStorage.js +0 -69
- package/esm/useSessionStorage.js.map +0 -1
- package/esm/useWS.d.ts +0 -3
- package/esm/useWS.d.ts.map +0 -1
- package/esm/useWS.js +0 -54
- package/esm/useWS.js.map +0 -1
- package/esm/useWsStatus.d.ts +0 -7
- package/esm/useWsStatus.d.ts.map +0 -1
- package/esm/useWsStatus.js +0 -41
- package/esm/useWsStatus.js.map +0 -1
- package/esm/utils/createGetter.d.ts +0 -11
- package/esm/utils/createGetter.d.ts.map +0 -1
- package/esm/utils/createGetter.js +0 -26
- package/esm/utils/createGetter.js.map +0 -1
- package/esm/utils/createOrder.d.ts +0 -2
- package/esm/utils/createOrder.d.ts.map +0 -1
- package/esm/utils/createOrder.js +0 -16
- package/esm/utils/createOrder.js.map +0 -1
- package/esm/utils/dev.d.ts +0 -2
- package/esm/utils/dev.d.ts.map +0 -1
- package/esm/utils/dev.js +0 -21
- package/esm/utils/dev.js.map +0 -1
- package/esm/utils/fetcher.d.ts +0 -6
- package/esm/utils/fetcher.d.ts.map +0 -1
- package/esm/utils/fetcher.js +0 -4
- package/esm/utils/fetcher.js.map +0 -1
- package/esm/utils/fokCreator.d.ts +0 -1
- package/esm/utils/fokCreator.d.ts.map +0 -1
- package/esm/utils/fokCreator.js +0 -2
- package/esm/utils/fokCreator.js.map +0 -1
- package/esm/utils/index.d.ts +0 -6
- package/esm/utils/index.d.ts.map +0 -1
- package/esm/utils/index.js +0 -7
- package/esm/utils/index.js.map +0 -1
- package/esm/utils/json.d.ts +0 -2
- package/esm/utils/json.d.ts.map +0 -1
- package/esm/utils/json.js +0 -9
- package/esm/utils/json.js.map +0 -1
- package/esm/utils/order.d.ts +0 -2
- package/esm/utils/order.d.ts.map +0 -1
- package/esm/utils/order.js +0 -3
- package/esm/utils/order.js.map +0 -1
- package/esm/utils/orderEntryHelper.d.ts +0 -26
- package/esm/utils/orderEntryHelper.d.ts.map +0 -1
- package/esm/utils/orderEntryHelper.js +0 -296
- package/esm/utils/orderEntryHelper.js.map +0 -1
- package/esm/utils/parseHolding.d.ts +0 -9
- package/esm/utils/parseHolding.d.ts.map +0 -1
- package/esm/utils/parseHolding.js +0 -25
- package/esm/utils/parseHolding.js.map +0 -1
- package/esm/utils/swr.d.ts +0 -12
- package/esm/utils/swr.d.ts.map +0 -1
- package/esm/utils/swr.js +0 -239
- package/esm/utils/swr.js.map +0 -1
- package/esm/utils/ws.d.ts +0 -2
- package/esm/utils/ws.d.ts.map +0 -1
- package/esm/utils/ws.js +0 -9
- package/esm/utils/ws.js.map +0 -1
- package/esm/version.d.ts +0 -10
- package/esm/version.d.ts.map +0 -1
- package/esm/version.js +0 -7
- package/esm/version.js.map +0 -1
- package/esm/walletConnectorContext.d.ts +0 -31
- package/esm/walletConnectorContext.d.ts.map +0 -1
- package/esm/walletConnectorContext.js +0 -7
- package/esm/walletConnectorContext.js.map +0 -1
- package/lib/configProvider.d.ts +0 -24
- package/lib/configProvider.d.ts.map +0 -1
- package/lib/configProvider.js +0 -136
- package/lib/configProvider.js.map +0 -1
- package/lib/dataProvider.d.ts +0 -11
- package/lib/dataProvider.d.ts.map +0 -1
- package/lib/dataProvider.js +0 -58
- package/lib/dataProvider.js.map +0 -1
- package/lib/dev/proxyConfigStore.d.ts +0 -15
- package/lib/dev/proxyConfigStore.d.ts.map +0 -1
- package/lib/dev/proxyConfigStore.js +0 -51
- package/lib/dev/proxyConfigStore.js.map +0 -1
- package/lib/index.d.ts +0 -38
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -202
- package/lib/index.js.map +0 -1
- package/lib/middleware/signatureMiddleware.d.ts +0 -3
- package/lib/middleware/signatureMiddleware.d.ts.map +0 -1
- package/lib/middleware/signatureMiddleware.js +0 -44
- package/lib/middleware/signatureMiddleware.js.map +0 -1
- package/lib/orderly/orderbook.service.d.ts +0 -33
- package/lib/orderly/orderbook.service.d.ts.map +0 -1
- package/lib/orderly/orderbook.service.js +0 -147
- package/lib/orderly/orderbook.service.js.map +0 -1
- package/lib/orderly/orderlyHooks.d.ts +0 -36
- package/lib/orderly/orderlyHooks.d.ts.map +0 -1
- package/lib/orderly/orderlyHooks.js +0 -137
- package/lib/orderly/orderlyHooks.js.map +0 -1
- package/lib/orderly/useAccountInfo.d.ts +0 -3
- package/lib/orderly/useAccountInfo.d.ts.map +0 -1
- package/lib/orderly/useAccountInfo.js +0 -16
- package/lib/orderly/useAccountInfo.js.map +0 -1
- package/lib/orderly/useChain.d.ts +0 -6
- package/lib/orderly/useChain.d.ts.map +0 -1
- package/lib/orderly/useChain.js +0 -39
- package/lib/orderly/useChain.js.map +0 -1
- package/lib/orderly/useChains.d.ts +0 -33
- package/lib/orderly/useChains.d.ts.map +0 -1
- package/lib/orderly/useChains.js +0 -209
- package/lib/orderly/useChains.js.map +0 -1
- package/lib/orderly/useCollateral.d.ts +0 -15
- package/lib/orderly/useCollateral.d.ts.map +0 -1
- package/lib/orderly/useCollateral.js +0 -114
- package/lib/orderly/useCollateral.js.map +0 -1
- package/lib/orderly/useDeposit.d.ts +0 -38
- package/lib/orderly/useDeposit.d.ts.map +0 -1
- package/lib/orderly/useDeposit.js +0 -278
- package/lib/orderly/useDeposit.js.map +0 -1
- package/lib/orderly/useFundingRate.d.ts +0 -11
- package/lib/orderly/useFundingRate.d.ts.map +0 -1
- package/lib/orderly/useFundingRate.js +0 -51
- package/lib/orderly/useFundingRate.js.map +0 -1
- package/lib/orderly/useFundingRates.d.ts +0 -7
- package/lib/orderly/useFundingRates.d.ts.map +0 -1
- package/lib/orderly/useFundingRates.js +0 -32
- package/lib/orderly/useFundingRates.js.map +0 -1
- package/lib/orderly/useHoldingStream.d.ts +0 -7
- package/lib/orderly/useHoldingStream.d.ts.map +0 -1
- package/lib/orderly/useHoldingStream.js +0 -66
- package/lib/orderly/useHoldingStream.js.map +0 -1
- package/lib/orderly/useIndexPrice.d.ts +0 -2
- package/lib/orderly/useIndexPrice.d.ts.map +0 -1
- package/lib/orderly/useIndexPrice.js +0 -34
- package/lib/orderly/useIndexPrice.js.map +0 -1
- package/lib/orderly/useLeverage.d.ts +0 -2
- package/lib/orderly/useLeverage.d.ts.map +0 -1
- package/lib/orderly/useLeverage.js +0 -41
- package/lib/orderly/useLeverage.js.map +0 -1
- package/lib/orderly/useMaintenanceStatus.d.ts +0 -7
- package/lib/orderly/useMaintenanceStatus.d.ts.map +0 -1
- package/lib/orderly/useMaintenanceStatus.js +0 -71
- package/lib/orderly/useMaintenanceStatus.js.map +0 -1
- package/lib/orderly/useMarginRatio.d.ts +0 -7
- package/lib/orderly/useMarginRatio.d.ts.map +0 -1
- package/lib/orderly/useMarginRatio.js +0 -65
- package/lib/orderly/useMarginRatio.js.map +0 -1
- package/lib/orderly/useMarkPrice.d.ts +0 -4
- package/lib/orderly/useMarkPrice.d.ts.map +0 -1
- package/lib/orderly/useMarkPrice.js +0 -44
- package/lib/orderly/useMarkPrice.js.map +0 -1
- package/lib/orderly/useMarkPricesStream.d.ts +0 -2
- package/lib/orderly/useMarkPricesStream.d.ts.map +0 -1
- package/lib/orderly/useMarkPricesStream.js +0 -42
- package/lib/orderly/useMarkPricesStream.js.map +0 -1
- package/lib/orderly/useMarketTradeStream.d.ts +0 -9
- package/lib/orderly/useMarketTradeStream.d.ts.map +0 -1
- package/lib/orderly/useMarketTradeStream.js +0 -76
- package/lib/orderly/useMarketTradeStream.js.map +0 -1
- package/lib/orderly/useMarkets.d.ts +0 -36
- package/lib/orderly/useMarkets.d.ts.map +0 -1
- package/lib/orderly/useMarkets.js +0 -349
- package/lib/orderly/useMarkets.js.map +0 -1
- package/lib/orderly/useMarketsStream.d.ts +0 -5
- package/lib/orderly/useMarketsStream.d.ts.map +0 -1
- package/lib/orderly/useMarketsStream.js +0 -68
- package/lib/orderly/useMarketsStream.js.map +0 -1
- package/lib/orderly/useMaxQty.d.ts +0 -9
- package/lib/orderly/useMaxQty.d.ts.map +0 -1
- package/lib/orderly/useMaxQty.js +0 -114
- package/lib/orderly/useMaxQty.js.map +0 -1
- package/lib/orderly/useOpenInterest.d.ts +0 -2
- package/lib/orderly/useOpenInterest.d.ts.map +0 -1
- package/lib/orderly/useOpenInterest.js +0 -32
- package/lib/orderly/useOpenInterest.js.map +0 -1
- package/lib/orderly/useOrderEntry.d.ts +0 -63
- package/lib/orderly/useOrderEntry.d.ts.map +0 -1
- package/lib/orderly/useOrderEntry.js +0 -553
- package/lib/orderly/useOrderEntry.js.map +0 -1
- package/lib/orderly/useOrderEntryNext/index.d.ts +0 -1
- package/lib/orderly/useOrderEntryNext/index.d.ts.map +0 -1
- package/lib/orderly/useOrderEntryNext/index.js +0 -3
- package/lib/orderly/useOrderEntryNext/index.js.map +0 -1
- package/lib/orderly/useOrderStream/useOrderStream.d.ts +0 -55
- package/lib/orderly/useOrderStream/useOrderStream.d.ts.map +0 -1
- package/lib/orderly/useOrderStream/useOrderStream.js +0 -292
- package/lib/orderly/useOrderStream/useOrderStream.js.map +0 -1
- package/lib/orderly/useOrderbookStream.d.ts +0 -52
- package/lib/orderly/useOrderbookStream.d.ts.map +0 -1
- package/lib/orderly/useOrderbookStream.js +0 -385
- package/lib/orderly/useOrderbookStream.js.map +0 -1
- package/lib/orderly/usePositionStream/usePositionStream.d.ts +0 -42
- package/lib/orderly/usePositionStream/usePositionStream.d.ts.map +0 -1
- package/lib/orderly/usePositionStream/usePositionStream.js +0 -287
- package/lib/orderly/usePositionStream/usePositionStream.js.map +0 -1
- package/lib/orderly/usePositionStream/utils.d.ts +0 -8
- package/lib/orderly/usePositionStream/utils.d.ts.map +0 -1
- package/lib/orderly/usePositionStream/utils.js +0 -55
- package/lib/orderly/usePositionStream/utils.js.map +0 -1
- package/lib/orderly/usePrivateDataObserver.d.ts +0 -5
- package/lib/orderly/usePrivateDataObserver.d.ts.map +0 -1
- package/lib/orderly/usePrivateDataObserver.js +0 -140
- package/lib/orderly/usePrivateDataObserver.js.map +0 -1
- package/lib/orderly/useSettleSubscription.d.ts +0 -4
- package/lib/orderly/useSettleSubscription.d.ts.map +0 -1
- package/lib/orderly/useSettleSubscription.js +0 -37
- package/lib/orderly/useSettleSubscription.js.map +0 -1
- package/lib/orderly/useSymbolLeverage.d.ts +0 -2
- package/lib/orderly/useSymbolLeverage.d.ts.map +0 -1
- package/lib/orderly/useSymbolLeverage.js +0 -41
- package/lib/orderly/useSymbolLeverage.js.map +0 -1
- package/lib/orderly/useSymbolPriceRange.d.ts +0 -13
- package/lib/orderly/useSymbolPriceRange.d.ts.map +0 -1
- package/lib/orderly/useSymbolPriceRange.js +0 -49
- package/lib/orderly/useSymbolPriceRange.js.map +0 -1
- package/lib/orderly/useSymbolsInfo.d.ts +0 -7
- package/lib/orderly/useSymbolsInfo.d.ts.map +0 -1
- package/lib/orderly/useSymbolsInfo.js +0 -45
- package/lib/orderly/useSymbolsInfo.js.map +0 -1
- package/lib/orderly/useTakeProfitAndStopLoss/__test__/useTakeProfitAndStopLoss.test.d.ts +0 -1
- package/lib/orderly/useTakeProfitAndStopLoss/__test__/useTakeProfitAndStopLoss.test.d.ts.map +0 -1
- package/lib/orderly/useTakeProfitAndStopLoss/__test__/utils.test.d.ts +0 -2
- package/lib/orderly/useTakeProfitAndStopLoss/__test__/utils.test.d.ts.map +0 -1
- package/lib/orderly/useTakeProfitAndStopLoss/index.d.ts +0 -30
- package/lib/orderly/useTakeProfitAndStopLoss/index.d.ts.map +0 -1
- package/lib/orderly/useTakeProfitAndStopLoss/index.js +0 -33
- package/lib/orderly/useTakeProfitAndStopLoss/index.js.map +0 -1
- package/lib/orderly/useTakeProfitAndStopLoss/useTPSL.d.ts +0 -57
- package/lib/orderly/useTakeProfitAndStopLoss/useTPSL.d.ts.map +0 -1
- package/lib/orderly/useTakeProfitAndStopLoss/useTPSL.js +0 -218
- package/lib/orderly/useTakeProfitAndStopLoss/useTPSL.js.map +0 -1
- package/lib/orderly/useTakeProfitAndStopLoss/utils.d.ts +0 -70
- package/lib/orderly/useTakeProfitAndStopLoss/utils.d.ts.map +0 -1
- package/lib/orderly/useTakeProfitAndStopLoss/utils.js +0 -254
- package/lib/orderly/useTakeProfitAndStopLoss/utils.js.map +0 -1
- package/lib/orderly/useTickerStream.d.ts +0 -7
- package/lib/orderly/useTickerStream.d.ts.map +0 -1
- package/lib/orderly/useTickerStream.js +0 -93
- package/lib/orderly/useTickerStream.js.map +0 -1
- package/lib/orderly/useWalletSubscription.d.ts +0 -4
- package/lib/orderly/useWalletSubscription.d.ts.map +0 -1
- package/lib/orderly/useWalletSubscription.js +0 -37
- package/lib/orderly/useWalletSubscription.js.map +0 -1
- package/lib/orderly/useWithdraw.d.ts +0 -24
- package/lib/orderly/useWithdraw.d.ts.map +0 -1
- package/lib/orderly/useWithdraw.js +0 -121
- package/lib/orderly/useWithdraw.js.map +0 -1
- package/lib/orderlyContext.d.ts +0 -24
- package/lib/orderlyContext.d.ts.map +0 -1
- package/lib/orderlyContext.js +0 -24
- package/lib/orderlyContext.js.map +0 -1
- package/lib/referral/api.d.ts +0 -87
- package/lib/referral/api.d.ts.map +0 -1
- package/lib/referral/api.js +0 -6
- package/lib/referral/api.js.map +0 -1
- package/lib/referral/format.d.ts +0 -2
- package/lib/referral/format.d.ts.map +0 -1
- package/lib/referral/format.js +0 -18
- package/lib/referral/format.js.map +0 -1
- package/lib/referral/index.d.ts +0 -12
- package/lib/referral/index.d.ts.map +0 -1
- package/lib/referral/index.js +0 -68
- package/lib/referral/index.js.map +0 -1
- package/lib/referral/swr.d.ts +0 -7
- package/lib/referral/swr.d.ts.map +0 -1
- package/lib/referral/swr.js +0 -34
- package/lib/referral/swr.js.map +0 -1
- package/lib/referral/useCheckReferralCode.d.ts +0 -6
- package/lib/referral/useCheckReferralCode.d.ts.map +0 -1
- package/lib/referral/useCheckReferralCode.js +0 -28
- package/lib/referral/useCheckReferralCode.js.map +0 -1
- package/lib/referral/useCommission.d.ts +0 -4
- package/lib/referral/useCommission.d.ts.map +0 -1
- package/lib/referral/useCommission.js +0 -69
- package/lib/referral/useCommission.js.map +0 -1
- package/lib/referral/useDaily.d.ts +0 -9
- package/lib/referral/useDaily.d.ts.map +0 -1
- package/lib/referral/useDaily.js +0 -30
- package/lib/referral/useDaily.js.map +0 -1
- package/lib/referral/useDistribution.d.ts +0 -9
- package/lib/referral/useDistribution.d.ts.map +0 -1
- package/lib/referral/useDistribution.js +0 -63
- package/lib/referral/useDistribution.js.map +0 -1
- package/lib/referral/useGetReferralCode.d.ts +0 -6
- package/lib/referral/useGetReferralCode.d.ts.map +0 -1
- package/lib/referral/useGetReferralCode.js +0 -28
- package/lib/referral/useGetReferralCode.js.map +0 -1
- package/lib/referral/useRefereeHistory.d.ts +0 -9
- package/lib/referral/useRefereeHistory.d.ts.map +0 -1
- package/lib/referral/useRefereeHistory.js +0 -57
- package/lib/referral/useRefereeHistory.js.map +0 -1
- package/lib/referral/useRefereeInfo.d.ts +0 -9
- package/lib/referral/useRefereeInfo.d.ts.map +0 -1
- package/lib/referral/useRefereeInfo.js +0 -57
- package/lib/referral/useRefereeInfo.js.map +0 -1
- package/lib/referral/useRefereeRebateSummary.d.ts +0 -12
- package/lib/referral/useRefereeRebateSummary.d.ts.map +0 -1
- package/lib/referral/useRefereeRebateSummary.js +0 -41
- package/lib/referral/useRefereeRebateSummary.js.map +0 -1
- package/lib/referral/useReferralInfo.d.ts +0 -10
- package/lib/referral/useReferralInfo.d.ts.map +0 -1
- package/lib/referral/useReferralInfo.js +0 -66
- package/lib/referral/useReferralInfo.js.map +0 -1
- package/lib/referral/useReferralRebateSummary.d.ts +0 -9
- package/lib/referral/useReferralRebateSummary.d.ts.map +0 -1
- package/lib/referral/useReferralRebateSummary.js +0 -57
- package/lib/referral/useReferralRebateSummary.js.map +0 -1
- package/lib/services/dataCenter.d.ts +0 -2
- package/lib/services/dataCenter.d.ts.map +0 -1
- package/lib/services/dataCenter.js +0 -19
- package/lib/services/dataCenter.js.map +0 -1
- package/lib/services/orderCreator/__test__/limitOrderCreator.test.d.ts +0 -2
- package/lib/services/orderCreator/__test__/limitOrderCreator.test.d.ts.map +0 -1
- package/lib/services/orderCreator/__test__/orderCreator.test.d.ts +0 -2
- package/lib/services/orderCreator/__test__/orderCreator.test.d.ts.map +0 -1
- package/lib/services/orderCreator/__test__/stopLimitOrderCreator.test.d.ts +0 -2
- package/lib/services/orderCreator/__test__/stopLimitOrderCreator.test.d.ts.map +0 -1
- package/lib/services/orderCreator/__test__/stopMarketOrderCreator.test.d.ts +0 -2
- package/lib/services/orderCreator/__test__/stopMarketOrderCreator.test.d.ts.map +0 -1
- package/lib/services/orderCreator/__test__/tpslOrderCreator.test.d.ts +0 -2
- package/lib/services/orderCreator/__test__/tpslOrderCreator.test.d.ts.map +0 -1
- package/lib/services/orderCreator/__test__/tpslPositionOrderCreator.test.d.ts +0 -2
- package/lib/services/orderCreator/__test__/tpslPositionOrderCreator.test.d.ts.map +0 -1
- package/lib/services/orderCreator/baseAlgoCreator.d.ts +0 -22
- package/lib/services/orderCreator/baseAlgoCreator.d.ts.map +0 -1
- package/lib/services/orderCreator/baseAlgoCreator.js +0 -67
- package/lib/services/orderCreator/baseAlgoCreator.js.map +0 -1
- package/lib/services/orderCreator/baseCreator.d.ts +0 -14
- package/lib/services/orderCreator/baseCreator.d.ts.map +0 -1
- package/lib/services/orderCreator/baseCreator.js +0 -108
- package/lib/services/orderCreator/baseCreator.js.map +0 -1
- package/lib/services/orderCreator/factory.d.ts +0 -7
- package/lib/services/orderCreator/factory.d.ts.map +0 -1
- package/lib/services/orderCreator/factory.js +0 -54
- package/lib/services/orderCreator/factory.js.map +0 -1
- package/lib/services/orderCreator/fokCreator.d.ts +0 -4
- package/lib/services/orderCreator/fokCreator.d.ts.map +0 -1
- package/lib/services/orderCreator/fokCreator.js +0 -15
- package/lib/services/orderCreator/fokCreator.js.map +0 -1
- package/lib/services/orderCreator/generalCreator.d.ts +0 -8
- package/lib/services/orderCreator/generalCreator.d.ts.map +0 -1
- package/lib/services/orderCreator/generalCreator.js +0 -25
- package/lib/services/orderCreator/generalCreator.js.map +0 -1
- package/lib/services/orderCreator/interface.d.ts +0 -23
- package/lib/services/orderCreator/interface.d.ts.map +0 -1
- package/lib/services/orderCreator/interface.js +0 -6
- package/lib/services/orderCreator/interface.js.map +0 -1
- package/lib/services/orderCreator/iocCreator.d.ts +0 -4
- package/lib/services/orderCreator/iocCreator.d.ts.map +0 -1
- package/lib/services/orderCreator/iocCreator.js +0 -15
- package/lib/services/orderCreator/iocCreator.js.map +0 -1
- package/lib/services/orderCreator/limitOrderCreator.d.ts +0 -8
- package/lib/services/orderCreator/limitOrderCreator.d.ts.map +0 -1
- package/lib/services/orderCreator/limitOrderCreator.js +0 -79
- package/lib/services/orderCreator/limitOrderCreator.js.map +0 -1
- package/lib/services/orderCreator/marketOrderCreator.d.ts +0 -24
- package/lib/services/orderCreator/marketOrderCreator.d.ts.map +0 -1
- package/lib/services/orderCreator/marketOrderCreator.js +0 -28
- package/lib/services/orderCreator/marketOrderCreator.js.map +0 -1
- package/lib/services/orderCreator/postOnlyCreator.d.ts +0 -4
- package/lib/services/orderCreator/postOnlyCreator.d.ts.map +0 -1
- package/lib/services/orderCreator/postOnlyCreator.js +0 -15
- package/lib/services/orderCreator/postOnlyCreator.js.map +0 -1
- package/lib/services/orderCreator/stopLimitOrderCreator.d.ts +0 -11
- package/lib/services/orderCreator/stopLimitOrderCreator.d.ts.map +0 -1
- package/lib/services/orderCreator/stopLimitOrderCreator.js +0 -93
- package/lib/services/orderCreator/stopLimitOrderCreator.js.map +0 -1
- package/lib/services/orderCreator/stopMarketOrderCreator.d.ts +0 -30
- package/lib/services/orderCreator/stopMarketOrderCreator.d.ts.map +0 -1
- package/lib/services/orderCreator/stopMarketOrderCreator.js +0 -56
- package/lib/services/orderCreator/stopMarketOrderCreator.js.map +0 -1
- package/lib/services/orderCreator/tpslOrderCreator.d.ts +0 -32
- package/lib/services/orderCreator/tpslOrderCreator.d.ts.map +0 -1
- package/lib/services/orderCreator/tpslOrderCreator.js +0 -94
- package/lib/services/orderCreator/tpslOrderCreator.js.map +0 -1
- package/lib/services/orderCreator/tpslPositionOrderCreator.d.ts +0 -33
- package/lib/services/orderCreator/tpslPositionOrderCreator.d.ts.map +0 -1
- package/lib/services/orderCreator/tpslPositionOrderCreator.js +0 -83
- package/lib/services/orderCreator/tpslPositionOrderCreator.js.map +0 -1
- package/lib/services/orderMerge/algoOrderMergeHandler.d.ts +0 -10
- package/lib/services/orderMerge/algoOrderMergeHandler.d.ts.map +0 -1
- package/lib/services/orderMerge/algoOrderMergeHandler.js +0 -56
- package/lib/services/orderMerge/algoOrderMergeHandler.js.map +0 -1
- package/lib/services/orderMerge/baseMergeHandler.d.ts +0 -23
- package/lib/services/orderMerge/baseMergeHandler.d.ts.map +0 -1
- package/lib/services/orderMerge/baseMergeHandler.js +0 -170
- package/lib/services/orderMerge/baseMergeHandler.js.map +0 -1
- package/lib/services/orderMerge/interface.d.ts +0 -8
- package/lib/services/orderMerge/interface.d.ts.map +0 -1
- package/lib/services/orderMerge/interface.js +0 -6
- package/lib/services/orderMerge/interface.js.map +0 -1
- package/lib/services/orderMerge/regularOrderMergeHandler.d.ts +0 -9
- package/lib/services/orderMerge/regularOrderMergeHandler.d.ts.map +0 -1
- package/lib/services/orderMerge/regularOrderMergeHandler.js +0 -28
- package/lib/services/orderMerge/regularOrderMergeHandler.js.map +0 -1
- package/lib/services/painter/backgroundPaint.d.ts +0 -9
- package/lib/services/painter/backgroundPaint.d.ts.map +0 -1
- package/lib/services/painter/backgroundPaint.js +0 -48
- package/lib/services/painter/backgroundPaint.js.map +0 -1
- package/lib/services/painter/basePaint.d.ts +0 -104
- package/lib/services/painter/basePaint.d.ts.map +0 -1
- package/lib/services/painter/basePaint.js +0 -20
- package/lib/services/painter/basePaint.js.map +0 -1
- package/lib/services/painter/dataPaint.d.ts +0 -20
- package/lib/services/painter/dataPaint.d.ts.map +0 -1
- package/lib/services/painter/dataPaint.js +0 -325
- package/lib/services/painter/dataPaint.js.map +0 -1
- package/lib/services/painter/layout.config.d.ts +0 -3
- package/lib/services/painter/layout.config.d.ts.map +0 -1
- package/lib/services/painter/layout.config.js +0 -69
- package/lib/services/painter/layout.config.js.map +0 -1
- package/lib/services/painter/painter.d.ts +0 -14
- package/lib/services/painter/painter.d.ts.map +0 -1
- package/lib/services/painter/painter.js +0 -58
- package/lib/services/painter/painter.js.map +0 -1
- package/lib/services/painter/qrPaint.d.ts +0 -8
- package/lib/services/painter/qrPaint.d.ts.map +0 -1
- package/lib/services/painter/qrPaint.js +0 -49
- package/lib/services/painter/qrPaint.js.map +0 -1
- package/lib/services/painter/resource.d.ts +0 -7
- package/lib/services/painter/resource.d.ts.map +0 -1
- package/lib/services/painter/resource.js +0 -27
- package/lib/services/painter/resource.js.map +0 -1
- package/lib/statusProvider.d.ts +0 -8
- package/lib/statusProvider.d.ts.map +0 -1
- package/lib/statusProvider.js +0 -33
- package/lib/statusProvider.js.map +0 -1
- package/lib/unuse/apiPrefixMiddleware.d.ts +0 -3
- package/lib/unuse/apiPrefixMiddleware.d.ts.map +0 -1
- package/lib/unuse/apiPrefixMiddleware.js +0 -39
- package/lib/unuse/apiPrefixMiddleware.js.map +0 -1
- package/lib/unuse/fn.d.ts +0 -2
- package/lib/unuse/fn.d.ts.map +0 -1
- package/lib/unuse/fn.js +0 -18
- package/lib/unuse/fn.js.map +0 -1
- package/lib/unuse/useBalance.d.ts +0 -2
- package/lib/unuse/useBalance.d.ts.map +0 -1
- package/lib/unuse/useBalance.js +0 -29
- package/lib/unuse/useBalance.js.map +0 -1
- package/lib/unuse/useFetures.d.ts +0 -11
- package/lib/unuse/useFetures.d.ts.map +0 -1
- package/lib/unuse/useFetures.js +0 -56
- package/lib/unuse/useFetures.js.map +0 -1
- package/lib/unuse/useRunOnce.d.ts +0 -7
- package/lib/unuse/useRunOnce.d.ts.map +0 -1
- package/lib/unuse/useRunOnce.js +0 -71
- package/lib/unuse/useRunOnce.js.map +0 -1
- package/lib/unuse/useSyncEnd.d.ts +0 -2
- package/lib/unuse/useSyncEnd.d.ts.map +0 -1
- package/lib/unuse/useSyncEnd.js +0 -21
- package/lib/unuse/useSyncEnd.js.map +0 -1
- package/lib/unuse/useTokenInfo.d.ts +0 -7
- package/lib/unuse/useTokenInfo.d.ts.map +0 -1
- package/lib/unuse/useTokenInfo.js +0 -32
- package/lib/unuse/useTokenInfo.js.map +0 -1
- package/lib/unuse/useUnsettlementPnL.d.ts +0 -2
- package/lib/unuse/useUnsettlementPnL.d.ts.map +0 -1
- package/lib/unuse/useUnsettlementPnL.js +0 -34
- package/lib/unuse/useUnsettlementPnL.js.map +0 -1
- package/lib/useAccount.d.ts +0 -8
- package/lib/useAccount.d.ts.map +0 -1
- package/lib/useAccount.js +0 -66
- package/lib/useAccount.js.map +0 -1
- package/lib/useAccountInstance.d.ts +0 -3
- package/lib/useAccountInstance.d.ts.map +0 -1
- package/lib/useAccountInstance.js +0 -37
- package/lib/useAccountInstance.js.map +0 -1
- package/lib/useBoolean.d.ts +0 -6
- package/lib/useBoolean.d.ts.map +0 -1
- package/lib/useBoolean.js +0 -27
- package/lib/useBoolean.js.map +0 -1
- package/lib/useConfig.d.ts +0 -4
- package/lib/useConfig.d.ts.map +0 -1
- package/lib/useConfig.js +0 -24
- package/lib/useConfig.js.map +0 -1
- package/lib/useEventEmitter.d.ts +0 -3
- package/lib/useEventEmitter.d.ts.map +0 -1
- package/lib/useEventEmitter.js +0 -29
- package/lib/useEventEmitter.js.map +0 -1
- package/lib/useLazyQuery.d.ts +0 -13
- package/lib/useLazyQuery.d.ts.map +0 -1
- package/lib/useLazyQuery.js +0 -44
- package/lib/useLazyQuery.js.map +0 -1
- package/lib/useLocalStorage.d.ts +0 -2
- package/lib/useLocalStorage.d.ts.map +0 -1
- package/lib/useLocalStorage.js +0 -92
- package/lib/useLocalStorage.js.map +0 -1
- package/lib/useMediaQuery.d.ts +0 -2
- package/lib/useMediaQuery.d.ts.map +0 -1
- package/lib/useMediaQuery.js +0 -48
- package/lib/useMediaQuery.js.map +0 -1
- package/lib/useMutation.d.ts +0 -13
- package/lib/useMutation.d.ts.map +0 -1
- package/lib/useMutation.js +0 -94
- package/lib/useMutation.js.map +0 -1
- package/lib/useObserve.d.ts +0 -6
- package/lib/useObserve.d.ts.map +0 -1
- package/lib/useObserve.js +0 -26
- package/lib/useObserve.js.map +0 -1
- package/lib/useParamsCheck.d.ts +0 -4
- package/lib/useParamsCheck.d.ts.map +0 -1
- package/lib/useParamsCheck.js +0 -22
- package/lib/useParamsCheck.js.map +0 -1
- package/lib/usePoster.d.ts +0 -44
- package/lib/usePoster.d.ts.map +0 -1
- package/lib/usePoster.js +0 -138
- package/lib/usePoster.js.map +0 -1
- package/lib/usePreloadData.d.ts +0 -5
- package/lib/usePreloadData.d.ts.map +0 -1
- package/lib/usePreloadData.js +0 -48
- package/lib/usePreloadData.js.map +0 -1
- package/lib/usePrivateInfiniteQuery.d.ts +0 -5
- package/lib/usePrivateInfiniteQuery.d.ts.map +0 -1
- package/lib/usePrivateInfiniteQuery.js +0 -46
- package/lib/usePrivateInfiniteQuery.js.map +0 -1
- package/lib/usePrivateQuery.d.ts +0 -10
- package/lib/usePrivateQuery.d.ts.map +0 -1
- package/lib/usePrivateQuery.js +0 -43
- package/lib/usePrivateQuery.js.map +0 -1
- package/lib/useQuery.d.ts +0 -10
- package/lib/useQuery.d.ts.map +0 -1
- package/lib/useQuery.js +0 -31
- package/lib/useQuery.js.map +0 -1
- package/lib/useSessionStorage.d.ts +0 -2
- package/lib/useSessionStorage.d.ts.map +0 -1
- package/lib/useSessionStorage.js +0 -79
- package/lib/useSessionStorage.js.map +0 -1
- package/lib/useWS.d.ts +0 -3
- package/lib/useWS.d.ts.map +0 -1
- package/lib/useWS.js +0 -69
- package/lib/useWS.js.map +0 -1
- package/lib/useWsStatus.d.ts +0 -7
- package/lib/useWsStatus.d.ts.map +0 -1
- package/lib/useWsStatus.js +0 -59
- package/lib/useWsStatus.js.map +0 -1
- package/lib/utils/createGetter.d.ts +0 -11
- package/lib/utils/createGetter.d.ts.map +0 -1
- package/lib/utils/createGetter.js +0 -35
- package/lib/utils/createGetter.js.map +0 -1
- package/lib/utils/createOrder.d.ts +0 -2
- package/lib/utils/createOrder.d.ts.map +0 -1
- package/lib/utils/createOrder.js +0 -26
- package/lib/utils/createOrder.js.map +0 -1
- package/lib/utils/dev.d.ts +0 -2
- package/lib/utils/dev.d.ts.map +0 -1
- package/lib/utils/dev.js +0 -25
- package/lib/utils/dev.js.map +0 -1
- package/lib/utils/fetcher.d.ts +0 -6
- package/lib/utils/fetcher.d.ts.map +0 -1
- package/lib/utils/fetcher.js +0 -14
- package/lib/utils/fetcher.js.map +0 -1
- package/lib/utils/fokCreator.d.ts +0 -1
- package/lib/utils/fokCreator.d.ts.map +0 -1
- package/lib/utils/fokCreator.js +0 -3
- package/lib/utils/fokCreator.js.map +0 -1
- package/lib/utils/index.d.ts +0 -6
- package/lib/utils/index.d.ts.map +0 -1
- package/lib/utils/index.js +0 -39
- package/lib/utils/index.js.map +0 -1
- package/lib/utils/json.d.ts +0 -2
- package/lib/utils/json.d.ts.map +0 -1
- package/lib/utils/json.js +0 -19
- package/lib/utils/json.js.map +0 -1
- package/lib/utils/order.d.ts +0 -2
- package/lib/utils/order.d.ts.map +0 -1
- package/lib/utils/order.js +0 -6
- package/lib/utils/order.js.map +0 -1
- package/lib/utils/orderEntryHelper.d.ts +0 -26
- package/lib/utils/orderEntryHelper.d.ts.map +0 -1
- package/lib/utils/orderEntryHelper.js +0 -320
- package/lib/utils/orderEntryHelper.js.map +0 -1
- package/lib/utils/parseHolding.d.ts +0 -9
- package/lib/utils/parseHolding.d.ts.map +0 -1
- package/lib/utils/parseHolding.js +0 -35
- package/lib/utils/parseHolding.js.map +0 -1
- package/lib/utils/swr.d.ts +0 -12
- package/lib/utils/swr.d.ts.map +0 -1
- package/lib/utils/swr.js +0 -262
- package/lib/utils/swr.js.map +0 -1
- package/lib/utils/ws.d.ts +0 -2
- package/lib/utils/ws.d.ts.map +0 -1
- package/lib/utils/ws.js +0 -19
- package/lib/utils/ws.js.map +0 -1
- package/lib/version.d.ts +0 -10
- package/lib/version.d.ts.map +0 -1
- package/lib/version.js +0 -17
- package/lib/version.js.map +0 -1
- package/lib/walletConnectorContext.d.ts +0 -31
- package/lib/walletConnectorContext.d.ts.map +0 -1
- package/lib/walletConnectorContext.js +0 -25
- package/lib/walletConnectorContext.js.map +0 -1
package/lib/usePoster.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { type DrawOptions } from "./services/painter/basePaint";
|
|
2
|
-
/**
|
|
3
|
-
* Generates a poster image based on position information. You can set the size, background color, font color, font size, and content position of the poster.
|
|
4
|
-
* @example
|
|
5
|
-
* ```tsx
|
|
6
|
-
* const { ref, toDataURL, toBlob, download, copy } = usePoster({
|
|
7
|
-
* backgroundColor: "#0b8c70",
|
|
8
|
-
* backgroundImg: "/images/poster_bg.png",
|
|
9
|
-
* color: "rgba(255, 255, 255, 0.98)",
|
|
10
|
-
* profitColor: "rgb(0,181,159)",
|
|
11
|
-
* // ...
|
|
12
|
-
* });
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export declare const usePoster: (data: DrawOptions, options?: {
|
|
16
|
-
/**
|
|
17
|
-
* The ratio of the poster
|
|
18
|
-
*/
|
|
19
|
-
ratio?: number;
|
|
20
|
-
}) => {
|
|
21
|
-
readonly error: Error | null;
|
|
22
|
-
/**
|
|
23
|
-
* The ref to the canvas element, you should pass this ref to the canvas element
|
|
24
|
-
*/
|
|
25
|
-
readonly ref: (ref: HTMLCanvasElement | null) => void;
|
|
26
|
-
/**
|
|
27
|
-
* Converts the poster to a data URL
|
|
28
|
-
*/
|
|
29
|
-
readonly toDataURL: (type?: string, encoderOptions?: number) => string;
|
|
30
|
-
/**
|
|
31
|
-
* Converts the poster to a blob
|
|
32
|
-
*/
|
|
33
|
-
readonly toBlob: (type?: string, encoderOptions?: number) => Promise<Blob | null>;
|
|
34
|
-
/**
|
|
35
|
-
* Downloads the poster as an image
|
|
36
|
-
*/
|
|
37
|
-
readonly download: (filename: string, type?: string, encoderOptions?: number) => void;
|
|
38
|
-
/**
|
|
39
|
-
* Browser if supports copy image to clipboard
|
|
40
|
-
*/
|
|
41
|
-
readonly canCopy: boolean;
|
|
42
|
-
readonly copy: () => Promise<void>;
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=usePoster.d.ts.map
|
package/lib/usePoster.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePoster.d.ts","sourceRoot":"","sources":["../src/usePoster.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAIhE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,SAId,WAAW,YACP;IACR;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;;IAiHC;;OAEG;wBAnDa,iBAAiB,GAAG,IAAI;IAqDxC;;OAEG;gCA9EqB,MAAM,mBAAmB,MAAM;IAgFvD;;OAEG;6BAvEK,MAAM,mBAAmB,MAAM,KAAG,QAAQ,IAAI,GAAG,IAAI,CAAC;IAyE9D;;OAEG;kCApDQ,MAAM,SAAQ,MAAM,mBAAiC,MAAM;IAsDtE;;OAEG;;;CAIN,CAAC"}
|
package/lib/usePoster.js
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "usePoster", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return usePoster;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _react = require("react");
|
|
12
|
-
const _ramda = require("ramda");
|
|
13
|
-
const _painter = require("./services/painter/painter");
|
|
14
|
-
const _layoutconfig = require("./services/painter/layout.config");
|
|
15
|
-
const _types = require("@orderly.network/types");
|
|
16
|
-
const usePoster = (/**
|
|
17
|
-
* The options to draw the poster
|
|
18
|
-
*/ data, options)=>{
|
|
19
|
-
const [error, setError] = (0, _react.useState)(null);
|
|
20
|
-
const [canCopy, setCanCopy] = (0, _react.useState)(()=>typeof navigator.clipboard !== "undefined");
|
|
21
|
-
const painterRef = (0, _react.useRef)(null);
|
|
22
|
-
const [target, setTarget] = (0, _react.useState)(null);
|
|
23
|
-
(0, _react.useEffect)(()=>{
|
|
24
|
-
// Create the painter instance
|
|
25
|
-
if (target) {
|
|
26
|
-
if (!painterRef.current) {
|
|
27
|
-
painterRef.current = new _painter.PosterPainter(target, {
|
|
28
|
-
ratio: options?.ratio || 1,
|
|
29
|
-
...options
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
painterRef.current.draw((0, _ramda.mergeDeepRight)({
|
|
33
|
-
layout: _layoutconfig.DefaultLayoutConfig,
|
|
34
|
-
fontFamily: "Manrope"
|
|
35
|
-
}, data));
|
|
36
|
-
}
|
|
37
|
-
}, [
|
|
38
|
-
target,
|
|
39
|
-
data
|
|
40
|
-
]);
|
|
41
|
-
// useEffect(() => {
|
|
42
|
-
// if (painterRef.current) {
|
|
43
|
-
// painterRef.current.draw(
|
|
44
|
-
// mergeDeepRight<Partial<DrawOptions>, DrawOptions>(
|
|
45
|
-
// { layout: DefaultLayoutConfig, fontFamily: "Manrope" },
|
|
46
|
-
// data
|
|
47
|
-
// )
|
|
48
|
-
// );
|
|
49
|
-
// }
|
|
50
|
-
// }, [data]);
|
|
51
|
-
const toDataURL = (type, encoderOptions)=>{
|
|
52
|
-
if (!target) {
|
|
53
|
-
throw new _types.SDKError("The ref must be a canvas element");
|
|
54
|
-
}
|
|
55
|
-
return target.toDataURL(type, encoderOptions);
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Converts the poster to a blob
|
|
59
|
-
*/ const toBlob = (0, _react.useCallback)((type, encoderOptions)=>{
|
|
60
|
-
return new Promise((resolve)=>{
|
|
61
|
-
if (!target) {
|
|
62
|
-
resolve(null);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
target.toBlob(resolve, type, encoderOptions);
|
|
66
|
-
});
|
|
67
|
-
}, [
|
|
68
|
-
target
|
|
69
|
-
]);
|
|
70
|
-
const ref = (ref)=>{
|
|
71
|
-
if (!ref) return;
|
|
72
|
-
if (ref.tagName.toUpperCase() !== "CANVAS") {
|
|
73
|
-
// throw new Error("The ref must be a canvas element");
|
|
74
|
-
setError(new _types.SDKError("The ref must be a canvas element"));
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
setTarget(ref);
|
|
78
|
-
};
|
|
79
|
-
const download = (0, _react.useCallback)((filename, type = "image/png", encoderOptions)=>{
|
|
80
|
-
if (!target) {
|
|
81
|
-
throw new _types.SDKError("The ref must be a canvas element");
|
|
82
|
-
}
|
|
83
|
-
const img = new Image();
|
|
84
|
-
img.src = target.toDataURL(type, encoderOptions);
|
|
85
|
-
const link = document.createElement("a");
|
|
86
|
-
link.href = img.src;
|
|
87
|
-
link.download = filename;
|
|
88
|
-
link.click();
|
|
89
|
-
}, [
|
|
90
|
-
target
|
|
91
|
-
]);
|
|
92
|
-
const copy = (0, _react.useCallback)(()=>{
|
|
93
|
-
if (!target) {
|
|
94
|
-
throw new _types.SDKError("The ref must be a canvas element");
|
|
95
|
-
}
|
|
96
|
-
// copy image to clipboard
|
|
97
|
-
return new Promise((resolve, reject)=>{
|
|
98
|
-
if (!navigator.clipboard) {
|
|
99
|
-
reject(new _types.SDKError("Clipboard API is not supported"));
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
target.toBlob((blob)=>{
|
|
103
|
-
if (!blob) {
|
|
104
|
-
reject(new _types.SDKError("Failed to create blob"));
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
return navigator.clipboard.write([
|
|
108
|
-
new ClipboardItem({
|
|
109
|
-
[blob.type]: blob
|
|
110
|
-
})
|
|
111
|
-
]).then(resolve, reject);
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
}, [
|
|
115
|
-
target
|
|
116
|
-
]);
|
|
117
|
-
return {
|
|
118
|
-
error,
|
|
119
|
-
/**
|
|
120
|
-
* The ref to the canvas element, you should pass this ref to the canvas element
|
|
121
|
-
*/ ref,
|
|
122
|
-
/**
|
|
123
|
-
* Converts the poster to a data URL
|
|
124
|
-
*/ toDataURL,
|
|
125
|
-
/**
|
|
126
|
-
* Converts the poster to a blob
|
|
127
|
-
*/ toBlob,
|
|
128
|
-
/**
|
|
129
|
-
* Downloads the poster as an image
|
|
130
|
-
*/ download,
|
|
131
|
-
/**
|
|
132
|
-
* Browser if supports copy image to clipboard
|
|
133
|
-
*/ canCopy,
|
|
134
|
-
copy
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
//# sourceMappingURL=usePoster.js.map
|
package/lib/usePoster.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/usePoster.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { mergeDeepRight } from \"ramda\";\nimport { PosterPainter } from \"./services/painter/painter\";\nimport { type DrawOptions } from \"./services/painter/basePaint\";\nimport { DefaultLayoutConfig } from \"./services/painter/layout.config\";\nimport { SDKError } from \"@orderly.network/types\";\n\n/**\n * Generates a poster image based on position information. You can set the size, background color, font color, font size, and content position of the poster.\n * @example\n * ```tsx\n * const { ref, toDataURL, toBlob, download, copy } = usePoster({\n * backgroundColor: \"#0b8c70\",\n * backgroundImg: \"/images/poster_bg.png\",\n * color: \"rgba(255, 255, 255, 0.98)\",\n * profitColor: \"rgb(0,181,159)\",\n * // ...\n * });\n * ```\n */\nexport const usePoster = (\n /**\n * The options to draw the poster\n */\n data: DrawOptions,\n options?: {\n /**\n * The ratio of the poster\n */\n ratio?: number;\n }\n) => {\n const [error, setError] = useState<Error | null>(null);\n const [canCopy, setCanCopy] = useState<boolean>(\n () => typeof navigator.clipboard !== \"undefined\"\n );\n\n const painterRef = useRef<PosterPainter | null>(null);\n\n const [target, setTarget] = useState<HTMLCanvasElement | null>(null);\n\n useEffect(() => {\n // Create the painter instance\n if (target) {\n if (!painterRef.current) {\n painterRef.current = new PosterPainter(target, {\n ratio: options?.ratio || 1,\n ...options,\n });\n }\n\n painterRef.current.draw(\n mergeDeepRight<Partial<DrawOptions>, DrawOptions>(\n { layout: DefaultLayoutConfig, fontFamily: \"Manrope\" },\n data\n )\n );\n }\n }, [target, data]);\n\n // useEffect(() => {\n // if (painterRef.current) {\n // painterRef.current.draw(\n // mergeDeepRight<Partial<DrawOptions>, DrawOptions>(\n // { layout: DefaultLayoutConfig, fontFamily: \"Manrope\" },\n // data\n // )\n // );\n // }\n // }, [data]);\n\n const toDataURL = (type?: string, encoderOptions?: number) => {\n if (!target) {\n throw new SDKError(\"The ref must be a canvas element\");\n }\n return target.toDataURL(type, encoderOptions);\n };\n\n /**\n * Converts the poster to a blob\n */\n const toBlob = useCallback(\n (type?: string, encoderOptions?: number): Promise<Blob | null> => {\n return new Promise<Blob | null>((resolve) => {\n if (!target) {\n resolve(null);\n return;\n }\n target.toBlob(resolve, type, encoderOptions);\n });\n },\n [target]\n );\n\n const ref = (ref: HTMLCanvasElement | null) => {\n if (!ref) return;\n if (ref.tagName.toUpperCase() !== \"CANVAS\") {\n // throw new Error(\"The ref must be a canvas element\");\n setError(new SDKError(\"The ref must be a canvas element\"));\n return;\n }\n setTarget(ref);\n };\n\n const download = useCallback(\n (filename: string, type: string = \"image/png\", encoderOptions?: number) => {\n if (!target) {\n throw new SDKError(\"The ref must be a canvas element\");\n }\n const img = new Image();\n img.src = target.toDataURL(type, encoderOptions);\n const link = document.createElement(\"a\");\n link.href = img.src;\n link.download = filename;\n link.click();\n },\n [target]\n );\n\n const copy = useCallback(() => {\n if (!target) {\n throw new SDKError(\"The ref must be a canvas element\");\n }\n // copy image to clipboard\n return new Promise<void>((resolve, reject) => {\n if (!navigator.clipboard) {\n reject(new SDKError(\"Clipboard API is not supported\"));\n return;\n }\n target.toBlob((blob) => {\n if (!blob) {\n reject(new SDKError(\"Failed to create blob\"));\n return;\n }\n return navigator.clipboard\n .write([new ClipboardItem({ [blob.type]: blob })])\n .then(resolve, reject);\n });\n });\n }, [target]);\n\n return {\n error,\n /**\n * The ref to the canvas element, you should pass this ref to the canvas element\n */\n ref,\n /**\n * Converts the poster to a data URL\n */\n toDataURL,\n /**\n * Converts the poster to a blob\n */\n toBlob,\n /**\n * Downloads the poster as an image\n */\n download,\n /**\n * Browser if supports copy image to clipboard\n */\n canCopy,\n copy,\n } as const;\n};\n"],"names":["usePoster","data","options","error","setError","useState","canCopy","setCanCopy","navigator","clipboard","painterRef","useRef","target","setTarget","useEffect","current","PosterPainter","ratio","draw","mergeDeepRight","layout","DefaultLayoutConfig","fontFamily","toDataURL","type","encoderOptions","SDKError","toBlob","useCallback","Promise","resolve","ref","tagName","toUpperCase","download","filename","img","Image","src","link","document","createElement","href","click","copy","reject","blob","write","ClipboardItem","then"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAoBaA;;;eAAAA;;;uBApB4C;uBAC1B;yBACD;8BAEM;uBACX;AAelB,MAAMA,YAAY,CACvB;;GAEC,GACDC,MACAC;IAOA,MAAM,CAACC,OAAOC,SAAS,GAAGC,IAAAA,eAAQ,EAAe;IACjD,MAAM,CAACC,SAASC,WAAW,GAAGF,IAAAA,eAAQ,EACpC,IAAM,OAAOG,UAAUC,SAAS,KAAK;IAGvC,MAAMC,aAAaC,IAAAA,aAAM,EAAuB;IAEhD,MAAM,CAACC,QAAQC,UAAU,GAAGR,IAAAA,eAAQ,EAA2B;IAE/DS,IAAAA,gBAAS,EAAC;QACR,8BAA8B;QAC9B,IAAIF,QAAQ;YACV,IAAI,CAACF,WAAWK,OAAO,EAAE;gBACvBL,WAAWK,OAAO,GAAG,IAAIC,sBAAa,CAACJ,QAAQ;oBAC7CK,OAAOf,SAASe,SAAS;oBACzB,GAAGf,OAAO;gBACZ;YACF;YAEAQ,WAAWK,OAAO,CAACG,IAAI,CACrBC,IAAAA,qBAAc,EACZ;gBAAEC,QAAQC,iCAAmB;gBAAEC,YAAY;YAAU,GACrDrB;QAGN;IACF,GAAG;QAACW;QAAQX;KAAK;IAEjB,oBAAoB;IACpB,8BAA8B;IAC9B,+BAA+B;IAC/B,2DAA2D;IAC3D,kEAAkE;IAClE,eAAe;IACf,UAAU;IACV,SAAS;IACT,MAAM;IACN,cAAc;IAEd,MAAMsB,YAAY,CAACC,MAAeC;QAChC,IAAI,CAACb,QAAQ;YACX,MAAM,IAAIc,eAAQ,CAAC;QACrB;QACA,OAAOd,OAAOW,SAAS,CAACC,MAAMC;IAChC;IAEA;;GAEC,GACD,MAAME,SAASC,IAAAA,kBAAW,EACxB,CAACJ,MAAeC;QACd,OAAO,IAAII,QAAqB,CAACC;YAC/B,IAAI,CAAClB,QAAQ;gBACXkB,QAAQ;gBACR;YACF;YACAlB,OAAOe,MAAM,CAACG,SAASN,MAAMC;QAC/B;IACF,GACA;QAACb;KAAO;IAGV,MAAMmB,MAAM,CAACA;QACX,IAAI,CAACA,KAAK;QACV,IAAIA,IAAIC,OAAO,CAACC,WAAW,OAAO,UAAU;YAC1C,uDAAuD;YACvD7B,SAAS,IAAIsB,eAAQ,CAAC;YACtB;QACF;QACAb,UAAUkB;IACZ;IAEA,MAAMG,WAAWN,IAAAA,kBAAW,EAC1B,CAACO,UAAkBX,OAAe,WAAW,EAAEC;QAC7C,IAAI,CAACb,QAAQ;YACX,MAAM,IAAIc,eAAQ,CAAC;QACrB;QACA,MAAMU,MAAM,IAAIC;QAChBD,IAAIE,GAAG,GAAG1B,OAAOW,SAAS,CAACC,MAAMC;QACjC,MAAMc,OAAOC,SAASC,aAAa,CAAC;QACpCF,KAAKG,IAAI,GAAGN,IAAIE,GAAG;QACnBC,KAAKL,QAAQ,GAAGC;QAChBI,KAAKI,KAAK;IACZ,GACA;QAAC/B;KAAO;IAGV,MAAMgC,OAAOhB,IAAAA,kBAAW,EAAC;QACvB,IAAI,CAAChB,QAAQ;YACX,MAAM,IAAIc,eAAQ,CAAC;QACrB;QACA,0BAA0B;QAC1B,OAAO,IAAIG,QAAc,CAACC,SAASe;YACjC,IAAI,CAACrC,UAAUC,SAAS,EAAE;gBACxBoC,OAAO,IAAInB,eAAQ,CAAC;gBACpB;YACF;YACAd,OAAOe,MAAM,CAAC,CAACmB;gBACb,IAAI,CAACA,MAAM;oBACTD,OAAO,IAAInB,eAAQ,CAAC;oBACpB;gBACF;gBACA,OAAOlB,UAAUC,SAAS,CACvBsC,KAAK,CAAC;oBAAC,IAAIC,cAAc;wBAAE,CAACF,KAAKtB,IAAI,CAAC,EAAEsB;oBAAK;iBAAG,EAChDG,IAAI,CAACnB,SAASe;YACnB;QACF;IACF,GAAG;QAACjC;KAAO;IAEX,OAAO;QACLT;QACA;;KAEC,GACD4B;QACA;;KAEC,GACDR;QACA;;KAEC,GACDI;QACA;;KAEC,GACDO;QACA;;KAEC,GACD5B;QACAsC;IACF;AACF"}
|
package/lib/usePreloadData.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePreloadData.d.ts","sourceRoot":"","sources":["../src/usePreloadData.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc;;;CAoD1B,CAAC"}
|
package/lib/usePreloadData.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "usePreLoadData", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return usePreLoadData;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _react = require("react");
|
|
12
|
-
const _ = require(".");
|
|
13
|
-
const _utils = require("@orderly.network/utils");
|
|
14
|
-
const usePreLoadData = ()=>{
|
|
15
|
-
const { error: tokenError, data: tokenData } = (0, _.useQuery)("https://api-evm.orderly.org/v1/public/token", {
|
|
16
|
-
revalidateOnFocus: false
|
|
17
|
-
});
|
|
18
|
-
/// get service timestamp
|
|
19
|
-
/// get local timestamp
|
|
20
|
-
/// calculate delta offset = SD - LD
|
|
21
|
-
/// save to getGlobalObject.__ORDERLY_timestamp_offset
|
|
22
|
-
const apiBaseUrl = (0, _.useConfig)("apiBaseUrl");
|
|
23
|
-
const { data: systemInfo } = (0, _.useSWR)("/v1/public/system_info", async (url, init)=>{
|
|
24
|
-
const data = await fetch(url.startsWith("http") ? url : `${apiBaseUrl}${url}`, init);
|
|
25
|
-
return await data.json();
|
|
26
|
-
}, {
|
|
27
|
-
errorRetryCount: 3,
|
|
28
|
-
errorRetryInterval: 500
|
|
29
|
-
});
|
|
30
|
-
if (typeof systemInfo !== "undefined") {
|
|
31
|
-
const sd = systemInfo.timestamp;
|
|
32
|
-
const ld = Date.now();
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
(0, _utils.getGlobalObject)().__ORDERLY_timestamp_offset = sd - ld;
|
|
35
|
-
}
|
|
36
|
-
;
|
|
37
|
-
const isDone = (0, _react.useMemo)(()=>{
|
|
38
|
-
return !!tokenData;
|
|
39
|
-
}, [
|
|
40
|
-
tokenData
|
|
41
|
-
]);
|
|
42
|
-
return {
|
|
43
|
-
error: tokenError,
|
|
44
|
-
done: isDone
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
//# sourceMappingURL=usePreloadData.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/usePreloadData.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useConfig, useQuery, useSWR } from \".\";\nimport { request } from \"@orderly.network/net/src/fetch\";\nimport { getGlobalObject } from \"@orderly.network/utils\";\n\nexport const usePreLoadData = () => {\n const { error: tokenError, data: tokenData } = useQuery(\n \"https://api-evm.orderly.org/v1/public/token\",\n {\n revalidateOnFocus: false,\n }\n );\n\n /// get service timestamp\n /// get local timestamp\n /// calculate delta offset = SD - LD\n /// save to getGlobalObject.__ORDERLY_timestamp_offset\n\n const apiBaseUrl = useConfig(\"apiBaseUrl\");\n\n const { data: systemInfo } = useSWR(\n \"/v1/public/system_info\",\n async (url: any, init: any) => {\n const data = await fetch(\n url.startsWith(\"http\") ? url : `${apiBaseUrl}${url}`,\n init\n );\n return await data.json();\n },\n {\n errorRetryCount: 3,\n errorRetryInterval: 500,\n }\n );\n\n if (typeof systemInfo !== \"undefined\") {\n const sd = systemInfo.timestamp;\n const ld = Date.now();\n // @ts-ignore\n getGlobalObject().__ORDERLY_timestamp_offset = sd - ld;\n }\n\n console.log(\n \"systemInfo\",\n systemInfo,\n // @ts-ignore\n getGlobalObject().__ORDERLY_timestamp_offset\n );\n\n const isDone = useMemo(() => {\n return !!tokenData;\n }, [tokenData]);\n\n return {\n error: tokenError,\n done: isDone,\n };\n};\n"],"names":["usePreLoadData","error","tokenError","data","tokenData","useQuery","revalidateOnFocus","apiBaseUrl","useConfig","systemInfo","useSWR","url","init","fetch","startsWith","json","errorRetryCount","errorRetryInterval","sd","timestamp","ld","Date","now","getGlobalObject","__ORDERLY_timestamp_offset","isDone","useMemo","done"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAKaA;;;eAAAA;;;uBALW;kBACoB;uBAEZ;AAEzB,MAAMA,iBAAiB;IAC5B,MAAM,EAAEC,OAAOC,UAAU,EAAEC,MAAMC,SAAS,EAAE,GAAGC,IAAAA,UAAQ,EACrD,+CACA;QACEC,mBAAmB;IACrB;IAGF,yBAAyB;IACzB,uBAAuB;IACvB,oCAAoC;IACpC,sDAAsD;IAEtD,MAAMC,aAAaC,IAAAA,WAAS,EAAC;IAE7B,MAAM,EAAEL,MAAMM,UAAU,EAAE,GAAGC,IAAAA,QAAM,EACjC,0BACA,OAAOC,KAAUC;QACf,MAAMT,OAAO,MAAMU,MACjBF,IAAIG,UAAU,CAAC,UAAUH,MAAM,CAAC,EAAEJ,WAAW,EAAEI,IAAI,CAAC,EACpDC;QAEF,OAAO,MAAMT,KAAKY,IAAI;IACxB,GACA;QACEC,iBAAiB;QACjBC,oBAAoB;IACtB;IAGF,IAAI,OAAOR,eAAe,aAAa;QACrC,MAAMS,KAAKT,WAAWU,SAAS;QAC/B,MAAMC,KAAKC,KAAKC,GAAG;QACnB,aAAa;QACbC,IAAAA,sBAAe,IAAGC,0BAA0B,GAAGN,KAAKE;IACtD;;IASA,MAAMK,SAASC,IAAAA,cAAO,EAAC;QACrB,OAAO,CAAC,CAACtB;IACX,GAAG;QAACA;KAAU;IAEd,OAAO;QACLH,OAAOC;QACPyB,MAAMF;IACR;AACF"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type SWRInfiniteKeyLoader, type SWRInfiniteConfiguration } from "swr/infinite";
|
|
2
|
-
export declare const usePrivateInfiniteQuery: (getKey: SWRInfiniteKeyLoader, options?: (SWRInfiniteConfiguration<any, any, import("swr/_internal").BareFetcher<any>> & {
|
|
3
|
-
formatter?: ((data: any) => any) | undefined;
|
|
4
|
-
}) | undefined) => import("swr/infinite").SWRInfiniteResponse<any, any>;
|
|
5
|
-
//# sourceMappingURL=usePrivateInfiniteQuery.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePrivateInfiniteQuery.d.ts","sourceRoot":"","sources":["../src/usePrivateInfiniteQuery.ts"],"names":[],"mappings":"AAAA,OAAuB,EACrB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC9B,MAAM,cAAc,CAAC;AAMtB,eAAO,MAAM,uBAAuB,WAC1B,oBAAoB;wBAEP,GAAG,KAAK,GAAG;uEA4BjC,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "usePrivateInfiniteQuery", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return usePrivateInfiniteQuery;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _infinite = /*#__PURE__*/ _interop_require_default(require("swr/infinite"));
|
|
12
|
-
const _signatureMiddleware = require("./middleware/signatureMiddleware");
|
|
13
|
-
const _net = require("@orderly.network/net");
|
|
14
|
-
const _useAccount = require("./useAccount");
|
|
15
|
-
const _types = require("@orderly.network/types");
|
|
16
|
-
function _interop_require_default(obj) {
|
|
17
|
-
return obj && obj.__esModule ? obj : {
|
|
18
|
-
default: obj
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
const usePrivateInfiniteQuery = (getKey, options)=>{
|
|
22
|
-
const { formatter, ...restOptions } = options || {};
|
|
23
|
-
const account = (0, _useAccount.useAccount)();
|
|
24
|
-
const middleware = Array.isArray(restOptions?.use) ? restOptions?.use ?? [] : [];
|
|
25
|
-
const result = (0, _infinite.default)((pageIndex, previousPageData)=>{
|
|
26
|
-
const queryKey = getKey(pageIndex, previousPageData);
|
|
27
|
-
if (account.state.status < _types.AccountStatusEnum.EnableTrading || !queryKey) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
return [
|
|
31
|
-
queryKey,
|
|
32
|
-
account.state.accountId
|
|
33
|
-
];
|
|
34
|
-
}, (url, init)=>{
|
|
35
|
-
return restOptions.fetcher?.(url, init) || (0, _net.get)(url, init, formatter);
|
|
36
|
-
}, {
|
|
37
|
-
...restOptions,
|
|
38
|
-
use: [
|
|
39
|
-
_signatureMiddleware.signatureMiddleware,
|
|
40
|
-
...middleware
|
|
41
|
-
]
|
|
42
|
-
});
|
|
43
|
-
return result;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
//# sourceMappingURL=usePrivateInfiniteQuery.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/usePrivateInfiniteQuery.ts"],"sourcesContent":["import useSWRInfinite, {\n type SWRInfiniteKeyLoader,\n type SWRInfiniteConfiguration,\n} from \"swr/infinite\";\nimport { signatureMiddleware } from \"./middleware/signatureMiddleware\";\nimport { get } from \"@orderly.network/net\";\nimport { useAccount } from \"./useAccount\";\nimport { AccountStatusEnum } from \"@orderly.network/types\";\n\nexport const usePrivateInfiniteQuery = (\n getKey: SWRInfiniteKeyLoader,\n options?: SWRInfiniteConfiguration & {\n formatter?: (data: any) => any;\n }\n) => {\n const { formatter, ...restOptions } = options || {};\n const account = useAccount();\n\n const middleware = Array.isArray(restOptions?.use)\n ? restOptions?.use ?? []\n : [];\n\n const result = useSWRInfinite(\n (pageIndex: number, previousPageData) => {\n const queryKey = getKey(pageIndex, previousPageData);\n if (account.state.status < AccountStatusEnum.EnableTrading || !queryKey) {\n return null;\n }\n return [queryKey, account.state.accountId];\n },\n (url: string, init: RequestInit) => {\n return restOptions.fetcher?.(url, init) || get(url, init, formatter);\n },\n {\n ...restOptions,\n use: [signatureMiddleware, ...middleware],\n }\n );\n\n return result;\n};\n"],"names":["usePrivateInfiniteQuery","getKey","options","formatter","restOptions","account","useAccount","middleware","Array","isArray","use","result","useSWRInfinite","pageIndex","previousPageData","queryKey","state","status","AccountStatusEnum","EnableTrading","accountId","url","init","fetcher","get","signatureMiddleware"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;iEANN;qCAC6B;qBAChB;4BACO;uBACO;;;;;;AAE3B,MAAMA,0BAA0B,CACrCC,QACAC;IAIA,MAAM,EAAEC,SAAS,EAAE,GAAGC,aAAa,GAAGF,WAAW,CAAC;IAClD,MAAMG,UAAUC,IAAAA,sBAAU;IAE1B,MAAMC,aAAaC,MAAMC,OAAO,CAACL,aAAaM,OAC1CN,aAAaM,OAAO,EAAE,GACtB,EAAE;IAEN,MAAMC,SAASC,IAAAA,iBAAc,EAC3B,CAACC,WAAmBC;QAClB,MAAMC,WAAWd,OAAOY,WAAWC;QACnC,IAAIT,QAAQW,KAAK,CAACC,MAAM,GAAGC,wBAAiB,CAACC,aAAa,IAAI,CAACJ,UAAU;YACvE,OAAO;QACT;QACA,OAAO;YAACA;YAAUV,QAAQW,KAAK,CAACI,SAAS;SAAC;IAC5C,GACA,CAACC,KAAaC;QACZ,OAAOlB,YAAYmB,OAAO,GAAGF,KAAKC,SAASE,IAAAA,QAAG,EAACH,KAAKC,MAAMnB;IAC5D,GACA;QACE,GAAGC,WAAW;QACdM,KAAK;YAACe,wCAAmB;eAAKlB;SAAW;IAC3C;IAGF,OAAOI;AACT"}
|
package/lib/usePrivateQuery.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { SWRResponse } from "swr";
|
|
2
|
-
import { useQueryOptions } from "./utils/fetcher";
|
|
3
|
-
/**
|
|
4
|
-
* usePrivateQuery
|
|
5
|
-
* @description for private api
|
|
6
|
-
* @param query
|
|
7
|
-
* @param options
|
|
8
|
-
*/
|
|
9
|
-
export declare const usePrivateQuery: <T>(query: string, options?: useQueryOptions<T> | undefined) => SWRResponse<T, any, any>;
|
|
10
|
-
//# sourceMappingURL=usePrivateQuery.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePrivateQuery.d.ts","sourceRoot":"","sources":["../src/usePrivateQuery.ts"],"names":[],"mappings":"AAAA,OAAe,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAE1C,OAAO,EAAW,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAI3D;;;;;GAKG;AACH,eAAO,MAAM,eAAe,aACnB,MAAM,uEAsBd,CAAC"}
|
package/lib/usePrivateQuery.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "usePrivateQuery", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return usePrivateQuery;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _swr = /*#__PURE__*/ _interop_require_default(require("swr"));
|
|
12
|
-
const _signatureMiddleware = require("./middleware/signatureMiddleware");
|
|
13
|
-
const _fetcher = require("./utils/fetcher");
|
|
14
|
-
const _useAccount = require("./useAccount");
|
|
15
|
-
const _types = require("@orderly.network/types");
|
|
16
|
-
function _interop_require_default(obj) {
|
|
17
|
-
return obj && obj.__esModule ? obj : {
|
|
18
|
-
default: obj
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
const usePrivateQuery = (query, options)=>{
|
|
22
|
-
const { formatter, ...swrOptions } = options || {};
|
|
23
|
-
const account = (0, _useAccount.useAccount)();
|
|
24
|
-
const middleware = Array.isArray(options?.use) ? options?.use ?? [] : [];
|
|
25
|
-
// @ts-ignore
|
|
26
|
-
return (0, _swr.default)(()=>account.state.status >= _types.AccountStatusEnum.EnableTrading ? [
|
|
27
|
-
query,
|
|
28
|
-
account.state.accountId
|
|
29
|
-
] : null, (url, init)=>{
|
|
30
|
-
return (0, _fetcher.fetcher)(url, init, {
|
|
31
|
-
formatter
|
|
32
|
-
});
|
|
33
|
-
}, {
|
|
34
|
-
...swrOptions,
|
|
35
|
-
use: [
|
|
36
|
-
_signatureMiddleware.signatureMiddleware,
|
|
37
|
-
...middleware
|
|
38
|
-
],
|
|
39
|
-
onError: (err)=>{}
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
//# sourceMappingURL=usePrivateQuery.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/usePrivateQuery.ts"],"sourcesContent":["import useSWR, { SWRResponse } from \"swr\";\nimport { signatureMiddleware } from \"./middleware/signatureMiddleware\";\nimport { fetcher, useQueryOptions } from \"./utils/fetcher\";\nimport { useAccount } from \"./useAccount\";\nimport { AccountStatusEnum } from \"@orderly.network/types\";\n\n/**\n * usePrivateQuery\n * @description for private api\n * @param query\n * @param options\n */\nexport const usePrivateQuery = <T>(\n query: string,\n options?: useQueryOptions<T>\n): SWRResponse<T> => {\n const { formatter, ...swrOptions } = options || {};\n const account = useAccount();\n const middleware = Array.isArray(options?.use) ? options?.use ?? [] : [];\n\n // @ts-ignore\n return useSWR<T>(\n () =>\n account.state.status >= AccountStatusEnum.EnableTrading\n ? [query, account.state.accountId]\n : null,\n (url: string, init: RequestInit) => {\n return fetcher(url, init, { formatter });\n },\n {\n ...swrOptions,\n use: [signatureMiddleware, ...middleware],\n onError: (err) => {},\n }\n );\n};\n"],"names":["usePrivateQuery","query","options","formatter","swrOptions","account","useAccount","middleware","Array","isArray","use","useSWR","state","status","AccountStatusEnum","EnableTrading","accountId","url","init","fetcher","signatureMiddleware","onError","err"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAYaA;;;eAAAA;;;4DAZuB;qCACA;yBACK;4BACd;uBACO;;;;;;AAQ3B,MAAMA,kBAAkB,CAC7BC,OACAC;IAEA,MAAM,EAAEC,SAAS,EAAE,GAAGC,YAAY,GAAGF,WAAW,CAAC;IACjD,MAAMG,UAAUC,IAAAA,sBAAU;IAC1B,MAAMC,aAAaC,MAAMC,OAAO,CAACP,SAASQ,OAAOR,SAASQ,OAAO,EAAE,GAAG,EAAE;IAExE,aAAa;IACb,OAAOC,IAAAA,YAAM,EACX,IACEN,QAAQO,KAAK,CAACC,MAAM,IAAIC,wBAAiB,CAACC,aAAa,GACnD;YAACd;YAAOI,QAAQO,KAAK,CAACI,SAAS;SAAC,GAChC,MACN,CAACC,KAAaC;QACZ,OAAOC,IAAAA,gBAAO,EAACF,KAAKC,MAAM;YAAEf;QAAU;IACxC,GACA;QACE,GAAGC,UAAU;QACbM,KAAK;YAACU,wCAAmB;eAAKb;SAAW;QACzCc,SAAS,CAACC,OAAS;IACrB;AAEJ"}
|
package/lib/useQuery.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import useSWR, { SWRResponse } from "swr";
|
|
2
|
-
import { useQueryOptions } from "./utils/fetcher";
|
|
3
|
-
/**
|
|
4
|
-
* useQuery
|
|
5
|
-
* @description for public api
|
|
6
|
-
* @param query
|
|
7
|
-
* @param options
|
|
8
|
-
*/
|
|
9
|
-
export declare const useQuery: <T>(query: Parameters<typeof useSWR>["0"], options?: useQueryOptions<T> | undefined) => SWRResponse<T, any, any>;
|
|
10
|
-
//# sourceMappingURL=useQuery.d.ts.map
|
package/lib/useQuery.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useQuery.d.ts","sourceRoot":"","sources":["../src/useQuery.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAW,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAG3D;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,aACZ,WAAW,aAAa,CAAC,CAAC,GAAG,CAAC,uEAmBtC,CAAC"}
|
package/lib/useQuery.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "useQuery", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return useQuery;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _swr = /*#__PURE__*/ _interop_require_default(require("swr"));
|
|
12
|
-
const _fetcher = require("./utils/fetcher");
|
|
13
|
-
const _useConfig = require("./useConfig");
|
|
14
|
-
function _interop_require_default(obj) {
|
|
15
|
-
return obj && obj.__esModule ? obj : {
|
|
16
|
-
default: obj
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
const useQuery = (query, options)=>{
|
|
20
|
-
const apiBaseUrl = (0, _useConfig.useConfig)("apiBaseUrl");
|
|
21
|
-
const { formatter, ...swrOptions } = options || {};
|
|
22
|
-
if (typeof apiBaseUrl === "undefined") {
|
|
23
|
-
throw new Error("please add OrderlyConfigProvider to your app");
|
|
24
|
-
}
|
|
25
|
-
// @ts-ignore
|
|
26
|
-
return (0, _swr.default)(query, (url, init)=>(0, _fetcher.fetcher)(url.startsWith("http") ? url : `${apiBaseUrl}${url}`, init, {
|
|
27
|
-
formatter
|
|
28
|
-
}), swrOptions);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
//# sourceMappingURL=useQuery.js.map
|
package/lib/useQuery.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/useQuery.ts"],"sourcesContent":["import useSWR, { SWRResponse } from \"swr\";\nimport { fetcher, useQueryOptions } from \"./utils/fetcher\";\nimport { useConfig } from \"./useConfig\";\n\n/**\n * useQuery\n * @description for public api\n * @param query\n * @param options\n */\nexport const useQuery = <T>(\n query: Parameters<typeof useSWR>[\"0\"],\n options?: useQueryOptions<T>\n): SWRResponse<T> => {\n const apiBaseUrl = useConfig(\"apiBaseUrl\");\n const { formatter, ...swrOptions } = options || {};\n\n if (typeof apiBaseUrl === \"undefined\") {\n throw new Error(\"please add OrderlyConfigProvider to your app\");\n }\n\n // @ts-ignore\n return useSWR<T>(\n query,\n (url, init) =>\n fetcher(url.startsWith(\"http\") ? url : `${apiBaseUrl}${url}`, init, {\n formatter,\n }),\n swrOptions\n );\n};\n"],"names":["useQuery","query","options","apiBaseUrl","useConfig","formatter","swrOptions","Error","useSWR","url","init","fetcher","startsWith"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;4DAVuB;yBACK;2BACf;;;;;;AAQnB,MAAMA,WAAW,CACtBC,OACAC;IAEA,MAAMC,aAAaC,IAAAA,oBAAS,EAAC;IAC7B,MAAM,EAAEC,SAAS,EAAE,GAAGC,YAAY,GAAGJ,WAAW,CAAC;IAEjD,IAAI,OAAOC,eAAe,aAAa;QACrC,MAAM,IAAII,MAAM;IAClB;IAEA,aAAa;IACb,OAAOC,IAAAA,YAAM,EACXP,OACA,CAACQ,KAAKC,OACJC,IAAAA,gBAAO,EAACF,IAAIG,UAAU,CAAC,UAAUH,MAAM,CAAC,EAAEN,WAAW,EAAEM,IAAI,CAAC,EAAEC,MAAM;YAClEL;QACF,IACFC;AAEJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSessionStorage.d.ts","sourceRoot":"","sources":["../src/useSessionStorage.ts"],"names":[],"mappings":"AAGA,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC,CAuE1B"}
|
package/lib/useSessionStorage.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "useSessionStorage", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return useSessionStorage;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _react = require("react");
|
|
12
|
-
const _json = require("./utils/json");
|
|
13
|
-
function useSessionStorage(key, initialValue) {
|
|
14
|
-
// Get from session storage then
|
|
15
|
-
// parse stored json or return initialValue
|
|
16
|
-
const readValue = (0, _react.useCallback)(()=>{
|
|
17
|
-
// Prevent build error "window is undefined" but keep keep working
|
|
18
|
-
if (typeof window === "undefined") {
|
|
19
|
-
return initialValue;
|
|
20
|
-
}
|
|
21
|
-
try {
|
|
22
|
-
const item = window.sessionStorage.getItem(key);
|
|
23
|
-
return item ? (0, _json.parseJSON)(item) : initialValue;
|
|
24
|
-
} catch (error) {
|
|
25
|
-
;
|
|
26
|
-
return initialValue;
|
|
27
|
-
}
|
|
28
|
-
}, [
|
|
29
|
-
initialValue,
|
|
30
|
-
key
|
|
31
|
-
]);
|
|
32
|
-
const [storedValue, setStoredValue] = (0, _react.useState)(readValue);
|
|
33
|
-
const setValue = (value)=>{
|
|
34
|
-
// Prevent build error "window is undefined" but keeps working
|
|
35
|
-
if (typeof window == "undefined") {
|
|
36
|
-
;
|
|
37
|
-
}
|
|
38
|
-
try {
|
|
39
|
-
// Allow value to be a function so we have the same API as useState
|
|
40
|
-
const newValue = value instanceof Function ? value(storedValue) : value;
|
|
41
|
-
// Save to session storage
|
|
42
|
-
window.sessionStorage.setItem(key, JSON.stringify(newValue));
|
|
43
|
-
// Save state
|
|
44
|
-
setStoredValue(newValue);
|
|
45
|
-
// We dispatch a custom event so every useSessionStorage hook are notified
|
|
46
|
-
// window.dispatchEvent(new Event("session-storage"));
|
|
47
|
-
} catch (error) {
|
|
48
|
-
;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
(0, _react.useEffect)(()=>{
|
|
52
|
-
setStoredValue(readValue());
|
|
53
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
54
|
-
}, []);
|
|
55
|
-
(0, _react.useEffect)(()=>{
|
|
56
|
-
if (typeof window == "undefined") {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
window.addEventListener?.("storage", handleStorageChange);
|
|
60
|
-
return ()=>{
|
|
61
|
-
window.removeEventListener?.("storage", handleStorageChange);
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
-
const handleStorageChange = (0, _react.useCallback)((event)=>{
|
|
65
|
-
if (event?.key && event.key !== key) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
setStoredValue(readValue());
|
|
69
|
-
}, [
|
|
70
|
-
key,
|
|
71
|
-
readValue
|
|
72
|
-
]);
|
|
73
|
-
return [
|
|
74
|
-
storedValue,
|
|
75
|
-
setValue
|
|
76
|
-
];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
//# sourceMappingURL=useSessionStorage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/useSessionStorage.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from \"react\";\nimport { parseJSON } from \"./utils/json\";\n\nexport function useSessionStorage<T>(\n key: string,\n initialValue: T\n): [T, (data: any) => void] {\n // Get from session storage then\n // parse stored json or return initialValue\n const readValue = useCallback((): T => {\n // Prevent build error \"window is undefined\" but keep keep working\n if (typeof window === \"undefined\") {\n return initialValue;\n }\n\n try {\n const item = window.sessionStorage.getItem(key);\n return item ? (parseJSON(item) as T) : initialValue;\n } catch (error) {\n console.warn(`Error reading sessionStorage key “${key}”:`, error);\n return initialValue;\n }\n }, [initialValue, key]);\n const [storedValue, setStoredValue] = useState<T>(readValue);\n\n const setValue: React.Dispatch<T> = (value: any) => {\n // Prevent build error \"window is undefined\" but keeps working\n if (typeof window == \"undefined\") {\n console.warn(\n `Tried setting sessionStorage key “${key}” even though environment is not a client`\n );\n }\n\n try {\n // Allow value to be a function so we have the same API as useState\n const newValue = value instanceof Function ? value(storedValue) : value;\n\n // Save to session storage\n window.sessionStorage.setItem(key, JSON.stringify(newValue));\n\n // Save state\n setStoredValue(newValue);\n\n // We dispatch a custom event so every useSessionStorage hook are notified\n // window.dispatchEvent(new Event(\"session-storage\"));\n } catch (error) {\n console.warn(`Error setting sessionStorage key “${key}”:`, error);\n }\n };\n\n useEffect(() => {\n setStoredValue(readValue());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (typeof window == \"undefined\") {\n return;\n }\n window.addEventListener?.(\"storage\", handleStorageChange);\n\n return () => {\n window.removeEventListener?.(\"storage\", handleStorageChange);\n };\n });\n\n const handleStorageChange = useCallback(\n (event: StorageEvent | CustomEvent) => {\n if ((event as StorageEvent)?.key && (event as StorageEvent).key !== key) {\n return;\n }\n setStoredValue(readValue());\n },\n [key, readValue]\n );\n\n return [storedValue, setValue];\n}\n"],"names":["useSessionStorage","key","initialValue","readValue","useCallback","window","item","sessionStorage","getItem","parseJSON","error","storedValue","setStoredValue","useState","setValue","value","newValue","Function","setItem","JSON","stringify","useEffect","addEventListener","handleStorageChange","removeEventListener","event"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAGgBA;;;eAAAA;;;uBAHiC;sBACvB;AAEnB,SAASA,kBACdC,GAAW,EACXC,YAAe;IAEf,gCAAgC;IAChC,2CAA2C;IAC3C,MAAMC,YAAYC,IAAAA,kBAAW,EAAC;QAC5B,kEAAkE;QAClE,IAAI,OAAOC,WAAW,aAAa;YACjC,OAAOH;QACT;QAEA,IAAI;YACF,MAAMI,OAAOD,OAAOE,cAAc,CAACC,OAAO,CAACP;YAC3C,OAAOK,OAAQG,IAAAA,eAAS,EAACH,QAAcJ;QACzC,EAAE,OAAOQ,OAAO;;YAEd,OAAOR;QACT;IACF,GAAG;QAACA;QAAcD;KAAI;IACtB,MAAM,CAACU,aAAaC,eAAe,GAAGC,IAAAA,eAAQ,EAAIV;IAElD,MAAMW,WAA8B,CAACC;QACnC,8DAA8D;QAC9D,IAAI,OAAOV,UAAU,aAAa;;QAIlC;QAEA,IAAI;YACF,mEAAmE;YACnE,MAAMW,WAAWD,iBAAiBE,WAAWF,MAAMJ,eAAeI;YAElE,0BAA0B;YAC1BV,OAAOE,cAAc,CAACW,OAAO,CAACjB,KAAKkB,KAAKC,SAAS,CAACJ;YAElD,aAAa;YACbJ,eAAeI;QAEf,0EAA0E;QAC1E,sDAAsD;QACxD,EAAE,OAAON,OAAO;;QAEhB;IACF;IAEAW,IAAAA,gBAAS,EAAC;QACRT,eAAeT;IACf,uDAAuD;IACzD,GAAG,EAAE;IAELkB,IAAAA,gBAAS,EAAC;QACR,IAAI,OAAOhB,UAAU,aAAa;YAChC;QACF;QACAA,OAAOiB,gBAAgB,GAAG,WAAWC;QAErC,OAAO;YACLlB,OAAOmB,mBAAmB,GAAG,WAAWD;QAC1C;IACF;IAEA,MAAMA,sBAAsBnB,IAAAA,kBAAW,EACrC,CAACqB;QACC,IAAI,AAACA,OAAwBxB,OAAO,AAACwB,MAAuBxB,GAAG,KAAKA,KAAK;YACvE;QACF;QACAW,eAAeT;IACjB,GACA;QAACF;QAAKE;KAAU;IAGlB,OAAO;QAACQ;QAAaG;KAAS;AAChC"}
|
package/lib/useWS.d.ts
DELETED
package/lib/useWS.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWS.d.ts","sourceRoot":"","sources":["../src/useWS.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAQ1C,eAAO,MAAM,KAAK,UAyDjB,CAAC"}
|
package/lib/useWS.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "useWS", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return useWS;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _react = require("react");
|
|
12
|
-
const _core = require("@orderly.network/core");
|
|
13
|
-
const _net = require("@orderly.network/net");
|
|
14
|
-
const _useconstant = /*#__PURE__*/ _interop_require_default(require("use-constant"));
|
|
15
|
-
const _types = require("@orderly.network/types");
|
|
16
|
-
const _orderlyContext = require("./orderlyContext");
|
|
17
|
-
const _utils = require("@orderly.network/utils");
|
|
18
|
-
function _interop_require_default(obj) {
|
|
19
|
-
return obj && obj.__esModule ? obj : {
|
|
20
|
-
default: obj
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
const WS_NAME = "nativeWebsocketClient";
|
|
24
|
-
const useWS = ()=>{
|
|
25
|
-
const { configStore } = (0, _react.useContext)(_orderlyContext.OrderlyContext);
|
|
26
|
-
// const prevAccountState = useRef<AccountState | null>(null);
|
|
27
|
-
const ws = (0, _useconstant.default)(()=>{
|
|
28
|
-
let websocketClient = _core.SimpleDI.get(WS_NAME);
|
|
29
|
-
const account = _core.SimpleDI.get(_core.Account.instanceName);
|
|
30
|
-
if (!websocketClient) {
|
|
31
|
-
websocketClient = new _net.WS({
|
|
32
|
-
networkId: configStore.get("networkId"),
|
|
33
|
-
publicUrl: configStore.get("publicWsUrl"),
|
|
34
|
-
privateUrl: configStore.get("privateWsUrl"),
|
|
35
|
-
onSigntureRequest: async (accountId)=>{
|
|
36
|
-
const signer = account.signer;
|
|
37
|
-
const timestamp = new Date().getTime();
|
|
38
|
-
const result = await signer.signText(timestamp.toString());
|
|
39
|
-
return {
|
|
40
|
-
...result,
|
|
41
|
-
timestamp
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
// if user login, open the private websocket
|
|
46
|
-
if (account.stateValue.status === _types.AccountStatusEnum.EnableTrading && account.stateValue.accountId) {
|
|
47
|
-
websocketClient.openPrivate(account.stateValue.accountId);
|
|
48
|
-
}
|
|
49
|
-
// open the pirvate websocket when user login
|
|
50
|
-
account.on("change:status", (nextState)=>{
|
|
51
|
-
if (nextState.status === _types.AccountStatusEnum.EnableTrading && nextState.accountId) {
|
|
52
|
-
websocketClient.openPrivate(nextState.accountId);
|
|
53
|
-
} else {
|
|
54
|
-
websocketClient.closePrivate(1000, "switch account");
|
|
55
|
-
}
|
|
56
|
-
// prevAccountState.current = nextState;
|
|
57
|
-
});
|
|
58
|
-
if (typeof window !== "undefined") {
|
|
59
|
-
(0, _utils.getGlobalObject)()["__Orderly_WS"] = websocketClient;
|
|
60
|
-
}
|
|
61
|
-
_core.SimpleDI.registerByName(WS_NAME, websocketClient);
|
|
62
|
-
}
|
|
63
|
-
return websocketClient;
|
|
64
|
-
});
|
|
65
|
-
// auto open private when user login;
|
|
66
|
-
return ws;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
//# sourceMappingURL=useWS.js.map
|