timelock-sdk 0.0.105 → 0.0.107
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/{client-1hXpAcRP.d.cts → client-BbT_pl5p.d.ts} +1191 -268
- package/dist/{client-Fw1-4Rrd.d.ts → client-CgsSS_2P.d.cts} +1029 -106
- package/dist/client.cjs +42 -8
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +44 -13
- package/dist/client.js.map +1 -1
- package/dist/package.d.cts +1 -1
- package/dist/package.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -838,9 +838,9 @@ var PerpsOperator = class {
|
|
|
838
838
|
const { message } = await this.#request("api/auth/gen", { userAddr });
|
|
839
839
|
return message;
|
|
840
840
|
};
|
|
841
|
-
validateAuthMessage = async (
|
|
841
|
+
validateAuthMessage = async (message, signature) => {
|
|
842
842
|
const { address, createdAt, validUntil } = await this.#request("api/auth/validate", {
|
|
843
|
-
|
|
843
|
+
message,
|
|
844
844
|
signature
|
|
845
845
|
});
|
|
846
846
|
return {
|
|
@@ -849,9 +849,9 @@ var PerpsOperator = class {
|
|
|
849
849
|
validUntil
|
|
850
850
|
};
|
|
851
851
|
};
|
|
852
|
-
setAuth = (
|
|
852
|
+
setAuth = (message, signature) => {
|
|
853
853
|
this.auth = {
|
|
854
|
-
|
|
854
|
+
message,
|
|
855
855
|
signature
|
|
856
856
|
};
|
|
857
857
|
};
|
|
@@ -872,8 +872,8 @@ var PerpsOperator = class {
|
|
|
872
872
|
if (!this.auth) throw new Error("Authentication required. Call setAuth() with authMessage and signature before exercising perps.");
|
|
873
873
|
const { txHash, optionId } = await this.#request("api/positions/mint", {
|
|
874
874
|
...body,
|
|
875
|
-
|
|
876
|
-
|
|
875
|
+
amount: body.amount.toString(),
|
|
876
|
+
auth: this.auth
|
|
877
877
|
});
|
|
878
878
|
return {
|
|
879
879
|
txHash,
|
|
@@ -884,9 +884,9 @@ var PerpsOperator = class {
|
|
|
884
884
|
if (!this.auth) throw new Error("Authentication required. Call setAuth() with authMessage and signature before exercising perps.");
|
|
885
885
|
const { txHash, optionId } = await this.#request("api/positions/exercise", {
|
|
886
886
|
...body,
|
|
887
|
-
...this.auth,
|
|
888
887
|
optionId: body.optionId.toString(),
|
|
889
|
-
liquidities: body.liquidities.map((l) => l.toString())
|
|
888
|
+
liquidities: body.liquidities.map((l) => l.toString()),
|
|
889
|
+
auth: this.auth
|
|
890
890
|
});
|
|
891
891
|
return {
|
|
892
892
|
txHash,
|
|
@@ -1097,6 +1097,37 @@ const useClosePerp = () => {
|
|
|
1097
1097
|
} });
|
|
1098
1098
|
};
|
|
1099
1099
|
|
|
1100
|
+
//#endregion
|
|
1101
|
+
//#region src/hooks/perps/useUserPerps.ts
|
|
1102
|
+
const EMPTY_ARRAY = [];
|
|
1103
|
+
const useUserPerps = (marketAddr, userAddr, type) => {
|
|
1104
|
+
const { operator } = usePerpsOperator();
|
|
1105
|
+
userAddr = userAddr === null || userAddr === void 0 ? void 0 : userAddr.toLowerCase();
|
|
1106
|
+
marketAddr = marketAddr === null || marketAddr === void 0 ? void 0 : marketAddr.toLowerCase();
|
|
1107
|
+
const { data,...rest } = (0, __tanstack_react_query.useQuery)({
|
|
1108
|
+
queryKey: [
|
|
1109
|
+
"userPerps",
|
|
1110
|
+
type,
|
|
1111
|
+
userAddr || "-",
|
|
1112
|
+
marketAddr || "-"
|
|
1113
|
+
],
|
|
1114
|
+
queryFn: () => operator === null || operator === void 0 ? void 0 : operator.getUserPerps(userAddr, marketAddr, type),
|
|
1115
|
+
enabled: !!userAddr,
|
|
1116
|
+
staleTime: 1e4,
|
|
1117
|
+
refetchInterval: 1e4
|
|
1118
|
+
});
|
|
1119
|
+
return {
|
|
1120
|
+
data: data || EMPTY_ARRAY,
|
|
1121
|
+
...rest
|
|
1122
|
+
};
|
|
1123
|
+
};
|
|
1124
|
+
const useActiveUserPerps = (marketAddr, userAddr) => {
|
|
1125
|
+
return useUserPerps(marketAddr, userAddr, "active");
|
|
1126
|
+
};
|
|
1127
|
+
const useClosedUserPerps = (marketAddr, userAddr) => {
|
|
1128
|
+
return useUserPerps(marketAddr, userAddr, "closed");
|
|
1129
|
+
};
|
|
1130
|
+
|
|
1100
1131
|
//#endregion
|
|
1101
1132
|
//#region src/hooks/operators/useOperatorPerms.ts
|
|
1102
1133
|
const useOperatorPerms = (marketAddr, userAddr, operatorAddr) => {
|
|
@@ -1357,10 +1388,12 @@ const useVaultTVL = (vaultAddr) => {
|
|
|
1357
1388
|
exports.TimelockProvider = TimelockProvider;
|
|
1358
1389
|
exports.batchGetAmountsFromLiquidity = batchGetAmountsFromLiquidity;
|
|
1359
1390
|
exports.useActiveUserOptions = useActiveUserOptions;
|
|
1391
|
+
exports.useActiveUserPerps = useActiveUserPerps;
|
|
1360
1392
|
exports.useApproval = useApproval;
|
|
1361
1393
|
exports.useBurnLiquidity = useBurnLiquidity;
|
|
1362
1394
|
exports.useClosePerp = useClosePerp;
|
|
1363
1395
|
exports.useClosedUserOptions = useClosedUserOptions;
|
|
1396
|
+
exports.useClosedUserPerps = useClosedUserPerps;
|
|
1364
1397
|
exports.useCurrentMarket = useCurrentMarket;
|
|
1365
1398
|
exports.useCurrentPrice = useCurrentPrice;
|
|
1366
1399
|
exports.useCurrentTick = useCurrentTick;
|
|
@@ -1384,6 +1417,7 @@ exports.usePriceHistory = usePriceHistory;
|
|
|
1384
1417
|
exports.useSetOperatorPerms = useSetOperatorPerms;
|
|
1385
1418
|
exports.useTimelockConfig = useTimelockConfig;
|
|
1386
1419
|
exports.useUserOperators = useUserOperators;
|
|
1420
|
+
exports.useUserPerps = useUserPerps;
|
|
1387
1421
|
exports.useVaultData = useVaultData;
|
|
1388
1422
|
exports.useVaultTVL = useVaultTVL;
|
|
1389
1423
|
//# sourceMappingURL=client.cjs.map
|