@orderly.network/hooks 2.10.0-alpha.1 → 2.10.1-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 +1 -5
- package/dist/index.d.ts +1 -5
- package/dist/index.js +11 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -64
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -37,7 +37,7 @@ declare global {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
declare const _default: "2.10.
|
|
40
|
+
declare const _default: "2.10.1-alpha.0";
|
|
41
41
|
|
|
42
42
|
declare const fetcher: (url: string, init: RequestInit | undefined, queryOptions: useQueryOptions<any>) => Promise<any>;
|
|
43
43
|
type useQueryOptions<T> = SWRConfiguration & {
|
|
@@ -403,12 +403,8 @@ declare const useFeeState: () => {
|
|
|
403
403
|
readonly takerFee: string;
|
|
404
404
|
readonly makerFee: string;
|
|
405
405
|
readonly refereeRebate: number | undefined;
|
|
406
|
-
readonly effectiveTakerFee: string;
|
|
407
|
-
readonly effectiveMakerFee: string;
|
|
408
406
|
readonly rwaTakerFee: string;
|
|
409
407
|
readonly rwaMakerFee: string;
|
|
410
|
-
readonly rwaEffectiveTakerFee: string;
|
|
411
|
-
readonly rwaEffectiveMakerFee: string;
|
|
412
408
|
};
|
|
413
409
|
|
|
414
410
|
declare const useTrack: () => {
|
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ declare global {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
declare const _default: "2.10.
|
|
40
|
+
declare const _default: "2.10.1-alpha.0";
|
|
41
41
|
|
|
42
42
|
declare const fetcher: (url: string, init: RequestInit | undefined, queryOptions: useQueryOptions<any>) => Promise<any>;
|
|
43
43
|
type useQueryOptions<T> = SWRConfiguration & {
|
|
@@ -403,12 +403,8 @@ declare const useFeeState: () => {
|
|
|
403
403
|
readonly takerFee: string;
|
|
404
404
|
readonly makerFee: string;
|
|
405
405
|
readonly refereeRebate: number | undefined;
|
|
406
|
-
readonly effectiveTakerFee: string;
|
|
407
|
-
readonly effectiveMakerFee: string;
|
|
408
406
|
readonly rwaTakerFee: string;
|
|
409
407
|
readonly rwaMakerFee: string;
|
|
410
|
-
readonly rwaEffectiveTakerFee: string;
|
|
411
|
-
readonly rwaEffectiveMakerFee: string;
|
|
412
408
|
};
|
|
413
409
|
|
|
414
410
|
declare const useTrack: () => {
|
package/dist/index.js
CHANGED
|
@@ -64,9 +64,9 @@ var __export = (target, all) => {
|
|
|
64
64
|
// src/version.ts
|
|
65
65
|
if (typeof window !== "undefined") {
|
|
66
66
|
window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
|
|
67
|
-
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.10.
|
|
67
|
+
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.10.1-alpha.0";
|
|
68
68
|
}
|
|
69
|
-
var version_default = "2.10.
|
|
69
|
+
var version_default = "2.10.1-alpha.0";
|
|
70
70
|
var fetcher = (url, init2 = {}, queryOptions) => net.get(url, init2, queryOptions?.formatter);
|
|
71
71
|
var noCacheConfig = {
|
|
72
72
|
dedupingInterval: 0,
|
|
@@ -2891,23 +2891,18 @@ var useAccountInfo2 = () => {
|
|
|
2891
2891
|
};
|
|
2892
2892
|
|
|
2893
2893
|
// src/useFeeState.ts
|
|
2894
|
-
var ORDERLY_TAKER_FEE_BPS = 1;
|
|
2895
|
-
var ORDERLY_MAKER_FEE_BPS = 0;
|
|
2896
2894
|
var bpsToFraction = (bps) => new utils.Decimal(bps ?? 0).mul(1e-4);
|
|
2897
2895
|
var formatFractionAsPercent = (val) => `${val.mul(100).toNumber()}%`;
|
|
2898
|
-
var computeEffectiveFromBps = (userBps, orderlyBps, rebate) => {
|
|
2899
|
-
const user = bpsToFraction(userBps);
|
|
2900
|
-
const orderly = bpsToFraction(orderlyBps);
|
|
2901
|
-
const effective = user.sub(user.sub(orderly).mul(rebate ?? 0));
|
|
2902
|
-
return effective;
|
|
2903
|
-
};
|
|
2904
2896
|
var useFeeState = () => {
|
|
2905
2897
|
const { data: accountInfo, isLoading: isAccountLoading } = useAccountInfo2();
|
|
2906
|
-
const { data: referralData
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2898
|
+
const { data: referralData } = usePrivateQuery(
|
|
2899
|
+
"/v1/referral/info",
|
|
2900
|
+
{
|
|
2901
|
+
revalidateOnFocus: true,
|
|
2902
|
+
errorRetryCount: 3,
|
|
2903
|
+
...noCacheConfig
|
|
2904
|
+
}
|
|
2905
|
+
);
|
|
2911
2906
|
const ws = useWS();
|
|
2912
2907
|
const topic = "account";
|
|
2913
2908
|
const { data: wsAccountData } = useSWRSubscription__default.default(
|
|
@@ -2972,28 +2967,6 @@ var useFeeState = () => {
|
|
|
2972
2967
|
}
|
|
2973
2968
|
return formatFractionAsPercent(bpsToFraction(makerFeeBps));
|
|
2974
2969
|
}, [isAccountLoading, makerFeeBps]);
|
|
2975
|
-
const effectiveTakerFee = React2.useMemo(() => {
|
|
2976
|
-
if (isReferralLoading) {
|
|
2977
|
-
return "-";
|
|
2978
|
-
}
|
|
2979
|
-
const effective = computeEffectiveFromBps(
|
|
2980
|
-
takerFeeBps,
|
|
2981
|
-
ORDERLY_TAKER_FEE_BPS,
|
|
2982
|
-
refereeRebate
|
|
2983
|
-
);
|
|
2984
|
-
return formatFractionAsPercent(effective);
|
|
2985
|
-
}, [takerFeeBps, refereeRebate, isReferralLoading]);
|
|
2986
|
-
const effectiveMakerFee = React2.useMemo(() => {
|
|
2987
|
-
if (isReferralLoading) {
|
|
2988
|
-
return "-";
|
|
2989
|
-
}
|
|
2990
|
-
const effective = computeEffectiveFromBps(
|
|
2991
|
-
makerFeeBps,
|
|
2992
|
-
ORDERLY_MAKER_FEE_BPS,
|
|
2993
|
-
refereeRebate
|
|
2994
|
-
);
|
|
2995
|
-
return formatFractionAsPercent(effective);
|
|
2996
|
-
}, [makerFeeBps, refereeRebate, isReferralLoading]);
|
|
2997
2970
|
const rwaTakerFee = React2.useMemo(() => {
|
|
2998
2971
|
if (isAccountLoading || rwaTakerFeeBps === null || rwaTakerFeeBps === void 0) {
|
|
2999
2972
|
return "-";
|
|
@@ -3006,38 +2979,12 @@ var useFeeState = () => {
|
|
|
3006
2979
|
}
|
|
3007
2980
|
return formatFractionAsPercent(bpsToFraction(rwaMakerFeeBps));
|
|
3008
2981
|
}, [isAccountLoading, rwaMakerFeeBps]);
|
|
3009
|
-
const rwaEffectiveTakerFee = React2.useMemo(() => {
|
|
3010
|
-
if (isAccountLoading || rwaTakerFeeBps === null || rwaTakerFeeBps === void 0 || isReferralLoading) {
|
|
3011
|
-
return "-";
|
|
3012
|
-
}
|
|
3013
|
-
const effective = computeEffectiveFromBps(
|
|
3014
|
-
rwaTakerFeeBps,
|
|
3015
|
-
ORDERLY_MAKER_FEE_BPS,
|
|
3016
|
-
refereeRebate
|
|
3017
|
-
);
|
|
3018
|
-
return formatFractionAsPercent(effective);
|
|
3019
|
-
}, [isAccountLoading, rwaTakerFeeBps, refereeRebate, isReferralLoading]);
|
|
3020
|
-
const rwaEffectiveMakerFee = React2.useMemo(() => {
|
|
3021
|
-
if (isAccountLoading || rwaMakerFeeBps === null || rwaMakerFeeBps === void 0 || isReferralLoading) {
|
|
3022
|
-
return "-";
|
|
3023
|
-
}
|
|
3024
|
-
const effective = computeEffectiveFromBps(
|
|
3025
|
-
rwaMakerFeeBps,
|
|
3026
|
-
ORDERLY_MAKER_FEE_BPS,
|
|
3027
|
-
refereeRebate
|
|
3028
|
-
);
|
|
3029
|
-
return formatFractionAsPercent(effective);
|
|
3030
|
-
}, [isAccountLoading, rwaMakerFeeBps, refereeRebate, isReferralLoading]);
|
|
3031
2982
|
return {
|
|
3032
2983
|
takerFee,
|
|
3033
2984
|
makerFee,
|
|
3034
2985
|
refereeRebate,
|
|
3035
|
-
effectiveTakerFee,
|
|
3036
|
-
effectiveMakerFee,
|
|
3037
2986
|
rwaTakerFee,
|
|
3038
|
-
rwaMakerFee
|
|
3039
|
-
rwaEffectiveTakerFee,
|
|
3040
|
-
rwaEffectiveMakerFee
|
|
2987
|
+
rwaMakerFee
|
|
3041
2988
|
};
|
|
3042
2989
|
};
|
|
3043
2990
|
var apiKeyMap = {
|