@typus/typus-perp-sdk 1.0.11 → 1.0.12
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.
|
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PKG_V1 = exports.PUBLISHED_AT = exports.PACKAGE_ID = void 0;
|
|
4
4
|
var index_1 = require("../index");
|
|
5
5
|
exports.PACKAGE_ID = index_1.NETWORK == "MAINNET" ? "" : "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509";
|
|
6
|
-
exports.PUBLISHED_AT = index_1.NETWORK == "MAINNET" ? "" : "
|
|
6
|
+
exports.PUBLISHED_AT = index_1.NETWORK == "MAINNET" ? "" : "0x2ee86fc212394e7440f3c08f897c7a9cdc036f203eb1788332a06e1f69b1b685";
|
|
7
7
|
exports.PKG_V1 = index_1.NETWORK == "MAINNET" ? "" : "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509";
|
|
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PKG_V1 = exports.PUBLISHED_AT = exports.PACKAGE_ID = void 0;
|
|
4
4
|
var index_1 = require("../index");
|
|
5
5
|
exports.PACKAGE_ID = index_1.NETWORK == "MAINNET" ? "" : "0x6db1e799c84de3665b86c7db8db3478b76fef05b194bbe53b479207d85776895";
|
|
6
|
-
exports.PUBLISHED_AT = index_1.NETWORK == "MAINNET" ? "" : "
|
|
6
|
+
exports.PUBLISHED_AT = index_1.NETWORK == "MAINNET" ? "" : "0x1b3d24935e153596e86fc28ce2877885495635f9ed871e5eca4e0e9454a36263";
|
|
7
7
|
exports.PKG_V1 = index_1.NETWORK == "MAINNET" ? "" : "0x6db1e799c84de3665b86c7db8db3478b76fef05b194bbe53b479207d85776895";
|
package/dist/src/user/tlp.d.ts
CHANGED
|
@@ -6,12 +6,15 @@ export declare function mintStakeLp(config: TypusConfig, tx: Transaction, pythCl
|
|
|
6
6
|
lpPool: LiquidityPool;
|
|
7
7
|
coins: string[];
|
|
8
8
|
cTOKEN: TOKEN;
|
|
9
|
+
iTOKEN: TOKEN;
|
|
9
10
|
amount: string;
|
|
10
11
|
userShareId: string | null;
|
|
12
|
+
user: string;
|
|
11
13
|
}): Promise<Transaction>;
|
|
12
14
|
export declare function unstakeBurn(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
13
15
|
lpPool: LiquidityPool;
|
|
14
16
|
cTOKEN: TOKEN;
|
|
17
|
+
iTOKEN: TOKEN;
|
|
15
18
|
userShareId: string;
|
|
16
19
|
share: string | null;
|
|
17
20
|
user: string;
|
package/dist/src/user/tlp.js
CHANGED
|
@@ -75,7 +75,7 @@ var constants_1 = require("@typus/typus-sdk/dist/src/constants");
|
|
|
75
75
|
var __1 = require("..");
|
|
76
76
|
function mintStakeLp(config, tx, pythClient, input) {
|
|
77
77
|
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
-
var tokens, cToken, tokens_1, tokens_1_1, token, coin, destination, lpCoin;
|
|
78
|
+
var tokens, cToken, tokens_1, tokens_1_1, token, coin, destination, iToken, iCoin, lpCoin;
|
|
79
79
|
var e_1, _a, _b, _c;
|
|
80
80
|
return __generator(this, function (_d) {
|
|
81
81
|
switch (_d.label) {
|
|
@@ -117,6 +117,18 @@ function mintStakeLp(config, tx, pythClient, input) {
|
|
|
117
117
|
}
|
|
118
118
|
_c = __read(tx.splitCoins(destination, [input.amount]), 1), coin = _c[0];
|
|
119
119
|
}
|
|
120
|
+
iToken = constants_1.tokenType[__1.NETWORK][input.iTOKEN];
|
|
121
|
+
console.log(iToken);
|
|
122
|
+
if (input.userShareId) {
|
|
123
|
+
iCoin = (0, functions_2.harvestPerUserShare)(tx, iToken, {
|
|
124
|
+
version: __1.STAKE_POOL_VERSION,
|
|
125
|
+
registry: __1.STAKE_POOL,
|
|
126
|
+
index: BigInt(0),
|
|
127
|
+
userShareId: BigInt(input.userShareId),
|
|
128
|
+
clock: constants_1.CLOCK,
|
|
129
|
+
});
|
|
130
|
+
tx.transferObjects([iCoin], input.user);
|
|
131
|
+
}
|
|
120
132
|
lpCoin = (0, functions_1.mintLp)(tx, [cToken, __1.TLP_TOKEN], {
|
|
121
133
|
version: __1.PERP_VERSION,
|
|
122
134
|
registry: __1.LP_POOL,
|
|
@@ -142,7 +154,7 @@ function mintStakeLp(config, tx, pythClient, input) {
|
|
|
142
154
|
}
|
|
143
155
|
function unstakeBurn(config, tx, pythClient, input) {
|
|
144
156
|
return __awaiter(this, void 0, void 0, function () {
|
|
145
|
-
var tokens, cToken, oracle, tokens_2, tokens_2_1, token, lpCoin, coin;
|
|
157
|
+
var tokens, cToken, oracle, tokens_2, tokens_2_1, token, iToken, iCoin, lpCoin, coin;
|
|
146
158
|
var e_2, _a;
|
|
147
159
|
return __generator(this, function (_b) {
|
|
148
160
|
switch (_b.label) {
|
|
@@ -173,6 +185,18 @@ function unstakeBurn(config, tx, pythClient, input) {
|
|
|
173
185
|
}
|
|
174
186
|
finally { if (e_2) throw e_2.error; }
|
|
175
187
|
}
|
|
188
|
+
iToken = constants_1.tokenType[__1.NETWORK][input.iTOKEN];
|
|
189
|
+
console.log(iToken);
|
|
190
|
+
if (input.userShareId) {
|
|
191
|
+
iCoin = (0, functions_2.harvestPerUserShare)(tx, iToken, {
|
|
192
|
+
version: __1.STAKE_POOL_VERSION,
|
|
193
|
+
registry: __1.STAKE_POOL,
|
|
194
|
+
index: BigInt(0),
|
|
195
|
+
userShareId: BigInt(input.userShareId),
|
|
196
|
+
clock: constants_1.CLOCK,
|
|
197
|
+
});
|
|
198
|
+
tx.transferObjects([iCoin], input.user);
|
|
199
|
+
}
|
|
176
200
|
lpCoin = (0, functions_2.unstake)(tx, __1.TLP_TOKEN, {
|
|
177
201
|
version: __1.STAKE_POOL_VERSION,
|
|
178
202
|
registry: __1.STAKE_POOL,
|