@typus/typus-perp-sdk 1.1.32-codegen-exp1 → 1.1.32-codegen-exp3
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/fetch.d.ts +435 -29
- package/dist/src/fetch.js +9 -7
- package/dist/src/generated/typus_stake_pool/admin.d.ts +135 -1
- package/dist/src/generated/typus_stake_pool/admin.js +181 -0
- package/dist/src/generated/typus_stake_pool/stake_pool.d.ts +32 -69
- package/dist/src/generated/typus_stake_pool/stake_pool.js +21 -65
- package/dist/src/index.js +5 -5
- package/dist/src/user/order.d.ts +5 -0
- package/dist/src/user/order.js +9 -9
- package/dist/src/user/tlp.d.ts +2 -10
- package/dist/src/user/tlp.js +29 -28
- package/package.json +45 -46
|
@@ -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
|
-
|
|
104
|
-
|
|
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
|
-
|
|
203
|
-
|
|
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"
|
|
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
|
-
"
|
|
649
|
-
"
|
|
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"
|
|
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", "
|
|
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"
|
|
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"
|
|
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
|
-
: "
|
|
39
|
+
: "0xa59d5f571a6f57ee5faf842ec633245afb78ca3721b8b1194052c69ad6a12230";
|
|
40
40
|
exports.STAKE_PUBLISHED_AT = exports.NETWORK == "MAINNET"
|
|
41
41
|
? "0xdf96424bc1ba70a6e53c07b2b55c597eccb8a21f722a917a5b4c9d8514b2d858"
|
|
42
|
-
: "
|
|
42
|
+
: "0xa59d5f571a6f57ee5faf842ec633245afb78ca3721b8b1194052c69ad6a12230";
|
|
43
43
|
exports.STAKE_PKG_V1 = exports.NETWORK == "MAINNET"
|
|
44
44
|
? "0xc427209145715a00a93d7e674a95c556a7147d79fda1bbaeb1a1cac5f9923966"
|
|
45
|
-
: "
|
|
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
|
-
: "
|
|
67
|
+
: "0xa43479d938b1d46e2dc3ae0558a54c2ab32312a1da8eeaa8d5b49238e739b2fa";
|
|
68
68
|
exports.STAKE_POOL_VERSION = exports.NETWORK == "MAINNET"
|
|
69
69
|
? "0xdf3ed1599218b2415b2cd7fa06296f7f647676019b2873ec18e55a626c584f1b"
|
|
70
|
-
: "
|
|
70
|
+
: "0x57221de2517aee3d628be7fcf07afb9f6021edb06b519e57bd84ec5d37fff6f5";
|
|
71
71
|
exports.COMPETITION_CONFIG = exports.NETWORK == "MAINNET"
|
|
72
72
|
? "0x36056abf9adde86f81667dad680a8ac98868c9fc1cb4d519fd2222d5d4522906"
|
|
73
73
|
: "0xbb246d6ee24d7c751777d81cbf95ffcfcda26910fecfdcfedab81b2b8e48dfe5";
|
package/dist/src/user/order.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { TOKEN } from "@typus/typus-sdk/dist/src/constants";
|
|
|
3
3
|
import { Transaction } from "@mysten/sui/transactions";
|
|
4
4
|
import { TypusClient } from "../../src/client";
|
|
5
5
|
export declare function createTradingOrder(client: TypusClient, tx: Transaction, input: {
|
|
6
|
+
perpIndex: string;
|
|
6
7
|
coins: string[];
|
|
7
8
|
cToken: TOKEN;
|
|
8
9
|
amount: string;
|
|
@@ -17,21 +18,25 @@ export declare function createTradingOrder(client: TypusClient, tx: Transaction,
|
|
|
17
18
|
}): Promise<Transaction>;
|
|
18
19
|
export declare function zeroCoin(tx: Transaction, typeArgs: [string]): import("@mysten/sui/transactions").TransactionResult;
|
|
19
20
|
export declare function cancelTradingOrder(client: TypusClient, tx: Transaction, input: {
|
|
21
|
+
perpIndex: string;
|
|
20
22
|
order: typeof TradingOrder.$inferType;
|
|
21
23
|
user: string;
|
|
22
24
|
}): Promise<Transaction>;
|
|
23
25
|
export declare function increaseCollateral(client: TypusClient, tx: Transaction, input: {
|
|
26
|
+
perpIndex: string;
|
|
24
27
|
coins: string[];
|
|
25
28
|
amount: string;
|
|
26
29
|
position: typeof Position.$inferType;
|
|
27
30
|
suiCoins?: string[];
|
|
28
31
|
}): Promise<Transaction>;
|
|
29
32
|
export declare function releaseCollateral(client: TypusClient, tx: Transaction, input: {
|
|
33
|
+
perpIndex: string;
|
|
30
34
|
position: typeof Position.$inferType;
|
|
31
35
|
amount: string;
|
|
32
36
|
suiCoins?: string[];
|
|
33
37
|
}): Promise<Transaction>;
|
|
34
38
|
export declare function collectPositionFundingFee(client: TypusClient, tx: Transaction, input: {
|
|
39
|
+
perpIndex: string;
|
|
35
40
|
position: typeof Position.$inferType;
|
|
36
41
|
suiCoins?: string[];
|
|
37
42
|
}): Promise<Transaction>;
|
package/dist/src/user/order.js
CHANGED
|
@@ -40,8 +40,8 @@ async function createTradingOrder(client, tx, input) {
|
|
|
40
40
|
version: __1.PERP_VERSION,
|
|
41
41
|
registry: __1.MARKET,
|
|
42
42
|
poolRegistry: __1.LP_POOL,
|
|
43
|
-
marketIndex: BigInt(
|
|
44
|
-
poolIndex: BigInt(
|
|
43
|
+
marketIndex: BigInt(input.perpIndex),
|
|
44
|
+
poolIndex: BigInt(input.perpIndex),
|
|
45
45
|
typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
|
|
46
46
|
typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
|
|
47
47
|
typusEcosystemVersion: client.config.version.typus,
|
|
@@ -75,7 +75,7 @@ async function cancelTradingOrder(client, tx, input) {
|
|
|
75
75
|
arguments: {
|
|
76
76
|
version: __1.PERP_VERSION,
|
|
77
77
|
registry: __1.MARKET,
|
|
78
|
-
marketIndex: BigInt(
|
|
78
|
+
marketIndex: BigInt(input.perpIndex),
|
|
79
79
|
orderId: BigInt(input.order.order_id),
|
|
80
80
|
triggerPrice: BigInt(input.order.trigger_price),
|
|
81
81
|
orderUser: null,
|
|
@@ -115,8 +115,8 @@ async function increaseCollateral(client, tx, input) {
|
|
|
115
115
|
version: __1.PERP_VERSION,
|
|
116
116
|
registry: __1.MARKET,
|
|
117
117
|
poolRegistry: __1.LP_POOL,
|
|
118
|
-
marketIndex: BigInt(
|
|
119
|
-
poolIndex: BigInt(
|
|
118
|
+
marketIndex: BigInt(input.perpIndex),
|
|
119
|
+
poolIndex: BigInt(input.perpIndex),
|
|
120
120
|
typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
|
|
121
121
|
typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
|
|
122
122
|
positionId: BigInt(input.position.position_id),
|
|
@@ -146,8 +146,8 @@ async function releaseCollateral(client, tx, input) {
|
|
|
146
146
|
version: __1.PERP_VERSION,
|
|
147
147
|
registry: __1.MARKET,
|
|
148
148
|
poolRegistry: __1.LP_POOL,
|
|
149
|
-
marketIndex: BigInt(
|
|
150
|
-
poolIndex: BigInt(
|
|
149
|
+
marketIndex: BigInt(input.perpIndex),
|
|
150
|
+
poolIndex: BigInt(input.perpIndex),
|
|
151
151
|
typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
|
|
152
152
|
typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
|
|
153
153
|
positionId: BigInt(input.position.position_id),
|
|
@@ -178,8 +178,8 @@ async function collectPositionFundingFee(client, tx, input) {
|
|
|
178
178
|
version: __1.PERP_VERSION,
|
|
179
179
|
registry: __1.MARKET,
|
|
180
180
|
poolRegistry: __1.LP_POOL,
|
|
181
|
-
marketIndex: BigInt(
|
|
182
|
-
poolIndex: BigInt(
|
|
181
|
+
marketIndex: BigInt(input.perpIndex),
|
|
182
|
+
poolIndex: BigInt(input.perpIndex),
|
|
183
183
|
typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
|
|
184
184
|
typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
|
|
185
185
|
positionId: BigInt(input.position.position_id),
|
package/dist/src/user/tlp.d.ts
CHANGED
|
@@ -4,8 +4,7 @@ import { StakePool } from "../../src/generated/typus_stake_pool/stake_pool";
|
|
|
4
4
|
import { LiquidityPool } from "../../src/generated/typus_perp/lp_pool";
|
|
5
5
|
import { TypusClient } from "../../src/client";
|
|
6
6
|
export declare function snapshot(client: TypusClient, tx: Transaction, input: {
|
|
7
|
-
|
|
8
|
-
perpIndex?: number;
|
|
7
|
+
perpIndex: string;
|
|
9
8
|
}): Promise<Transaction>;
|
|
10
9
|
export declare function mintStakeLp(client: TypusClient, tx: Transaction, input: {
|
|
11
10
|
lpPool: typeof LiquidityPool.$inferType;
|
|
@@ -18,7 +17,6 @@ export declare function mintStakeLp(client: TypusClient, tx: Transaction, input:
|
|
|
18
17
|
user: string;
|
|
19
18
|
stake: boolean;
|
|
20
19
|
suiCoins?: string[];
|
|
21
|
-
perpIndex?: number;
|
|
22
20
|
}): Promise<Transaction>;
|
|
23
21
|
export declare function stakeLp(client: TypusClient, tx: Transaction, input: {
|
|
24
22
|
stakePool: typeof StakePool.$inferType;
|
|
@@ -26,7 +24,6 @@ export declare function stakeLp(client: TypusClient, tx: Transaction, input: {
|
|
|
26
24
|
amount: string;
|
|
27
25
|
userShareId: string | null;
|
|
28
26
|
user: string;
|
|
29
|
-
perpIndex?: number;
|
|
30
27
|
}): Promise<Transaction>;
|
|
31
28
|
export declare function unstake(client: TypusClient, tx: Transaction, input: {
|
|
32
29
|
lpPool: typeof LiquidityPool.$inferType;
|
|
@@ -34,7 +31,6 @@ export declare function unstake(client: TypusClient, tx: Transaction, input: {
|
|
|
34
31
|
userShareId: string;
|
|
35
32
|
share: string | null;
|
|
36
33
|
user: string;
|
|
37
|
-
perpIndex?: number;
|
|
38
34
|
}): Promise<Transaction>;
|
|
39
35
|
export declare function unstakeRedeem(client: TypusClient, tx: Transaction, input: {
|
|
40
36
|
lpPool: typeof LiquidityPool.$inferType;
|
|
@@ -43,7 +39,6 @@ export declare function unstakeRedeem(client: TypusClient, tx: Transaction, inpu
|
|
|
43
39
|
share: string | null;
|
|
44
40
|
user: string;
|
|
45
41
|
suiCoins?: string[];
|
|
46
|
-
perpIndex?: number;
|
|
47
42
|
}): Promise<Transaction>;
|
|
48
43
|
export declare function redeemTlp(client: TypusClient, tx: Transaction, input: {
|
|
49
44
|
lpPool: typeof LiquidityPool.$inferType;
|
|
@@ -51,7 +46,6 @@ export declare function redeemTlp(client: TypusClient, tx: Transaction, input: {
|
|
|
51
46
|
share: string | null;
|
|
52
47
|
user: string;
|
|
53
48
|
suiCoins?: string[];
|
|
54
|
-
perpIndex?: number;
|
|
55
49
|
}): Promise<Transaction>;
|
|
56
50
|
export declare function claim(client: TypusClient, tx: Transaction, input: {
|
|
57
51
|
lpPool: typeof LiquidityPool.$inferType;
|
|
@@ -59,7 +53,6 @@ export declare function claim(client: TypusClient, tx: Transaction, input: {
|
|
|
59
53
|
cTOKEN: TOKEN;
|
|
60
54
|
user: string;
|
|
61
55
|
suiCoins?: string[];
|
|
62
|
-
perpIndex?: number;
|
|
63
56
|
}): Promise<Transaction>;
|
|
64
57
|
export declare function swap(client: TypusClient, tx: Transaction, input: {
|
|
65
58
|
coins: string[];
|
|
@@ -67,12 +60,11 @@ export declare function swap(client: TypusClient, tx: Transaction, input: {
|
|
|
67
60
|
TO_TOKEN: TOKEN;
|
|
68
61
|
amount: string;
|
|
69
62
|
user: string;
|
|
63
|
+
perpIndex: number;
|
|
70
64
|
suiCoins?: string[];
|
|
71
|
-
perpIndex?: number;
|
|
72
65
|
}): Promise<Transaction>;
|
|
73
66
|
export declare function harvestStakeReward(client: TypusClient, tx: Transaction, input: {
|
|
74
67
|
stakePool: typeof StakePool.$inferType;
|
|
75
68
|
userShareId: string;
|
|
76
69
|
user: string;
|
|
77
|
-
perpIndex?: number;
|
|
78
70
|
}): Promise<Transaction>;
|
package/dist/src/user/tlp.js
CHANGED
|
@@ -20,8 +20,7 @@ async function snapshot(client, tx, input) {
|
|
|
20
20
|
arguments: {
|
|
21
21
|
version: __1.STAKE_POOL_VERSION,
|
|
22
22
|
registry: __1.STAKE_POOL,
|
|
23
|
-
index: BigInt(input.perpIndex
|
|
24
|
-
UserShareId: BigInt(input.userShareId),
|
|
23
|
+
index: BigInt(input.perpIndex),
|
|
25
24
|
typusEcosystemVersion: client.config.version.typus,
|
|
26
25
|
typusUserRegistry: client.config.registry.typus.user,
|
|
27
26
|
},
|
|
@@ -54,7 +53,7 @@ async function mintStakeLp(client, tx, input) {
|
|
|
54
53
|
arguments: {
|
|
55
54
|
version: __1.PERP_VERSION,
|
|
56
55
|
registry: __1.LP_POOL,
|
|
57
|
-
index: BigInt(input.
|
|
56
|
+
index: BigInt(input.stakePool.pool_info.index),
|
|
58
57
|
oracle: constants_1.oracle[__1.NETWORK][token],
|
|
59
58
|
},
|
|
60
59
|
typeArguments: [constants_1.tokenType[__1.NETWORK][token]],
|
|
@@ -70,7 +69,7 @@ async function mintStakeLp(client, tx, input) {
|
|
|
70
69
|
version: __1.PERP_VERSION,
|
|
71
70
|
registry: __1.LP_POOL,
|
|
72
71
|
treasuryCaps: __1.TLP_TREASURY_CAP,
|
|
73
|
-
index: BigInt(input.
|
|
72
|
+
index: BigInt(input.stakePool.pool_info.index),
|
|
74
73
|
oracle: constants_1.oracle[__1.NETWORK][input.cTOKEN],
|
|
75
74
|
coin,
|
|
76
75
|
},
|
|
@@ -81,9 +80,8 @@ async function mintStakeLp(client, tx, input) {
|
|
|
81
80
|
arguments: {
|
|
82
81
|
version: __1.STAKE_POOL_VERSION,
|
|
83
82
|
registry: __1.STAKE_POOL,
|
|
84
|
-
index: BigInt(input.
|
|
83
|
+
index: BigInt(input.stakePool.pool_info.index),
|
|
85
84
|
lpToken: lpCoin,
|
|
86
|
-
UserShareId: null,
|
|
87
85
|
},
|
|
88
86
|
typeArguments: [lpToken],
|
|
89
87
|
}));
|
|
@@ -108,9 +106,8 @@ async function stakeLp(client, tx, input) {
|
|
|
108
106
|
arguments: {
|
|
109
107
|
version: __1.STAKE_POOL_VERSION,
|
|
110
108
|
registry: __1.STAKE_POOL,
|
|
111
|
-
index: BigInt(input.
|
|
109
|
+
index: BigInt(input.stakePool.pool_info.index),
|
|
112
110
|
lpToken: lpCoin,
|
|
113
|
-
UserShareId: null,
|
|
114
111
|
},
|
|
115
112
|
typeArguments: [(0, utils_1.normalizeStructTag)(input.stakePool.pool_info.stake_token.name)],
|
|
116
113
|
}));
|
|
@@ -123,9 +120,8 @@ async function unstake(client, tx, input) {
|
|
|
123
120
|
arguments: {
|
|
124
121
|
version: __1.STAKE_POOL_VERSION,
|
|
125
122
|
registry: __1.STAKE_POOL,
|
|
126
|
-
index: BigInt(input.
|
|
123
|
+
index: BigInt(input.stakePool.pool_info.index),
|
|
127
124
|
unsubscribedShares: input.share ? BigInt(input.share) : null,
|
|
128
|
-
UserShareId: BigInt(input.userShareId),
|
|
129
125
|
},
|
|
130
126
|
typeArguments: [lpToken],
|
|
131
127
|
}));
|
|
@@ -133,8 +129,7 @@ async function unstake(client, tx, input) {
|
|
|
133
129
|
arguments: {
|
|
134
130
|
version: __1.STAKE_POOL_VERSION,
|
|
135
131
|
registry: __1.STAKE_POOL,
|
|
136
|
-
index: BigInt(input.
|
|
137
|
-
UserShareId: BigInt(input.userShareId),
|
|
132
|
+
index: BigInt(input.stakePool.pool_info.index),
|
|
138
133
|
},
|
|
139
134
|
typeArguments: [lpToken],
|
|
140
135
|
}));
|
|
@@ -152,7 +147,12 @@ async function unstakeRedeem(client, tx, input) {
|
|
|
152
147
|
for (let token of tokens) {
|
|
153
148
|
(0, utils_2.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
|
|
154
149
|
(0, lp_pool_1.updateLiquidityValue)({
|
|
155
|
-
arguments: {
|
|
150
|
+
arguments: {
|
|
151
|
+
version: __1.PERP_VERSION,
|
|
152
|
+
registry: __1.LP_POOL,
|
|
153
|
+
index: BigInt(input.stakePool.pool_info.index),
|
|
154
|
+
oracle: constants_1.oracle[__1.NETWORK][token],
|
|
155
|
+
},
|
|
156
156
|
typeArguments: [constants_1.tokenType[__1.NETWORK][token]],
|
|
157
157
|
})(tx);
|
|
158
158
|
}
|
|
@@ -162,9 +162,8 @@ async function unstakeRedeem(client, tx, input) {
|
|
|
162
162
|
arguments: {
|
|
163
163
|
version: __1.STAKE_POOL_VERSION,
|
|
164
164
|
registry: __1.STAKE_POOL,
|
|
165
|
-
index: BigInt(input.
|
|
165
|
+
index: BigInt(input.stakePool.pool_info.index),
|
|
166
166
|
unsubscribedShares: input.share ? BigInt(input.share) : null,
|
|
167
|
-
UserShareId: BigInt(input.userShareId),
|
|
168
167
|
},
|
|
169
168
|
typeArguments: [lpToken],
|
|
170
169
|
}));
|
|
@@ -172,8 +171,7 @@ async function unstakeRedeem(client, tx, input) {
|
|
|
172
171
|
arguments: {
|
|
173
172
|
version: __1.STAKE_POOL_VERSION,
|
|
174
173
|
registry: __1.STAKE_POOL,
|
|
175
|
-
index: BigInt(input.
|
|
176
|
-
UserShareId: BigInt(input.userShareId),
|
|
174
|
+
index: BigInt(input.stakePool.pool_info.index),
|
|
177
175
|
},
|
|
178
176
|
typeArguments: [lpToken],
|
|
179
177
|
}));
|
|
@@ -186,7 +184,7 @@ async function unstakeRedeem(client, tx, input) {
|
|
|
186
184
|
arguments: {
|
|
187
185
|
version: __1.PERP_VERSION,
|
|
188
186
|
registry: __1.LP_POOL,
|
|
189
|
-
index: BigInt(input.
|
|
187
|
+
index: BigInt(input.stakePool.pool_info.index),
|
|
190
188
|
balance,
|
|
191
189
|
},
|
|
192
190
|
typeArguments: [input.lpPool.lp_token_type.name],
|
|
@@ -207,7 +205,7 @@ async function redeemTlp(client, tx, input) {
|
|
|
207
205
|
arguments: {
|
|
208
206
|
version: __1.PERP_VERSION,
|
|
209
207
|
registry: __1.LP_POOL,
|
|
210
|
-
index: BigInt(input.
|
|
208
|
+
index: BigInt(input.lpPool.index),
|
|
211
209
|
oracle: constants_1.oracle[__1.NETWORK][token],
|
|
212
210
|
},
|
|
213
211
|
typeArguments: [constants_1.tokenType[__1.NETWORK][token]],
|
|
@@ -235,7 +233,7 @@ async function redeemTlp(client, tx, input) {
|
|
|
235
233
|
arguments: {
|
|
236
234
|
version: __1.PERP_VERSION,
|
|
237
235
|
registry: __1.LP_POOL,
|
|
238
|
-
index: BigInt(input.
|
|
236
|
+
index: BigInt(input.lpPool.index),
|
|
239
237
|
balance,
|
|
240
238
|
},
|
|
241
239
|
typeArguments: [lpToken],
|
|
@@ -253,7 +251,12 @@ async function claim(client, tx, input) {
|
|
|
253
251
|
for (let token of tokens) {
|
|
254
252
|
(0, utils_2.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
|
|
255
253
|
(0, lp_pool_1.updateLiquidityValue)({
|
|
256
|
-
arguments: {
|
|
254
|
+
arguments: {
|
|
255
|
+
version: __1.PERP_VERSION,
|
|
256
|
+
registry: __1.LP_POOL,
|
|
257
|
+
index: BigInt(input.stakePool.pool_info.index),
|
|
258
|
+
oracle: constants_1.oracle[__1.NETWORK][token],
|
|
259
|
+
},
|
|
257
260
|
typeArguments: [constants_1.tokenType[__1.NETWORK][token]],
|
|
258
261
|
})(tx);
|
|
259
262
|
}
|
|
@@ -262,7 +265,7 @@ async function claim(client, tx, input) {
|
|
|
262
265
|
arguments: {
|
|
263
266
|
version: __1.PERP_VERSION,
|
|
264
267
|
registry: __1.LP_POOL,
|
|
265
|
-
index: BigInt(input.
|
|
268
|
+
index: BigInt(input.stakePool.pool_info.index),
|
|
266
269
|
treasuryCaps: __1.TLP_TREASURY_CAP,
|
|
267
270
|
oracle: constants_1.oracle[__1.NETWORK][input.cTOKEN],
|
|
268
271
|
},
|
|
@@ -295,7 +298,7 @@ async function swap(client, tx, input) {
|
|
|
295
298
|
arguments: {
|
|
296
299
|
version: __1.PERP_VERSION,
|
|
297
300
|
registry: __1.LP_POOL,
|
|
298
|
-
index: BigInt(input.perpIndex
|
|
301
|
+
index: BigInt(input.perpIndex),
|
|
299
302
|
oracleFromToken: constants_1.oracle[__1.NETWORK][input.FROM_TOKEN],
|
|
300
303
|
oracleToToken: constants_1.oracle[__1.NETWORK][input.TO_TOKEN],
|
|
301
304
|
fromCoin: coin,
|
|
@@ -308,15 +311,14 @@ async function swap(client, tx, input) {
|
|
|
308
311
|
}
|
|
309
312
|
async function harvestStakeReward(client, tx, input) {
|
|
310
313
|
let iTokens = input.stakePool.incentives.map((i) => i.token_type.name);
|
|
311
|
-
snapshot(client, tx, {
|
|
314
|
+
snapshot(client, tx, { perpIndex: input.stakePool.pool_info.index });
|
|
312
315
|
for (let iToken of iTokens) {
|
|
313
316
|
// console.log(iToken);
|
|
314
317
|
let iCoin = tx.add((0, stake_pool_1.harvestPerUserShare)({
|
|
315
318
|
arguments: {
|
|
316
319
|
version: __1.STAKE_POOL_VERSION,
|
|
317
320
|
registry: __1.STAKE_POOL,
|
|
318
|
-
index: BigInt(input.
|
|
319
|
-
UserShareId: BigInt(input.userShareId),
|
|
321
|
+
index: BigInt(input.stakePool.pool_info.index),
|
|
320
322
|
},
|
|
321
323
|
typeArguments: [iToken],
|
|
322
324
|
}));
|
|
@@ -326,9 +328,8 @@ async function harvestStakeReward(client, tx, input) {
|
|
|
326
328
|
arguments: {
|
|
327
329
|
version: __1.STAKE_POOL_VERSION,
|
|
328
330
|
registry: __1.STAKE_POOL,
|
|
329
|
-
index: BigInt(input.
|
|
331
|
+
index: BigInt(input.stakePool.pool_info.index),
|
|
330
332
|
lpToken: iCoin,
|
|
331
|
-
UserShareId: BigInt(input.userShareId),
|
|
332
333
|
},
|
|
333
334
|
typeArguments: [(0, utils_1.normalizeStructTag)(input.stakePool.pool_info.stake_token.name)],
|
|
334
335
|
}));
|
package/package.json
CHANGED
|
@@ -1,47 +1,46 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
2
|
+
"name": "@typus/typus-perp-sdk",
|
|
3
|
+
"version": "1.1.32-codegen-exp3",
|
|
4
|
+
"repository": "https://github.com/Typus-Lab/typus-perp-sdk.git",
|
|
5
|
+
"author": "Typus",
|
|
6
|
+
"description": "typus perp sdk",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@mysten/bcs": "1.9.2",
|
|
10
|
+
"@mysten/sui": "1.44.0",
|
|
11
|
+
"@typus/typus-sdk": "1.8.25"
|
|
12
|
+
},
|
|
13
|
+
"resolutions": {
|
|
14
|
+
"@mysten/bcs": "1.9.2",
|
|
15
|
+
"@mysten/sui": "1.44.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/bs58": "^4.0.1",
|
|
19
|
+
"@types/camelcase-keys-deep": "^0.1.2",
|
|
20
|
+
"@types/expect": "^24.3.0",
|
|
21
|
+
"@types/mocha": "^10.0.1",
|
|
22
|
+
"@types/node": "^24.10.1",
|
|
23
|
+
"@types/rx": "^4.1.2",
|
|
24
|
+
"axios": "^1.13.2",
|
|
25
|
+
"prettier": "^3.0.0",
|
|
26
|
+
"ts-node": "^10.9.2",
|
|
27
|
+
"tsc-alias": "^1.8.10",
|
|
28
|
+
"tsconfig-paths": "^4.2.0",
|
|
29
|
+
"tslint": "^6.1.3",
|
|
30
|
+
"tslint-config-prettier": "^1.18.0",
|
|
31
|
+
"typescript": "^5.1.6"
|
|
32
|
+
},
|
|
33
|
+
"main": "dist/src/index.js",
|
|
34
|
+
"types": "dist/src/index.d.ts",
|
|
35
|
+
"files": [
|
|
36
|
+
"dist"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json && tsc-alias"
|
|
40
|
+
},
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/Typus-Lab/typus-perp-sdk/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/Typus-Lab/typus-perp-sdk#readme",
|
|
45
|
+
"packageManager": "yarn@4.10.3+sha512.c38cafb5c7bb273f3926d04e55e1d8c9dfa7d9c3ea1f36a4868fa028b9e5f72298f0b7f401ad5eb921749eb012eb1c3bb74bf7503df3ee43fd600d14a018266f"
|
|
46
|
+
}
|