timelock-sdk 0.0.106 → 0.0.108
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-DlkfUDwU.d.cts → client-D71s6e9Z.d.cts} +4 -4
- package/dist/{client-cOGBr2Ca.d.ts → client-_c3y1ZlX.d.ts} +138 -138
- package/dist/client.cjs +9 -9
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +9 -9
- 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,
|
|
@@ -942,7 +942,7 @@ const usePerpsOperator = () => {
|
|
|
942
942
|
try {
|
|
943
943
|
const { address: address$1, validUntil } = await operator.validateAuthMessage(message, signature);
|
|
944
944
|
if (validUntil < Date.now()) throw new Error("Signature expired");
|
|
945
|
-
if (address$1 !== userAddr) throw new Error("Valid signature but different user address");
|
|
945
|
+
if (address$1.toLowerCase() !== userAddr.toLowerCase()) throw new Error("Valid signature but different user address");
|
|
946
946
|
operator.setAuth(message, signature);
|
|
947
947
|
} catch (error) {
|
|
948
948
|
clearSignature(userAddr);
|