@typus/typus-perp-sdk 1.1.54 → 1.2.0
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 +13 -12
- package/dist/src/client.js +24 -49
- package/dist/src/fetch.d.ts +15 -61
- package/dist/src/fetch.js +63 -163
- 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/index.js +4 -4
- package/dist/src/user/history.js +13 -12
- package/dist/src/user/order.d.ts +1 -1
- package/dist/src/user/orderWithBidReceipt.d.ts +1 -1
- package/package.json +7 -13
- 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 {
|
package/dist/src/index.js
CHANGED
|
@@ -60,8 +60,8 @@ exports.COMPETITION_CONFIG = exports.NETWORK == "MAINNET"
|
|
|
60
60
|
? "0xe896530a778adedc1b38e4fc31059a6557146caa7b1da56950b671a433de5f08"
|
|
61
61
|
: "0x2b811b120177839555aabdc2c28b28078170e663e855d29aa9072013d4fc918d";
|
|
62
62
|
exports.PROFIT_VAULT = exports.NETWORK == "MAINNET"
|
|
63
|
-
? "0xd24222307ba17ee1a08fe46ac587b1106e585e53f314ffffb525a4d4158b64c3"
|
|
64
|
-
: "0xb1d603139b24db2c46f6a423c8613ce677f329a0b159ff6e57672f3b663aec47";
|
|
63
|
+
? "0xd24222307ba17ee1a08fe46ac587b1106e585e53f314ffffb525a4d4158b64c3"
|
|
64
|
+
: "0xb1d603139b24db2c46f6a423c8613ce677f329a0b159ff6e57672f3b663aec47";
|
|
65
65
|
exports.LOCK_VAULT = exports.NETWORK == "MAINNET"
|
|
66
|
-
? "0x585355900351dd1915b77f31c06ae9e6d58b187de848d4e6e6a55d3789e281d6"
|
|
67
|
-
: "0x25dd9540f031b9a62b83784a727e1ef410f9aa91ecf7e3bb27a0c61f8ceecbfb";
|
|
66
|
+
? "0x585355900351dd1915b77f31c06ae9e6d58b187de848d4e6e6a55d3789e281d6"
|
|
67
|
+
: "0x25dd9540f031b9a62b83784a727e1ef410f9aa91ecf7e3bb27a0c61f8ceecbfb";
|
package/dist/src/user/history.js
CHANGED
|
@@ -56,8 +56,8 @@ async function parseUserHistory(raw_events, matchingDatas) {
|
|
|
56
56
|
collateral = Number(json.collateral_in_deposit_token) / 10 ** (0, constants_1.assetToDecimal)(collateral_token);
|
|
57
57
|
}
|
|
58
58
|
const marketOrderRation = json.is_long ? 1.02 : 0.9;
|
|
59
|
-
const isMarketOrder = Number(json.trigger_price) / Number(json.trading_pair_oracle_price) <=
|
|
60
|
-
|
|
59
|
+
const isMarketOrder = Number(json.trigger_price) / Number(json.trading_pair_oracle_price) <= marketOrderRation + 0.005 &&
|
|
60
|
+
Number(json.trigger_price) / Number(json.trading_pair_oracle_price) >= marketOrderRation - 0.005;
|
|
61
61
|
var order_type = "Limit";
|
|
62
62
|
var price = json.trigger_price;
|
|
63
63
|
if (json.filled || isMarketOrder) {
|
|
@@ -70,19 +70,18 @@ async function parseUserHistory(raw_events, matchingDatas) {
|
|
|
70
70
|
else if (json.reduce_only && json.is_stop_order) {
|
|
71
71
|
order_type = "Stop Loss";
|
|
72
72
|
if (json.linked_position_id != undefined) {
|
|
73
|
-
const related = matchingDatas.findLast((e) => e.position_id === json.linked_position_id &&
|
|
74
|
-
e.base_token === base_token);
|
|
73
|
+
const related = matchingDatas.findLast((e) => e.position_id === json.linked_position_id && e.base_token === base_token);
|
|
75
74
|
if (related) {
|
|
76
75
|
const positionFilledPrice = related.filled_price;
|
|
77
76
|
const orderTriggerPrice = (0, bignumber_js_1.default)(json.trigger_price).div((0, bignumber_js_1.default)(10).pow(8));
|
|
78
77
|
if (related.side === "Long") {
|
|
79
78
|
if ((0, bignumber_js_1.default)(orderTriggerPrice).gt(positionFilledPrice)) {
|
|
80
|
-
order_type =
|
|
79
|
+
order_type = "Take Profit";
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
82
|
else {
|
|
84
83
|
if ((0, bignumber_js_1.default)(orderTriggerPrice).lt(positionFilledPrice)) {
|
|
85
|
-
order_type =
|
|
84
|
+
order_type = "Take Profit";
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
87
|
}
|
|
@@ -350,12 +349,12 @@ async function parseUserHistory(raw_events, matchingDatas) {
|
|
|
350
349
|
typeName: name,
|
|
351
350
|
order_id: undefined,
|
|
352
351
|
position_id: undefined,
|
|
353
|
-
market:
|
|
352
|
+
market: "TYPUS/USD",
|
|
354
353
|
side: undefined,
|
|
355
354
|
order_type: undefined,
|
|
356
|
-
status:
|
|
355
|
+
status: "Filled",
|
|
357
356
|
size: undefined,
|
|
358
|
-
base_token:
|
|
357
|
+
base_token: "TYPUS",
|
|
359
358
|
collateral: profit,
|
|
360
359
|
collateral_token: profit_token,
|
|
361
360
|
price: undefined,
|
|
@@ -674,16 +673,18 @@ async function getOrderMatchFromSentio(userAddress, startTimestamp, events, remo
|
|
|
674
673
|
if (related) {
|
|
675
674
|
x.order_type = related.order_type;
|
|
676
675
|
if (related?.position_id !== null) {
|
|
677
|
-
const origin_order_filled_event = order_match.findLast(e => e.market == x.market && e.position_id == related?.position_id);
|
|
676
|
+
const origin_order_filled_event = order_match.findLast((e) => e.market == x.market && e.position_id == related?.position_id);
|
|
678
677
|
if (origin_order_filled_event) {
|
|
679
678
|
let origin_order_place_event = events.findLast((e) => e.order_id == origin_order_filled_event?.order_id && e.market == origin_order_filled_event.market);
|
|
680
679
|
if (!origin_order_place_event && archiveDatas) {
|
|
681
680
|
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);
|
|
682
681
|
}
|
|
683
682
|
const related_collateral = origin_order_place_event?.collateral ?? 0;
|
|
684
|
-
const isPartialClose = removeEventDatas.findIndex(r => r.transaction_hash === x.tx_digest);
|
|
683
|
+
const isPartialClose = removeEventDatas.findIndex((r) => r.transaction_hash === x.tx_digest);
|
|
685
684
|
if (isPartialClose !== -1) {
|
|
686
|
-
x.collateral = (0, bignumber_js_1.default)(x.collateral ?? 0)
|
|
685
|
+
x.collateral = (0, bignumber_js_1.default)(x.collateral ?? 0)
|
|
686
|
+
.plus(related_collateral)
|
|
687
|
+
.toNumber();
|
|
687
688
|
}
|
|
688
689
|
else if (x.collateral) {
|
|
689
690
|
if (x.collateral < 0) {
|
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.
|
|
3
|
+
"version": "1.2.0",
|
|
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.
|
|
9
|
+
"@mysten/bcs": "2.0.3",
|
|
10
|
+
"@mysten/sui": "2.13.2",
|
|
11
|
+
"@typus/typus-sdk": "1.9.0"
|
|
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",
|
|
@@ -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;
|