@orderly.network/hooks 1.4.0 → 1.4.3
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/esm/index.d.ts +1 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/orderly/useAccountInfo.d.ts +1 -1
- package/esm/orderly/useAccountInfo.d.ts.map +1 -1
- package/esm/orderly/useIndexPrice.d.ts +1 -1
- package/esm/orderly/useIndexPrice.d.ts.map +1 -1
- package/esm/orderly/useMarkPricesStream.d.ts +1 -1
- package/esm/orderly/useMarkPricesStream.d.ts.map +1 -1
- package/esm/orderly/useOpenInterest.d.ts +1 -1
- package/esm/orderly/useOpenInterest.d.ts.map +1 -1
- package/esm/orderly/useOrderStream/useOrderStream.d.ts +1 -1
- package/esm/orderly/usePositionStream/usePositionStream.d.ts +1 -1
- package/esm/orderly/useSettleSubscription.d.ts +1 -1
- package/esm/orderly/useSettleSubscription.d.ts.map +1 -1
- package/esm/orderly/useTakeProfitAndStopLoss/index.d.ts +4 -4
- package/esm/orderly/useTakeProfitAndStopLoss/useTPSL.d.ts +4 -4
- package/esm/orderly/useTakeProfitAndStopLoss/useTPSL.d.ts.map +1 -1
- package/esm/orderly/useTakeProfitAndStopLoss/useTPSL.js.map +1 -1
- package/esm/orderly/useWalletSubscription.d.ts +1 -1
- package/esm/orderly/useWalletSubscription.d.ts.map +1 -1
- package/esm/referral/api.d.ts +87 -0
- package/esm/referral/api.d.ts.map +1 -0
- package/esm/referral/api.js +3 -0
- package/esm/referral/api.js.map +1 -0
- package/esm/referral/format.d.ts +2 -0
- package/esm/referral/format.d.ts.map +1 -0
- package/esm/referral/format.js +8 -0
- package/esm/referral/format.js.map +1 -0
- package/esm/referral/index.d.ts +9 -0
- package/esm/referral/index.d.ts.map +1 -0
- package/esm/referral/index.js +10 -0
- package/esm/referral/index.js.map +1 -0
- package/esm/referral/swr.d.ts +7 -0
- package/esm/referral/swr.d.ts.map +1 -0
- package/esm/referral/swr.js +24 -0
- package/esm/referral/swr.js.map +1 -0
- package/esm/referral/useCommission.d.ts +4 -0
- package/esm/referral/useCommission.d.ts.map +1 -0
- package/esm/referral/useCommission.js +59 -0
- package/esm/referral/useCommission.js.map +1 -0
- package/esm/referral/useDaily.d.ts +9 -0
- package/esm/referral/useDaily.d.ts.map +1 -0
- package/esm/referral/useDaily.js +19 -0
- package/esm/referral/useDaily.js.map +1 -0
- package/esm/referral/useDistribution.d.ts +9 -0
- package/esm/referral/useDistribution.d.ts.map +1 -0
- package/esm/referral/useDistribution.js +53 -0
- package/esm/referral/useDistribution.js.map +1 -0
- package/esm/referral/useRefereeHistory.d.ts +9 -0
- package/esm/referral/useRefereeHistory.d.ts.map +1 -0
- package/esm/referral/useRefereeHistory.js +47 -0
- package/esm/referral/useRefereeHistory.js.map +1 -0
- package/esm/referral/useRefereeInfo.d.ts +9 -0
- package/esm/referral/useRefereeInfo.d.ts.map +1 -0
- package/esm/referral/useRefereeInfo.js +47 -0
- package/esm/referral/useRefereeInfo.js.map +1 -0
- package/esm/referral/useRefereeRebateSummary.d.ts +12 -0
- package/esm/referral/useRefereeRebateSummary.d.ts.map +1 -0
- package/esm/referral/useRefereeRebateSummary.js +31 -0
- package/esm/referral/useRefereeRebateSummary.js.map +1 -0
- package/esm/referral/useReferralRebateSummary.d.ts +9 -0
- package/esm/referral/useReferralRebateSummary.d.ts.map +1 -0
- package/esm/referral/useReferralRebateSummary.js +47 -0
- package/esm/referral/useReferralRebateSummary.js.map +1 -0
- package/esm/services/orderCreator/baseCreator.d.ts.map +1 -1
- package/esm/services/orderCreator/baseCreator.js +5 -3
- package/esm/services/orderCreator/baseCreator.js.map +1 -1
- package/esm/usePrivateInfiniteQuery.d.ts +2 -2
- package/esm/usePrivateInfiniteQuery.d.ts.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +2 -2
- package/esm/version.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/orderly/useAccountInfo.d.ts +1 -1
- package/lib/orderly/useAccountInfo.d.ts.map +1 -1
- package/lib/orderly/useIndexPrice.d.ts +1 -1
- package/lib/orderly/useIndexPrice.d.ts.map +1 -1
- package/lib/orderly/useMarkPricesStream.d.ts +1 -1
- package/lib/orderly/useMarkPricesStream.d.ts.map +1 -1
- package/lib/orderly/useOpenInterest.d.ts +1 -1
- package/lib/orderly/useOpenInterest.d.ts.map +1 -1
- package/lib/orderly/useOrderStream/useOrderStream.d.ts +1 -1
- package/lib/orderly/usePositionStream/usePositionStream.d.ts +1 -1
- package/lib/orderly/useSettleSubscription.d.ts +1 -1
- package/lib/orderly/useSettleSubscription.d.ts.map +1 -1
- package/lib/orderly/useTakeProfitAndStopLoss/index.d.ts +4 -4
- package/lib/orderly/useTakeProfitAndStopLoss/useTPSL.d.ts +4 -4
- package/lib/orderly/useTakeProfitAndStopLoss/useTPSL.d.ts.map +1 -1
- package/lib/orderly/useTakeProfitAndStopLoss/useTPSL.js.map +1 -1
- package/lib/orderly/useWalletSubscription.d.ts +1 -1
- package/lib/orderly/useWalletSubscription.d.ts.map +1 -1
- package/lib/referral/api.d.ts +87 -0
- package/lib/referral/api.d.ts.map +1 -0
- package/lib/referral/api.js +6 -0
- package/lib/referral/api.js.map +1 -0
- package/lib/referral/format.d.ts +2 -0
- package/lib/referral/format.d.ts.map +1 -0
- package/lib/referral/format.js +18 -0
- package/lib/referral/format.js.map +1 -0
- package/lib/referral/index.d.ts +9 -0
- package/lib/referral/index.d.ts.map +1 -0
- package/lib/referral/index.js +56 -0
- package/lib/referral/index.js.map +1 -0
- package/lib/referral/swr.d.ts +7 -0
- package/lib/referral/swr.d.ts.map +1 -0
- package/lib/referral/swr.js +34 -0
- package/lib/referral/swr.js.map +1 -0
- package/lib/referral/useCommission.d.ts +4 -0
- package/lib/referral/useCommission.d.ts.map +1 -0
- package/lib/referral/useCommission.js +69 -0
- package/lib/referral/useCommission.js.map +1 -0
- package/lib/referral/useDaily.d.ts +9 -0
- package/lib/referral/useDaily.d.ts.map +1 -0
- package/lib/referral/useDaily.js +29 -0
- package/lib/referral/useDaily.js.map +1 -0
- package/lib/referral/useDistribution.d.ts +9 -0
- package/lib/referral/useDistribution.d.ts.map +1 -0
- package/lib/referral/useDistribution.js +63 -0
- package/lib/referral/useDistribution.js.map +1 -0
- package/lib/referral/useRefereeHistory.d.ts +9 -0
- package/lib/referral/useRefereeHistory.d.ts.map +1 -0
- package/lib/referral/useRefereeHistory.js +57 -0
- package/lib/referral/useRefereeHistory.js.map +1 -0
- package/lib/referral/useRefereeInfo.d.ts +9 -0
- package/lib/referral/useRefereeInfo.d.ts.map +1 -0
- package/lib/referral/useRefereeInfo.js +57 -0
- package/lib/referral/useRefereeInfo.js.map +1 -0
- package/lib/referral/useRefereeRebateSummary.d.ts +12 -0
- package/lib/referral/useRefereeRebateSummary.d.ts.map +1 -0
- package/lib/referral/useRefereeRebateSummary.js +41 -0
- package/lib/referral/useRefereeRebateSummary.js.map +1 -0
- package/lib/referral/useReferralRebateSummary.d.ts +9 -0
- package/lib/referral/useReferralRebateSummary.d.ts.map +1 -0
- package/lib/referral/useReferralRebateSummary.js +57 -0
- package/lib/referral/useReferralRebateSummary.js.map +1 -0
- package/lib/services/orderCreator/baseCreator.d.ts.map +1 -1
- package/lib/services/orderCreator/baseCreator.js +5 -3
- package/lib/services/orderCreator/baseCreator.js.map +1 -1
- package/lib/usePrivateInfiniteQuery.d.ts +2 -2
- package/lib/usePrivateInfiniteQuery.d.ts.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +2 -2
- package/lib/version.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { usePrivateQuery } from "../usePrivateQuery";
|
|
2
|
+
import { formatDate } from "./format";
|
|
3
|
+
export const useDaily = (options)=>{
|
|
4
|
+
const path = "/v1/volume/user/daily";
|
|
5
|
+
const endDate = options?.startDate || new Date();
|
|
6
|
+
const startDate = options?.endDate || new Date(Date.now() - 86400000 * 30);
|
|
7
|
+
const start_date = formatDate(startDate);
|
|
8
|
+
const end_date = formatDate(endDate);
|
|
9
|
+
const url = `${path}?start_date=${start_date}&end_date=${end_date}`;
|
|
10
|
+
const { data: dailyVolume, mutate } = usePrivateQuery(url, {
|
|
11
|
+
revalidateOnFocus: true
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
data: dailyVolume,
|
|
15
|
+
mutate
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=useDaily.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/referral/useDaily.ts"],"sourcesContent":["\nimport { usePrivateQuery } from \"../usePrivateQuery\";\nimport { RefferalAPI } from \"./api\";\nimport { formatDate } from \"./format\";\nexport const useDaily = (options?: {\n //** default Date() - 30d */\n startDate?: Date,\n //** default Date() */\n endDate?: Date\n}): {\n data?: RefferalAPI.DayliVolume[],\n mutate: any,\n} => {\n\n const path = \"/v1/volume/user/daily\";\n const endDate = options?.startDate || new Date();\n const startDate = options?.endDate || new Date(Date.now() - 86400000 * 30);\n\n const start_date = formatDate(startDate);\n const end_date = formatDate(endDate);\n\n const url = `${path}?start_date=${start_date}&end_date=${end_date}`;\n const {\n data: dailyVolume,\n mutate,\n } = usePrivateQuery<RefferalAPI.DayliVolume[]>(url, {\n revalidateOnFocus: true\n });\n\n return {\n data: dailyVolume,\n mutate,\n }\n}\n\n\n\n"],"names":["usePrivateQuery","formatDate","useDaily","options","path","endDate","startDate","Date","now","start_date","end_date","url","data","dailyVolume","mutate","revalidateOnFocus"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AACA,SAASA,eAAe,QAAQ,qBAAqB;AAErD,SAASC,UAAU,QAAQ,WAAW;AACtC,OAAO,MAAMC,WAAW,CAACC;IAUrB,MAAMC,OAAO;IACb,MAAMC,UAAUF,SAASG,aAAa,IAAIC;IAC1C,MAAMD,YAAYH,SAASE,WAAW,IAAIE,KAAKA,KAAKC,GAAG,KAAK,WAAW;IAEvE,MAAMC,aAAaR,WAAWK;IAC9B,MAAMI,WAAWT,WAAWI;IAE5B,MAAMM,MAAM,CAAC,EAAEP,KAAK,YAAY,EAAEK,WAAW,UAAU,EAAEC,SAAS,CAAC;IACnE,MAAM,EACFE,MAAMC,WAAW,EACjBC,MAAM,EACT,GAAGd,gBAA2CW,KAAK;QAChDI,mBAAmB;IACvB;IAEA,OAAO;QACHH,MAAMC;QACNC;IACJ;AACJ,EAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDistribution.d.ts","sourceRoot":"","sources":["../../src/referral/useDistribution.ts"],"names":[],"mappings":"AAKA,KAAK,MAAM,GAAG;IAEV,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CAAA;AAED,eAAO,MAAM,eAAe,WAAY,MAAM,KAAG,GA+ChD,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { generateKeyFun } from "./swr";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { usePrivateInfiniteQuery } from "../usePrivateInfiniteQuery";
|
|
4
|
+
export const useDistribution = (params)=>{
|
|
5
|
+
const { size = 10, startDate, endDate, initialSize } = params;
|
|
6
|
+
const ordersResponse = usePrivateInfiniteQuery(generateKeyFun({
|
|
7
|
+
path: '/v1/client/distribution_history',
|
|
8
|
+
size,
|
|
9
|
+
startDate,
|
|
10
|
+
endDate
|
|
11
|
+
}), {
|
|
12
|
+
initialSize: initialSize,
|
|
13
|
+
// revalidateFirstPage: false,
|
|
14
|
+
// onError: (err) => {
|
|
15
|
+
// console.error("fetch failed::::", err);
|
|
16
|
+
// },
|
|
17
|
+
formatter: (data)=>data,
|
|
18
|
+
revalidateOnFocus: false
|
|
19
|
+
});
|
|
20
|
+
const loadMore = ()=>{
|
|
21
|
+
ordersResponse.setSize(ordersResponse.size + 1);
|
|
22
|
+
};
|
|
23
|
+
const total = useMemo(()=>{
|
|
24
|
+
return ordersResponse.data?.[0]?.meta?.total || 0;
|
|
25
|
+
}, [
|
|
26
|
+
ordersResponse.data?.[0]?.meta?.total
|
|
27
|
+
]);
|
|
28
|
+
const flattenOrders = useMemo(()=>{
|
|
29
|
+
if (!ordersResponse.data) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return ordersResponse.data?.map((item)=>item.rows)?.flat().map((item)=>{
|
|
33
|
+
return {
|
|
34
|
+
...item,
|
|
35
|
+
created_time: item.created_time - 86400000,
|
|
36
|
+
updated_time: item.updated_time - 86400000
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
}, [
|
|
40
|
+
ordersResponse.data
|
|
41
|
+
]);
|
|
42
|
+
return [
|
|
43
|
+
flattenOrders,
|
|
44
|
+
{
|
|
45
|
+
total,
|
|
46
|
+
isLoading: ordersResponse.isLoading,
|
|
47
|
+
refresh: ordersResponse.mutate,
|
|
48
|
+
loadMore
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=useDistribution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/referral/useDistribution.ts"],"sourcesContent":["import { generateKeyFun } from \"./swr\";\nimport { useMemo } from \"react\";\nimport { RefferalAPI } from \"./api\";\nimport { usePrivateInfiniteQuery } from \"../usePrivateInfiniteQuery\";\n\ntype Params = {\n //** default is 10 */\n size?: number,\n //** YYYY-MM-dd */\n startDate?: string,\n //** YYYY-MM-dd */\n endDate?: string,\n //** default is 1 */\n initialSize?: number,\n}\n\nexport const useDistribution = (params: Params): any => {\n const { size = 10, startDate, endDate, initialSize } = params;\n\n const ordersResponse = usePrivateInfiniteQuery(\n generateKeyFun({ path: '/v1/client/distribution_history', size, startDate, endDate }),\n {\n initialSize: initialSize,\n // revalidateFirstPage: false,\n // onError: (err) => {\n // console.error(\"fetch failed::::\", err);\n // },\n formatter: (data: any) => data,\n revalidateOnFocus: false,\n }\n );\n\n\n const loadMore = () => {\n ordersResponse.setSize(ordersResponse.size + 1);\n };\n\n const total = useMemo(() => {\n return ordersResponse.data?.[0]?.meta?.total || 0;\n }, [ordersResponse.data?.[0]?.meta?.total]);\n\n\n const flattenOrders = useMemo((): RefferalAPI.Distribution[] | null => {\n if (!ordersResponse.data) {\n return null;\n }\n\n return ordersResponse.data?.map((item: any) => item.rows)?.flat()\n /// TODO: next version will be remove this code\n .map((item: any) => {\n return { ...item, created_time: item.created_time - 86400000, updated_time: item.updated_time - 86400000 };\n });\n }, [ordersResponse.data]);\n\n return [\n flattenOrders,\n {\n total,\n isLoading: ordersResponse.isLoading,\n refresh: ordersResponse.mutate,\n loadMore\n }\n ] as const;\n}"],"names":["generateKeyFun","useMemo","usePrivateInfiniteQuery","useDistribution","params","size","startDate","endDate","initialSize","ordersResponse","path","formatter","data","revalidateOnFocus","loadMore","setSize","total","meta","flattenOrders","map","item","rows","flat","created_time","updated_time","isLoading","refresh","mutate"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,cAAc,QAAQ,QAAQ;AACvC,SAASC,OAAO,QAAQ,QAAQ;AAEhC,SAASC,uBAAuB,QAAQ,6BAA6B;AAarE,OAAO,MAAMC,kBAAkB,CAACC;IAC5B,MAAM,EAAEC,OAAO,EAAE,EAAEC,SAAS,EAAEC,OAAO,EAAEC,WAAW,EAAE,GAAGJ;IAEvD,MAAMK,iBAAiBP,wBACnBF,eAAe;QAAEU,MAAM;QAAmCL;QAAMC;QAAWC;IAAQ,IACnF;QACIC,aAAaA;QACb,8BAA8B;QAC9B,sBAAsB;QACtB,4CAA4C;QAC5C,KAAK;QACLG,WAAW,CAACC,OAAcA;QAC1BC,mBAAmB;IACvB;IAIJ,MAAMC,WAAW;QACbL,eAAeM,OAAO,CAACN,eAAeJ,IAAI,GAAG;IACjD;IAEA,MAAMW,QAAQf,QAAQ;QAClB,OAAOQ,eAAeG,IAAI,EAAE,CAAC,EAAE,EAAEK,MAAMD,SAAS;IACpD,GAAG;QAACP,eAAeG,IAAI,EAAE,CAAC,EAAE,EAAEK,MAAMD;KAAM;IAG1C,MAAME,gBAAgBjB,QAAQ;QAC1B,IAAI,CAACQ,eAAeG,IAAI,EAAE;YACtB,OAAO;QACX;QAEA,OAAOH,eAAeG,IAAI,EAAEO,IAAI,CAACC,OAAcA,KAAKC,IAAI,GAAGC,OAEtDH,IAAI,CAACC;YACF,OAAO;gBAAE,GAAGA,IAAI;gBAAEG,cAAcH,KAAKG,YAAY,GAAG;gBAAUC,cAAcJ,KAAKI,YAAY,GAAG;YAAS;QAC7G;IACR,GAAG;QAACf,eAAeG,IAAI;KAAC;IAExB,OAAO;QACHM;QACA;YACIF;YACAS,WAAWhB,eAAegB,SAAS;YACnCC,SAASjB,eAAekB,MAAM;YAC9Bb;QACJ;KACH;AACL,EAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRefereeHistory.d.ts","sourceRoot":"","sources":["../../src/referral/useRefereeHistory.ts"],"names":[],"mappings":"AAIA,KAAK,MAAM,GAAG;IAEV,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CAAA;AAED,eAAO,MAAM,iBAAiB,WAAY,MAAM,KAAG,GAAG,EA2CrD,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { usePrivateInfiniteQuery } from "../usePrivateInfiniteQuery";
|
|
2
|
+
import { generateKeyFun } from "./swr";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
export const useRefereeHistory = (params)=>{
|
|
5
|
+
const { size = 10, startDate, endDate, initialSize } = params;
|
|
6
|
+
const response = usePrivateInfiniteQuery(generateKeyFun({
|
|
7
|
+
path: '/v1/referral/referee_history',
|
|
8
|
+
size,
|
|
9
|
+
startDate,
|
|
10
|
+
endDate
|
|
11
|
+
}), {
|
|
12
|
+
initialSize: initialSize,
|
|
13
|
+
// revalidateFirstPage: false,
|
|
14
|
+
// onError: (err) => {
|
|
15
|
+
// console.error("fetch failed::::", err);
|
|
16
|
+
// },
|
|
17
|
+
formatter: (data)=>data,
|
|
18
|
+
revalidateOnFocus: false
|
|
19
|
+
});
|
|
20
|
+
const loadMore = ()=>{
|
|
21
|
+
response.setSize(response.size + 1);
|
|
22
|
+
};
|
|
23
|
+
const total = useMemo(()=>{
|
|
24
|
+
return response.data?.[0]?.meta?.total || 0;
|
|
25
|
+
}, [
|
|
26
|
+
response.data?.[0]?.meta?.total
|
|
27
|
+
]);
|
|
28
|
+
const flattenOrders = useMemo(()=>{
|
|
29
|
+
if (!response.data) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return response.data?.map((item)=>item.rows)?.flat();
|
|
33
|
+
}, [
|
|
34
|
+
response.data
|
|
35
|
+
]);
|
|
36
|
+
return [
|
|
37
|
+
flattenOrders,
|
|
38
|
+
{
|
|
39
|
+
total,
|
|
40
|
+
isLoading: response.isLoading,
|
|
41
|
+
refresh: response.mutate,
|
|
42
|
+
loadMore
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=useRefereeHistory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/referral/useRefereeHistory.ts"],"sourcesContent":["import { usePrivateInfiniteQuery } from \"../usePrivateInfiniteQuery\";\nimport { generateKeyFun } from \"./swr\";\nimport { useMemo } from \"react\";\n\ntype Params = {\n //** default is 10 */\n size?: number,\n //** YYYY-MM-dd */\n startDate?: string,\n //** YYYY-MM-dd */\n endDate?: string,\n //** default is 1 */\n initialSize?: number,\n}\n\nexport const useRefereeHistory = (params: Params): any[] => {\n const { size = 10, startDate, endDate, initialSize } = params;\n\n const response = usePrivateInfiniteQuery(\n generateKeyFun({ path: '/v1/referral/referee_history', size, startDate, endDate }),\n {\n initialSize: initialSize,\n // revalidateFirstPage: false,\n // onError: (err) => {\n // console.error(\"fetch failed::::\", err);\n // },\n formatter: (data) => data,\n revalidateOnFocus: false,\n }\n );\n\n\n const loadMore = () => {\n response.setSize(response.size + 1);\n };\n\n const total = useMemo(() => {\n return response.data?.[0]?.meta?.total || 0;\n }, [response.data?.[0]?.meta?.total]);\n\n\n const flattenOrders = useMemo(() => {\n if (!response.data) {\n return null;\n }\n\n return response.data?.map((item) => item.rows)?.flat();\n }, [response.data]);\n\n return [\n flattenOrders,\n {\n total,\n isLoading: response.isLoading,\n refresh: response.mutate,\n loadMore\n }\n ];\n}"],"names":["usePrivateInfiniteQuery","generateKeyFun","useMemo","useRefereeHistory","params","size","startDate","endDate","initialSize","response","path","formatter","data","revalidateOnFocus","loadMore","setSize","total","meta","flattenOrders","map","item","rows","flat","isLoading","refresh","mutate"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,uBAAuB,QAAQ,6BAA6B;AACrE,SAASC,cAAc,QAAQ,QAAQ;AACvC,SAASC,OAAO,QAAQ,QAAQ;AAahC,OAAO,MAAMC,oBAAoB,CAACC;IAC9B,MAAM,EAAEC,OAAO,EAAE,EAAEC,SAAS,EAAEC,OAAO,EAAEC,WAAW,EAAE,GAAGJ;IAEvD,MAAMK,WAAWT,wBACbC,eAAe;QAAES,MAAM;QAAgCL;QAAMC;QAAWC;IAAQ,IAChF;QACIC,aAAaA;QACb,8BAA8B;QAC9B,sBAAsB;QACtB,4CAA4C;QAC5C,KAAK;QACLG,WAAW,CAACC,OAASA;QACrBC,mBAAmB;IACvB;IAIJ,MAAMC,WAAW;QACbL,SAASM,OAAO,CAACN,SAASJ,IAAI,GAAG;IACrC;IAEA,MAAMW,QAAQd,QAAQ;QAClB,OAAOO,SAASG,IAAI,EAAE,CAAC,EAAE,EAAEK,MAAMD,SAAS;IAC9C,GAAG;QAACP,SAASG,IAAI,EAAE,CAAC,EAAE,EAAEK,MAAMD;KAAM;IAGpC,MAAME,gBAAgBhB,QAAQ;QAC1B,IAAI,CAACO,SAASG,IAAI,EAAE;YAChB,OAAO;QACX;QAEA,OAAOH,SAASG,IAAI,EAAEO,IAAI,CAACC,OAASA,KAAKC,IAAI,GAAGC;IACpD,GAAG;QAACb,SAASG,IAAI;KAAC;IAElB,OAAO;QACHM;QACA;YACIF;YACAO,WAAWd,SAASc,SAAS;YAC7BC,SAASf,SAASgB,MAAM;YACxBX;QACJ;KACH;AACL,EAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRefereeInfo.d.ts","sourceRoot":"","sources":["../../src/referral/useRefereeInfo.ts"],"names":[],"mappings":"AAKA,KAAK,MAAM,GAAG;IAEV,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CAAA;AAED,eAAO,MAAM,cAAc,WAAY,MAAM,KAAG,GAAG,EA2ClD,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { generateKeyFun } from "./swr";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { usePrivateInfiniteQuery } from "../usePrivateInfiniteQuery";
|
|
4
|
+
export const useRefereeInfo = (params)=>{
|
|
5
|
+
const { size = 10, startDate, endDate, initialSize } = params;
|
|
6
|
+
const response = usePrivateInfiniteQuery(generateKeyFun({
|
|
7
|
+
path: '/v1/referral/referee_info',
|
|
8
|
+
size,
|
|
9
|
+
startDate,
|
|
10
|
+
endDate
|
|
11
|
+
}), {
|
|
12
|
+
initialSize: initialSize,
|
|
13
|
+
// revalidateFirstPage: false,
|
|
14
|
+
// onError: (err) => {
|
|
15
|
+
// console.error("fetch failed::::", err);
|
|
16
|
+
// },
|
|
17
|
+
formatter: (data)=>data,
|
|
18
|
+
revalidateOnFocus: false
|
|
19
|
+
});
|
|
20
|
+
const loadMore = ()=>{
|
|
21
|
+
response.setSize(response.size + 1);
|
|
22
|
+
};
|
|
23
|
+
const total = useMemo(()=>{
|
|
24
|
+
return response.data?.[0]?.meta?.total || 0;
|
|
25
|
+
}, [
|
|
26
|
+
response.data?.[0]?.meta?.total
|
|
27
|
+
]);
|
|
28
|
+
const flattenOrders = useMemo(()=>{
|
|
29
|
+
if (!response.data) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return response.data?.map((item)=>item.rows)?.flat();
|
|
33
|
+
}, [
|
|
34
|
+
response.data
|
|
35
|
+
]);
|
|
36
|
+
return [
|
|
37
|
+
flattenOrders,
|
|
38
|
+
{
|
|
39
|
+
total,
|
|
40
|
+
isLoading: response.isLoading,
|
|
41
|
+
refresh: response.mutate,
|
|
42
|
+
loadMore
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=useRefereeInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/referral/useRefereeInfo.ts"],"sourcesContent":["import { generateKeyFun } from \"./swr\";\nimport { useMemo } from \"react\";\nimport { RefferalAPI } from \"./api\";\nimport { usePrivateInfiniteQuery } from \"../usePrivateInfiniteQuery\";\n\ntype Params = {\n //** default is 10 */\n size?: number,\n //** YYYY-MM-dd */\n startDate?: string,\n //** YYYY-MM-dd */\n endDate?: string,\n //** default is 1 */\n initialSize?: number,\n}\n\nexport const useRefereeInfo = (params: Params): any[] => {\n const { size = 10, startDate, endDate, initialSize } = params;\n\n const response = usePrivateInfiniteQuery(\n generateKeyFun({ path: '/v1/referral/referee_info', size, startDate, endDate }),\n {\n initialSize: initialSize,\n // revalidateFirstPage: false,\n // onError: (err) => {\n // console.error(\"fetch failed::::\", err);\n // },\n formatter: (data) => data,\n revalidateOnFocus: false,\n }\n );\n\n\n const loadMore = () => {\n response.setSize(response.size + 1);\n };\n\n const total = useMemo(() => {\n return response.data?.[0]?.meta?.total || 0;\n }, [response.data?.[0]?.meta?.total]);\n\n\n const flattenOrders = useMemo((): RefferalAPI.RefereeInfoItem[] | null => {\n if (!response.data) {\n return null;\n }\n\n return response.data?.map((item) => item.rows)?.flat();\n }, [response.data]);\n\n return [\n flattenOrders,\n {\n total,\n isLoading: response.isLoading,\n refresh: response.mutate,\n loadMore\n }\n ];\n}"],"names":["generateKeyFun","useMemo","usePrivateInfiniteQuery","useRefereeInfo","params","size","startDate","endDate","initialSize","response","path","formatter","data","revalidateOnFocus","loadMore","setSize","total","meta","flattenOrders","map","item","rows","flat","isLoading","refresh","mutate"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,cAAc,QAAQ,QAAQ;AACvC,SAASC,OAAO,QAAQ,QAAQ;AAEhC,SAASC,uBAAuB,QAAQ,6BAA6B;AAarE,OAAO,MAAMC,iBAAiB,CAACC;IAC3B,MAAM,EAAEC,OAAO,EAAE,EAAEC,SAAS,EAAEC,OAAO,EAAEC,WAAW,EAAE,GAAGJ;IAEvD,MAAMK,WAAWP,wBACbF,eAAe;QAAEU,MAAM;QAA6BL;QAAMC;QAAWC;IAAQ,IAC7E;QACIC,aAAaA;QACb,8BAA8B;QAC9B,sBAAsB;QACtB,4CAA4C;QAC5C,KAAK;QACLG,WAAW,CAACC,OAASA;QACrBC,mBAAmB;IACvB;IAIJ,MAAMC,WAAW;QACbL,SAASM,OAAO,CAACN,SAASJ,IAAI,GAAG;IACrC;IAEA,MAAMW,QAAQf,QAAQ;QAClB,OAAOQ,SAASG,IAAI,EAAE,CAAC,EAAE,EAAEK,MAAMD,SAAS;IAC9C,GAAG;QAACP,SAASG,IAAI,EAAE,CAAC,EAAE,EAAEK,MAAMD;KAAM;IAGpC,MAAME,gBAAgBjB,QAAQ;QAC1B,IAAI,CAACQ,SAASG,IAAI,EAAE;YAChB,OAAO;QACX;QAEA,OAAOH,SAASG,IAAI,EAAEO,IAAI,CAACC,OAASA,KAAKC,IAAI,GAAGC;IACpD,GAAG;QAACb,SAASG,IAAI;KAAC;IAElB,OAAO;QACHM;QACA;YACIF;YACAO,WAAWd,SAASc,SAAS;YAC7BC,SAASf,SAASgB,MAAM;YACxBX;QACJ;KACH;AACL,EAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RefferalAPI } from "./api";
|
|
2
|
+
type Params = {
|
|
3
|
+
startDate?: Date;
|
|
4
|
+
endDate?: Date;
|
|
5
|
+
};
|
|
6
|
+
export declare const useRefereeRebateSummary: (params: Params) => {
|
|
7
|
+
data?: RefferalAPI.RefereeRebateSummary[] | undefined;
|
|
8
|
+
mutate: any;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=useRefereeRebateSummary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRefereeRebateSummary.d.ts","sourceRoot":"","sources":["../../src/referral/useRefereeRebateSummary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGpC,KAAK,MAAM,GAAG;IACV,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,IAAI,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,uBAAuB,WAAY,MAAM;;YAE1C,GAAG;eACA,OAAO;CA4BrB,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { usePrivateQuery } from "../usePrivateQuery";
|
|
2
|
+
import { formatDate } from "./format";
|
|
3
|
+
export const useRefereeRebateSummary = (params)=>{
|
|
4
|
+
const path = "/v1/referral/referee_rebate_summary";
|
|
5
|
+
let url = path;
|
|
6
|
+
if (typeof params.endDate !== 'undefined' && typeof params.startDate !== 'undefined') {
|
|
7
|
+
const sDate = minDate(params.startDate, params.endDate);
|
|
8
|
+
const eDate = maxDate(params.startDate, params.endDate);
|
|
9
|
+
const search = new URLSearchParams([]);
|
|
10
|
+
search.set(`start_date`, formatDate(sDate));
|
|
11
|
+
search.set(`end_date`, formatDate(eDate));
|
|
12
|
+
const queryParams = search.toString() || "";
|
|
13
|
+
url = `${path}?${queryParams}`;
|
|
14
|
+
}
|
|
15
|
+
const { data, mutate, isLoading } = usePrivateQuery(url, {
|
|
16
|
+
revalidateOnFocus: true
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
data,
|
|
20
|
+
mutate,
|
|
21
|
+
isLoading
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
function minDate(a, b) {
|
|
25
|
+
return a < b ? a : b;
|
|
26
|
+
}
|
|
27
|
+
function maxDate(a, b) {
|
|
28
|
+
return a > b ? a : b;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=useRefereeRebateSummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/referral/useRefereeRebateSummary.ts"],"sourcesContent":["import { usePrivateQuery } from \"../usePrivateQuery\";\nimport { RefferalAPI } from \"./api\";\nimport { formatDate } from \"./format\";\n\ntype Params = {\n startDate?: Date,\n endDate?: Date\n}\n\nexport const useRefereeRebateSummary = (params: Params): {\n data?: RefferalAPI.RefereeRebateSummary[],\n mutate: any,\n isLoading: boolean,\n} => {\n const path = \"/v1/referral/referee_rebate_summary\";\n\n let url = path;\n if (typeof params.endDate !== 'undefined' && typeof params.startDate !== 'undefined') {\n\n const sDate = minDate(params.startDate, params.endDate);\n const eDate = maxDate(params.startDate, params.endDate);\n const search = new URLSearchParams([]);\n search.set(`start_date`, formatDate(sDate, ));\n search.set(`end_date`, formatDate(eDate,));\n const queryParams = search.toString() || \"\";\n url = `${path}?${queryParams}`;\n }\n const {\n data,\n mutate,\n isLoading,\n } = usePrivateQuery<RefferalAPI.RefereeRebateSummary[]>(url, {\n revalidateOnFocus: true\n });\n\n return {\n data,\n mutate,\n isLoading,\n }\n}\n\nfunction minDate(a: Date, b: Date) {\n return a < b ? a : b;\n}\n\nfunction maxDate(a: Date, b: Date) {\n return a > b ? a : b;\n}"],"names":["usePrivateQuery","formatDate","useRefereeRebateSummary","params","path","url","endDate","startDate","sDate","minDate","eDate","maxDate","search","URLSearchParams","set","queryParams","toString","data","mutate","isLoading","revalidateOnFocus","a","b"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,QAAQ,qBAAqB;AAErD,SAASC,UAAU,QAAQ,WAAW;AAOtC,OAAO,MAAMC,0BAA0B,CAACC;IAKpC,MAAMC,OAAO;IAEb,IAAIC,MAAMD;IACV,IAAI,OAAOD,OAAOG,OAAO,KAAK,eAAe,OAAOH,OAAOI,SAAS,KAAK,aAAa;QAElF,MAAMC,QAAQC,QAAQN,OAAOI,SAAS,EAAEJ,OAAOG,OAAO;QACtD,MAAMI,QAAQC,QAAQR,OAAOI,SAAS,EAAEJ,OAAOG,OAAO;QACtD,MAAMM,SAAS,IAAIC,gBAAgB,EAAE;QACrCD,OAAOE,GAAG,CAAC,CAAC,UAAU,CAAC,EAAEb,WAAWO;QACpCI,OAAOE,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAEb,WAAWS;QAClC,MAAMK,cAAcH,OAAOI,QAAQ,MAAM;QACzCX,MAAM,CAAC,EAAED,KAAK,CAAC,EAAEW,YAAY,CAAC;IAClC;IACA,MAAM,EACFE,IAAI,EACJC,MAAM,EACNC,SAAS,EACZ,GAAGnB,gBAAoDK,KAAK;QACzDe,mBAAmB;IACvB;IAEA,OAAO;QACHH;QACAC;QACAC;IACJ;AACJ,EAAC;AAED,SAASV,QAAQY,CAAO,EAAEC,CAAO;IAC7B,OAAOD,IAAIC,IAAID,IAAIC;AACvB;AAEA,SAASX,QAAQU,CAAO,EAAEC,CAAO;IAC7B,OAAOD,IAAIC,IAAID,IAAIC;AACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReferralRebateSummary.d.ts","sourceRoot":"","sources":["../../src/referral/useReferralRebateSummary.ts"],"names":[],"mappings":"AAKA,KAAK,MAAM,GAAG;IAEV,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CAAA;AAED,eAAO,MAAM,wBAAwB,WAAY,MAAM,KAAG,GAAG,EA2C5D,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { generateKeyFun } from "./swr";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { usePrivateInfiniteQuery } from "../usePrivateInfiniteQuery";
|
|
4
|
+
export const useReferralRebateSummary = (params)=>{
|
|
5
|
+
const { size = 10, startDate, endDate, initialSize } = params;
|
|
6
|
+
const response = usePrivateInfiniteQuery(generateKeyFun({
|
|
7
|
+
path: '/v1/referral/rebate_summary',
|
|
8
|
+
size,
|
|
9
|
+
startDate,
|
|
10
|
+
endDate
|
|
11
|
+
}), {
|
|
12
|
+
initialSize: initialSize,
|
|
13
|
+
// revalidateFirstPage: false,
|
|
14
|
+
// onError: (err) => {
|
|
15
|
+
// console.error("fetch failed::::", err);
|
|
16
|
+
// },
|
|
17
|
+
formatter: (data)=>data,
|
|
18
|
+
revalidateOnFocus: false
|
|
19
|
+
});
|
|
20
|
+
const loadMore = ()=>{
|
|
21
|
+
response.setSize(response.size + 1);
|
|
22
|
+
};
|
|
23
|
+
const total = useMemo(()=>{
|
|
24
|
+
return response.data?.[0]?.meta?.total || 0;
|
|
25
|
+
}, [
|
|
26
|
+
response.data?.[0]?.meta?.total
|
|
27
|
+
]);
|
|
28
|
+
const flattenOrders = useMemo(()=>{
|
|
29
|
+
if (!response.data) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return response.data?.map((item)=>item.rows)?.flat();
|
|
33
|
+
}, [
|
|
34
|
+
response.data
|
|
35
|
+
]);
|
|
36
|
+
return [
|
|
37
|
+
flattenOrders,
|
|
38
|
+
{
|
|
39
|
+
total,
|
|
40
|
+
isLoading: response.isLoading,
|
|
41
|
+
refresh: response.mutate,
|
|
42
|
+
loadMore
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=useReferralRebateSummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/referral/useReferralRebateSummary.ts"],"sourcesContent":["import { generateKeyFun } from \"./swr\";\nimport { useMemo } from \"react\";\nimport { RefferalAPI } from \"./api\";\nimport { usePrivateInfiniteQuery } from \"../usePrivateInfiniteQuery\";\n\ntype Params = {\n //** default is 10 */\n size?: number,\n //** YYYY-MM-dd */\n startDate?: string,\n //** YYYY-MM-dd */\n endDate?: string,\n //** default is 1 */\n initialSize?: number,\n}\n\nexport const useReferralRebateSummary = (params: Params): any[] => {\n const { size = 10, startDate, endDate, initialSize } = params;\n\n const response = usePrivateInfiniteQuery(\n generateKeyFun({ path: '/v1/referral/rebate_summary', size, startDate, endDate }),\n {\n initialSize: initialSize,\n // revalidateFirstPage: false,\n // onError: (err) => {\n // console.error(\"fetch failed::::\", err);\n // },\n formatter: (data) => data,\n revalidateOnFocus: false,\n }\n );\n\n\n const loadMore = () => {\n response.setSize(response.size + 1);\n };\n\n const total = useMemo(() => {\n return response.data?.[0]?.meta?.total || 0;\n }, [response.data?.[0]?.meta?.total]);\n\n\n const flattenOrders = useMemo((): RefferalAPI.ReferralRebateSummary[] | null => {\n if (!response.data) {\n return null;\n }\n\n return response.data?.map((item) => item.rows)?.flat();\n }, [response.data]);\n\n return [\n flattenOrders,\n {\n total,\n isLoading: response.isLoading,\n refresh: response.mutate,\n loadMore\n }\n ];\n}"],"names":["generateKeyFun","useMemo","usePrivateInfiniteQuery","useReferralRebateSummary","params","size","startDate","endDate","initialSize","response","path","formatter","data","revalidateOnFocus","loadMore","setSize","total","meta","flattenOrders","map","item","rows","flat","isLoading","refresh","mutate"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,cAAc,QAAQ,QAAQ;AACvC,SAASC,OAAO,QAAQ,QAAQ;AAEhC,SAASC,uBAAuB,QAAQ,6BAA6B;AAarE,OAAO,MAAMC,2BAA2B,CAACC;IACrC,MAAM,EAAEC,OAAO,EAAE,EAAEC,SAAS,EAAEC,OAAO,EAAEC,WAAW,EAAE,GAAGJ;IAEvD,MAAMK,WAAWP,wBACbF,eAAe;QAAEU,MAAM;QAA+BL;QAAMC;QAAWC;IAAQ,IAC/E;QACIC,aAAaA;QACb,8BAA8B;QAC9B,sBAAsB;QACtB,4CAA4C;QAC5C,KAAK;QACLG,WAAW,CAACC,OAASA;QACrBC,mBAAmB;IACvB;IAIJ,MAAMC,WAAW;QACbL,SAASM,OAAO,CAACN,SAASJ,IAAI,GAAG;IACrC;IAEA,MAAMW,QAAQf,QAAQ;QAClB,OAAOQ,SAASG,IAAI,EAAE,CAAC,EAAE,EAAEK,MAAMD,SAAS;IAC9C,GAAG;QAACP,SAASG,IAAI,EAAE,CAAC,EAAE,EAAEK,MAAMD;KAAM;IAGpC,MAAME,gBAAgBjB,QAAQ;QAC1B,IAAI,CAACQ,SAASG,IAAI,EAAE;YAChB,OAAO;QACX;QAEA,OAAOH,SAASG,IAAI,EAAEO,IAAI,CAACC,OAASA,KAAKC,IAAI,GAAGC;IACpD,GAAG;QAACb,SAASG,IAAI;KAAC;IAElB,OAAO;QACHM;QACA;YACIF;YACAO,WAAWd,SAASc,SAAS;YAC7BC,SAASf,SAASgB,MAAM;YACxBX;QACJ;KACH;AACL,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseCreator.d.ts","sourceRoot":"","sources":["../../../src/services/orderCreator/baseCreator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,wBAAwB,CAAC;AAChE,OAAO,EACL,YAAY,EACZ,eAAe,EACf,eAAe,EACf,YAAY,EACb,MAAM,aAAa,CAAC;AAIrB,8BAAsB,gBAAgB,CAAC,CAAC,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;IAClE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,CAAC;IAEvD,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC;IAE5E,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW;IA+BzC,YAAY,CACV,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"baseCreator.d.ts","sourceRoot":"","sources":["../../../src/services/orderCreator/baseCreator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,wBAAwB,CAAC;AAChE,OAAO,EACL,YAAY,EACZ,eAAe,EACf,eAAe,EACf,YAAY,EACb,MAAM,aAAa,CAAC;AAIrB,8BAAsB,gBAAgB,CAAC,CAAC,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;IAClE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,CAAC;IAEvD,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC;IAE5E,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW;IA+BzC,YAAY,CACV,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,YAAY,CAAC;IAsFxB,eAAe,CACb,KAAK,EAAE;QACL,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACjC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KAC/B,EACD,MAAM,EAAE,eAAe,GACtB,WAAW;CAaf"}
|
|
@@ -18,8 +18,9 @@ export class BaseOrderCreator {
|
|
|
18
18
|
}
|
|
19
19
|
baseValidate(values, configs) {
|
|
20
20
|
const errors = {};
|
|
21
|
-
const { maxQty, symbol } = configs;
|
|
22
|
-
|
|
21
|
+
const { maxQty, symbol, markPrice } = configs;
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
let { order_quantity, total, order_price, reduce_only, order_type } = values;
|
|
23
24
|
const { min_notional } = symbol;
|
|
24
25
|
if (!order_quantity) {
|
|
25
26
|
// calculate order_quantity from total
|
|
@@ -67,7 +68,8 @@ export class BaseOrderCreator {
|
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
|
-
const
|
|
71
|
+
const price = `${order_type}`.includes("MARKET") ? markPrice : order_price;
|
|
72
|
+
const notionalHintStr = checkNotional(price, order_quantity, min_notional);
|
|
71
73
|
if (notionalHintStr !== undefined && reduce_only !== true) {
|
|
72
74
|
errors.total = {
|
|
73
75
|
type: "min",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/services/orderCreator/baseCreator.ts"],"sourcesContent":["import { OrderEntity, OrderType } from \"@orderly.network/types\";\nimport {\n OrderCreator,\n OrderFormEntity,\n ValuesDepConfig,\n VerifyResult,\n} from \"./interface\";\nimport { Decimal } from \"@orderly.network/utils\";\nimport { checkNotional } from \"../../utils/createOrder\";\n\nexport abstract class BaseOrderCreator<T> implements OrderCreator<T> {\n abstract create(values: T, config?: ValuesDepConfig): T;\n\n abstract validate(values: T, config: ValuesDepConfig): Promise<VerifyResult>;\n\n baseOrder(data: OrderEntity): OrderEntity {\n const order: Pick<\n OrderEntity,\n | \"symbol\"\n | \"order_type\"\n | \"side\"\n | \"reduce_only\"\n | \"order_quantity\"\n | \"total\"\n | \"visible_quantity\"\n > = {\n symbol: data.symbol!,\n order_type:\n data.order_type === OrderType.LIMIT\n ? !!data.order_type_ext\n ? data.order_type_ext\n : data.order_type\n : data.order_type,\n side: data.side,\n reduce_only: data.reduce_only!,\n order_quantity: data.order_quantity!,\n total: data.total,\n };\n\n if (data.visible_quantity === 0) {\n order.visible_quantity = data.visible_quantity;\n }\n\n return order as OrderEntity;\n }\n\n baseValidate(\n values: OrderFormEntity,\n configs: ValuesDepConfig\n ): Promise<VerifyResult> {\n const errors: {\n [P in keyof OrderEntity]?: { type: string; message: string };\n } = {};\n\n const { maxQty, symbol } = configs;\n\n let { order_quantity, total, order_price, reduce_only } = values;\n\n const { min_notional } = symbol;\n\n if (!order_quantity) {\n // calculate order_quantity from total\n if (total && order_price) {\n const { quote_dp } = configs.symbol;\n const totalNumber = new Decimal(total);\n const qty = totalNumber.dividedBy(order_price).toFixed(quote_dp);\n order_quantity = qty;\n }\n }\n\n if (!order_quantity) {\n errors.order_quantity = {\n type: \"required\",\n message: \"quantity is required\",\n };\n } else {\n // need to use MaxQty+base_max, base_min to compare\n const { base_min, quote_dp, base_dp } = configs.symbol;\n const qty = new Decimal(order_quantity);\n if (qty.lt(base_min)) {\n errors.order_quantity = {\n type: \"min\",\n message: `quantity must be greater than ${new Decimal(base_min).todp(\n base_dp\n )}`,\n };\n // errors.order_quantity = `quantity must be greater than ${base_min}`;\n } else if (qty.gt(maxQty)) {\n errors.order_quantity = {\n type: \"max\",\n message: `quantity must be less than ${new Decimal(maxQty).todp(\n base_dp\n )}`,\n };\n }\n }\n\n if (!!total) {\n const { quote_max, quote_min, quote_dp } = configs.symbol;\n const totalNumber = new Decimal(total);\n if (totalNumber.lt(quote_min)) {\n errors.total = {\n type: \"min\",\n message: `Quantity must be at least ${new Decimal(quote_min).todp(\n quote_dp\n )}`,\n };\n } else if (totalNumber.gt(quote_max)) {\n errors.total = {\n type: \"max\",\n message: `Quantity should be less or equal than ${new Decimal(\n quote_max\n ).todp(quote_dp)}`,\n };\n }\n }\n\n const notionalHintStr = checkNotional(\n
|
|
1
|
+
{"version":3,"sources":["../../../src/services/orderCreator/baseCreator.ts"],"sourcesContent":["import { OrderEntity, OrderType } from \"@orderly.network/types\";\nimport {\n OrderCreator,\n OrderFormEntity,\n ValuesDepConfig,\n VerifyResult,\n} from \"./interface\";\nimport { Decimal } from \"@orderly.network/utils\";\nimport { checkNotional } from \"../../utils/createOrder\";\n\nexport abstract class BaseOrderCreator<T> implements OrderCreator<T> {\n abstract create(values: T, config?: ValuesDepConfig): T;\n\n abstract validate(values: T, config: ValuesDepConfig): Promise<VerifyResult>;\n\n baseOrder(data: OrderEntity): OrderEntity {\n const order: Pick<\n OrderEntity,\n | \"symbol\"\n | \"order_type\"\n | \"side\"\n | \"reduce_only\"\n | \"order_quantity\"\n | \"total\"\n | \"visible_quantity\"\n > = {\n symbol: data.symbol!,\n order_type:\n data.order_type === OrderType.LIMIT\n ? !!data.order_type_ext\n ? data.order_type_ext\n : data.order_type\n : data.order_type,\n side: data.side,\n reduce_only: data.reduce_only!,\n order_quantity: data.order_quantity!,\n total: data.total,\n };\n\n if (data.visible_quantity === 0) {\n order.visible_quantity = data.visible_quantity;\n }\n\n return order as OrderEntity;\n }\n\n baseValidate(\n values: OrderFormEntity,\n configs: ValuesDepConfig\n ): Promise<VerifyResult> {\n const errors: {\n [P in keyof OrderEntity]?: { type: string; message: string };\n } = {};\n\n const { maxQty, symbol, markPrice } = configs;\n\n // @ts-ignore\n let { order_quantity, total, order_price, reduce_only, order_type } = values;\n\n const { min_notional } = symbol;\n\n if (!order_quantity) {\n // calculate order_quantity from total\n if (total && order_price) {\n const { quote_dp } = configs.symbol;\n const totalNumber = new Decimal(total);\n const qty = totalNumber.dividedBy(order_price).toFixed(quote_dp);\n order_quantity = qty;\n }\n }\n\n if (!order_quantity) {\n errors.order_quantity = {\n type: \"required\",\n message: \"quantity is required\",\n };\n } else {\n // need to use MaxQty+base_max, base_min to compare\n const { base_min, quote_dp, base_dp } = configs.symbol;\n const qty = new Decimal(order_quantity);\n if (qty.lt(base_min)) {\n errors.order_quantity = {\n type: \"min\",\n message: `quantity must be greater than ${new Decimal(base_min).todp(\n base_dp\n )}`,\n };\n // errors.order_quantity = `quantity must be greater than ${base_min}`;\n } else if (qty.gt(maxQty)) {\n errors.order_quantity = {\n type: \"max\",\n message: `quantity must be less than ${new Decimal(maxQty).todp(\n base_dp\n )}`,\n };\n }\n }\n\n if (!!total) {\n const { quote_max, quote_min, quote_dp } = configs.symbol;\n const totalNumber = new Decimal(total);\n if (totalNumber.lt(quote_min)) {\n errors.total = {\n type: \"min\",\n message: `Quantity must be at least ${new Decimal(quote_min).todp(\n quote_dp\n )}`,\n };\n } else if (totalNumber.gt(quote_max)) {\n errors.total = {\n type: \"max\",\n message: `Quantity should be less or equal than ${new Decimal(\n quote_max\n ).todp(quote_dp)}`,\n };\n }\n }\n\n const price = `${order_type}`.includes(\"MARKET\") ? markPrice : order_price;\n const notionalHintStr = checkNotional(\n price,\n order_quantity,\n min_notional\n );\n\n if (notionalHintStr !== undefined && reduce_only !== true) {\n errors.total = {\n type: \"min\",\n message: notionalHintStr,\n };\n }\n\n return Promise.resolve(errors);\n }\n\n totalToQuantity(\n order: {\n order_quantity?: number | string;\n total?: string | number;\n order_price?: string | number;\n },\n config: ValuesDepConfig\n ): OrderEntity {\n // if order_quantity is not set but total is set, calculate order_quantity from total\n if (!order.order_quantity && order.total && order.order_price) {\n const { base_dp } = config.symbol;\n const totalNumber = new Decimal(order.total);\n const qty = totalNumber.div(order.order_price).toDecimalPlaces(base_dp);\n order.order_quantity = qty.toNumber();\n\n delete order.total;\n }\n\n return order as OrderEntity;\n }\n}\n"],"names":["OrderType","Decimal","checkNotional","BaseOrderCreator","baseOrder","data","order","symbol","order_type","LIMIT","order_type_ext","side","reduce_only","order_quantity","total","visible_quantity","baseValidate","values","configs","errors","maxQty","markPrice","order_price","min_notional","quote_dp","totalNumber","qty","dividedBy","toFixed","type","message","base_min","base_dp","lt","todp","gt","quote_max","quote_min","price","includes","notionalHintStr","undefined","Promise","resolve","totalToQuantity","config","div","toDecimalPlaces","toNumber"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAAsBA,SAAS,QAAQ,yBAAyB;AAOhE,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,aAAa,QAAQ,0BAA0B;AAExD,OAAO,MAAeC;IAKpBC,UAAUC,IAAiB,EAAe;QACxC,MAAMC,QASF;YACFC,QAAQF,KAAKE,MAAM;YACnBC,YACEH,KAAKG,UAAU,KAAKR,UAAUS,KAAK,GAC/B,CAAC,CAACJ,KAAKK,cAAc,GACnBL,KAAKK,cAAc,GACnBL,KAAKG,UAAU,GACjBH,KAAKG,UAAU;YACrBG,MAAMN,KAAKM,IAAI;YACfC,aAAaP,KAAKO,WAAW;YAC7BC,gBAAgBR,KAAKQ,cAAc;YACnCC,OAAOT,KAAKS,KAAK;QACnB;QAEA,IAAIT,KAAKU,gBAAgB,KAAK,GAAG;YAC/BT,MAAMS,gBAAgB,GAAGV,KAAKU,gBAAgB;QAChD;QAEA,OAAOT;IACT;IAEAU,aACEC,MAAuB,EACvBC,OAAwB,EACD;QACvB,MAAMC,SAEF,CAAC;QAEL,MAAM,EAAEC,MAAM,EAAEb,MAAM,EAAEc,SAAS,EAAE,GAAGH;QAEtC,aAAa;QACb,IAAI,EAAEL,cAAc,EAAEC,KAAK,EAAEQ,WAAW,EAAEV,WAAW,EAAEJ,UAAU,EAAE,GAAGS;QAEtE,MAAM,EAAEM,YAAY,EAAE,GAAGhB;QAEzB,IAAI,CAACM,gBAAgB;YACnB,sCAAsC;YACtC,IAAIC,SAASQ,aAAa;gBACxB,MAAM,EAAEE,QAAQ,EAAE,GAAGN,QAAQX,MAAM;gBACnC,MAAMkB,cAAc,IAAIxB,QAAQa;gBAChC,MAAMY,MAAMD,YAAYE,SAAS,CAACL,aAAaM,OAAO,CAACJ;gBACvDX,iBAAiBa;YACnB;QACF;QAEA,IAAI,CAACb,gBAAgB;YACnBM,OAAON,cAAc,GAAG;gBACtBgB,MAAM;gBACNC,SAAS;YACX;QACF,OAAO;YACL,mDAAmD;YACnD,MAAM,EAAEC,QAAQ,EAAEP,QAAQ,EAAEQ,OAAO,EAAE,GAAGd,QAAQX,MAAM;YACtD,MAAMmB,MAAM,IAAIzB,QAAQY;YACxB,IAAIa,IAAIO,EAAE,CAACF,WAAW;gBACpBZ,OAAON,cAAc,GAAG;oBACtBgB,MAAM;oBACNC,SAAS,CAAC,8BAA8B,EAAE,IAAI7B,QAAQ8B,UAAUG,IAAI,CAClEF,SACA,CAAC;gBACL;YACA,uEAAuE;YACzE,OAAO,IAAIN,IAAIS,EAAE,CAACf,SAAS;gBACzBD,OAAON,cAAc,GAAG;oBACtBgB,MAAM;oBACNC,SAAS,CAAC,2BAA2B,EAAE,IAAI7B,QAAQmB,QAAQc,IAAI,CAC7DF,SACA,CAAC;gBACL;YACF;QACF;QAEA,IAAI,CAAC,CAAClB,OAAO;YACX,MAAM,EAAEsB,SAAS,EAAEC,SAAS,EAAEb,QAAQ,EAAE,GAAGN,QAAQX,MAAM;YACzD,MAAMkB,cAAc,IAAIxB,QAAQa;YAChC,IAAIW,YAAYQ,EAAE,CAACI,YAAY;gBAC7BlB,OAAOL,KAAK,GAAG;oBACbe,MAAM;oBACNC,SAAS,CAAC,0BAA0B,EAAE,IAAI7B,QAAQoC,WAAWH,IAAI,CAC/DV,UACA,CAAC;gBACL;YACF,OAAO,IAAIC,YAAYU,EAAE,CAACC,YAAY;gBACpCjB,OAAOL,KAAK,GAAG;oBACbe,MAAM;oBACNC,SAAS,CAAC,sCAAsC,EAAE,IAAI7B,QACpDmC,WACAF,IAAI,CAACV,UAAU,CAAC;gBACpB;YACF;QACF;QAEA,MAAMc,QAAQ,CAAC,EAAE9B,WAAW,CAAC,CAAC+B,QAAQ,CAAC,YAAYlB,YAAYC;QAC/D,MAAMkB,kBAAkBtC,cACtBoC,OACAzB,gBACAU;QAGF,IAAIiB,oBAAoBC,aAAa7B,gBAAgB,MAAM;YACzDO,OAAOL,KAAK,GAAG;gBACbe,MAAM;gBACNC,SAASU;YACX;QACF;QAEA,OAAOE,QAAQC,OAAO,CAACxB;IACzB;IAEAyB,gBACEtC,KAIC,EACDuC,MAAuB,EACV;QACb,qFAAqF;QACrF,IAAI,CAACvC,MAAMO,cAAc,IAAIP,MAAMQ,KAAK,IAAIR,MAAMgB,WAAW,EAAE;YAC7D,MAAM,EAAEU,OAAO,EAAE,GAAGa,OAAOtC,MAAM;YACjC,MAAMkB,cAAc,IAAIxB,QAAQK,MAAMQ,KAAK;YAC3C,MAAMY,MAAMD,YAAYqB,GAAG,CAACxC,MAAMgB,WAAW,EAAEyB,eAAe,CAACf;YAC/D1B,MAAMO,cAAc,GAAGa,IAAIsB,QAAQ;YAEnC,OAAO1C,MAAMQ,KAAK;QACpB;QAEA,OAAOR;IACT;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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>> & {
|
|
2
|
+
export declare const usePrivateInfiniteQuery: (getKey: SWRInfiniteKeyLoader, options?: (SWRInfiniteConfiguration<any, any, import("swr/dist/_internal").BareFetcher<any>> & {
|
|
3
3
|
formatter?: ((data: any) => any) | undefined;
|
|
4
|
-
}) | undefined) => import("swr/infinite").SWRInfiniteResponse<any, any>;
|
|
4
|
+
}) | undefined) => import("swr/dist/infinite").SWRInfiniteResponse<any, any>;
|
|
5
5
|
//# sourceMappingURL=usePrivateInfiniteQuery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;4EA4BjC,CAAC"}
|
package/esm/version.d.ts
CHANGED
package/esm/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
if (typeof window !== 'undefined') {
|
|
2
2
|
window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
|
|
3
|
-
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.4.
|
|
3
|
+
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.4.3";
|
|
4
4
|
}
|
|
5
|
-
export default "1.4.
|
|
5
|
+
export default "1.4.3";
|
|
6
6
|
|
|
7
7
|
//# sourceMappingURL=version.js.map
|
package/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/version.ts"],"sourcesContent":["\ndeclare global {\n interface Window {\n __ORDERLY_VERSION__?: {\n [key: string]: string;\n };\n }\n}\nif(typeof window !== 'undefined') {\n window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};\n window.__ORDERLY_VERSION__[\"@orderly.network/hooks\"] = \"1.4.
|
|
1
|
+
{"version":3,"sources":["../src/version.ts"],"sourcesContent":["\ndeclare global {\n interface Window {\n __ORDERLY_VERSION__?: {\n [key: string]: string;\n };\n }\n}\nif(typeof window !== 'undefined') {\n window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};\n window.__ORDERLY_VERSION__[\"@orderly.network/hooks\"] = \"1.4.3\";\n};\n\nexport default \"1.4.3\";\n"],"names":["window","__ORDERLY_VERSION__"],"rangeMappings":";;;;","mappings":"AAQA,IAAG,OAAOA,WAAW,aAAa;IAC9BA,OAAOC,mBAAmB,GAAGD,OAAOC,mBAAmB,IAAI,CAAC;IAC5DD,OAAOC,mBAAmB,CAAC,yBAAyB,GAAG;AAC3D;AAEA,eAAe,QAAQ"}
|
package/lib/index.d.ts
CHANGED
|
@@ -34,4 +34,5 @@ export { cleanStringStyle } from "./utils/orderEntryHelper";
|
|
|
34
34
|
export { checkNotional } from "./utils/createOrder";
|
|
35
35
|
export * as utils from "./utils";
|
|
36
36
|
export type { WalletAdapter } from "@orderly.network/core";
|
|
37
|
+
export * from "./referral";
|
|
37
38
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,cAAc,wBAAwB,CAAC;AAEvC,OAAO,MAAM,EAAE,EACb,KAAK,gBAAgB,EACrB,SAAS,EACT,YAAY,EACZ,kBAAkB,EACnB,MAAM,KAAK,CAAC;AAEb,OAAO,EACL,MAAM,EACN,SAAS,EACT,YAAY,EACZ,KAAK,gBAAgB,EACrB,kBAAkB,GACnB,CAAC;AAEF,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,YAAY,EACV,kBAAkB,EAClB,WAAW,GACZ,MAAM,8BAA8B,CAAC;AAEtC,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,cAAc,wBAAwB,CAAC;AAEvC,OAAO,MAAM,EAAE,EACb,KAAK,gBAAgB,EACrB,SAAS,EACT,YAAY,EACZ,kBAAkB,EACnB,MAAM,KAAK,CAAC;AAEb,OAAO,EACL,MAAM,EACN,SAAS,EACT,YAAY,EACZ,KAAK,gBAAgB,EACrB,kBAAkB,GACnB,CAAC;AAEF,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,YAAY,EACV,kBAAkB,EAClB,WAAW,GACZ,MAAM,8BAA8B,CAAC;AAEtC,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,cAAc,YAAY,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -138,6 +138,7 @@ const _layoutconfig = require("./services/painter/layout.config");
|
|
|
138
138
|
const _orderEntryHelper = require("./utils/orderEntryHelper");
|
|
139
139
|
const _createOrder = require("./utils/createOrder");
|
|
140
140
|
const _utils = /*#__PURE__*/ _interop_require_wildcard(require("./utils"));
|
|
141
|
+
_export_star(require("./referral"), exports);
|
|
141
142
|
function _export_star(from, to) {
|
|
142
143
|
Object.keys(from).forEach(function(k) {
|
|
143
144
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// import \"./utils/dev\";\n\nexport { default as version } from \"./version\";\n\nexport { useQuery } from \"./useQuery\";\nexport { useLazyQuery } from \"./useLazyQuery\";\nexport { useMutation } from \"./useMutation\";\nexport { usePrivateQuery } from \"./usePrivateQuery\";\nexport { usePrivateInfiniteQuery } from \"./usePrivateInfiniteQuery\";\nexport { useBoolean } from \"./useBoolean\";\n\nexport { useAccount } from \"./useAccount\";\nexport { useAccountInstance } from \"./useAccountInstance\";\n\nexport { usePreLoadData } from \"./usePreloadData\";\n\nexport { useEventEmitter } from \"./useEventEmitter\";\n\nexport { useSessionStorage } from \"./useSessionStorage\";\nexport { useLocalStorage } from \"./useLocalStorage\";\n\nexport { parseJSON } from \"./utils/json\";\n\nexport { default as useConstant } from \"use-constant\";\nexport { useWS } from \"./useWS\";\nexport { useConfig } from \"./useConfig\";\n\nexport * from \"./orderlyContext\";\nexport * from \"./statusProvider\";\nexport { useWsStatus, WsNetworkStatus } from \"./useWsStatus\";\nexport type { ConfigProviderProps } from \"./configProvider\";\nexport { OrderlyConfigProvider } from \"./configProvider\";\n\nexport {\n WalletConnectorContext,\n useWalletConnector,\n} from \"./walletConnectorContext\";\n\nexport * from \"./orderly/orderlyHooks\";\n\nimport useSWR, {\n type SWRConfiguration,\n SWRConfig,\n useSWRConfig,\n unstable_serialize,\n} from \"swr\";\n\nexport {\n useSWR,\n SWRConfig,\n useSWRConfig,\n type SWRConfiguration,\n unstable_serialize,\n};\n\nexport * from \"use-debounce\";\n\nexport { useMediaQuery } from \"./useMediaQuery\";\n\nexport { usePoster } from \"./usePoster\";\nexport { DefaultLayoutConfig } from \"./services/painter/layout.config\";\nexport type {\n PosterLayoutConfig,\n DrawOptions,\n} from \"./services/painter/basePaint\";\n\nexport * from \"./orderly/orderlyHooks\";\n\nexport { cleanStringStyle } from \"./utils/orderEntryHelper\";\nexport { checkNotional } from \"./utils/createOrder\";\n\nexport * as utils from \"./utils\";\n\nexport type { WalletAdapter } from \"@orderly.network/core\";\n"],"names":["DefaultLayoutConfig","OrderlyConfigProvider","SWRConfig","WalletConnectorContext","WsNetworkStatus","checkNotional","cleanStringStyle","parseJSON","unstable_serialize","useAccount","useAccountInstance","useBoolean","useConfig","useConstant","useEventEmitter","useLazyQuery","useLocalStorage","useMediaQuery","useMutation","usePoster","usePreLoadData","usePrivateInfiniteQuery","usePrivateQuery","useQuery","useSWR","useSWRConfig","useSessionStorage","useWS","useWalletConnector","useWsStatus","utils","version"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// import \"./utils/dev\";\n\nexport { default as version } from \"./version\";\n\nexport { useQuery } from \"./useQuery\";\nexport { useLazyQuery } from \"./useLazyQuery\";\nexport { useMutation } from \"./useMutation\";\nexport { usePrivateQuery } from \"./usePrivateQuery\";\nexport { usePrivateInfiniteQuery } from \"./usePrivateInfiniteQuery\";\nexport { useBoolean } from \"./useBoolean\";\n\nexport { useAccount } from \"./useAccount\";\nexport { useAccountInstance } from \"./useAccountInstance\";\n\nexport { usePreLoadData } from \"./usePreloadData\";\n\nexport { useEventEmitter } from \"./useEventEmitter\";\n\nexport { useSessionStorage } from \"./useSessionStorage\";\nexport { useLocalStorage } from \"./useLocalStorage\";\n\nexport { parseJSON } from \"./utils/json\";\n\nexport { default as useConstant } from \"use-constant\";\nexport { useWS } from \"./useWS\";\nexport { useConfig } from \"./useConfig\";\n\nexport * from \"./orderlyContext\";\nexport * from \"./statusProvider\";\nexport { useWsStatus, WsNetworkStatus } from \"./useWsStatus\";\nexport type { ConfigProviderProps } from \"./configProvider\";\nexport { OrderlyConfigProvider } from \"./configProvider\";\n\nexport {\n WalletConnectorContext,\n useWalletConnector,\n} from \"./walletConnectorContext\";\n\nexport * from \"./orderly/orderlyHooks\";\n\nimport useSWR, {\n type SWRConfiguration,\n SWRConfig,\n useSWRConfig,\n unstable_serialize,\n} from \"swr\";\n\nexport {\n useSWR,\n SWRConfig,\n useSWRConfig,\n type SWRConfiguration,\n unstable_serialize,\n};\n\nexport * from \"use-debounce\";\n\nexport { useMediaQuery } from \"./useMediaQuery\";\n\nexport { usePoster } from \"./usePoster\";\nexport { DefaultLayoutConfig } from \"./services/painter/layout.config\";\nexport type {\n PosterLayoutConfig,\n DrawOptions,\n} from \"./services/painter/basePaint\";\n\nexport * from \"./orderly/orderlyHooks\";\n\nexport { cleanStringStyle } from \"./utils/orderEntryHelper\";\nexport { checkNotional } from \"./utils/createOrder\";\n\nexport * as utils from \"./utils\";\n\nexport type { WalletAdapter } from \"@orderly.network/core\";\n\n\nexport * from \"./referral\";"],"names":["DefaultLayoutConfig","OrderlyConfigProvider","SWRConfig","WalletConnectorContext","WsNetworkStatus","checkNotional","cleanStringStyle","parseJSON","unstable_serialize","useAccount","useAccountInstance","useBoolean","useConfig","useConstant","useEventEmitter","useLazyQuery","useLocalStorage","useMediaQuery","useMutation","usePoster","usePreLoadData","usePrivateInfiniteQuery","usePrivateQuery","useQuery","useSWR","useSWRConfig","useSessionStorage","useWS","useWalletConnector","useWsStatus","utils","version"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,wBAAwB;;;;;;;;;;;;IA4DfA,mBAAmB;eAAnBA,iCAAmB;;IA7BnBC,qBAAqB;eAArBA,qCAAqB;;IAkB5BC,SAAS;eAATA,cAAS;;IAfTC,sBAAsB;eAAtBA,8CAAsB;;IALFC,eAAe;eAAfA,4BAAe;;IAwC5BC,aAAa;eAAbA,0BAAa;;IADbC,gBAAgB;eAAhBA,kCAAgB;;IA/ChBC,SAAS;eAATA,eAAS;;IA+BhBC,kBAAkB;eAAlBA,uBAAkB;;IAzCXC,UAAU;eAAVA,sBAAU;;IACVC,kBAAkB;eAAlBA,sCAAkB;;IAHlBC,UAAU;eAAVA,sBAAU;;IAgBVC,SAAS;eAATA,oBAAS;;IAFEC,WAAW;eAAXA,oBAAW;;IAPtBC,eAAe;eAAfA,gCAAe;;IAXfC,YAAY;eAAZA,0BAAY;;IAcZC,eAAe;eAAfA,gCAAe;;IAsCfC,aAAa;eAAbA,4BAAa;;IAnDbC,WAAW;eAAXA,wBAAW;;IAqDXC,SAAS;eAATA,oBAAS;;IA7CTC,cAAc;eAAdA,8BAAc;;IANdC,uBAAuB;eAAvBA,gDAAuB;;IADvBC,eAAe;eAAfA,gCAAe;;IAHfC,QAAQ;eAARA,kBAAQ;;IA4CfC,MAAM;eAANA,YAAM;;IAENC,YAAY;eAAZA,iBAAY;;IAhCLC,iBAAiB;eAAjBA,oCAAiB;;IAMjBC,KAAK;eAALA,YAAK;;IAWZC,kBAAkB;eAAlBA,0CAAkB;;IANXC,WAAW;eAAXA,wBAAW;;IA0CRC,KAAK;;;IArEGC,OAAO;eAAPA,gBAAO;;;gEAAQ;0BAEV;8BACI;6BACD;iCACI;yCACQ;4BACb;4BAEA;oCACQ;gCAEJ;iCAEC;mCAEE;iCACF;sBAEN;oEAEa;uBACjB;2BACI;qBAEZ;qBACA;6BAC+B;gCAEP;wCAK/B;qBAEO;6DAOP;qBAUO;+BAEgB;2BAEJ;8BACU;kCAQH;6BACH;+DAEP;qBAKT"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { API } from "@orderly.network/types";
|
|
2
|
-
export declare const useAccountInfo: () => import("swr/_internal").SWRResponse<API.AccountInfo, any, any>;
|
|
2
|
+
export declare const useAccountInfo: () => import("swr/dist/_internal").SWRResponse<API.AccountInfo, any, any>;
|
|
3
3
|
//# sourceMappingURL=useAccountInfo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAccountInfo.d.ts","sourceRoot":"","sources":["../../src/orderly/useAccountInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAG7C,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"useAccountInfo.d.ts","sourceRoot":"","sources":["../../src/orderly/useAccountInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAG7C,eAAO,MAAM,cAAc,2EAE1B,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const useIndexPrice: (symbol: string) => import("swr/subscription").SWRSubscriptionResponse<any, any>;
|
|
1
|
+
export declare const useIndexPrice: (symbol: string) => import("swr/dist/subscription").SWRSubscriptionResponse<any, any>;
|
|
2
2
|
//# sourceMappingURL=useIndexPrice.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIndexPrice.d.ts","sourceRoot":"","sources":["../../src/orderly/useIndexPrice.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,WAAY,MAAM,
|
|
1
|
+
{"version":3,"file":"useIndexPrice.d.ts","sourceRoot":"","sources":["../../src/orderly/useIndexPrice.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,WAAY,MAAM,sEAe3C,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const useMarkPricesStream: () => import("swr/subscription").SWRSubscriptionResponse<Record<string, number>, any>;
|
|
1
|
+
export declare const useMarkPricesStream: () => import("swr/dist/subscription").SWRSubscriptionResponse<Record<string, number>, any>;
|
|
2
2
|
//# sourceMappingURL=useMarkPricesStream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMarkPricesStream.d.ts","sourceRoot":"","sources":["../../src/orderly/useMarkPricesStream.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"useMarkPricesStream.d.ts","sourceRoot":"","sources":["../../src/orderly/useMarkPricesStream.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,4FAkC/B,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const useOpenInterest: (symbol: string) => import("swr/subscription").SWRSubscriptionResponse<any, any>;
|
|
1
|
+
export declare const useOpenInterest: (symbol: string) => import("swr/dist/subscription").SWRSubscriptionResponse<any, any>;
|
|
2
2
|
//# sourceMappingURL=useOpenInterest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOpenInterest.d.ts","sourceRoot":"","sources":["../../src/orderly/useOpenInterest.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,WAAY,MAAM,
|
|
1
|
+
{"version":3,"file":"useOpenInterest.d.ts","sourceRoot":"","sources":["../../src/orderly/useOpenInterest.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,WAAY,MAAM,sEAa7C,CAAC"}
|
|
@@ -27,7 +27,7 @@ export declare const useOrderStream: (params: {
|
|
|
27
27
|
}) => readonly [any[] | null, {
|
|
28
28
|
readonly total: number;
|
|
29
29
|
readonly isLoading: boolean;
|
|
30
|
-
readonly refresh: import("swr/_internal").
|
|
30
|
+
readonly refresh: <MutationData = any[]>(data?: any[] | import("swr/dist/_internal").MutatorCallback<any[]> | Promise<any[] | undefined> | undefined, opts?: boolean | import("swr/dist/infinite").SWRInfiniteMutatorOptions<any[], MutationData> | undefined) => Promise<any[] | MutationData | undefined>;
|
|
31
31
|
readonly loadMore: () => void;
|
|
32
32
|
readonly cancelAllOrders: () => Promise<[any, any]>;
|
|
33
33
|
readonly cancelAllTPSLOrders: () => Promise<any[]>;
|