timelock-sdk 0.0.77 → 0.0.78
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.cjs +73 -0
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +851 -1
- package/dist/client.d.ts +984 -134
- package/dist/client.js +73 -1
- package/dist/client.js.map +1 -1
- package/dist/{index-BdBPLPWm.d.ts → index-CdkTrz02.d.ts} +92 -92
- package/dist/package.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -787,6 +787,78 @@ const useSetOperatorPerms = (marketAddr) => {
|
|
|
787
787
|
return (0, __tanstack_react_query.useMutation)({ mutationFn: setOperatorPerms });
|
|
788
788
|
};
|
|
789
789
|
|
|
790
|
+
//#endregion
|
|
791
|
+
//#region src/hooks/market/useOptionTimeline.ts
|
|
792
|
+
const useOptionTimeline = (marketAddr, optionId) => {
|
|
793
|
+
const { graphqlClient } = useTimelockConfig();
|
|
794
|
+
const normalizedMarketAddr = marketAddr === null || marketAddr === void 0 ? void 0 : marketAddr.toLowerCase();
|
|
795
|
+
const { data,...rest } = (0, __tanstack_react_query.useQuery)({
|
|
796
|
+
queryKey: [
|
|
797
|
+
"optionTimeline",
|
|
798
|
+
normalizedMarketAddr || "--",
|
|
799
|
+
(optionId === null || optionId === void 0 ? void 0 : optionId.toString()) || "--"
|
|
800
|
+
],
|
|
801
|
+
queryFn: async () => {
|
|
802
|
+
if (!graphqlClient || !normalizedMarketAddr || optionId === void 0) return [];
|
|
803
|
+
const result = await graphqlClient.GetOptionEvents({
|
|
804
|
+
marketAddr: normalizedMarketAddr,
|
|
805
|
+
optionId: optionId.toString()
|
|
806
|
+
});
|
|
807
|
+
const mintEvents = result.MintOptionEvent.map((event) => ({
|
|
808
|
+
id: event.id,
|
|
809
|
+
optionType: event.optionType,
|
|
810
|
+
strikeTick: event.strikeTick,
|
|
811
|
+
currentTick: event.currentTick,
|
|
812
|
+
expiresAt: /* @__PURE__ */ new Date(Number(event.expiresAt) * 1e3),
|
|
813
|
+
premium: BigInt(event.premium),
|
|
814
|
+
protocolFee: BigInt(event.protocolFee),
|
|
815
|
+
liquidities: event.liquidities.map((l) => BigInt(l)),
|
|
816
|
+
timestamp: /* @__PURE__ */ new Date(Number(event.timestamp) * 1e3),
|
|
817
|
+
blockNumber: BigInt(event.blockNumber),
|
|
818
|
+
transactionHash: event.transactionHash
|
|
819
|
+
}));
|
|
820
|
+
const exerciseEvents = result.ExerciseOptionEvent.map((event) => ({
|
|
821
|
+
id: event.id,
|
|
822
|
+
liquidities: event.liquidities.map((l) => BigInt(l)),
|
|
823
|
+
currentTick: event.currentTick,
|
|
824
|
+
payout: BigInt(event.payout),
|
|
825
|
+
timestamp: /* @__PURE__ */ new Date(Number(event.timestamp) * 1e3),
|
|
826
|
+
blockNumber: BigInt(event.blockNumber),
|
|
827
|
+
transactionHash: event.transactionHash
|
|
828
|
+
}));
|
|
829
|
+
const extendEvents = result.ExtendOptionEvent.map((event) => ({
|
|
830
|
+
id: event.id,
|
|
831
|
+
premium: BigInt(event.premium),
|
|
832
|
+
protocolFee: BigInt(event.protocolFee),
|
|
833
|
+
currentTick: event.currentTick,
|
|
834
|
+
addedDuration: BigInt(event.addedDuration),
|
|
835
|
+
timestamp: /* @__PURE__ */ new Date(Number(event.timestamp) * 1e3),
|
|
836
|
+
blockNumber: BigInt(event.blockNumber),
|
|
837
|
+
transactionHash: event.transactionHash
|
|
838
|
+
}));
|
|
839
|
+
return [
|
|
840
|
+
...mintEvents.map((data$1) => ({
|
|
841
|
+
type: "mint",
|
|
842
|
+
data: data$1
|
|
843
|
+
})),
|
|
844
|
+
...exerciseEvents.map((data$1) => ({
|
|
845
|
+
type: "exercise",
|
|
846
|
+
data: data$1
|
|
847
|
+
})),
|
|
848
|
+
...extendEvents.map((data$1) => ({
|
|
849
|
+
type: "extend",
|
|
850
|
+
data: data$1
|
|
851
|
+
}))
|
|
852
|
+
].sort((a, b) => a.data.timestamp.getTime() - b.data.timestamp.getTime());
|
|
853
|
+
},
|
|
854
|
+
enabled: !!normalizedMarketAddr && optionId !== void 0 && !!graphqlClient
|
|
855
|
+
});
|
|
856
|
+
return {
|
|
857
|
+
data: data || [],
|
|
858
|
+
...rest
|
|
859
|
+
};
|
|
860
|
+
};
|
|
861
|
+
|
|
790
862
|
//#endregion
|
|
791
863
|
//#region src/hooks/pool/usePriceAtTick.ts
|
|
792
864
|
const usePriceAtTick = (tick, poolAddr) => {
|
|
@@ -1177,6 +1249,7 @@ exports.useMintLiquidity = useMintLiquidity;
|
|
|
1177
1249
|
exports.useMintOption = useMintOption;
|
|
1178
1250
|
exports.useOptionPnl = useOptionPnl;
|
|
1179
1251
|
exports.useOptionPremium = useOptionPremium;
|
|
1252
|
+
exports.useOptionTimeline = useOptionTimeline;
|
|
1180
1253
|
exports.usePoolData = usePoolData;
|
|
1181
1254
|
exports.usePriceAtTick = usePriceAtTick;
|
|
1182
1255
|
exports.usePriceHistory = usePriceHistory;
|