@typus/typus-perp-sdk 1.1.50 → 1.1.51-upgrade
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/src/api/sentio.js +2 -2
- package/dist/src/client.d.ts +11 -12
- package/dist/src/client.js +16 -44
- package/dist/src/fetch.d.ts +15 -45
- package/dist/src/fetch.js +70 -69
- package/dist/src/generated/typus_perp/admin.d.ts +32 -42
- package/dist/src/generated/typus_perp/admin.js +41 -67
- package/dist/src/generated/typus_perp/competition.d.ts +22 -10
- package/dist/src/generated/typus_perp/competition.js +19 -54
- package/dist/src/generated/typus_perp/deps/std/type_name.d.ts +2 -2
- package/dist/src/generated/typus_perp/deps/std/type_name.js +2 -2
- package/dist/src/generated/typus_perp/deps/sui/balance.d.ts +3 -3
- package/dist/src/generated/typus_perp/deps/sui/balance.js +3 -3
- package/dist/src/generated/typus_perp/deps/sui/object_table.d.ts +4 -6
- package/dist/src/generated/typus_perp/deps/sui/object_table.js +4 -38
- package/dist/src/generated/typus_perp/deps/sui/table.d.ts +4 -6
- package/dist/src/generated/typus_perp/deps/sui/table.js +4 -38
- package/dist/src/generated/typus_perp/deps/sui/vec_set.d.ts +2 -2
- package/dist/src/generated/typus_perp/deps/sui/vec_set.js +2 -2
- package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.d.ts +7 -9
- package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.js +6 -6
- package/dist/src/generated/typus_perp/deps/typus/linked_object_table.d.ts +6 -10
- package/dist/src/generated/typus_perp/deps/typus/linked_object_table.js +5 -39
- package/dist/src/generated/typus_perp/deps/typus_framework/vault.d.ts +14 -8
- package/dist/src/generated/typus_perp/deps/typus_framework/vault.js +13 -39
- package/dist/src/generated/typus_perp/error.d.ts +97 -87
- package/dist/src/generated/typus_perp/error.js +18 -0
- package/dist/src/generated/typus_perp/escrow.d.ts +17 -21
- package/dist/src/generated/typus_perp/escrow.js +10 -22
- package/dist/src/generated/typus_perp/lending.d.ts +47 -0
- package/dist/src/generated/typus_perp/lending.js +40 -0
- package/dist/src/generated/typus_perp/lp_pool.d.ts +718 -397
- package/dist/src/generated/typus_perp/lp_pool.js +485 -365
- package/dist/src/generated/typus_perp/math.d.ts +18 -8
- package/dist/src/generated/typus_perp/math.js +24 -6
- package/dist/src/generated/typus_perp/position.d.ts +207 -185
- package/dist/src/generated/typus_perp/position.js +236 -277
- package/dist/src/generated/typus_perp/profit_vault.d.ts +64 -72
- package/dist/src/generated/typus_perp/profit_vault.js +48 -86
- package/dist/src/generated/typus_perp/symbol.d.ts +6 -6
- package/dist/src/generated/typus_perp/symbol.js +11 -13
- package/dist/src/generated/typus_perp/trading.d.ts +451 -558
- package/dist/src/generated/typus_perp/trading.js +429 -681
- package/dist/src/generated/typus_perp/treasury_caps.d.ts +5 -7
- package/dist/src/generated/typus_perp/treasury_caps.js +8 -45
- package/dist/src/generated/typus_stake_pool/admin.d.ts +13 -122
- package/dist/src/generated/typus_stake_pool/admin.js +19 -103
- package/dist/src/generated/typus_stake_pool/deps/std/type_name.d.ts +2 -2
- package/dist/src/generated/typus_stake_pool/deps/std/type_name.js +2 -2
- package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.d.ts +2 -2
- package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.js +2 -2
- package/dist/src/generated/typus_stake_pool/stake_pool.d.ts +249 -240
- package/dist/src/generated/typus_stake_pool/stake_pool.js +159 -246
- package/dist/src/generated/utils/index.d.ts +21 -2
- package/dist/src/generated/utils/index.js +34 -10
- package/dist/src/user/history.d.ts +2 -2
- package/dist/src/user/history.js +24 -14
- package/dist/src/user/order.d.ts +1 -1
- package/dist/src/user/orderWithBidReceipt.d.ts +1 -1
- package/package.json +9 -16
- package/dist/src/generated/typus_perp/deps/sui/object.d.ts +0 -8
- package/dist/src/generated/typus_perp/deps/sui/object.js +0 -16
- package/dist/src/generated/typus_perp/user_account.d.ts +0 -146
- package/dist/src/generated/typus_perp/user_account.js +0 -221
- package/dist/src/generated/typus_stake_pool/deps/sui/object.d.ts +0 -8
- package/dist/src/generated/typus_stake_pool/deps/sui/object.js +0 -16
- package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.d.ts +0 -30
- package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.js +0 -37
- package/dist/src/grpc/graphql.d.ts +0 -26
- package/dist/src/grpc/graphql.js +0 -126
- package/dist/src/grpc/grpc.d.ts +0 -1
- package/dist/src/grpc/grpc.js +0 -38
- package/dist/src/grpc/ledgerService.d.ts +0 -0
- package/dist/src/grpc/ledgerService.js +0 -64
- package/dist/src/grpc/liveDataService.d.ts +0 -0
- package/dist/src/grpc/liveDataService.js +0 -49
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
import { BcsType, TypeTag, BcsStruct, BcsEnum, BcsTuple } from "@mysten/sui/bcs";
|
|
2
2
|
import { TransactionArgument } from "@mysten/sui/transactions";
|
|
3
|
+
import { ClientWithCoreApi, SuiClientTypes } from "@mysten/sui/client";
|
|
3
4
|
export type RawTransactionArgument<T> = T | TransactionArgument;
|
|
5
|
+
export interface GetOptions<Include extends Omit<SuiClientTypes.ObjectInclude, "content"> = {}> extends SuiClientTypes.GetObjectOptions<Include> {
|
|
6
|
+
client: ClientWithCoreApi;
|
|
7
|
+
}
|
|
8
|
+
export interface GetManyOptions<Include extends Omit<SuiClientTypes.ObjectInclude, "content"> = {}> extends SuiClientTypes.GetObjectsOptions<Include> {
|
|
9
|
+
client: ClientWithCoreApi;
|
|
10
|
+
}
|
|
4
11
|
export declare function getPureBcsSchema(typeTag: string | TypeTag): BcsType<any> | null;
|
|
5
|
-
export declare function normalizeMoveArguments(args: unknown[] | object, argTypes: string[], parameterNames?: string[]): TransactionArgument[];
|
|
12
|
+
export declare function normalizeMoveArguments(args: unknown[] | object, argTypes: readonly (string | null)[], parameterNames?: string[]): TransactionArgument[];
|
|
6
13
|
export declare class MoveStruct<T extends Record<string, BcsType<any>>, const Name extends string = string> extends BcsStruct<T, Name> {
|
|
14
|
+
get<Include extends Omit<SuiClientTypes.ObjectInclude, "content" | "json"> = {}>({ objectId, ...options }: GetOptions<Include>): Promise<SuiClientTypes.Object<Include & {
|
|
15
|
+
content: true;
|
|
16
|
+
json: true;
|
|
17
|
+
}> & {
|
|
18
|
+
json: BcsStruct<T>["$inferType"];
|
|
19
|
+
}>;
|
|
20
|
+
getMany<Include extends Omit<SuiClientTypes.ObjectInclude, "content" | "json"> = {}>({ client, ...options }: GetManyOptions<Include>): Promise<Array<SuiClientTypes.Object<Include & {
|
|
21
|
+
content: true;
|
|
22
|
+
json: true;
|
|
23
|
+
}> & {
|
|
24
|
+
json: BcsStruct<T>["$inferType"];
|
|
25
|
+
}>>;
|
|
7
26
|
}
|
|
8
27
|
export declare class MoveEnum<T extends Record<string, BcsType<any> | null>, const Name extends string> extends BcsEnum<T, Name> {
|
|
9
28
|
}
|
|
10
|
-
export declare class MoveTuple<T extends readonly BcsType<any>[], const Name extends string> extends BcsTuple<T, Name> {
|
|
29
|
+
export declare class MoveTuple<const T extends readonly BcsType<any>[], const Name extends string> extends BcsTuple<T, Name> {
|
|
11
30
|
}
|
|
@@ -8,7 +8,6 @@ const utils_1 = require("@mysten/sui/utils");
|
|
|
8
8
|
const transactions_1 = require("@mysten/sui/transactions");
|
|
9
9
|
const MOVE_STDLIB_ADDRESS = (0, utils_1.normalizeSuiAddress)("0x1");
|
|
10
10
|
const SUI_FRAMEWORK_ADDRESS = (0, utils_1.normalizeSuiAddress)("0x2");
|
|
11
|
-
const SUI_SYSTEM_ADDRESS = (0, utils_1.normalizeSuiAddress)("0x3");
|
|
12
11
|
function getPureBcsSchema(typeTag) {
|
|
13
12
|
const parsedTag = typeof typeTag === "string" ? bcs_1.TypeTagSerializer.parseFromStr(typeTag) : typeTag;
|
|
14
13
|
if ("u8" in parsedTag) {
|
|
@@ -41,7 +40,7 @@ function getPureBcsSchema(typeTag) {
|
|
|
41
40
|
}
|
|
42
41
|
else if ("struct" in parsedTag) {
|
|
43
42
|
const structTag = parsedTag.struct;
|
|
44
|
-
const pkg = (0, utils_1.normalizeSuiAddress)(
|
|
43
|
+
const pkg = (0, utils_1.normalizeSuiAddress)(structTag.address);
|
|
45
44
|
if (pkg === MOVE_STDLIB_ADDRESS) {
|
|
46
45
|
if ((structTag.module === "ascii" || structTag.module === "string") && structTag.name === "String") {
|
|
47
46
|
return bcs_1.bcs.String;
|
|
@@ -51,7 +50,7 @@ function getPureBcsSchema(typeTag) {
|
|
|
51
50
|
return type ? bcs_1.bcs.option(type) : null;
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
|
-
if (pkg === SUI_FRAMEWORK_ADDRESS && structTag.module === "
|
|
53
|
+
if (pkg === SUI_FRAMEWORK_ADDRESS && structTag.module === "object" && (structTag.name === "ID" || structTag.name === "UID")) {
|
|
55
54
|
return bcs_1.bcs.Address;
|
|
56
55
|
}
|
|
57
56
|
}
|
|
@@ -65,19 +64,19 @@ function normalizeMoveArguments(args, argTypes, parameterNames) {
|
|
|
65
64
|
const normalizedArgs = [];
|
|
66
65
|
let index = 0;
|
|
67
66
|
for (const [i, argType] of argTypes.entries()) {
|
|
68
|
-
if (argType ===
|
|
69
|
-
normalizedArgs.push((tx) => tx.object.
|
|
67
|
+
if (argType === "0x2::clock::Clock") {
|
|
68
|
+
normalizedArgs.push((tx) => tx.object.clock());
|
|
70
69
|
continue;
|
|
71
70
|
}
|
|
72
|
-
if (argType ===
|
|
71
|
+
if (argType === "0x2::random::Random") {
|
|
73
72
|
normalizedArgs.push((tx) => tx.object.random());
|
|
74
73
|
continue;
|
|
75
74
|
}
|
|
76
|
-
if (argType ===
|
|
77
|
-
normalizedArgs.push((tx) => tx.object.
|
|
75
|
+
if (argType === "0x2::deny_list::DenyList") {
|
|
76
|
+
normalizedArgs.push((tx) => tx.object.denyList());
|
|
78
77
|
continue;
|
|
79
78
|
}
|
|
80
|
-
if (argType ===
|
|
79
|
+
if (argType === "0x3::sui_system::SuiSystemState") {
|
|
81
80
|
normalizedArgs.push((tx) => tx.object.system());
|
|
82
81
|
continue;
|
|
83
82
|
}
|
|
@@ -104,7 +103,7 @@ function normalizeMoveArguments(args, argTypes, parameterNames) {
|
|
|
104
103
|
continue;
|
|
105
104
|
}
|
|
106
105
|
const type = argTypes[i];
|
|
107
|
-
const bcsType = getPureBcsSchema(type);
|
|
106
|
+
const bcsType = type === null ? null : getPureBcsSchema(type);
|
|
108
107
|
if (bcsType) {
|
|
109
108
|
const bytes = bcsType.serialize(arg);
|
|
110
109
|
normalizedArgs.push((tx) => tx.pure(bytes));
|
|
@@ -119,6 +118,31 @@ function normalizeMoveArguments(args, argTypes, parameterNames) {
|
|
|
119
118
|
return normalizedArgs;
|
|
120
119
|
}
|
|
121
120
|
class MoveStruct extends bcs_1.BcsStruct {
|
|
121
|
+
async get({ objectId, ...options }) {
|
|
122
|
+
const [res] = await this.getMany({
|
|
123
|
+
...options,
|
|
124
|
+
objectIds: [objectId],
|
|
125
|
+
});
|
|
126
|
+
return res;
|
|
127
|
+
}
|
|
128
|
+
async getMany({ client, ...options }) {
|
|
129
|
+
const response = (await client.core.getObjects({
|
|
130
|
+
...options,
|
|
131
|
+
include: {
|
|
132
|
+
...options.include,
|
|
133
|
+
content: true,
|
|
134
|
+
},
|
|
135
|
+
}));
|
|
136
|
+
return response.objects.map((obj) => {
|
|
137
|
+
if (obj instanceof Error) {
|
|
138
|
+
throw obj;
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
...obj,
|
|
142
|
+
json: this.parse(obj.content),
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
}
|
|
122
146
|
}
|
|
123
147
|
exports.MoveStruct = MoveStruct;
|
|
124
148
|
class MoveEnum extends bcs_1.BcsEnum {
|
|
@@ -30,8 +30,8 @@ export declare function getGraphQLEvents(module: string, sender: string | null,
|
|
|
30
30
|
export declare function getArchivePlaceOrderEvents(userAddress: string, startTimestamp: number, endTimestamp: number, events: Event[]): Promise<Event[]>;
|
|
31
31
|
export declare function getLiquidateFromSentio(userAddress: string, startTimestamp: number, events: Event[]): Promise<Event[]>;
|
|
32
32
|
export declare function getRealizeFundingFromSentio(userAddress: string, startTimestamp: number, events: Event[]): Promise<Event[]>;
|
|
33
|
-
export declare function getRemovePositionFromSentio(userAddress: string, startTimestamp: number, events: Event[]): Promise<Event[]>;
|
|
33
|
+
export declare function getRemovePositionFromSentio(userAddress: string, startTimestamp: number, events: Event[], datas?: any[]): Promise<Event[]>;
|
|
34
34
|
export declare function getCancelOrderFromSentio(userAddress: string, startTimestamp: number, events: Event[]): Promise<Event[]>;
|
|
35
|
-
export declare function getOrderMatchFromSentio(userAddress: string, startTimestamp: number, events: Event[], datas?: any[], archiveDatas?: Event[]): Promise<Event[]>;
|
|
35
|
+
export declare function getOrderMatchFromSentio(userAddress: string, startTimestamp: number, events: Event[], removeEventDatas: any[], datas?: any[], archiveDatas?: Event[]): Promise<Event[]>;
|
|
36
36
|
export declare function getRealizeOptionFromSentio(userAddress: string, startTimestamp: number, events: Event[]): Promise<Event[]>;
|
|
37
37
|
export declare function toSentioToken(name: TOKEN): string;
|
package/dist/src/user/history.js
CHANGED
|
@@ -52,8 +52,8 @@ async function parseUserHistory(raw_events, matchingDatas) {
|
|
|
52
52
|
collateral = Number(json.collateral_in_deposit_token) / 10 ** (0, constants_1.assetToDecimal)(collateral_token);
|
|
53
53
|
}
|
|
54
54
|
const marketOrderRation = json.is_long ? 1.02 : 0.9;
|
|
55
|
-
const isMarketOrder = Number(json.trigger_price) / Number(json.trading_pair_oracle_price) <=
|
|
56
|
-
|
|
55
|
+
const isMarketOrder = Number(json.trigger_price) / Number(json.trading_pair_oracle_price) <= marketOrderRation + 0.005 &&
|
|
56
|
+
Number(json.trigger_price) / Number(json.trading_pair_oracle_price) >= marketOrderRation - 0.005;
|
|
57
57
|
var order_type = "Limit";
|
|
58
58
|
var price = json.trigger_price;
|
|
59
59
|
if (json.filled || isMarketOrder) {
|
|
@@ -66,19 +66,18 @@ async function parseUserHistory(raw_events, matchingDatas) {
|
|
|
66
66
|
else if (json.reduce_only && json.is_stop_order) {
|
|
67
67
|
order_type = "Stop Loss";
|
|
68
68
|
if (json.linked_position_id != undefined) {
|
|
69
|
-
const related = matchingDatas.findLast((e) => e.position_id === json.linked_position_id &&
|
|
70
|
-
e.base_token === base_token);
|
|
69
|
+
const related = matchingDatas.findLast((e) => e.position_id === json.linked_position_id && e.base_token === base_token);
|
|
71
70
|
if (related) {
|
|
72
71
|
const positionFilledPrice = related.filled_price;
|
|
73
72
|
const orderTriggerPrice = (0, bignumber_js_1.default)(json.trigger_price).div((0, bignumber_js_1.default)(10).pow(8));
|
|
74
73
|
if (related.side === "Long") {
|
|
75
74
|
if ((0, bignumber_js_1.default)(orderTriggerPrice).gt(positionFilledPrice)) {
|
|
76
|
-
order_type =
|
|
75
|
+
order_type = "Take Profit";
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
else {
|
|
80
79
|
if ((0, bignumber_js_1.default)(orderTriggerPrice).lt(positionFilledPrice)) {
|
|
81
|
-
order_type =
|
|
80
|
+
order_type = "Take Profit";
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
}
|
|
@@ -335,12 +334,12 @@ async function parseUserHistory(raw_events, matchingDatas) {
|
|
|
335
334
|
typeName: name,
|
|
336
335
|
order_id: undefined,
|
|
337
336
|
position_id: undefined,
|
|
338
|
-
market:
|
|
337
|
+
market: "TYPUS/USD",
|
|
339
338
|
side: undefined,
|
|
340
339
|
order_type: undefined,
|
|
341
|
-
status:
|
|
340
|
+
status: "Filled",
|
|
342
341
|
size: undefined,
|
|
343
|
-
base_token:
|
|
342
|
+
base_token: "TYPUS",
|
|
344
343
|
collateral: profit,
|
|
345
344
|
collateral_token: profit_token,
|
|
346
345
|
price: undefined,
|
|
@@ -553,8 +552,9 @@ async function getRealizeFundingFromSentio(userAddress, startTimestamp, events)
|
|
|
553
552
|
events = events.sort((a, b) => Number(new Date(a.timestamp)) - Number(new Date(b.timestamp)));
|
|
554
553
|
return events;
|
|
555
554
|
}
|
|
556
|
-
async function getRemovePositionFromSentio(userAddress, startTimestamp, events) {
|
|
557
|
-
|
|
555
|
+
async function getRemovePositionFromSentio(userAddress, startTimestamp, events, datas) {
|
|
556
|
+
if (!datas)
|
|
557
|
+
datas = await (0, sentio_1.getFromSentio)("RemovePosition", userAddress, startTimestamp.toString());
|
|
558
558
|
// console.log(datas);
|
|
559
559
|
datas.forEach((x) => {
|
|
560
560
|
// console.log(x);
|
|
@@ -619,7 +619,7 @@ async function getCancelOrderFromSentio(userAddress, startTimestamp, events) {
|
|
|
619
619
|
events = events.sort((a, b) => Number(new Date(a.timestamp)) - Number(new Date(b.timestamp)));
|
|
620
620
|
return events;
|
|
621
621
|
}
|
|
622
|
-
async function getOrderMatchFromSentio(userAddress, startTimestamp, events, datas, archiveDatas) {
|
|
622
|
+
async function getOrderMatchFromSentio(userAddress, startTimestamp, events, removeEventDatas, datas, archiveDatas) {
|
|
623
623
|
if (!datas)
|
|
624
624
|
datas = await (0, sentio_1.getFromSentio)("OrderFilled", userAddress, startTimestamp.toString(), undefined, true);
|
|
625
625
|
let order_match = datas.map((x) => {
|
|
@@ -658,14 +658,24 @@ async function getOrderMatchFromSentio(userAddress, startTimestamp, events, data
|
|
|
658
658
|
if (related) {
|
|
659
659
|
x.order_type = related.order_type;
|
|
660
660
|
if (related?.position_id !== null) {
|
|
661
|
-
const origin_order_filled_event = order_match.findLast(e => e.market == x.market && e.position_id == related?.position_id);
|
|
661
|
+
const origin_order_filled_event = order_match.findLast((e) => e.market == x.market && e.position_id == related?.position_id);
|
|
662
662
|
if (origin_order_filled_event) {
|
|
663
663
|
let origin_order_place_event = events.findLast((e) => e.order_id == origin_order_filled_event?.order_id && e.market == origin_order_filled_event.market);
|
|
664
664
|
if (!origin_order_place_event && archiveDatas) {
|
|
665
665
|
origin_order_place_event = archiveDatas.findLast((e) => e.order_id == origin_order_filled_event?.order_id && e.base_token == origin_order_filled_event.base_token);
|
|
666
666
|
}
|
|
667
667
|
const related_collateral = origin_order_place_event?.collateral ?? 0;
|
|
668
|
-
|
|
668
|
+
const isPartialClose = removeEventDatas.findIndex((r) => r.transaction_hash === x.tx_digest);
|
|
669
|
+
if (isPartialClose !== -1) {
|
|
670
|
+
x.collateral = (0, bignumber_js_1.default)(x.collateral ?? 0)
|
|
671
|
+
.plus(related_collateral)
|
|
672
|
+
.toNumber();
|
|
673
|
+
}
|
|
674
|
+
else if (x.collateral) {
|
|
675
|
+
if (x.collateral < 0) {
|
|
676
|
+
x.collateral = undefined;
|
|
677
|
+
}
|
|
678
|
+
}
|
|
669
679
|
}
|
|
670
680
|
}
|
|
671
681
|
x.dov_index = related.dov_index;
|
package/dist/src/user/order.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare function createTradingOrder(client: TypusClient, tx: Transaction,
|
|
|
22
22
|
linkedPositionId: string | null;
|
|
23
23
|
suiCoins?: string[];
|
|
24
24
|
}): Promise<Transaction>;
|
|
25
|
-
export declare function zeroCoin(tx: Transaction, typeArgs: [string]): import("@mysten/sui/transactions").TransactionResult;
|
|
25
|
+
export declare function zeroCoin(tx: Transaction, typeArgs: [string]): import("@mysten/sui/transactions", { with: { "resolution-mode": "import" } }).TransactionResult;
|
|
26
26
|
export declare function cancelTradingOrder(client: TypusClient, tx: Transaction, input: {
|
|
27
27
|
order: typeof TradingOrder.$inferType;
|
|
28
28
|
user: string;
|
|
@@ -6,7 +6,7 @@ export declare function splitBidReceiptTx(client: TypusClient, tx: Transaction,
|
|
|
6
6
|
receipts: TransactionObjectArgument[];
|
|
7
7
|
share?: string;
|
|
8
8
|
recipient: string;
|
|
9
|
-
}): import("@mysten/sui/transactions").TransactionResult;
|
|
9
|
+
}): import("@mysten/sui/transactions", { with: { "resolution-mode": "import" } }).TransactionResult;
|
|
10
10
|
export declare function createTradingOrderWithBidReceiptByAutoBid(client: TypusClient, tx: Transaction, input: {
|
|
11
11
|
perpIndex: string;
|
|
12
12
|
poolIndex: string;
|
package/package.json
CHANGED
|
@@ -1,28 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typus/typus-perp-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.51-upgrade",
|
|
4
4
|
"repository": "https://github.com/Typus-Lab/typus-perp-sdk.git",
|
|
5
5
|
"author": "Typus",
|
|
6
6
|
"description": "typus perp sdk",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@mysten/bcs": "
|
|
10
|
-
"@mysten/sui": "
|
|
11
|
-
"@typus/typus-sdk": "1.8.
|
|
9
|
+
"@mysten/bcs": "2.0.3",
|
|
10
|
+
"@mysten/sui": "2.13.2",
|
|
11
|
+
"@typus/typus-sdk": "1.8.43-upgrade"
|
|
12
12
|
},
|
|
13
13
|
"resolutions": {
|
|
14
|
-
"@mysten/bcs": "
|
|
15
|
-
"@mysten/sui": "
|
|
14
|
+
"@mysten/bcs": "2.0.3",
|
|
15
|
+
"@mysten/sui": "2.13.2",
|
|
16
16
|
"@pythnetwork/pyth-sui-js": "2.3.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@types/
|
|
20
|
-
"@types/camelcase-keys-deep": "^0.1.2",
|
|
21
|
-
"@types/expect": "^24.3.0",
|
|
22
|
-
"@types/mocha": "^10.0.1",
|
|
23
|
-
"@types/node": "^24.10.1",
|
|
24
|
-
"@types/rx": "^4.1.2",
|
|
25
|
-
"axios": "^1.13.2",
|
|
19
|
+
"@types/node": "^25.6.0",
|
|
26
20
|
"bignumber.js": "9.1.2",
|
|
27
21
|
"prettier": "^3.0.0",
|
|
28
22
|
"ts-node": "^10.9.2",
|
|
@@ -43,6 +37,5 @@
|
|
|
43
37
|
"bugs": {
|
|
44
38
|
"url": "https://github.com/Typus-Lab/typus-perp-sdk/issues"
|
|
45
39
|
},
|
|
46
|
-
"homepage": "https://github.com/Typus-Lab/typus-perp-sdk#readme"
|
|
47
|
-
|
|
48
|
-
}
|
|
40
|
+
"homepage": "https://github.com/Typus-Lab/typus-perp-sdk#readme"
|
|
41
|
+
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
/** Sui object identifiers */
|
|
5
|
-
import { MoveStruct } from "../../../utils/index";
|
|
6
|
-
export declare const UID: MoveStruct<{
|
|
7
|
-
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
8
|
-
}, "0x2::object::UID">;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**************************************************************
|
|
3
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
4
|
-
**************************************************************/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.UID = void 0;
|
|
7
|
-
/** Sui object identifiers */
|
|
8
|
-
const index_1 = require("../../../utils/index");
|
|
9
|
-
const bcs_1 = require("@mysten/sui/bcs");
|
|
10
|
-
const $moduleName = "0x2::object";
|
|
11
|
-
exports.UID = new index_1.MoveStruct({
|
|
12
|
-
name: `${$moduleName}::UID`,
|
|
13
|
-
fields: {
|
|
14
|
-
id: bcs_1.bcs.Address,
|
|
15
|
-
},
|
|
16
|
-
});
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
/**
|
|
5
|
-
* The `user_account` module defines the `UserAccount` and `UserAccountCap`
|
|
6
|
-
* structs, and the logic for creating, updating, and using them.
|
|
7
|
-
*/
|
|
8
|
-
import { MoveStruct, type RawTransactionArgument } from "../utils/index";
|
|
9
|
-
import { type Transaction } from "@mysten/sui/transactions";
|
|
10
|
-
export declare const UserAccount: MoveStruct<{
|
|
11
|
-
id: MoveStruct<{
|
|
12
|
-
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
13
|
-
}, "0x2::object::UID">;
|
|
14
|
-
/** The address of the owner of the user account. */
|
|
15
|
-
owner: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
16
|
-
/** A vector of the delegate users. */
|
|
17
|
-
delegate_user: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | Uint8Array<ArrayBufferLike>> & {
|
|
18
|
-
length: number;
|
|
19
|
-
}, string>;
|
|
20
|
-
/** A vector of the symbols of the tokens in the user account. */
|
|
21
|
-
symbols: import("@mysten/sui/bcs").BcsType<{
|
|
22
|
-
name: string;
|
|
23
|
-
}[], Iterable<{
|
|
24
|
-
name: string;
|
|
25
|
-
}> & {
|
|
26
|
-
length: number;
|
|
27
|
-
}, string>;
|
|
28
|
-
/** Padding for future use. */
|
|
29
|
-
u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
|
|
30
|
-
length: number;
|
|
31
|
-
}, string>;
|
|
32
|
-
}, "@typus/perp::user_account::UserAccount">;
|
|
33
|
-
export declare const UserAccountCap: MoveStruct<{
|
|
34
|
-
id: MoveStruct<{
|
|
35
|
-
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
36
|
-
}, "0x2::object::UID">;
|
|
37
|
-
/** The address of the owner of the user account. */
|
|
38
|
-
owner: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
39
|
-
/** The ID of the user account. */
|
|
40
|
-
user_account_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
41
|
-
}, "@typus/perp::user_account::UserAccountCap">;
|
|
42
|
-
export interface NewUserAccountOptions {
|
|
43
|
-
package?: string;
|
|
44
|
-
arguments?: [];
|
|
45
|
-
}
|
|
46
|
-
/** Creates a new user account and capability. */
|
|
47
|
-
export declare function newUserAccount(options?: NewUserAccountOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
48
|
-
export interface RemoveUserAccountArguments {
|
|
49
|
-
marketId: RawTransactionArgument<string>;
|
|
50
|
-
user: RawTransactionArgument<string>;
|
|
51
|
-
userAccountCap: RawTransactionArgument<string>;
|
|
52
|
-
}
|
|
53
|
-
export interface RemoveUserAccountOptions {
|
|
54
|
-
package?: string;
|
|
55
|
-
arguments: RemoveUserAccountArguments | [marketId: RawTransactionArgument<string>, user: RawTransactionArgument<string>, userAccountCap: RawTransactionArgument<string>];
|
|
56
|
-
}
|
|
57
|
-
/** Removes a user account. WARNING: no authority check inside */
|
|
58
|
-
export declare function removeUserAccount(options: RemoveUserAccountOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
59
|
-
export interface HasUserAccountArguments {
|
|
60
|
-
marketId: RawTransactionArgument<string>;
|
|
61
|
-
user: RawTransactionArgument<string>;
|
|
62
|
-
}
|
|
63
|
-
export interface HasUserAccountOptions {
|
|
64
|
-
package?: string;
|
|
65
|
-
arguments: HasUserAccountArguments | [marketId: RawTransactionArgument<string>, user: RawTransactionArgument<string>];
|
|
66
|
-
}
|
|
67
|
-
/** Checks if a user has an account. */
|
|
68
|
-
export declare function hasUserAccount(options: HasUserAccountOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
69
|
-
export interface GetMutUserAccountArguments {
|
|
70
|
-
marketId: RawTransactionArgument<string>;
|
|
71
|
-
user: RawTransactionArgument<string>;
|
|
72
|
-
}
|
|
73
|
-
export interface GetMutUserAccountOptions {
|
|
74
|
-
package?: string;
|
|
75
|
-
arguments: GetMutUserAccountArguments | [marketId: RawTransactionArgument<string>, user: RawTransactionArgument<string>];
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Gets a mutable reference to a user account. WARNING: no security check, only
|
|
79
|
-
* delegate_user or cranker can access
|
|
80
|
-
*/
|
|
81
|
-
export declare function getMutUserAccount(options: GetMutUserAccountOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
82
|
-
export interface CheckOwnerArguments {
|
|
83
|
-
userAccount: RawTransactionArgument<string>;
|
|
84
|
-
}
|
|
85
|
-
export interface CheckOwnerOptions {
|
|
86
|
-
package?: string;
|
|
87
|
-
arguments: CheckOwnerArguments | [userAccount: RawTransactionArgument<string>];
|
|
88
|
-
}
|
|
89
|
-
/** Checks if the sender is the owner of the user account. Abort if not owner */
|
|
90
|
-
export declare function checkOwner(options: CheckOwnerOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
91
|
-
export interface AddDelegateUserArguments {
|
|
92
|
-
userAccount: RawTransactionArgument<string>;
|
|
93
|
-
user: RawTransactionArgument<string>;
|
|
94
|
-
}
|
|
95
|
-
export interface AddDelegateUserOptions {
|
|
96
|
-
package?: string;
|
|
97
|
-
arguments: AddDelegateUserArguments | [userAccount: RawTransactionArgument<string>, user: RawTransactionArgument<string>];
|
|
98
|
-
}
|
|
99
|
-
/** Adds a delegate user to a user account. WARNING: no authority check inside */
|
|
100
|
-
export declare function addDelegateUser(options: AddDelegateUserOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
101
|
-
export interface RemoveDelegateUserArguments {
|
|
102
|
-
userAccount: RawTransactionArgument<string>;
|
|
103
|
-
user: RawTransactionArgument<string>;
|
|
104
|
-
}
|
|
105
|
-
export interface RemoveDelegateUserOptions {
|
|
106
|
-
package?: string;
|
|
107
|
-
arguments: RemoveDelegateUserArguments | [userAccount: RawTransactionArgument<string>, user: RawTransactionArgument<string>];
|
|
108
|
-
}
|
|
109
|
-
/** Remove a delegate user from a user account. WARNING: no authority check inside */
|
|
110
|
-
export declare function removeDelegateUser(options: RemoveDelegateUserOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
111
|
-
export interface DepositArguments {
|
|
112
|
-
userAccount: RawTransactionArgument<string>;
|
|
113
|
-
balance: RawTransactionArgument<string>;
|
|
114
|
-
}
|
|
115
|
-
export interface DepositOptions {
|
|
116
|
-
package?: string;
|
|
117
|
-
arguments: DepositArguments | [userAccount: RawTransactionArgument<string>, balance: RawTransactionArgument<string>];
|
|
118
|
-
typeArguments: [string];
|
|
119
|
-
}
|
|
120
|
-
/** Deposits collateral into a user account. WARNING: no authority check inside */
|
|
121
|
-
export declare function deposit(options: DepositOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
122
|
-
export interface WithdrawArguments {
|
|
123
|
-
userAccount: RawTransactionArgument<string>;
|
|
124
|
-
amount: RawTransactionArgument<number | bigint | null>;
|
|
125
|
-
userAccountCap: RawTransactionArgument<string>;
|
|
126
|
-
}
|
|
127
|
-
export interface WithdrawOptions {
|
|
128
|
-
package?: string;
|
|
129
|
-
arguments: WithdrawArguments | [
|
|
130
|
-
userAccount: RawTransactionArgument<string>,
|
|
131
|
-
amount: RawTransactionArgument<number | bigint | null>,
|
|
132
|
-
userAccountCap: RawTransactionArgument<string>
|
|
133
|
-
];
|
|
134
|
-
typeArguments: [string];
|
|
135
|
-
}
|
|
136
|
-
/** Withdraws collateral from a user account. WARNING: no authority check inside */
|
|
137
|
-
export declare function withdraw(options: WithdrawOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
138
|
-
export interface GetUserAccountOwnerArguments {
|
|
139
|
-
userAccountCap: RawTransactionArgument<string>;
|
|
140
|
-
}
|
|
141
|
-
export interface GetUserAccountOwnerOptions {
|
|
142
|
-
package?: string;
|
|
143
|
-
arguments: GetUserAccountOwnerArguments | [userAccountCap: RawTransactionArgument<string>];
|
|
144
|
-
}
|
|
145
|
-
/** Gets the owner of a user account from a capability. */
|
|
146
|
-
export declare function getUserAccountOwner(options: GetUserAccountOwnerOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|