@typus/typus-perp-sdk 1.1.32-codegen-exp18 → 1.1.32-codegen-exp19
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/user/order.d.ts +3 -0
- package/dist/src/user/order.js +21 -6
- package/package.json +2 -2
package/dist/src/user/order.d.ts
CHANGED
|
@@ -29,17 +29,20 @@ export declare function cancelTradingOrder(client: TypusClient, tx: Transaction,
|
|
|
29
29
|
user: string;
|
|
30
30
|
}): Promise<Transaction>;
|
|
31
31
|
export declare function increaseCollateral(client: TypusClient, tx: Transaction, input: {
|
|
32
|
+
oracleContract?: string;
|
|
32
33
|
coins: string[];
|
|
33
34
|
amount: string;
|
|
34
35
|
position: typeof Position.$inferType;
|
|
35
36
|
suiCoins?: string[];
|
|
36
37
|
}): Promise<Transaction>;
|
|
37
38
|
export declare function releaseCollateral(client: TypusClient, tx: Transaction, input: {
|
|
39
|
+
oracleContract?: string;
|
|
38
40
|
position: typeof Position.$inferType;
|
|
39
41
|
amount: string;
|
|
40
42
|
suiCoins?: string[];
|
|
41
43
|
}): Promise<Transaction>;
|
|
42
44
|
export declare function collectPositionFundingFee(client: TypusClient, tx: Transaction, input: {
|
|
45
|
+
oracleContract?: string;
|
|
43
46
|
position: typeof Position.$inferType;
|
|
44
47
|
suiCoins?: string[];
|
|
45
48
|
}): Promise<Transaction>;
|
package/dist/src/user/order.js
CHANGED
|
@@ -120,10 +120,15 @@ async function increaseCollateral(client, tx, input) {
|
|
|
120
120
|
coin = (0, utils_2.splitCoin)(tx, cToken, input.coins, input.amount, client.config.sponsored);
|
|
121
121
|
// no suiCoin
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
const tokensWithoutTypus = Array.from(new Set([TOKEN, BASE_TOKEN])).filter((token) => token !== "TYPUS");
|
|
124
|
+
await (0, utils_2.updatePyth)(client.pythClient, tx, tokensWithoutTypus, suiCoin);
|
|
125
|
+
for (let token of tokensWithoutTypus) {
|
|
125
126
|
(0, utils_2.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
|
|
126
127
|
}
|
|
128
|
+
if (tokens.includes("TYPUS")) {
|
|
129
|
+
const oracleContract = input.oracleContract ?? client.config.package.oracle;
|
|
130
|
+
tx = await (0, utils_1.updateOracleWithSignatureTx)(__1.NETWORK, tx, oracleContract, constants_1.tokenType[__1.NETWORK]["TYPUS"]);
|
|
131
|
+
}
|
|
127
132
|
// @ts-ignore
|
|
128
133
|
let marketIndex = BigInt(input.position.marketIndex);
|
|
129
134
|
tx.add((0, trading_1.increaseCollateral)({
|
|
@@ -151,10 +156,15 @@ async function releaseCollateral(client, tx, input) {
|
|
|
151
156
|
if (client.config.sponsored) {
|
|
152
157
|
suiCoin = (0, utils_2.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), client.config.sponsored);
|
|
153
158
|
}
|
|
154
|
-
|
|
155
|
-
|
|
159
|
+
const tokensWithoutTypus = Array.from(new Set([TOKEN, BASE_TOKEN])).filter((token) => token !== "TYPUS");
|
|
160
|
+
await (0, utils_2.updatePyth)(client.pythClient, tx, tokensWithoutTypus, suiCoin);
|
|
161
|
+
for (let token of tokensWithoutTypus) {
|
|
156
162
|
(0, utils_2.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
|
|
157
163
|
}
|
|
164
|
+
if (tokens.includes("TYPUS")) {
|
|
165
|
+
const oracleContract = input.oracleContract ?? client.config.package.oracle;
|
|
166
|
+
tx = await (0, utils_1.updateOracleWithSignatureTx)(__1.NETWORK, tx, oracleContract, constants_1.tokenType[__1.NETWORK]["TYPUS"]);
|
|
167
|
+
}
|
|
158
168
|
let cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
|
|
159
169
|
let baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
|
|
160
170
|
// @ts-ignore
|
|
@@ -185,10 +195,15 @@ async function collectPositionFundingFee(client, tx, input) {
|
|
|
185
195
|
if (client.config.sponsored) {
|
|
186
196
|
suiCoin = (0, utils_2.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), client.config.sponsored);
|
|
187
197
|
}
|
|
188
|
-
|
|
189
|
-
|
|
198
|
+
const tokensWithoutTypus = Array.from(new Set([TOKEN, BASE_TOKEN])).filter((token) => token !== "TYPUS");
|
|
199
|
+
await (0, utils_2.updatePyth)(client.pythClient, tx, tokensWithoutTypus, suiCoin);
|
|
200
|
+
for (let token of tokensWithoutTypus) {
|
|
190
201
|
(0, utils_2.updateOracleWithPythUsd)(client.pythClient, tx, client.config.package.oracle, token);
|
|
191
202
|
}
|
|
203
|
+
if (tokens.includes("TYPUS")) {
|
|
204
|
+
const oracleContract = input.oracleContract ?? client.config.package.oracle;
|
|
205
|
+
tx = await (0, utils_1.updateOracleWithSignatureTx)(__1.NETWORK, tx, oracleContract, constants_1.tokenType[__1.NETWORK]["TYPUS"]);
|
|
206
|
+
}
|
|
192
207
|
let cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
|
|
193
208
|
let baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
|
|
194
209
|
// @ts-ignore
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typus/typus-perp-sdk",
|
|
3
|
-
"version": "1.1.32-codegen-
|
|
3
|
+
"version": "1.1.32-codegen-exp19",
|
|
4
4
|
"repository": "https://github.com/Typus-Lab/typus-perp-sdk.git",
|
|
5
5
|
"author": "Typus",
|
|
6
6
|
"description": "typus perp sdk",
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://github.com/Typus-Lab/typus-perp-sdk#readme",
|
|
46
46
|
"packageManager": "yarn@4.10.3+sha512.c38cafb5c7bb273f3926d04e55e1d8c9dfa7d9c3ea1f36a4868fa028b9e5f72298f0b7f401ad5eb921749eb012eb1c3bb74bf7503df3ee43fd600d14a018266f"
|
|
47
|
-
}
|
|
47
|
+
}
|