@typus/typus-perp-sdk 1.1.32-codegen-exp2 → 1.1.32-codegen-exp4

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.
@@ -23,10 +23,11 @@ export declare const StakePoolInfo: MoveStruct<{
23
23
  total_share: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
24
24
  /** Whether the pool is active. */
25
25
  active: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
26
- /**
27
- * Padding for future use. [new_tlp_price (decimal 4), usd_per_exp,
28
- * depositors_count]
29
- */
26
+ /** tlp price (decimal 4) */
27
+ new_tlp_price: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
28
+ /** number of depositor */
29
+ depositors_count: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
30
+ /** Padding for future use. */
30
31
  u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
31
32
  length: number;
32
33
  }, string>;
@@ -34,6 +35,8 @@ export declare const StakePoolInfo: MoveStruct<{
34
35
  export declare const StakePoolConfig: MoveStruct<{
35
36
  /** The unlock countdown in milliseconds. */
36
37
  unlock_countdown_ts_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
38
+ /** for exp calculation */
39
+ usd_per_exp: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
37
40
  /** Padding for future use. */
38
41
  u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
39
42
  length: number;
@@ -113,10 +116,11 @@ export declare const StakePool: MoveStruct<{
113
116
  total_share: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
114
117
  /** Whether the pool is active. */
115
118
  active: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
116
- /**
117
- * Padding for future use. [new_tlp_price (decimal 4), usd_per_exp,
118
- * depositors_count]
119
- */
119
+ /** tlp price (decimal 4) */
120
+ new_tlp_price: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
121
+ /** number of depositor */
122
+ depositors_count: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
123
+ /** Padding for future use. */
120
124
  u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
121
125
  length: number;
122
126
  }, string>;
@@ -125,6 +129,8 @@ export declare const StakePool: MoveStruct<{
125
129
  config: MoveStruct<{
126
130
  /** The unlock countdown in milliseconds. */
127
131
  unlock_countdown_ts_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
132
+ /** for exp calculation */
133
+ usd_per_exp: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
128
134
  /** Padding for future use. */
129
135
  u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
130
136
  length: number;
@@ -264,10 +270,13 @@ export declare const LpUserShare: MoveStruct<{
264
270
  length: number;
265
271
  }, string>;
266
272
  }, "0x2::vec_map::VecMap<std::type_name::TypeName, u64>">;
267
- /**
268
- * Padding for future use. [snapshot_ts_ms, old_tlp_price (decimal 4),
269
- * is_auto_compound(deprecated), harvested_amount]
270
- */
273
+ /** The last snapshot ts for exp. */
274
+ snapshot_ts_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
275
+ /** old tlp price for exp with decimal 4 */
276
+ tlp_price: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
277
+ /** accumulated harvested amount */
278
+ harvested_amount: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
279
+ /** Padding for future use. */
271
280
  u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
272
281
  length: number;
273
282
  }, string>;
@@ -287,10 +296,11 @@ export declare const NewStakePoolEvent: MoveStruct<{
287
296
  total_share: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
288
297
  /** Whether the pool is active. */
289
298
  active: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
290
- /**
291
- * Padding for future use. [new_tlp_price (decimal 4), usd_per_exp,
292
- * depositors_count]
293
- */
299
+ /** tlp price (decimal 4) */
300
+ new_tlp_price: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
301
+ /** number of depositor */
302
+ depositors_count: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
303
+ /** Padding for future use. */
294
304
  u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
295
305
  length: number;
296
306
  }, string>;
@@ -298,6 +308,8 @@ export declare const NewStakePoolEvent: MoveStruct<{
298
308
  stake_pool_config: MoveStruct<{
299
309
  /** The unlock countdown in milliseconds. */
300
310
  unlock_countdown_ts_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
311
+ /** for exp calculation */
312
+ usd_per_exp: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
301
313
  /** Padding for future use. */
302
314
  u64_padding: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
303
315
  length: number;
@@ -732,7 +744,6 @@ export interface StakeArguments {
732
744
  registry: RawTransactionArgument<string>;
733
745
  index: RawTransactionArgument<number | bigint>;
734
746
  lpToken: RawTransactionArgument<string>;
735
- UserShareId: RawTransactionArgument<number | bigint | null>;
736
747
  }
737
748
  export interface StakeOptions {
738
749
  package?: string;
@@ -740,8 +751,7 @@ export interface StakeOptions {
740
751
  version: RawTransactionArgument<string>,
741
752
  registry: RawTransactionArgument<string>,
742
753
  index: RawTransactionArgument<number | bigint>,
743
- lpToken: RawTransactionArgument<string>,
744
- UserShareId: RawTransactionArgument<number | bigint | null>
754
+ lpToken: RawTransactionArgument<string>
745
755
  ];
746
756
  typeArguments: [string];
747
757
  }
@@ -766,30 +776,12 @@ export interface UpdatePoolInfoU64PaddingOptions {
766
776
  }
767
777
  /** [Authorized Function] Update TLP price for calculating staking exp */
768
778
  export declare function updatePoolInfoU64Padding(options: UpdatePoolInfoU64PaddingOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
769
- export interface HotfixPoolInfoU64PaddingArguments {
770
- version: RawTransactionArgument<string>;
771
- registry: RawTransactionArgument<string>;
772
- index: RawTransactionArgument<number | bigint>;
773
- u64Padding: RawTransactionArgument<number | bigint[]>;
774
- }
775
- export interface HotfixPoolInfoU64PaddingOptions {
776
- package?: string;
777
- arguments: HotfixPoolInfoU64PaddingArguments | [
778
- version: RawTransactionArgument<string>,
779
- registry: RawTransactionArgument<string>,
780
- index: RawTransactionArgument<number | bigint>,
781
- u64Padding: RawTransactionArgument<number | bigint[]>
782
- ];
783
- }
784
- /** [Authorized Function] Update TLP price for calculating staking exp */
785
- export declare function hotfixPoolInfoU64Padding(options: HotfixPoolInfoU64PaddingOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
786
779
  export interface SnapshotArguments {
787
780
  version: RawTransactionArgument<string>;
788
781
  registry: RawTransactionArgument<string>;
789
782
  typusEcosystemVersion: RawTransactionArgument<string>;
790
783
  typusUserRegistry: RawTransactionArgument<string>;
791
784
  index: RawTransactionArgument<number | bigint>;
792
- UserShareId: RawTransactionArgument<number | bigint>;
793
785
  }
794
786
  export interface SnapshotOptions {
795
787
  package?: string;
@@ -798,8 +790,7 @@ export interface SnapshotOptions {
798
790
  registry: RawTransactionArgument<string>,
799
791
  typusEcosystemVersion: RawTransactionArgument<string>,
800
792
  typusUserRegistry: RawTransactionArgument<string>,
801
- index: RawTransactionArgument<number | bigint>,
802
- UserShareId: RawTransactionArgument<number | bigint>
793
+ index: RawTransactionArgument<number | bigint>
803
794
  ];
804
795
  }
805
796
  /** [User Function] Get the staking exp */
@@ -808,7 +799,6 @@ export interface UnsubscribeArguments {
808
799
  version: RawTransactionArgument<string>;
809
800
  registry: RawTransactionArgument<string>;
810
801
  index: RawTransactionArgument<number | bigint>;
811
- UserShareId: RawTransactionArgument<number | bigint>;
812
802
  unsubscribedShares: RawTransactionArgument<number | bigint | null>;
813
803
  }
814
804
  export interface UnsubscribeOptions {
@@ -817,7 +807,6 @@ export interface UnsubscribeOptions {
817
807
  version: RawTransactionArgument<string>,
818
808
  registry: RawTransactionArgument<string>,
819
809
  index: RawTransactionArgument<number | bigint>,
820
- UserShareId: RawTransactionArgument<number | bigint>,
821
810
  unsubscribedShares: RawTransactionArgument<number | bigint | null>
822
811
  ];
823
812
  typeArguments: [string];
@@ -828,15 +817,13 @@ export interface UnstakeArguments {
828
817
  version: RawTransactionArgument<string>;
829
818
  registry: RawTransactionArgument<string>;
830
819
  index: RawTransactionArgument<number | bigint>;
831
- UserShareId: RawTransactionArgument<number | bigint>;
832
820
  }
833
821
  export interface UnstakeOptions {
834
822
  package?: string;
835
823
  arguments: UnstakeArguments | [
836
824
  version: RawTransactionArgument<string>,
837
825
  registry: RawTransactionArgument<string>,
838
- index: RawTransactionArgument<number | bigint>,
839
- UserShareId: RawTransactionArgument<number | bigint>
826
+ index: RawTransactionArgument<number | bigint>
840
827
  ];
841
828
  typeArguments: [string];
842
829
  }
@@ -869,15 +856,13 @@ export interface HarvestPerUserShareArguments {
869
856
  version: RawTransactionArgument<string>;
870
857
  registry: RawTransactionArgument<string>;
871
858
  index: RawTransactionArgument<number | bigint>;
872
- UserShareId: RawTransactionArgument<number | bigint>;
873
859
  }
874
860
  export interface HarvestPerUserShareOptions {
875
861
  package?: string;
876
862
  arguments: HarvestPerUserShareArguments | [
877
863
  version: RawTransactionArgument<string>,
878
864
  registry: RawTransactionArgument<string>,
879
- index: RawTransactionArgument<number | bigint>,
880
- UserShareId: RawTransactionArgument<number | bigint>
865
+ index: RawTransactionArgument<number | bigint>
881
866
  ];
882
867
  typeArguments: [string];
883
868
  }
@@ -999,25 +984,3 @@ export interface GetLastIncentivePriceIndexOptions {
999
984
  arguments: GetLastIncentivePriceIndexArguments | [stakePool: RawTransactionArgument<string>];
1000
985
  }
1001
986
  export declare function getLastIncentivePriceIndex(options: GetLastIncentivePriceIndexOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
1002
- export interface WithdrawIncentiveArguments {
1003
- version: RawTransactionArgument<string>;
1004
- registry: RawTransactionArgument<string>;
1005
- index: RawTransactionArgument<number | bigint>;
1006
- amount: RawTransactionArgument<number | bigint | null>;
1007
- }
1008
- export interface WithdrawIncentiveOptions {
1009
- package?: string;
1010
- arguments: WithdrawIncentiveArguments | [
1011
- version: RawTransactionArgument<string>,
1012
- registry: RawTransactionArgument<string>,
1013
- index: RawTransactionArgument<number | bigint>,
1014
- amount: RawTransactionArgument<number | bigint | null>
1015
- ];
1016
- typeArguments: [string];
1017
- }
1018
- export declare function withdrawIncentive(options: WithdrawIncentiveOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
1019
- export interface DeprecatedOptions {
1020
- package?: string;
1021
- arguments?: [];
1022
- }
1023
- export declare function deprecated(options?: DeprecatedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -48,7 +48,6 @@ exports.depositIncentive = depositIncentive;
48
48
  exports.withdrawIncentiveV2 = withdrawIncentiveV2;
49
49
  exports.stake = stake;
50
50
  exports.updatePoolInfoU64Padding = updatePoolInfoU64Padding;
51
- exports.hotfixPoolInfoU64Padding = hotfixPoolInfoU64Padding;
52
51
  exports.snapshot = snapshot;
53
52
  exports.unsubscribe = unsubscribe;
54
53
  exports.unstake = unstake;
@@ -67,8 +66,6 @@ exports.getIncentive = getIncentive;
67
66
  exports.getMutIncentive = getMutIncentive;
68
67
  exports.removeIncentive = removeIncentive;
69
68
  exports.getLastIncentivePriceIndex = getLastIncentivePriceIndex;
70
- exports.withdrawIncentive = withdrawIncentive;
71
- exports.deprecated = deprecated;
72
69
  /**************************************************************
73
70
  * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
74
71
  **************************************************************/
@@ -99,10 +96,11 @@ exports.StakePoolInfo = new index_1.MoveStruct({
99
96
  total_share: bcs_1.bcs.u64(),
100
97
  /** Whether the pool is active. */
101
98
  active: bcs_1.bcs.bool(),
102
- /**
103
- * Padding for future use. [new_tlp_price (decimal 4), usd_per_exp,
104
- * depositors_count]
105
- */
99
+ /** tlp price (decimal 4) */
100
+ new_tlp_price: bcs_1.bcs.u64(),
101
+ /** number of depositor */
102
+ depositors_count: bcs_1.bcs.u64(),
103
+ /** Padding for future use. */
106
104
  u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
107
105
  },
108
106
  });
@@ -111,6 +109,8 @@ exports.StakePoolConfig = new index_1.MoveStruct({
111
109
  fields: {
112
110
  /** The unlock countdown in milliseconds. */
113
111
  unlock_countdown_ts_ms: bcs_1.bcs.u64(),
112
+ /** for exp calculation */
113
+ usd_per_exp: bcs_1.bcs.u64(),
114
114
  /** Padding for future use. */
115
115
  u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
116
116
  },
@@ -198,10 +198,13 @@ exports.LpUserShare = new index_1.MoveStruct({
198
198
  deactivating_shares: bcs_1.bcs.vector(exports.DeactivatingShares),
199
199
  /** The last incentive price index. */
200
200
  last_incentive_price_index: vec_map.VecMap(type_name.TypeName, bcs_1.bcs.u64()),
201
- /**
202
- * Padding for future use. [snapshot_ts_ms, old_tlp_price (decimal 4),
203
- * is_auto_compound(deprecated), harvested_amount]
204
- */
201
+ /** The last snapshot ts for exp. */
202
+ snapshot_ts_ms: bcs_1.bcs.u64(),
203
+ /** old tlp price for exp with decimal 4 */
204
+ tlp_price: bcs_1.bcs.u64(),
205
+ /** accumulated harvested amount */
206
+ harvested_amount: bcs_1.bcs.u64(),
207
+ /** Padding for future use. */
205
208
  u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
206
209
  },
207
210
  });
@@ -592,10 +595,9 @@ function stake(options) {
592
595
  `${packageAddress}::stake_pool::StakePoolRegistry`,
593
596
  "u64",
594
597
  `0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<${options.typeArguments[0]}>`,
595
- "0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>",
596
598
  "0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
597
599
  ];
598
- const parameterNames = ["version", "registry", "index", "lpToken", "UserShareId"];
600
+ const parameterNames = ["version", "registry", "index", "lpToken"];
599
601
  return (tx) => tx.moveCall({
600
602
  package: packageAddress,
601
603
  module: "stake_pool",
@@ -622,36 +624,18 @@ function updatePoolInfoU64Padding(options) {
622
624
  arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
623
625
  });
624
626
  }
625
- /** [Authorized Function] Update TLP price for calculating staking exp */
626
- function hotfixPoolInfoU64Padding(options) {
627
- const packageAddress = options.package ?? "@typus/stake-pool";
628
- const argumentsTypes = [
629
- `${packageAddress}::admin::Version`,
630
- `${packageAddress}::stake_pool::StakePoolRegistry`,
631
- "u64",
632
- "vector<u64>",
633
- ];
634
- const parameterNames = ["version", "registry", "index", "u64Padding"];
635
- return (tx) => tx.moveCall({
636
- package: packageAddress,
637
- module: "stake_pool",
638
- function: "hotfix_pool_info_u64_padding",
639
- arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
640
- });
641
- }
642
627
  /** [User Function] Get the staking exp */
643
628
  function snapshot(options) {
644
629
  const packageAddress = options.package ?? "@typus/stake-pool";
645
630
  const argumentsTypes = [
646
631
  `${packageAddress}::admin::Version`,
647
632
  `${packageAddress}::stake_pool::StakePoolRegistry`,
648
- "0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a::ecosystem::Version",
649
- "0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a::user::TypusUserRegistry",
650
- "u64",
633
+ "0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::ecosystem::Version",
634
+ "0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::user::TypusUserRegistry",
651
635
  "u64",
652
636
  "0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
653
637
  ];
654
- const parameterNames = ["version", "registry", "typusEcosystemVersion", "typusUserRegistry", "index", "UserShareId"];
638
+ const parameterNames = ["version", "registry", "typusEcosystemVersion", "typusUserRegistry", "index"];
655
639
  return (tx) => tx.moveCall({
656
640
  package: packageAddress,
657
641
  module: "stake_pool",
@@ -666,11 +650,10 @@ function unsubscribe(options) {
666
650
  `${packageAddress}::admin::Version`,
667
651
  `${packageAddress}::stake_pool::StakePoolRegistry`,
668
652
  "u64",
669
- "u64",
670
653
  "0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>",
671
654
  "0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
672
655
  ];
673
- const parameterNames = ["version", "registry", "index", "UserShareId", "unsubscribedShares"];
656
+ const parameterNames = ["version", "registry", "index", "unsubscribedShares"];
674
657
  return (tx) => tx.moveCall({
675
658
  package: packageAddress,
676
659
  module: "stake_pool",
@@ -686,10 +669,9 @@ function unstake(options) {
686
669
  `${packageAddress}::admin::Version`,
687
670
  `${packageAddress}::stake_pool::StakePoolRegistry`,
688
671
  "u64",
689
- "u64",
690
672
  "0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
691
673
  ];
692
- const parameterNames = ["version", "registry", "index", "UserShareId"];
674
+ const parameterNames = ["version", "registry", "index"];
693
675
  return (tx) => tx.moveCall({
694
676
  package: packageAddress,
695
677
  module: "stake_pool",
@@ -731,10 +713,9 @@ function harvestPerUserShare(options) {
731
713
  `${packageAddress}::admin::Version`,
732
714
  `${packageAddress}::stake_pool::StakePoolRegistry`,
733
715
  "u64",
734
- "u64",
735
716
  "0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
736
717
  ];
737
- const parameterNames = ["version", "registry", "index", "UserShareId"];
718
+ const parameterNames = ["version", "registry", "index"];
738
719
  return (tx) => tx.moveCall({
739
720
  package: packageAddress,
740
721
  module: "stake_pool",
@@ -891,28 +872,3 @@ function getLastIncentivePriceIndex(options) {
891
872
  arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
892
873
  });
893
874
  }
894
- function withdrawIncentive(options) {
895
- const packageAddress = options.package ?? "@typus/stake-pool";
896
- const argumentsTypes = [
897
- `${packageAddress}::admin::Version`,
898
- `${packageAddress}::stake_pool::StakePoolRegistry`,
899
- "u64",
900
- "0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>",
901
- ];
902
- const parameterNames = ["version", "registry", "index", "amount"];
903
- return (tx) => tx.moveCall({
904
- package: packageAddress,
905
- module: "stake_pool",
906
- function: "withdraw_incentive",
907
- arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
908
- typeArguments: options.typeArguments,
909
- });
910
- }
911
- function deprecated(options = {}) {
912
- const packageAddress = options.package ?? "@typus/stake-pool";
913
- return (tx) => tx.moveCall({
914
- package: packageAddress,
915
- module: "stake_pool",
916
- function: "deprecated",
917
- });
918
- }
package/dist/src/index.js CHANGED
@@ -36,13 +36,13 @@ exports.PERP_PKG_V1 = exports.NETWORK == "MAINNET"
36
36
  : "0x29d1dcc803ec1cc1b4c98a8c818c655ecf432ebd2f85757bffc21806d329e240";
37
37
  exports.STAKE_PACKAGE_ID = exports.NETWORK == "MAINNET"
38
38
  ? "0xc427209145715a00a93d7e674a95c556a7147d79fda1bbaeb1a1cac5f9923966"
39
- : "0xcfe3d323fec2dde129480328dbcf075bc47bac50f916f33746d74f1c875acd2e";
39
+ : "0xa59d5f571a6f57ee5faf842ec633245afb78ca3721b8b1194052c69ad6a12230";
40
40
  exports.STAKE_PUBLISHED_AT = exports.NETWORK == "MAINNET"
41
41
  ? "0xdf96424bc1ba70a6e53c07b2b55c597eccb8a21f722a917a5b4c9d8514b2d858"
42
- : "0xcfe3d323fec2dde129480328dbcf075bc47bac50f916f33746d74f1c875acd2e";
42
+ : "0xa59d5f571a6f57ee5faf842ec633245afb78ca3721b8b1194052c69ad6a12230";
43
43
  exports.STAKE_PKG_V1 = exports.NETWORK == "MAINNET"
44
44
  ? "0xc427209145715a00a93d7e674a95c556a7147d79fda1bbaeb1a1cac5f9923966"
45
- : "0xcfe3d323fec2dde129480328dbcf075bc47bac50f916f33746d74f1c875acd2e";
45
+ : "0xa59d5f571a6f57ee5faf842ec633245afb78ca3721b8b1194052c69ad6a12230";
46
46
  // lp_pool::Registry
47
47
  exports.LP_POOL = exports.NETWORK == "MAINNET"
48
48
  ? "0xfee68e535bf24702be28fa38ea2d5946e617e0035027d5ca29dbed99efd82aaa"
@@ -64,10 +64,10 @@ exports.TLP_TREASURY_CAP = exports.NETWORK == "MAINNET"
64
64
  // StakePoolRegistry
65
65
  exports.STAKE_POOL = exports.NETWORK == "MAINNET"
66
66
  ? "0x2cdf93717f87a8a7aeb98b27777b3b643f0ae2b277f44e6bcda0fc655a47d3e0"
67
- : "0xc48d38a6cd76ac6628ba98f1bdad7ade8d4b5273066aa4408a81e5e00a92363e";
67
+ : "0xa43479d938b1d46e2dc3ae0558a54c2ab32312a1da8eeaa8d5b49238e739b2fa";
68
68
  exports.STAKE_POOL_VERSION = exports.NETWORK == "MAINNET"
69
69
  ? "0xdf3ed1599218b2415b2cd7fa06296f7f647676019b2873ec18e55a626c584f1b"
70
- : "0x138583562f9f8fc6261e8fd752a105eb42c8887f83efaba87b42a757f3d98765";
70
+ : "0x57221de2517aee3d628be7fcf07afb9f6021edb06b519e57bd84ec5d37fff6f5";
71
71
  exports.COMPETITION_CONFIG = exports.NETWORK == "MAINNET"
72
72
  ? "0x36056abf9adde86f81667dad680a8ac98868c9fc1cb4d519fd2222d5d4522906"
73
73
  : "0xbb246d6ee24d7c751777d81cbf95ffcfcda26910fecfdcfedab81b2b8e48dfe5";
@@ -1,8 +1,14 @@
1
+ import { Markets } from "../../src/generated/typus_perp/trading";
1
2
  import { Position, TradingOrder } from "../../src/generated/typus_perp/position";
2
3
  import { TOKEN } from "@typus/typus-sdk/dist/src/constants";
3
4
  import { Transaction } from "@mysten/sui/transactions";
4
5
  import { TypusClient } from "../../src/client";
6
+ export declare function findMarketIndex(client: TypusClient, input: {
7
+ markets: (typeof Markets.$inferType)[];
8
+ tradingToken: TOKEN;
9
+ }): number | undefined;
5
10
  export declare function createTradingOrder(client: TypusClient, tx: Transaction, input: {
11
+ perpIndex: string;
6
12
  coins: string[];
7
13
  cToken: TOKEN;
8
14
  amount: string;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findMarketIndex = findMarketIndex;
3
4
  exports.createTradingOrder = createTradingOrder;
4
5
  exports.zeroCoin = zeroCoin;
5
6
  exports.cancelTradingOrder = cancelTradingOrder;
@@ -10,6 +11,17 @@ const trading_1 = require("../../src/generated/typus_perp/trading");
10
11
  const __1 = require("..");
11
12
  const utils_1 = require("@typus/typus-sdk/dist/src/utils");
12
13
  const constants_1 = require("@typus/typus-sdk/dist/src/constants");
14
+ const utils_2 = require("@mysten/sui/utils");
15
+ function findMarketIndex(client, input) {
16
+ let target = constants_1.tokenType[client.config.network][input.tradingToken];
17
+ for (let i = 0; i < input.markets.length; i++) {
18
+ for (let symbol of input.markets[i].symbols) {
19
+ if ((0, utils_2.normalizeStructTag)(symbol.name) == target) {
20
+ return i;
21
+ }
22
+ }
23
+ }
24
+ }
13
25
  async function createTradingOrder(client, tx, input) {
14
26
  // INPUTS
15
27
  let TOKEN = input.cToken;
@@ -40,8 +52,8 @@ async function createTradingOrder(client, tx, input) {
40
52
  version: __1.PERP_VERSION,
41
53
  registry: __1.MARKET,
42
54
  poolRegistry: __1.LP_POOL,
43
- marketIndex: BigInt(0),
44
- poolIndex: BigInt(0),
55
+ marketIndex: BigInt(input.perpIndex),
56
+ poolIndex: BigInt(input.perpIndex),
45
57
  typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
46
58
  typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
47
59
  typusEcosystemVersion: client.config.version.typus,
@@ -75,7 +87,8 @@ async function cancelTradingOrder(client, tx, input) {
75
87
  arguments: {
76
88
  version: __1.PERP_VERSION,
77
89
  registry: __1.MARKET,
78
- marketIndex: BigInt(0),
90
+ // @ts-ignore
91
+ marketIndex: BigInt(input.order.marketIndex),
79
92
  orderId: BigInt(input.order.order_id),
80
93
  triggerPrice: BigInt(input.order.trigger_price),
81
94
  orderUser: null,
@@ -110,13 +123,15 @@ async function increaseCollateral(client, tx, input) {
110
123
  for (let token of tokens) {
111
124
  (0, utils_1.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
112
125
  }
126
+ // @ts-ignore
127
+ let marketIndex = BigInt(input.position.marketIndex);
113
128
  tx.add((0, trading_1.increaseCollateral)({
114
129
  arguments: {
115
130
  version: __1.PERP_VERSION,
116
131
  registry: __1.MARKET,
117
132
  poolRegistry: __1.LP_POOL,
118
- marketIndex: BigInt(0),
119
- poolIndex: BigInt(0),
133
+ marketIndex: marketIndex,
134
+ poolIndex: marketIndex,
120
135
  typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
121
136
  typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
122
137
  positionId: BigInt(input.position.position_id),
@@ -141,13 +156,15 @@ async function releaseCollateral(client, tx, input) {
141
156
  }
142
157
  let cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
143
158
  let baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
159
+ // @ts-ignore
160
+ let marketIndex = BigInt(input.position.marketIndex);
144
161
  let coin = tx.add((0, trading_1.releaseCollateral)({
145
162
  arguments: {
146
163
  version: __1.PERP_VERSION,
147
164
  registry: __1.MARKET,
148
165
  poolRegistry: __1.LP_POOL,
149
- marketIndex: BigInt(0),
150
- poolIndex: BigInt(0),
166
+ marketIndex: marketIndex,
167
+ poolIndex: marketIndex,
151
168
  typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
152
169
  typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
153
170
  positionId: BigInt(input.position.position_id),
@@ -173,13 +190,15 @@ async function collectPositionFundingFee(client, tx, input) {
173
190
  }
174
191
  let cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
175
192
  let baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
193
+ // @ts-ignore
194
+ let marketIndex = BigInt(input.position.marketIndex);
176
195
  tx.add((0, trading_1.collectPositionFundingFee)({
177
196
  arguments: {
178
197
  version: __1.PERP_VERSION,
179
198
  registry: __1.MARKET,
180
199
  poolRegistry: __1.LP_POOL,
181
- marketIndex: BigInt(0),
182
- poolIndex: BigInt(0),
200
+ marketIndex: marketIndex,
201
+ poolIndex: marketIndex,
183
202
  typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
184
203
  typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
185
204
  positionId: BigInt(input.position.position_id),
@@ -2,6 +2,7 @@ import { Transaction } from "@mysten/sui/transactions";
2
2
  import { TOKEN } from "@typus/typus-sdk/dist/src/constants";
3
3
  import { TypusClient } from "../../src/client";
4
4
  export declare function createTradingOrderWithBidReceiptByAutoBid(client: TypusClient, tx: Transaction, input: {
5
+ perpIndex: string;
5
6
  cToken: TOKEN;
6
7
  tradingToken: TOKEN;
7
8
  isLong: boolean;
@@ -11,9 +12,9 @@ export declare function createTradingOrderWithBidReceiptByAutoBid(client: TypusC
11
12
  signalIndex: string;
12
13
  strategyIndex: string;
13
14
  suiCoins?: string[];
14
- perpIndex?: number;
15
15
  }): Promise<Transaction>;
16
16
  export declare function createTradingOrderWithBidReceipt(client: TypusClient, tx: Transaction, input: {
17
+ perpIndex: string;
17
18
  cToken: TOKEN;
18
19
  tradingToken: TOKEN;
19
20
  isLong: boolean;
@@ -23,14 +24,13 @@ export declare function createTradingOrderWithBidReceipt(client: TypusClient, tx
23
24
  bidReceipts: string[];
24
25
  share?: string;
25
26
  suiCoins?: string[];
26
- perpIndex?: number;
27
27
  }): Promise<Transaction>;
28
28
  export declare function reduceOptionCollateralPositionSize(client: TypusClient, tx: Transaction, input: {
29
+ perpIndex: string;
29
30
  cToken: TOKEN;
30
31
  tradingToken: TOKEN;
31
32
  bToken: string;
32
33
  positionId: string;
33
34
  orderSize: string | null;
34
35
  suiCoins?: string[];
35
- perpIndex?: number;
36
36
  }): Promise<Transaction>;
@@ -36,8 +36,8 @@ async function createTradingOrderWithBidReceiptByAutoBid(client, tx, input) {
36
36
  version: __1.PERP_VERSION,
37
37
  registry: __1.MARKET,
38
38
  poolRegistry: __1.LP_POOL,
39
- marketIndex: BigInt(input.perpIndex ?? 0),
40
- poolIndex: BigInt(input.perpIndex ?? 0),
39
+ marketIndex: BigInt(input.perpIndex),
40
+ poolIndex: BigInt(input.perpIndex),
41
41
  typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
42
42
  typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
43
43
  typusEcosystemVersion: client.config.version.typus,
@@ -81,8 +81,8 @@ async function createTradingOrderWithBidReceipt(client, tx, input) {
81
81
  version: __1.PERP_VERSION,
82
82
  registry: __1.MARKET,
83
83
  poolRegistry: __1.LP_POOL,
84
- marketIndex: BigInt(input.perpIndex ?? 0),
85
- poolIndex: BigInt(input.perpIndex ?? 0),
84
+ marketIndex: BigInt(input.perpIndex),
85
+ poolIndex: BigInt(input.perpIndex),
86
86
  typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
87
87
  typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
88
88
  typusEcosystemVersion: client.config.version.typus,
@@ -118,8 +118,8 @@ async function reduceOptionCollateralPositionSize(client, tx, input) {
118
118
  version: __1.PERP_VERSION,
119
119
  registry: __1.MARKET,
120
120
  poolRegistry: __1.LP_POOL,
121
- marketIndex: BigInt(input.perpIndex ?? 0),
122
- poolIndex: BigInt(input.perpIndex ?? 0),
121
+ marketIndex: BigInt(input.perpIndex),
122
+ poolIndex: BigInt(input.perpIndex),
123
123
  typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
124
124
  typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
125
125
  typusEcosystemVersion: client.config.version.typus,