@typus/typus-perp-sdk 1.1.49 → 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.
Files changed (77) hide show
  1. package/dist/src/api/sentio.d.ts +1 -1
  2. package/dist/src/api/sentio.js +3 -3
  3. package/dist/src/client.d.ts +11 -12
  4. package/dist/src/client.js +16 -44
  5. package/dist/src/fetch.d.ts +15 -45
  6. package/dist/src/fetch.js +70 -69
  7. package/dist/src/generated/typus_perp/admin.d.ts +32 -42
  8. package/dist/src/generated/typus_perp/admin.js +41 -67
  9. package/dist/src/generated/typus_perp/competition.d.ts +22 -10
  10. package/dist/src/generated/typus_perp/competition.js +19 -54
  11. package/dist/src/generated/typus_perp/deps/std/type_name.d.ts +2 -2
  12. package/dist/src/generated/typus_perp/deps/std/type_name.js +2 -2
  13. package/dist/src/generated/typus_perp/deps/sui/balance.d.ts +3 -3
  14. package/dist/src/generated/typus_perp/deps/sui/balance.js +3 -3
  15. package/dist/src/generated/typus_perp/deps/sui/object_table.d.ts +4 -6
  16. package/dist/src/generated/typus_perp/deps/sui/object_table.js +4 -38
  17. package/dist/src/generated/typus_perp/deps/sui/table.d.ts +4 -6
  18. package/dist/src/generated/typus_perp/deps/sui/table.js +4 -38
  19. package/dist/src/generated/typus_perp/deps/sui/vec_set.d.ts +2 -2
  20. package/dist/src/generated/typus_perp/deps/sui/vec_set.js +2 -2
  21. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.d.ts +7 -9
  22. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.js +6 -6
  23. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.d.ts +6 -10
  24. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.js +5 -39
  25. package/dist/src/generated/typus_perp/deps/typus_framework/vault.d.ts +14 -8
  26. package/dist/src/generated/typus_perp/deps/typus_framework/vault.js +13 -39
  27. package/dist/src/generated/typus_perp/error.d.ts +97 -87
  28. package/dist/src/generated/typus_perp/error.js +18 -0
  29. package/dist/src/generated/typus_perp/escrow.d.ts +17 -21
  30. package/dist/src/generated/typus_perp/escrow.js +10 -22
  31. package/dist/src/generated/typus_perp/lending.d.ts +47 -0
  32. package/dist/src/generated/typus_perp/lending.js +40 -0
  33. package/dist/src/generated/typus_perp/lp_pool.d.ts +718 -397
  34. package/dist/src/generated/typus_perp/lp_pool.js +485 -365
  35. package/dist/src/generated/typus_perp/math.d.ts +18 -8
  36. package/dist/src/generated/typus_perp/math.js +24 -6
  37. package/dist/src/generated/typus_perp/position.d.ts +207 -185
  38. package/dist/src/generated/typus_perp/position.js +236 -277
  39. package/dist/src/generated/typus_perp/profit_vault.d.ts +64 -72
  40. package/dist/src/generated/typus_perp/profit_vault.js +48 -86
  41. package/dist/src/generated/typus_perp/symbol.d.ts +6 -6
  42. package/dist/src/generated/typus_perp/symbol.js +11 -13
  43. package/dist/src/generated/typus_perp/trading.d.ts +451 -558
  44. package/dist/src/generated/typus_perp/trading.js +429 -681
  45. package/dist/src/generated/typus_perp/treasury_caps.d.ts +5 -7
  46. package/dist/src/generated/typus_perp/treasury_caps.js +8 -45
  47. package/dist/src/generated/typus_stake_pool/admin.d.ts +13 -122
  48. package/dist/src/generated/typus_stake_pool/admin.js +19 -103
  49. package/dist/src/generated/typus_stake_pool/deps/std/type_name.d.ts +2 -2
  50. package/dist/src/generated/typus_stake_pool/deps/std/type_name.js +2 -2
  51. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.d.ts +2 -2
  52. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.js +2 -2
  53. package/dist/src/generated/typus_stake_pool/stake_pool.d.ts +249 -240
  54. package/dist/src/generated/typus_stake_pool/stake_pool.js +159 -246
  55. package/dist/src/generated/utils/index.d.ts +21 -2
  56. package/dist/src/generated/utils/index.js +34 -10
  57. package/dist/src/user/history.d.ts +3 -2
  58. package/dist/src/user/history.js +60 -18
  59. package/dist/src/user/order.d.ts +1 -1
  60. package/dist/src/user/orderWithBidReceipt.d.ts +1 -1
  61. package/package.json +8 -15
  62. package/dist/src/generated/typus_perp/deps/sui/object.d.ts +0 -8
  63. package/dist/src/generated/typus_perp/deps/sui/object.js +0 -16
  64. package/dist/src/generated/typus_perp/user_account.d.ts +0 -146
  65. package/dist/src/generated/typus_perp/user_account.js +0 -221
  66. package/dist/src/generated/typus_stake_pool/deps/sui/object.d.ts +0 -8
  67. package/dist/src/generated/typus_stake_pool/deps/sui/object.js +0 -16
  68. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.d.ts +0 -30
  69. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.js +0 -37
  70. package/dist/src/grpc/graphql.d.ts +0 -26
  71. package/dist/src/grpc/graphql.js +0 -126
  72. package/dist/src/grpc/grpc.d.ts +0 -1
  73. package/dist/src/grpc/grpc.js +0 -38
  74. package/dist/src/grpc/ledgerService.d.ts +0 -0
  75. package/dist/src/grpc/ledgerService.js +0 -64
  76. package/dist/src/grpc/liveDataService.d.ts +0 -0
  77. 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)(parsedTag.struct.address);
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 === "Object" && structTag.name === "ID") {
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 === `${SUI_FRAMEWORK_ADDRESS}::deny_list::DenyList`) {
69
- normalizedArgs.push((tx) => tx.object.denyList());
67
+ if (argType === "0x2::clock::Clock") {
68
+ normalizedArgs.push((tx) => tx.object.clock());
70
69
  continue;
71
70
  }
72
- if (argType === `${SUI_FRAMEWORK_ADDRESS}::random::Random`) {
71
+ if (argType === "0x2::random::Random") {
73
72
  normalizedArgs.push((tx) => tx.object.random());
74
73
  continue;
75
74
  }
76
- if (argType === `${SUI_FRAMEWORK_ADDRESS}::clock::Clock`) {
77
- normalizedArgs.push((tx) => tx.object.clock());
75
+ if (argType === "0x2::deny_list::DenyList") {
76
+ normalizedArgs.push((tx) => tx.object.denyList());
78
77
  continue;
79
78
  }
80
- if (argType === `${SUI_SYSTEM_ADDRESS}::sui_system::SuiSystemState`) {
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 {
@@ -27,10 +27,11 @@ export interface Event {
27
27
  }
28
28
  export declare function parseUserHistory(raw_events: any, matchingDatas: any): Promise<Event[]>;
29
29
  export declare function getGraphQLEvents(module: string, sender: string | null, beforeCursor?: string | null): Promise<any>;
30
+ export declare function getArchivePlaceOrderEvents(userAddress: string, startTimestamp: number, endTimestamp: number, events: Event[]): Promise<Event[]>;
30
31
  export declare function getLiquidateFromSentio(userAddress: string, startTimestamp: number, events: Event[]): Promise<Event[]>;
31
32
  export declare function getRealizeFundingFromSentio(userAddress: string, startTimestamp: number, events: Event[]): Promise<Event[]>;
32
- 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[]>;
33
34
  export declare function getCancelOrderFromSentio(userAddress: string, startTimestamp: number, events: Event[]): Promise<Event[]>;
34
- export declare function getOrderMatchFromSentio(userAddress: string, startTimestamp: number, events: Event[], datas?: any[]): Promise<Event[]>;
35
+ export declare function getOrderMatchFromSentio(userAddress: string, startTimestamp: number, events: Event[], removeEventDatas: any[], datas?: any[], archiveDatas?: Event[]): Promise<Event[]>;
35
36
  export declare function getRealizeOptionFromSentio(userAddress: string, startTimestamp: number, events: Event[]): Promise<Event[]>;
36
37
  export declare function toSentioToken(name: TOKEN): string;
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.parseUserHistory = parseUserHistory;
7
7
  exports.getGraphQLEvents = getGraphQLEvents;
8
+ exports.getArchivePlaceOrderEvents = getArchivePlaceOrderEvents;
8
9
  exports.getLiquidateFromSentio = getLiquidateFromSentio;
9
10
  exports.getRealizeFundingFromSentio = getRealizeFundingFromSentio;
10
11
  exports.getRemovePositionFromSentio = getRemovePositionFromSentio;
@@ -51,8 +52,8 @@ async function parseUserHistory(raw_events, matchingDatas) {
51
52
  collateral = Number(json.collateral_in_deposit_token) / 10 ** (0, constants_1.assetToDecimal)(collateral_token);
52
53
  }
53
54
  const marketOrderRation = json.is_long ? 1.02 : 0.9;
54
- const isMarketOrder = Number(json.trigger_price) / Number(json.trading_pair_oracle_price) <= (marketOrderRation + 0.005)
55
- && Number(json.trigger_price) / Number(json.trading_pair_oracle_price) >= (marketOrderRation - 0.005);
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;
56
57
  var order_type = "Limit";
57
58
  var price = json.trigger_price;
58
59
  if (json.filled || isMarketOrder) {
@@ -65,19 +66,18 @@ async function parseUserHistory(raw_events, matchingDatas) {
65
66
  else if (json.reduce_only && json.is_stop_order) {
66
67
  order_type = "Stop Loss";
67
68
  if (json.linked_position_id != undefined) {
68
- const related = matchingDatas.findLast((e) => e.position_id === json.linked_position_id &&
69
- e.base_token === base_token);
69
+ const related = matchingDatas.findLast((e) => e.position_id === json.linked_position_id && e.base_token === base_token);
70
70
  if (related) {
71
71
  const positionFilledPrice = related.filled_price;
72
72
  const orderTriggerPrice = (0, bignumber_js_1.default)(json.trigger_price).div((0, bignumber_js_1.default)(10).pow(8));
73
73
  if (related.side === "Long") {
74
74
  if ((0, bignumber_js_1.default)(orderTriggerPrice).gt(positionFilledPrice)) {
75
- order_type = 'Take Profit';
75
+ order_type = "Take Profit";
76
76
  }
77
77
  }
78
78
  else {
79
79
  if ((0, bignumber_js_1.default)(orderTriggerPrice).lt(positionFilledPrice)) {
80
- order_type = 'Take Profit';
80
+ order_type = "Take Profit";
81
81
  }
82
82
  }
83
83
  }
@@ -334,12 +334,12 @@ async function parseUserHistory(raw_events, matchingDatas) {
334
334
  typeName: name,
335
335
  order_id: undefined,
336
336
  position_id: undefined,
337
- market: 'TYPUS/USD',
337
+ market: "TYPUS/USD",
338
338
  side: undefined,
339
339
  order_type: undefined,
340
- status: 'Filled',
340
+ status: "Filled",
341
341
  size: undefined,
342
- base_token: 'TYPUS',
342
+ base_token: "TYPUS",
343
343
  collateral: profit,
344
344
  collateral_token: profit_token,
345
345
  price: undefined,
@@ -424,6 +424,34 @@ async function getGraphQLEvents(module, sender, beforeCursor = null) {
424
424
  return data.data.events;
425
425
  }
426
426
  }
427
+ async function getArchivePlaceOrderEvents(userAddress, startTimestamp, endTimestamp, events) {
428
+ const datas = await (0, sentio_1.getFromSentio)("PlaceOrder", userAddress, startTimestamp.toString(), endTimestamp.toString(), false);
429
+ let placeOrders = datas.map((x) => {
430
+ let base_token = toToken(x.base_token);
431
+ let txHistory = {
432
+ action: "Place Order",
433
+ typeName: "PlaceOrderEvent",
434
+ order_id: x.order_id,
435
+ position_id: x.position_id,
436
+ market: `${base_token}/USD`,
437
+ side: undefined,
438
+ order_type: x.order_type,
439
+ status: x.status,
440
+ size: Number(x.position_size),
441
+ base_token,
442
+ collateral: x.collateral,
443
+ collateral_token: x.collateral_token,
444
+ price: Number(x.trading_price),
445
+ realized_pnl: undefined,
446
+ timestamp: x.timestamp,
447
+ tx_digest: x.transaction_hash,
448
+ dov_index: undefined,
449
+ sender: "user",
450
+ };
451
+ return txHistory;
452
+ });
453
+ return placeOrders;
454
+ }
427
455
  async function getLiquidateFromSentio(userAddress, startTimestamp, events) {
428
456
  const datas = await (0, sentio_1.getFromSentio)("Liquidate", userAddress, startTimestamp.toString());
429
457
  // console.log(datas);
@@ -524,8 +552,9 @@ async function getRealizeFundingFromSentio(userAddress, startTimestamp, events)
524
552
  events = events.sort((a, b) => Number(new Date(a.timestamp)) - Number(new Date(b.timestamp)));
525
553
  return events;
526
554
  }
527
- async function getRemovePositionFromSentio(userAddress, startTimestamp, events) {
528
- const datas = await (0, sentio_1.getFromSentio)("RemovePosition", userAddress, startTimestamp.toString());
555
+ async function getRemovePositionFromSentio(userAddress, startTimestamp, events, datas) {
556
+ if (!datas)
557
+ datas = await (0, sentio_1.getFromSentio)("RemovePosition", userAddress, startTimestamp.toString());
529
558
  // console.log(datas);
530
559
  datas.forEach((x) => {
531
560
  // console.log(x);
@@ -544,7 +573,7 @@ async function getRemovePositionFromSentio(userAddress, startTimestamp, events)
544
573
  return events;
545
574
  }
546
575
  async function getCancelOrderFromSentio(userAddress, startTimestamp, events) {
547
- const datas = await (0, sentio_1.getFromSentio)("CancelOrder", userAddress, startTimestamp.toString(), true);
576
+ const datas = await (0, sentio_1.getFromSentio)("CancelOrder", userAddress, startTimestamp.toString(), undefined, true);
548
577
  // console.log(datas);
549
578
  let cancelOrder = datas.map((x) => {
550
579
  let collateral = Number(x.released_collateral_amount);
@@ -590,9 +619,9 @@ async function getCancelOrderFromSentio(userAddress, startTimestamp, events) {
590
619
  events = events.sort((a, b) => Number(new Date(a.timestamp)) - Number(new Date(b.timestamp)));
591
620
  return events;
592
621
  }
593
- async function getOrderMatchFromSentio(userAddress, startTimestamp, events, datas) {
622
+ async function getOrderMatchFromSentio(userAddress, startTimestamp, events, removeEventDatas, datas, archiveDatas) {
594
623
  if (!datas)
595
- datas = await (0, sentio_1.getFromSentio)("OrderFilled", userAddress, startTimestamp.toString(), true);
624
+ datas = await (0, sentio_1.getFromSentio)("OrderFilled", userAddress, startTimestamp.toString(), undefined, true);
596
625
  let order_match = datas.map((x) => {
597
626
  let base_token = toToken(x.base_token);
598
627
  let txHistory = {
@@ -626,14 +655,27 @@ async function getOrderMatchFromSentio(userAddress, startTimestamp, events, data
626
655
  order_match = order_match.map((x) => {
627
656
  // find related order
628
657
  let related = events.findLast((e) => e.order_id == x.order_id && e.market == x.market);
629
- // console.log(x, related);
630
658
  if (related) {
631
659
  x.order_type = related.order_type;
632
660
  if (related?.position_id !== null) {
633
- 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);
634
662
  if (origin_order_filled_event) {
635
- const origin_order_place_event = events.findLast((e) => e.order_id == origin_order_filled_event?.order_id && e.market == origin_order_filled_event?.market);
636
- x.collateral = origin_order_place_event?.collateral ?? related.collateral;
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
+ if (!origin_order_place_event && archiveDatas) {
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
+ }
667
+ const related_collateral = origin_order_place_event?.collateral ?? 0;
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
+ }
637
679
  }
638
680
  }
639
681
  x.dov_index = related.dov_index;
@@ -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.49",
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": "1.9.2",
10
- "@mysten/sui": "1.44.0",
11
- "@typus/typus-sdk": "1.8.41"
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": "1.9.2",
15
- "@mysten/sui": "1.44.0",
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/bs58": "^4.0.1",
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
- "packageManager": "yarn@4.10.3+sha512.c38cafb5c7bb273f3926d04e55e1d8c9dfa7d9c3ea1f36a4868fa028b9e5f72298f0b7f401ad5eb921749eb012eb1c3bb74bf7503df3ee43fd600d14a018266f"
40
+ "homepage": "https://github.com/Typus-Lab/typus-perp-sdk#readme"
48
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;