@typus/typus-perp-sdk 1.1.32-codegen-exp3 → 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.
- package/dist/src/client.d.ts +2 -1
- package/dist/src/client.js +40 -13
- package/dist/src/fetch.d.ts +6 -31
- package/dist/src/fetch.js +15 -9
- package/dist/src/user/order.d.ts +5 -4
- package/dist/src/user/order.js +26 -7
- package/dist/src/user/orderWithBidReceipt.d.ts +3 -3
- package/dist/src/user/orderWithBidReceipt.js +6 -6
- package/dist/src/user/tlp.d.ts +0 -1
- package/dist/src/user/tlp.js +4 -4
- package/package.json +5 -4
package/dist/src/client.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare class TypusClient {
|
|
|
10
10
|
graphQLClient: SuiGraphQLClient;
|
|
11
11
|
pythClient: PythClient;
|
|
12
12
|
config: TypusConfig;
|
|
13
|
-
constructor(config: TypusConfig
|
|
13
|
+
constructor(config: TypusConfig);
|
|
14
14
|
getCoins(params: GetCoinsParams): Promise<import("@mysten/sui/client").PaginatedCoins>;
|
|
15
15
|
getObject(params: GetObjectParams): Promise<import("@mysten/sui/client").SuiObjectResponse>;
|
|
16
16
|
getOwnedObjects(params: GetOwnedObjectsParams): Promise<import("@mysten/sui/client").PaginatedObjectsResponse>;
|
|
@@ -24,4 +24,5 @@ export declare class TypusClient {
|
|
|
24
24
|
batchGetObjectsBcs(objectIds: string[]): Promise<(Uint8Array<ArrayBufferLike> | undefined)[]>;
|
|
25
25
|
getDynamicFieldsBcs(parent: string): Promise<Uint8Array<ArrayBufferLike>[]>;
|
|
26
26
|
getDynamicObjectFieldsBcs(parent: string): Promise<Uint8Array<ArrayBufferLike>[]>;
|
|
27
|
+
simulateTransaction(transactionBcs: Uint8Array<ArrayBufferLike>): Promise<Experimental_SuiClientTypes.DryRunTransactionResponse>;
|
|
27
28
|
}
|
package/dist/src/client.js
CHANGED
|
@@ -8,31 +8,35 @@ const utils_1 = require("@typus/typus-sdk/dist/src/utils");
|
|
|
8
8
|
const src_1 = require("../src");
|
|
9
9
|
class TypusClient {
|
|
10
10
|
// user: string;
|
|
11
|
-
|
|
11
|
+
// mvr?: Experimental_SuiClientTypes.MvrOptions
|
|
12
|
+
constructor(config) {
|
|
12
13
|
this.config = config;
|
|
13
14
|
const network = config.network.toLowerCase();
|
|
15
|
+
const mvr = {
|
|
16
|
+
overrides: {
|
|
17
|
+
packages: {
|
|
18
|
+
"@typus/perp": src_1.PERP_PUBLISHED_AT,
|
|
19
|
+
"@typus/stake-pool": src_1.STAKE_PUBLISHED_AT,
|
|
20
|
+
},
|
|
21
|
+
// types: {
|
|
22
|
+
// "@typus/perp": PERP_PACKAGE_ID,
|
|
23
|
+
// "@typus/stake-pool": STAKE_PACKAGE_ID,
|
|
24
|
+
// },
|
|
25
|
+
},
|
|
26
|
+
};
|
|
14
27
|
this.jsonRpcClient = new client_1.SuiClient({
|
|
15
28
|
network: network,
|
|
16
29
|
url: config.rpcEndpoint,
|
|
17
|
-
mvr
|
|
18
|
-
overrides: {
|
|
19
|
-
packages: {
|
|
20
|
-
"@typus/perp": src_1.PERP_PUBLISHED_AT,
|
|
21
|
-
"@typus/stake-pool": src_1.STAKE_PUBLISHED_AT,
|
|
22
|
-
},
|
|
23
|
-
// types: {
|
|
24
|
-
// "@typus/perp": PERP_PACKAGE_ID,
|
|
25
|
-
// "@typus/stake-pool": STAKE_PACKAGE_ID,
|
|
26
|
-
// },
|
|
27
|
-
},
|
|
28
|
-
},
|
|
30
|
+
mvr,
|
|
29
31
|
});
|
|
30
32
|
this.gRpcClient = new grpc_1.SuiGrpcClient({
|
|
31
33
|
network: network,
|
|
32
34
|
baseUrl: `https://fullnode.${network}.sui.io:443`,
|
|
33
35
|
});
|
|
34
36
|
this.graphQLClient = new graphql_1.SuiGraphQLClient({
|
|
37
|
+
network: network,
|
|
35
38
|
url: `https://graphql.${network}.sui.io/graphql`,
|
|
39
|
+
mvr,
|
|
36
40
|
});
|
|
37
41
|
this.pythClient = (0, utils_1.createPythClient)(this.jsonRpcClient, this.config.network);
|
|
38
42
|
}
|
|
@@ -52,9 +56,25 @@ class TypusClient {
|
|
|
52
56
|
return this.jsonRpcClient.multiGetObjects(params);
|
|
53
57
|
}
|
|
54
58
|
devInspectTransactionBlock(params) {
|
|
59
|
+
// this.gRpcClient.transactionExecutionService.simulateTransaction({ transaction: { bcs: { value: params.transactionBlock } } });
|
|
55
60
|
return this.jsonRpcClient.devInspectTransactionBlock(params);
|
|
56
61
|
}
|
|
57
62
|
executeTransactionBlock(params) {
|
|
63
|
+
// this.gRpcClient.transactionExecutionService.executeTransaction({
|
|
64
|
+
// transaction: { bcs: { value: params.transactionBlock } },
|
|
65
|
+
// signatures,
|
|
66
|
+
// });
|
|
67
|
+
// this.gRpcClient.transactionExecutionService.executeTransaction({
|
|
68
|
+
// transaction: {
|
|
69
|
+
// bcs: {
|
|
70
|
+
// value: transactionBytes,
|
|
71
|
+
// },
|
|
72
|
+
// },
|
|
73
|
+
// signatures: signatures.map((sig) => ({
|
|
74
|
+
// bcs: { value: fromBase64(sig) },
|
|
75
|
+
// signature: { oneofKind: undefined },
|
|
76
|
+
// })),
|
|
77
|
+
// });
|
|
58
78
|
return this.jsonRpcClient.executeTransactionBlock(params);
|
|
59
79
|
}
|
|
60
80
|
signAndExecuteTransaction(params) {
|
|
@@ -104,5 +124,12 @@ class TypusClient {
|
|
|
104
124
|
return x_1.childObject?.contents?.value;
|
|
105
125
|
});
|
|
106
126
|
}
|
|
127
|
+
simulateTransaction(transactionBcs) {
|
|
128
|
+
return this.gRpcClient.core.dryRunTransaction({ transaction: transactionBcs });
|
|
129
|
+
// return this.gRpcClient.transactionExecutionService.simulateTransaction({
|
|
130
|
+
// transaction: { bcs: { value: transactionBcs } },
|
|
131
|
+
// // checks: 1,
|
|
132
|
+
// });
|
|
133
|
+
}
|
|
107
134
|
}
|
|
108
135
|
exports.TypusClient = TypusClient;
|
package/dist/src/fetch.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TOKEN } from "@typus/typus-sdk/dist/src/constants";
|
|
2
|
-
import { Position } from "./generated/typus_perp/position";
|
|
2
|
+
import { TradingOrder, Position } from "./generated/typus_perp/position";
|
|
3
3
|
import { TypusClient } from "../src/client";
|
|
4
4
|
export declare function getLpPools(client: TypusClient): Promise<{
|
|
5
5
|
id: {
|
|
@@ -341,39 +341,14 @@ export declare function getMarkets(client: TypusClient, input: {
|
|
|
341
341
|
u64_padding: string[];
|
|
342
342
|
};
|
|
343
343
|
}[]][]>;
|
|
344
|
+
export type TradingOrder = (typeof TradingOrder.$inferType);
|
|
345
|
+
export type TradingOrderWithMarketIndex = TradingOrder & {
|
|
346
|
+
marketIndex: number;
|
|
347
|
+
};
|
|
344
348
|
export declare function getUserOrders(client: TypusClient, input: {
|
|
345
349
|
user: string;
|
|
346
350
|
indexes: string[];
|
|
347
|
-
}): Promise<
|
|
348
|
-
id: {
|
|
349
|
-
id: string;
|
|
350
|
-
};
|
|
351
|
-
create_ts_ms: string;
|
|
352
|
-
order_id: string;
|
|
353
|
-
linked_position_id: string | null;
|
|
354
|
-
user: string;
|
|
355
|
-
collateral_token: {
|
|
356
|
-
name: string;
|
|
357
|
-
};
|
|
358
|
-
collateral_token_decimal: string;
|
|
359
|
-
symbol: {
|
|
360
|
-
base_token: {
|
|
361
|
-
name: string;
|
|
362
|
-
};
|
|
363
|
-
quote_token: {
|
|
364
|
-
name: string;
|
|
365
|
-
};
|
|
366
|
-
};
|
|
367
|
-
leverage_mbp: string;
|
|
368
|
-
reduce_only: boolean;
|
|
369
|
-
is_long: boolean;
|
|
370
|
-
is_stop_order: boolean;
|
|
371
|
-
size: string;
|
|
372
|
-
size_decimal: string;
|
|
373
|
-
trigger_price: string;
|
|
374
|
-
oracle_price_when_placing: string;
|
|
375
|
-
u64_padding: string[];
|
|
376
|
-
}[]>;
|
|
351
|
+
}): Promise<TradingOrderWithMarketIndex[]>;
|
|
377
352
|
export declare function getUserPositions(client: TypusClient, input: {
|
|
378
353
|
user: string;
|
|
379
354
|
indexes: string[];
|
package/dist/src/fetch.js
CHANGED
|
@@ -90,6 +90,10 @@ async function getStakePool(client, objectId) {
|
|
|
90
90
|
async function getMarkets(client, input) {
|
|
91
91
|
let tx = new transactions_1.Transaction();
|
|
92
92
|
tx.add((0, trading_1.getMarketsBcs)({ arguments: { registry: _1.MARKET, indexes: input.indexes.map((x) => BigInt(x)) } }));
|
|
93
|
+
// tx.setSender(SENDER);
|
|
94
|
+
// let bcs = await tx.build({ client: client.jsonRpcClient, onlyTransactionKind: true });
|
|
95
|
+
// // console.log("bcs", bcs);
|
|
96
|
+
// let res = await client.simulateTransaction(bcs);
|
|
93
97
|
let devInspectTransactionBlockResult = await client.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: tx });
|
|
94
98
|
// @ts-ignore
|
|
95
99
|
let bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
|
|
@@ -137,7 +141,7 @@ async function getUserOrders(client, input) {
|
|
|
137
141
|
let length = reader.readULEB();
|
|
138
142
|
let bytes = reader.readBytes(length);
|
|
139
143
|
let order = position_1.TradingOrder.parse(bytes);
|
|
140
|
-
orders.push(order);
|
|
144
|
+
orders.push({ ...order, marketIndex: x });
|
|
141
145
|
});
|
|
142
146
|
}
|
|
143
147
|
return orders;
|
|
@@ -193,13 +197,15 @@ function parseOptionBidReceipts(positions) {
|
|
|
193
197
|
async function getUserStake(client, input) {
|
|
194
198
|
let tx = new transactions_1.Transaction();
|
|
195
199
|
for (let i of input.indexes) {
|
|
196
|
-
tx.add(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
200
|
+
// tx.add(
|
|
201
|
+
// allocateIncentive({
|
|
202
|
+
// arguments: {
|
|
203
|
+
// version: STAKE_POOL_VERSION,
|
|
204
|
+
// registry: STAKE_POOL,
|
|
205
|
+
// index: BigInt(i),
|
|
206
|
+
// },
|
|
207
|
+
// })
|
|
208
|
+
// );
|
|
203
209
|
tx.add((0, stake_pool_1.getUserShares)({
|
|
204
210
|
arguments: {
|
|
205
211
|
registry: _1.STAKE_POOL,
|
|
@@ -214,7 +220,7 @@ async function getUserStake(client, input) {
|
|
|
214
220
|
let results = [];
|
|
215
221
|
for (var x = 0; x < input.indexes.length; x++) {
|
|
216
222
|
// @ts-ignore
|
|
217
|
-
var returnValues = res.results[
|
|
223
|
+
var returnValues = res.results[x].returnValues[0][0];
|
|
218
224
|
// console.log(returnValues);
|
|
219
225
|
var reader = new bcs_1.BcsReader(new Uint8Array(returnValues));
|
|
220
226
|
let length = reader.readULEB();
|
package/dist/src/user/order.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
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: {
|
|
6
11
|
perpIndex: string;
|
|
7
12
|
coins: string[];
|
|
@@ -18,25 +23,21 @@ export declare function createTradingOrder(client: TypusClient, tx: Transaction,
|
|
|
18
23
|
}): Promise<Transaction>;
|
|
19
24
|
export declare function zeroCoin(tx: Transaction, typeArgs: [string]): import("@mysten/sui/transactions").TransactionResult;
|
|
20
25
|
export declare function cancelTradingOrder(client: TypusClient, tx: Transaction, input: {
|
|
21
|
-
perpIndex: string;
|
|
22
26
|
order: typeof TradingOrder.$inferType;
|
|
23
27
|
user: string;
|
|
24
28
|
}): Promise<Transaction>;
|
|
25
29
|
export declare function increaseCollateral(client: TypusClient, tx: Transaction, input: {
|
|
26
|
-
perpIndex: string;
|
|
27
30
|
coins: string[];
|
|
28
31
|
amount: string;
|
|
29
32
|
position: typeof Position.$inferType;
|
|
30
33
|
suiCoins?: string[];
|
|
31
34
|
}): Promise<Transaction>;
|
|
32
35
|
export declare function releaseCollateral(client: TypusClient, tx: Transaction, input: {
|
|
33
|
-
perpIndex: string;
|
|
34
36
|
position: typeof Position.$inferType;
|
|
35
37
|
amount: string;
|
|
36
38
|
suiCoins?: string[];
|
|
37
39
|
}): Promise<Transaction>;
|
|
38
40
|
export declare function collectPositionFundingFee(client: TypusClient, tx: Transaction, input: {
|
|
39
|
-
perpIndex: string;
|
|
40
41
|
position: typeof Position.$inferType;
|
|
41
42
|
suiCoins?: string[];
|
|
42
43
|
}): Promise<Transaction>;
|
package/dist/src/user/order.js
CHANGED
|
@@ -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;
|
|
@@ -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
|
-
|
|
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:
|
|
119
|
-
poolIndex:
|
|
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:
|
|
150
|
-
poolIndex:
|
|
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:
|
|
182
|
-
poolIndex:
|
|
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
|
|
40
|
-
poolIndex: BigInt(input.perpIndex
|
|
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
|
|
85
|
-
poolIndex: BigInt(input.perpIndex
|
|
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
|
|
122
|
-
poolIndex: BigInt(input.perpIndex
|
|
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,
|
package/dist/src/user/tlp.d.ts
CHANGED
|
@@ -65,6 +65,5 @@ export declare function swap(client: TypusClient, tx: Transaction, input: {
|
|
|
65
65
|
}): Promise<Transaction>;
|
|
66
66
|
export declare function harvestStakeReward(client: TypusClient, tx: Transaction, input: {
|
|
67
67
|
stakePool: typeof StakePool.$inferType;
|
|
68
|
-
userShareId: string;
|
|
69
68
|
user: string;
|
|
70
69
|
}): Promise<Transaction>;
|
package/dist/src/user/tlp.js
CHANGED
|
@@ -61,7 +61,7 @@ async function mintStakeLp(client, tx, input) {
|
|
|
61
61
|
}
|
|
62
62
|
// console.log(iToken);
|
|
63
63
|
if (input.userShareId) {
|
|
64
|
-
harvestStakeReward(client, tx, { stakePool: input.stakePool,
|
|
64
|
+
harvestStakeReward(client, tx, { stakePool: input.stakePool, user: input.user });
|
|
65
65
|
}
|
|
66
66
|
let lpToken = (0, utils_1.normalizeStructTag)(input.lpPool.lp_token_type.name);
|
|
67
67
|
let lpCoin = tx.add((0, lp_pool_1.mintLp)({
|
|
@@ -100,7 +100,7 @@ async function stakeLp(client, tx, input) {
|
|
|
100
100
|
[lpCoin] = tx.splitCoins(destination, [input.amount]);
|
|
101
101
|
// console.log(iToken);
|
|
102
102
|
if (input.userShareId) {
|
|
103
|
-
harvestStakeReward(client, tx, { stakePool: input.stakePool,
|
|
103
|
+
harvestStakeReward(client, tx, { stakePool: input.stakePool, user: input.user });
|
|
104
104
|
}
|
|
105
105
|
tx.add((0, stake_pool_1.stake)({
|
|
106
106
|
arguments: {
|
|
@@ -114,7 +114,7 @@ async function stakeLp(client, tx, input) {
|
|
|
114
114
|
return tx;
|
|
115
115
|
}
|
|
116
116
|
async function unstake(client, tx, input) {
|
|
117
|
-
harvestStakeReward(client, tx, { stakePool: input.stakePool,
|
|
117
|
+
harvestStakeReward(client, tx, { stakePool: input.stakePool, user: input.user });
|
|
118
118
|
let lpToken = (0, utils_1.normalizeStructTag)(input.lpPool.lp_token_type.name);
|
|
119
119
|
tx.add((0, stake_pool_1.unsubscribe)({
|
|
120
120
|
arguments: {
|
|
@@ -156,7 +156,7 @@ async function unstakeRedeem(client, tx, input) {
|
|
|
156
156
|
typeArguments: [constants_1.tokenType[__1.NETWORK][token]],
|
|
157
157
|
})(tx);
|
|
158
158
|
}
|
|
159
|
-
harvestStakeReward(client, tx, { stakePool: input.stakePool,
|
|
159
|
+
harvestStakeReward(client, tx, { stakePool: input.stakePool, user: input.user });
|
|
160
160
|
let lpToken = (0, utils_1.normalizeStructTag)(input.lpPool.lp_token_type.name);
|
|
161
161
|
tx.add((0, stake_pool_1.unsubscribe)({
|
|
162
162
|
arguments: {
|
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-exp4",
|
|
4
4
|
"repository": "https://github.com/Typus-Lab/typus-perp-sdk.git",
|
|
5
5
|
"author": "Typus",
|
|
6
6
|
"description": "typus perp sdk",
|
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@mysten/bcs": "1.9.2",
|
|
10
10
|
"@mysten/sui": "1.44.0",
|
|
11
|
-
"@typus/typus-sdk": "1.8.
|
|
11
|
+
"@typus/typus-sdk": "1.8.30"
|
|
12
12
|
},
|
|
13
13
|
"resolutions": {
|
|
14
14
|
"@mysten/bcs": "1.9.2",
|
|
15
|
-
"@mysten/sui": "1.44.0"
|
|
15
|
+
"@mysten/sui": "1.44.0",
|
|
16
|
+
"@pythnetwork/pyth-sui-js": "2.3.0"
|
|
16
17
|
},
|
|
17
18
|
"devDependencies": {
|
|
18
19
|
"@types/bs58": "^4.0.1",
|
|
@@ -43,4 +44,4 @@
|
|
|
43
44
|
},
|
|
44
45
|
"homepage": "https://github.com/Typus-Lab/typus-perp-sdk#readme",
|
|
45
46
|
"packageManager": "yarn@4.10.3+sha512.c38cafb5c7bb273f3926d04e55e1d8c9dfa7d9c3ea1f36a4868fa028b9e5f72298f0b7f401ad5eb921749eb012eb1c3bb74bf7503df3ee43fd600d14a018266f"
|
|
46
|
-
}
|
|
47
|
+
}
|