@typus/typus-sdk 1.4.84 → 1.4.85
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/auto-bid/view-function.js +5 -5
- package/dist/src/constants/token.js +3 -0
- package/dist/src/typus/tails-staking/authority-entry.d.ts +4 -2
- package/dist/src/typus/tails-staking/authority-entry.js +4 -2
- package/dist/src/typus-dov-single-v2/history/vault-history.d.ts +0 -1
- package/dist/src/typus-dov-single-v2/history/vault-history.js +0 -98
- package/dist/src/typus-dov-single-v2/view-function.js +18 -18
- package/dist/src/typus-launch/airdrop/view-function.d.ts +1 -0
- package/dist/src/typus-launch/airdrop/view-function.js +3 -2
- package/dist/src/typus-launch/funding-vault/view-function.js +1 -1
- package/dist/src/typus-launch/improvement-proposal/authority-entry.d.ts +2 -0
- package/dist/src/typus-launch/improvement-proposal/authority-entry.js +2 -0
- package/dist/src/typus-launch/improvement-proposal/view-function.d.ts +16 -1
- package/dist/src/typus-launch/improvement-proposal/view-function.js +61 -14
- package/dist/src/typus-launch/ve-typus/user-entry.js +4 -1
- package/dist/src/typus-perp/fetch.js +3 -3
- package/dist/src/typus-perp/index.d.ts +16 -2
- package/dist/src/typus-perp/index.js +20 -1
- package/dist/src/typus-perp/readVec.js +9 -9
- package/dist/src/typus-perp/stake-pool/functions.js +28 -28
- package/dist/src/typus-perp/user/order.js +4 -4
- package/dist/src/typus-perp/user/orderWithBidReceipt.js +2 -2
- package/dist/src/typus-perp/user/tlp.js +9 -9
- package/dist/src/typus-safu/user-history.js +1 -1
- package/dist/src/typus-safu/view-function.js +3 -3
- package/dist/src/utils/typusConfig.d.ts +8 -2
- package/package.json +1 -1
|
@@ -164,7 +164,7 @@ function getUserStrategies(config, input
|
|
|
164
164
|
id: (0, tools_1.AddressFromBytes)(reader.readBytes(32)),
|
|
165
165
|
vid: (0, tools_1.AddressFromBytes)(reader.readBytes(32)),
|
|
166
166
|
index: reader.read64(),
|
|
167
|
-
metadata: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
167
|
+
metadata: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
168
168
|
u64_padding: reader.readVec(function (reader) {
|
|
169
169
|
return reader.read64();
|
|
170
170
|
}),
|
|
@@ -192,16 +192,16 @@ function getUserStrategies(config, input
|
|
|
192
192
|
reader.read16();
|
|
193
193
|
var bidVault = {
|
|
194
194
|
id: (0, tools_1.AddressFromBytes)(reader.readBytes(32)),
|
|
195
|
-
depositToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
196
|
-
bidToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
195
|
+
depositToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
196
|
+
bidToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
197
197
|
incentiveToken: reader
|
|
198
198
|
.readVec(function (reader) {
|
|
199
|
-
return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
199
|
+
return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB())));
|
|
200
200
|
})
|
|
201
201
|
.at(0),
|
|
202
202
|
index: reader.read64(),
|
|
203
203
|
shareSupply: reader.read64(),
|
|
204
|
-
metadata: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
204
|
+
metadata: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
205
205
|
u64Padding: reader.readVec(function (reader) {
|
|
206
206
|
return reader.read64();
|
|
207
207
|
}),
|
|
@@ -41,6 +41,8 @@ function typeArgToAsset(typeArg) {
|
|
|
41
41
|
return "HIPPO";
|
|
42
42
|
case "0x83556891f4a0f233ce7b05cfe7f957d4020492a34f5405b2cb9377d060bef4bf":
|
|
43
43
|
return "sSUI";
|
|
44
|
+
case "0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e":
|
|
45
|
+
return "sSCA";
|
|
44
46
|
case "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519":
|
|
45
47
|
if (typeArgs[1] === "usdc") {
|
|
46
48
|
return "wUSDC";
|
|
@@ -79,6 +81,7 @@ function assetToDecimal(asset) {
|
|
|
79
81
|
case "HIPPO":
|
|
80
82
|
case "TYPUS":
|
|
81
83
|
case "BLUE":
|
|
84
|
+
case "sSCA":
|
|
82
85
|
return 9;
|
|
83
86
|
case "BTC":
|
|
84
87
|
case "WBTC":
|
|
@@ -110,11 +110,13 @@ export declare function getUpdateTailsStakingRegistryConfigTx(config: TypusConfi
|
|
|
110
110
|
value: string;
|
|
111
111
|
}): TransactionBlock;
|
|
112
112
|
/**
|
|
113
|
-
entry fun set_profit_sharing<TOKEN>(
|
|
113
|
+
entry fun set_profit_sharing<TOKEN, N_TOKEN>(
|
|
114
114
|
version: &Version,
|
|
115
115
|
tails_staking_registry: &mut TailsStakingRegistry,
|
|
116
116
|
level_profits: vector<u64>,
|
|
117
|
-
|
|
117
|
+
profit: Coin<TOKEN>,
|
|
118
|
+
amount: u64,
|
|
119
|
+
ts_ms: u64,
|
|
118
120
|
ctx: &TxContext,
|
|
119
121
|
) {
|
|
120
122
|
*/
|
|
@@ -182,11 +182,13 @@ function getUpdateTailsStakingRegistryConfigTx(config, tx, input) {
|
|
|
182
182
|
return tx;
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
|
-
entry fun set_profit_sharing<TOKEN>(
|
|
185
|
+
entry fun set_profit_sharing<TOKEN, N_TOKEN>(
|
|
186
186
|
version: &Version,
|
|
187
187
|
tails_staking_registry: &mut TailsStakingRegistry,
|
|
188
188
|
level_profits: vector<u64>,
|
|
189
|
-
|
|
189
|
+
profit: Coin<TOKEN>,
|
|
190
|
+
amount: u64,
|
|
191
|
+
ts_ms: u64,
|
|
190
192
|
ctx: &TxContext,
|
|
191
193
|
) {
|
|
192
194
|
*/
|
|
@@ -4,7 +4,6 @@ import { TypusConfig } from "../../../src/utils";
|
|
|
4
4
|
export declare function getVaultHistoryEvents(config: TypusConfig, startTimeMs: number): Promise<SuiEvent[]>;
|
|
5
5
|
export declare function parseGroupEvents(datas: SuiEvent[]): Promise<Map<string, Map<string, GroupEvent>>>;
|
|
6
6
|
export declare function parseVaultHistory(inputMap: Map<string, Map<string, GroupEvent>>): Promise<Map<string, Map<string, VaultHistory | undefined>>>;
|
|
7
|
-
export declare function getVaultHistoryFromDB(index?: string, startTs?: string, endTs?: string, rounds?: number[]): Promise<Map<string, Map<string, VaultHistory | undefined>> | undefined>;
|
|
8
7
|
export declare function convertGroupEventToVaultHistory(groupEvent: GroupEvent): Promise<VaultHistory | undefined>;
|
|
9
8
|
export interface VaultHistory {
|
|
10
9
|
vaultIndex: string;
|
|
@@ -35,22 +35,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
var __values = (this && this.__values) || function(o) {
|
|
39
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
-
if (m) return m.call(o);
|
|
41
|
-
if (o && typeof o.length === "number") return {
|
|
42
|
-
next: function () {
|
|
43
|
-
if (o && i >= o.length) o = void 0;
|
|
44
|
-
return { value: o && o[i++], done: !o };
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
-
};
|
|
49
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
39
|
exports.getVaultHistoryEvents = getVaultHistoryEvents;
|
|
51
40
|
exports.parseGroupEvents = parseGroupEvents;
|
|
52
41
|
exports.parseVaultHistory = parseVaultHistory;
|
|
53
|
-
exports.getVaultHistoryFromDB = getVaultHistoryFromDB;
|
|
54
42
|
exports.convertGroupEventToVaultHistory = convertGroupEventToVaultHistory;
|
|
55
43
|
exports.parseBidEvents = parseBidEvents;
|
|
56
44
|
var client_1 = require("@mysten/sui.js/client");
|
|
@@ -215,92 +203,6 @@ function parseVaultHistory(inputMap) {
|
|
|
215
203
|
});
|
|
216
204
|
});
|
|
217
205
|
}
|
|
218
|
-
function getVaultHistoryFromDB(index, startTs, endTs, rounds) {
|
|
219
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
220
|
-
var apiUrl, queryParams, apiUrlWithParams, _rounds, response, map, datas, datas_1, datas_1_1, data, index_1, round, vaultHistory, round_events, round_events;
|
|
221
|
-
var e_1, _a;
|
|
222
|
-
return __generator(this, function (_b) {
|
|
223
|
-
switch (_b.label) {
|
|
224
|
-
case 0:
|
|
225
|
-
apiUrl = "https://us-central1-aqueous-freedom-378103.cloudfunctions.net/vault-history";
|
|
226
|
-
queryParams = new URLSearchParams();
|
|
227
|
-
if (index) {
|
|
228
|
-
queryParams.append("index", index);
|
|
229
|
-
}
|
|
230
|
-
if (startTs) {
|
|
231
|
-
queryParams.append("startTs", startTs);
|
|
232
|
-
}
|
|
233
|
-
if (endTs) {
|
|
234
|
-
queryParams.append("endTs", endTs);
|
|
235
|
-
}
|
|
236
|
-
apiUrlWithParams = "".concat(apiUrl, "?").concat(queryParams.toString());
|
|
237
|
-
if (rounds) {
|
|
238
|
-
_rounds = JSON.stringify(rounds);
|
|
239
|
-
apiUrlWithParams += "&rounds=".concat(_rounds);
|
|
240
|
-
}
|
|
241
|
-
console.log(apiUrlWithParams);
|
|
242
|
-
return [4 /*yield*/, fetch(apiUrlWithParams, {
|
|
243
|
-
method: "GET",
|
|
244
|
-
headers: { "Content-Type": "application/json" },
|
|
245
|
-
})];
|
|
246
|
-
case 1:
|
|
247
|
-
response = _b.sent();
|
|
248
|
-
map = new Map();
|
|
249
|
-
if (!response.ok) return [3 /*break*/, 3];
|
|
250
|
-
return [4 /*yield*/, response.json()];
|
|
251
|
-
case 2:
|
|
252
|
-
datas = _b.sent();
|
|
253
|
-
try {
|
|
254
|
-
for (datas_1 = __values(datas), datas_1_1 = datas_1.next(); !datas_1_1.done; datas_1_1 = datas_1.next()) {
|
|
255
|
-
data = datas_1_1.value;
|
|
256
|
-
index_1 = data.index;
|
|
257
|
-
round = data.round;
|
|
258
|
-
vaultHistory = {
|
|
259
|
-
vaultIndex: index_1,
|
|
260
|
-
round: round,
|
|
261
|
-
ActivationDate: new Date(Number(data.activation_date)),
|
|
262
|
-
TotalAuctioned: data.max_size,
|
|
263
|
-
SettlementTime: new Date(Number(data.settle_date)),
|
|
264
|
-
StrikePrice: data.strikes || undefined,
|
|
265
|
-
SettlePrice: data.settle_price,
|
|
266
|
-
ActualReturn: data.return,
|
|
267
|
-
Filled: Number(data.delivery_size) == 0 ? 0 : Number(data.delivery_size) / Number(data.max_size),
|
|
268
|
-
DeliverySize: data.delivery_size,
|
|
269
|
-
DeliveryPrice: data.delivery_price,
|
|
270
|
-
DepositorsRewards: data.paid_to_depositors,
|
|
271
|
-
BiddersPayoff: data.paid_to_bidders,
|
|
272
|
-
DepositorPnl: data.paid_to_depositors - data.paid_to_bidders,
|
|
273
|
-
ActivateTx: data.activation_tx,
|
|
274
|
-
NewAuctionTx: data.new_auction_tx,
|
|
275
|
-
DeliveryTx: data.delivery_tx,
|
|
276
|
-
RecoupTx: data.recoup_tx,
|
|
277
|
-
SettleTx: data.settle_tx,
|
|
278
|
-
};
|
|
279
|
-
if (map.has(index_1)) {
|
|
280
|
-
round_events = map.get(index_1);
|
|
281
|
-
round_events.set(round, vaultHistory);
|
|
282
|
-
map.set(index_1, round_events);
|
|
283
|
-
}
|
|
284
|
-
else {
|
|
285
|
-
round_events = new Map();
|
|
286
|
-
round_events.set(round, vaultHistory);
|
|
287
|
-
map.set(index_1, round_events);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
292
|
-
finally {
|
|
293
|
-
try {
|
|
294
|
-
if (datas_1_1 && !datas_1_1.done && (_a = datas_1.return)) _a.call(datas_1);
|
|
295
|
-
}
|
|
296
|
-
finally { if (e_1) throw e_1.error; }
|
|
297
|
-
}
|
|
298
|
-
return [2 /*return*/, map];
|
|
299
|
-
case 3: return [2 /*return*/];
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
206
|
function convertGroupEventToVaultHistory(groupEvent) {
|
|
305
207
|
return __awaiter(this, void 0, void 0, function () {
|
|
306
208
|
var ActivationMs, SettlementTsMs, b_token, o_token, bidder_bid_value, bidder_fee, delivery_price, delivery_size, incentive_bid_value, incentive_fee, DepositorsRewards, BiddersPayoff, result;
|
|
@@ -93,12 +93,12 @@ function getVaults(config, input) {
|
|
|
93
93
|
period: reader.read8() + "",
|
|
94
94
|
activationTsMs: reader.read64(),
|
|
95
95
|
expirationTsMs: reader.read64(),
|
|
96
|
-
depositToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
97
|
-
bidToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
98
|
-
settlementBase: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
99
|
-
settlementQuote: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
100
|
-
settlementBaseName: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
101
|
-
settlementQuoteName: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
96
|
+
depositToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
97
|
+
bidToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
98
|
+
settlementBase: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
99
|
+
settlementQuote: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
100
|
+
settlementBaseName: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
101
|
+
settlementQuoteName: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
102
102
|
dTokenDecimal: reader.read64(),
|
|
103
103
|
bTokenDecimal: reader.read64(),
|
|
104
104
|
oTokenDecimal: reader.read64(),
|
|
@@ -173,7 +173,7 @@ function getVaults(config, input) {
|
|
|
173
173
|
depositFeeShareBp: reader.read64(),
|
|
174
174
|
depositSharedFeePool: reader
|
|
175
175
|
.readVec(function (reader) {
|
|
176
|
-
return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
176
|
+
return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB())));
|
|
177
177
|
})
|
|
178
178
|
.at(0),
|
|
179
179
|
bidFeeBp: reader.read64(),
|
|
@@ -252,11 +252,11 @@ function getVaults(config, input) {
|
|
|
252
252
|
}); // tail
|
|
253
253
|
var depositVault = {
|
|
254
254
|
id: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
255
|
-
depositToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
256
|
-
bidToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
255
|
+
depositToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
256
|
+
bidToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
257
257
|
incentiveToken: reader
|
|
258
258
|
.readVec(function (reader) {
|
|
259
|
-
return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
259
|
+
return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB())));
|
|
260
260
|
})
|
|
261
261
|
.at(0),
|
|
262
262
|
index: reader.read64(),
|
|
@@ -264,7 +264,7 @@ function getVaults(config, input) {
|
|
|
264
264
|
feeShareBp: reader.read64(),
|
|
265
265
|
sharedFeePool: reader
|
|
266
266
|
.readVec(function (reader) {
|
|
267
|
-
return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
267
|
+
return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB())));
|
|
268
268
|
})
|
|
269
269
|
.at(0),
|
|
270
270
|
activeShareSupply: reader.read64(),
|
|
@@ -274,7 +274,7 @@ function getVaults(config, input) {
|
|
|
274
274
|
premiumShareSupply: reader.read64(), // harvest
|
|
275
275
|
incentiveShareSupply: reader.read64(), // redeem
|
|
276
276
|
hasNext: reader.read8() > 0,
|
|
277
|
-
metadata: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
277
|
+
metadata: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
278
278
|
u64Padding: reader.readVec(function (reader) {
|
|
279
279
|
return reader.read64();
|
|
280
280
|
}),
|
|
@@ -319,7 +319,7 @@ function getAuctions(config, input) {
|
|
|
319
319
|
reader.read16();
|
|
320
320
|
var id = (0, utils_1.AddressFromBytes)(reader.readBytes(32));
|
|
321
321
|
var index = reader.read64();
|
|
322
|
-
var token = String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
322
|
+
var token = String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB())));
|
|
323
323
|
var startTsMs = reader.read64();
|
|
324
324
|
var endTsMs = reader.read64();
|
|
325
325
|
var size = reader.read64();
|
|
@@ -507,16 +507,16 @@ function getMyBids(config, input) {
|
|
|
507
507
|
reader.read16();
|
|
508
508
|
var bidVault = {
|
|
509
509
|
id: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
510
|
-
depositToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
511
|
-
bidToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
510
|
+
depositToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
511
|
+
bidToken: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
512
512
|
incentiveToken: reader
|
|
513
513
|
.readVec(function (reader) {
|
|
514
|
-
return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
514
|
+
return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB())));
|
|
515
515
|
})
|
|
516
516
|
.at(0),
|
|
517
517
|
index: reader.read64(),
|
|
518
518
|
shareSupply: reader.read64(),
|
|
519
|
-
metadata: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
519
|
+
metadata: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
520
520
|
u64Padding: reader.readVec(function (reader) {
|
|
521
521
|
return reader.read64();
|
|
522
522
|
}),
|
|
@@ -569,7 +569,7 @@ function getRefundShares(config, input) {
|
|
|
569
569
|
var bytes = result.returnValues[0][0];
|
|
570
570
|
var reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
571
571
|
reader.read8();
|
|
572
|
-
refundShares[String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
572
|
+
refundShares[String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB())))] = reader.read64();
|
|
573
573
|
});
|
|
574
574
|
// @ts-ignore
|
|
575
575
|
return [2 /*return*/, refundShares];
|
|
@@ -67,9 +67,10 @@ function getAirdrop(config, input) {
|
|
|
67
67
|
return [2 /*return*/, reader.readVec(function (reader) {
|
|
68
68
|
reader.readULEB();
|
|
69
69
|
return {
|
|
70
|
-
key: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
71
|
-
token: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
70
|
+
key: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
71
|
+
token: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
72
72
|
value: reader.read64(),
|
|
73
|
+
claimed: reader.read8() == 0 ? false : true,
|
|
73
74
|
};
|
|
74
75
|
})];
|
|
75
76
|
}
|
|
@@ -69,7 +69,7 @@ function getVault(config, input) {
|
|
|
69
69
|
var reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
70
70
|
reader.readULEB();
|
|
71
71
|
var id = (0, utils_1.AddressFromBytes)(reader.readBytes(32));
|
|
72
|
-
var token = String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
72
|
+
var token = String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB())));
|
|
73
73
|
var info = reader.readVec(function (reader) {
|
|
74
74
|
return reader.read64();
|
|
75
75
|
});
|
|
@@ -82,6 +82,7 @@ export declare function updateConfig(config: TypusConfig, tx: TransactionBlock,
|
|
|
82
82
|
version: &Version,
|
|
83
83
|
registry: &mut Registry,
|
|
84
84
|
index: u64,
|
|
85
|
+
key: String,
|
|
85
86
|
amount: u64,
|
|
86
87
|
ctx: &TxContext,
|
|
87
88
|
) {
|
|
@@ -89,6 +90,7 @@ export declare function updateConfig(config: TypusConfig, tx: TransactionBlock,
|
|
|
89
90
|
export declare function setReward(config: TypusConfig, tx: TransactionBlock, input: {
|
|
90
91
|
typeArguments: string[];
|
|
91
92
|
index: string;
|
|
93
|
+
key: string;
|
|
92
94
|
amount: string;
|
|
93
95
|
}): void;
|
|
94
96
|
/**
|
|
@@ -167,6 +167,7 @@ function updateConfig(config, tx, input) {
|
|
|
167
167
|
version: &Version,
|
|
168
168
|
registry: &mut Registry,
|
|
169
169
|
index: u64,
|
|
170
|
+
key: String,
|
|
170
171
|
amount: u64,
|
|
171
172
|
ctx: &TxContext,
|
|
172
173
|
) {
|
|
@@ -179,6 +180,7 @@ function setReward(config, tx, input) {
|
|
|
179
180
|
tx.object(config.version.launch.improvementProposal),
|
|
180
181
|
tx.object(config.registry.launch.improvementProposal),
|
|
181
182
|
tx.pure(input.index),
|
|
183
|
+
tx.pure(input.key),
|
|
182
184
|
tx.pure(input.amount),
|
|
183
185
|
],
|
|
184
186
|
});
|
|
@@ -11,13 +11,18 @@ export interface Tip {
|
|
|
11
11
|
votes: any;
|
|
12
12
|
u64Padding: any;
|
|
13
13
|
bcsPadding: any;
|
|
14
|
+
votingPower: any;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
public(package) fun get_ongoing_tips_bcs(
|
|
17
18
|
registry: &Registry,
|
|
19
|
+
ve_typus_registry: &VeTypusRegistry,
|
|
20
|
+
user_opt: Option<address>,
|
|
18
21
|
): vector<u8> {
|
|
19
22
|
*/
|
|
20
|
-
export declare function getOngoingTips(config: TypusConfig
|
|
23
|
+
export declare function getOngoingTips(config: TypusConfig, input: {
|
|
24
|
+
user?: string;
|
|
25
|
+
}): Promise<Tip[]>;
|
|
21
26
|
/**
|
|
22
27
|
public(package) fun get_ended_tips_bcs(
|
|
23
28
|
registry: &Registry,
|
|
@@ -26,6 +31,7 @@ export declare function getOngoingTips(config: TypusConfig): Promise<Tip[]>;
|
|
|
26
31
|
export declare function getEndedTips(config: TypusConfig): Promise<Tip[]>;
|
|
27
32
|
export interface Vote {
|
|
28
33
|
index: string;
|
|
34
|
+
user: string;
|
|
29
35
|
yes: string;
|
|
30
36
|
no: string;
|
|
31
37
|
}
|
|
@@ -47,3 +53,12 @@ export declare function getOngoingTipVotes(config: TypusConfig, input: {
|
|
|
47
53
|
export declare function getEndedTipVotes(config: TypusConfig, input: {
|
|
48
54
|
user: string;
|
|
49
55
|
}): Promise<Vote[]>;
|
|
56
|
+
/**
|
|
57
|
+
public(package) fun get_tip_votes_bcs(
|
|
58
|
+
registry: &Registry,
|
|
59
|
+
index: u64,
|
|
60
|
+
): vector<u8> {
|
|
61
|
+
*/
|
|
62
|
+
export declare function getTipVotes(config: TypusConfig, input: {
|
|
63
|
+
index: string;
|
|
64
|
+
}): Promise<Vote[]>;
|
|
@@ -40,6 +40,7 @@ exports.getOngoingTips = getOngoingTips;
|
|
|
40
40
|
exports.getEndedTips = getEndedTips;
|
|
41
41
|
exports.getOngoingTipVotes = getOngoingTipVotes;
|
|
42
42
|
exports.getEndedTipVotes = getEndedTipVotes;
|
|
43
|
+
exports.getTipVotes = getTipVotes;
|
|
43
44
|
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
44
45
|
var client_1 = require("@mysten/sui.js/client");
|
|
45
46
|
var bcs_1 = require("@mysten/bcs");
|
|
@@ -48,9 +49,11 @@ var constants_1 = require("../../../src/constants");
|
|
|
48
49
|
/**
|
|
49
50
|
public(package) fun get_ongoing_tips_bcs(
|
|
50
51
|
registry: &Registry,
|
|
52
|
+
ve_typus_registry: &VeTypusRegistry,
|
|
53
|
+
user_opt: Option<address>,
|
|
51
54
|
): vector<u8> {
|
|
52
55
|
*/
|
|
53
|
-
function getOngoingTips(config) {
|
|
56
|
+
function getOngoingTips(config, input) {
|
|
54
57
|
return __awaiter(this, void 0, void 0, function () {
|
|
55
58
|
var provider, transactionBlock, bytes, reader;
|
|
56
59
|
return __generator(this, function (_a) {
|
|
@@ -60,7 +63,11 @@ function getOngoingTips(config) {
|
|
|
60
63
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
61
64
|
transactionBlock.moveCall({
|
|
62
65
|
target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::get_ongoing_tips_bcs"),
|
|
63
|
-
arguments: [
|
|
66
|
+
arguments: [
|
|
67
|
+
transactionBlock.object(config.registry.launch.improvementProposal),
|
|
68
|
+
transactionBlock.object(config.registry.launch.veTypus),
|
|
69
|
+
transactionBlock.pure(input.user ? [input.user] : []),
|
|
70
|
+
],
|
|
64
71
|
});
|
|
65
72
|
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transactionBlock })];
|
|
66
73
|
case 1:
|
|
@@ -72,9 +79,9 @@ function getOngoingTips(config) {
|
|
|
72
79
|
return {
|
|
73
80
|
id: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
74
81
|
index: reader.read64(),
|
|
75
|
-
description: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
76
|
-
imageUrl: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
77
|
-
proposal: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
82
|
+
description: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
83
|
+
imageUrl: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
84
|
+
proposal: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
78
85
|
info: reader.readVec(function (reader) {
|
|
79
86
|
return reader.read64();
|
|
80
87
|
}),
|
|
@@ -83,14 +90,15 @@ function getOngoingTips(config) {
|
|
|
83
90
|
}),
|
|
84
91
|
rewards: reader.readVec(function (reader) {
|
|
85
92
|
return {
|
|
86
|
-
token: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
93
|
+
token: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
94
|
+
key: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
87
95
|
amount: reader.read64(),
|
|
88
96
|
};
|
|
89
97
|
}),
|
|
90
98
|
votes: {
|
|
91
99
|
id: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
92
|
-
key_type: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
93
|
-
value_type: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
100
|
+
key_type: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
101
|
+
value_type: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
94
102
|
slice_idx: reader.read16(),
|
|
95
103
|
slice_size: reader.read32(),
|
|
96
104
|
length: reader.read64(),
|
|
@@ -101,6 +109,7 @@ function getOngoingTips(config) {
|
|
|
101
109
|
bcsPadding: reader.readVec(function (reader) {
|
|
102
110
|
return reader.read8();
|
|
103
111
|
}),
|
|
112
|
+
votingPower: input.user ? reader.read64() : 0,
|
|
104
113
|
};
|
|
105
114
|
})];
|
|
106
115
|
}
|
|
@@ -134,9 +143,9 @@ function getEndedTips(config) {
|
|
|
134
143
|
return {
|
|
135
144
|
id: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
136
145
|
index: reader.read64(),
|
|
137
|
-
description: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
138
|
-
imageUrl: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
139
|
-
proposal: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
146
|
+
description: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
147
|
+
imageUrl: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
148
|
+
proposal: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
140
149
|
info: reader.readVec(function (reader) {
|
|
141
150
|
return reader.read64();
|
|
142
151
|
}),
|
|
@@ -145,14 +154,14 @@ function getEndedTips(config) {
|
|
|
145
154
|
}),
|
|
146
155
|
rewards: reader.readVec(function (reader) {
|
|
147
156
|
return {
|
|
148
|
-
token: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
157
|
+
token: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
149
158
|
amount: reader.read64(),
|
|
150
159
|
};
|
|
151
160
|
}),
|
|
152
161
|
votes: {
|
|
153
162
|
id: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
154
|
-
key_type: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
155
|
-
value_type: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
163
|
+
key_type: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
164
|
+
value_type: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
156
165
|
slice_idx: reader.read16(),
|
|
157
166
|
slice_size: reader.read32(),
|
|
158
167
|
length: reader.read64(),
|
|
@@ -196,6 +205,7 @@ function getOngoingTipVotes(config, input) {
|
|
|
196
205
|
reader.readULEB();
|
|
197
206
|
return {
|
|
198
207
|
index: reader.read64(),
|
|
208
|
+
user: input.user,
|
|
199
209
|
yes: reader.read64(),
|
|
200
210
|
no: reader.read64(),
|
|
201
211
|
};
|
|
@@ -231,6 +241,43 @@ function getEndedTipVotes(config, input) {
|
|
|
231
241
|
reader.readULEB();
|
|
232
242
|
return {
|
|
233
243
|
index: reader.read64(),
|
|
244
|
+
user: input.user,
|
|
245
|
+
yes: reader.read64(),
|
|
246
|
+
no: reader.read64(),
|
|
247
|
+
};
|
|
248
|
+
})];
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
public(package) fun get_tip_votes_bcs(
|
|
255
|
+
registry: &Registry,
|
|
256
|
+
index: u64,
|
|
257
|
+
): vector<u8> {
|
|
258
|
+
*/
|
|
259
|
+
function getTipVotes(config, input) {
|
|
260
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
261
|
+
var provider, transactionBlock, bytes, reader;
|
|
262
|
+
return __generator(this, function (_a) {
|
|
263
|
+
switch (_a.label) {
|
|
264
|
+
case 0:
|
|
265
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
266
|
+
transactionBlock = new transactions_1.TransactionBlock();
|
|
267
|
+
transactionBlock.moveCall({
|
|
268
|
+
target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::get_tip_votes_bcs"),
|
|
269
|
+
arguments: [transactionBlock.object(config.registry.launch.improvementProposal), transactionBlock.pure(input.index)],
|
|
270
|
+
});
|
|
271
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transactionBlock })];
|
|
272
|
+
case 1:
|
|
273
|
+
bytes = (_a.sent()).results[0].returnValues[0][0];
|
|
274
|
+
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
275
|
+
reader.readULEB();
|
|
276
|
+
return [2 /*return*/, reader.readVec(function (reader) {
|
|
277
|
+
reader.readULEB();
|
|
278
|
+
return {
|
|
279
|
+
index: input.index,
|
|
280
|
+
user: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
234
281
|
yes: reader.read64(),
|
|
235
282
|
no: reader.read64(),
|
|
236
283
|
};
|
|
@@ -20,6 +20,7 @@ exports.mint = mint;
|
|
|
20
20
|
exports.burn = burn;
|
|
21
21
|
exports.renew = renew;
|
|
22
22
|
var constants_1 = require("../../../src/constants");
|
|
23
|
+
var improvement_proposal_1 = require("../improvement-proposal");
|
|
23
24
|
/**
|
|
24
25
|
public fun mint(
|
|
25
26
|
version: &Version,
|
|
@@ -48,6 +49,7 @@ function mint(config, tx, input) {
|
|
|
48
49
|
tx.object(constants_1.CLOCK),
|
|
49
50
|
],
|
|
50
51
|
});
|
|
52
|
+
(0, improvement_proposal_1.updateVotes)(config, tx);
|
|
51
53
|
}
|
|
52
54
|
/**
|
|
53
55
|
public fun burn(
|
|
@@ -81,7 +83,7 @@ function burn(config, tx, input) {
|
|
|
81
83
|
) {
|
|
82
84
|
*/
|
|
83
85
|
function renew(config, tx, input) {
|
|
84
|
-
|
|
86
|
+
tx.moveCall({
|
|
85
87
|
target: "".concat(config.package.launch.veTypus, "::ve_typus::renew"),
|
|
86
88
|
arguments: [
|
|
87
89
|
tx.object(config.version.launch.veTypus),
|
|
@@ -91,4 +93,5 @@ function renew(config, tx, input) {
|
|
|
91
93
|
tx.object(constants_1.CLOCK),
|
|
92
94
|
],
|
|
93
95
|
});
|
|
96
|
+
(0, improvement_proposal_1.updateVotes)(config, tx);
|
|
94
97
|
}
|
|
@@ -266,7 +266,7 @@ function getUserOrders(config, user) {
|
|
|
266
266
|
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
267
267
|
tx = new transactions_1.TransactionBlock();
|
|
268
268
|
(0, functions_1.getUserOrders)(tx, {
|
|
269
|
-
version: config.version.perp,
|
|
269
|
+
version: config.version.perp.perp,
|
|
270
270
|
registry: config.registry.perp.market,
|
|
271
271
|
marketIndex: BigInt(0),
|
|
272
272
|
user: user,
|
|
@@ -291,7 +291,7 @@ function getUserPositions(config, user) {
|
|
|
291
291
|
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
292
292
|
tx = new transactions_1.TransactionBlock();
|
|
293
293
|
(0, functions_1.getUserPositions)(tx, {
|
|
294
|
-
version: config.version.perp,
|
|
294
|
+
version: config.version.perp.perp,
|
|
295
295
|
registry: config.registry.perp.market,
|
|
296
296
|
marketIndex: BigInt(0),
|
|
297
297
|
user: user,
|
|
@@ -378,7 +378,7 @@ function getLiquidationPrice(config, pythClient, input) {
|
|
|
378
378
|
cToken = constants_2.tokenType[_1.NETWORK][TOKEN];
|
|
379
379
|
baseToken = constants_2.tokenType[_1.NETWORK][BASE_TOKEN];
|
|
380
380
|
(0, functions_1.getEstimatedLiquidationPrice)(tx, [cToken, baseToken], {
|
|
381
|
-
version: config.version.perp,
|
|
381
|
+
version: config.version.perp.perp,
|
|
382
382
|
registry: config.registry.perp.market,
|
|
383
383
|
poolRegistry: config.registry.perp.lpPool,
|
|
384
384
|
marketIndex: BigInt(0),
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
export declare const NETWORK: string;
|
|
2
|
-
export declare const PACKAGE_ID: () => Promise<
|
|
3
|
-
|
|
2
|
+
export declare const PACKAGE_ID: () => Promise<{
|
|
3
|
+
perp: string;
|
|
4
|
+
stakePool: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const PUBLISHED_AT: () => Promise<{
|
|
7
|
+
perp: string;
|
|
8
|
+
stakePool: string;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const STAKE_POOL_PACKAGE_ID: () => Promise<{
|
|
11
|
+
perp: string;
|
|
12
|
+
stakePool: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const STAKE_POOL_PUBLISHED_AT: () => Promise<{
|
|
15
|
+
perp: string;
|
|
16
|
+
stakePool: string;
|
|
17
|
+
}>;
|
|
4
18
|
export { installEcosystemManagerCapEntry } from "./admin/functions";
|
|
5
19
|
export * from "./readVec";
|
|
6
20
|
export * from "./fetch";
|
|
@@ -53,7 +53,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
53
53
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
54
54
|
};
|
|
55
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
56
|
-
exports.installEcosystemManagerCapEntry = exports.PUBLISHED_AT = exports.PACKAGE_ID = exports.NETWORK = void 0;
|
|
56
|
+
exports.installEcosystemManagerCapEntry = exports.STAKE_POOL_PUBLISHED_AT = exports.STAKE_POOL_PACKAGE_ID = exports.PUBLISHED_AT = exports.PACKAGE_ID = exports.NETWORK = void 0;
|
|
57
57
|
var utils_1 = require("../../src/utils");
|
|
58
58
|
var path_1 = __importDefault(require("path"));
|
|
59
59
|
var dotenv_1 = __importDefault(require("dotenv"));
|
|
@@ -81,6 +81,25 @@ var PUBLISHED_AT = function () { return __awaiter(void 0, void 0, void 0, functi
|
|
|
81
81
|
});
|
|
82
82
|
}); };
|
|
83
83
|
exports.PUBLISHED_AT = PUBLISHED_AT;
|
|
84
|
+
var STAKE_POOL_PACKAGE_ID = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
85
|
+
return __generator(this, function (_a) {
|
|
86
|
+
switch (_a.label) {
|
|
87
|
+
case 0: return [4 /*yield*/, utils_1.TypusConfig.default(exports.NETWORK, null)];
|
|
88
|
+
case 1: return [2 /*return*/, (_a.sent()).packageOrigin.perp];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}); };
|
|
92
|
+
exports.STAKE_POOL_PACKAGE_ID = STAKE_POOL_PACKAGE_ID;
|
|
93
|
+
// export const PUBLISHED_AT = config.package.perp;
|
|
94
|
+
var STAKE_POOL_PUBLISHED_AT = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
95
|
+
return __generator(this, function (_a) {
|
|
96
|
+
switch (_a.label) {
|
|
97
|
+
case 0: return [4 /*yield*/, utils_1.TypusConfig.default(exports.NETWORK, null)];
|
|
98
|
+
case 1: return [2 /*return*/, (_a.sent()).package.perp];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}); };
|
|
102
|
+
exports.STAKE_POOL_PUBLISHED_AT = STAKE_POOL_PUBLISHED_AT;
|
|
84
103
|
var functions_1 = require("./admin/functions");
|
|
85
104
|
Object.defineProperty(exports, "installEcosystemManagerCapEntry", { enumerable: true, get: function () { return functions_1.installEcosystemManagerCapEntry; } });
|
|
86
105
|
__exportStar(require("./readVec"), exports);
|
|
@@ -20,11 +20,11 @@ function readVecPosition(bytes) {
|
|
|
20
20
|
isLong: reader.read8(),
|
|
21
21
|
size: reader.read64(),
|
|
22
22
|
sizeDecimal: reader.read64(),
|
|
23
|
-
collateralToken: { name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
23
|
+
collateralToken: { name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))) },
|
|
24
24
|
collateralTokenDecimal: reader.read64(),
|
|
25
25
|
symbol: {
|
|
26
|
-
baseToken: { name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
27
|
-
quoteToken: { name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
26
|
+
baseToken: { name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))) },
|
|
27
|
+
quoteToken: { name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))) },
|
|
28
28
|
},
|
|
29
29
|
collateralAmount: reader.read64(),
|
|
30
30
|
reserveAmount: reader.read64(),
|
|
@@ -41,7 +41,7 @@ function readVecPosition(bytes) {
|
|
|
41
41
|
.readVec(function (reader) {
|
|
42
42
|
return {
|
|
43
43
|
index: reader.read64(),
|
|
44
|
-
bid_token: { name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
44
|
+
bid_token: { name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))) },
|
|
45
45
|
};
|
|
46
46
|
})
|
|
47
47
|
.at(0),
|
|
@@ -64,11 +64,11 @@ function readVecOrder(bytes) {
|
|
|
64
64
|
})
|
|
65
65
|
.at(0),
|
|
66
66
|
user: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
67
|
-
collateralToken: { name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
67
|
+
collateralToken: { name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))) },
|
|
68
68
|
collateralTokenDecimal: reader.read64(),
|
|
69
69
|
symbol: {
|
|
70
|
-
baseToken: { name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
71
|
-
quoteToken: { name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
70
|
+
baseToken: { name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))) },
|
|
71
|
+
quoteToken: { name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))) },
|
|
72
72
|
},
|
|
73
73
|
leveragePct: reader.read64(),
|
|
74
74
|
reduceOnly: reader.read8(),
|
|
@@ -99,7 +99,7 @@ function readVecShares(bytes) {
|
|
|
99
99
|
unsubscribedTsMs: reader.read64(),
|
|
100
100
|
unlockedTsMs: reader.read64(),
|
|
101
101
|
unsubscribedIncentivePriceIndex: reader.readVec(function (reader) { return [
|
|
102
|
-
{ name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
102
|
+
{ name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))) },
|
|
103
103
|
reader.read64(),
|
|
104
104
|
]; }),
|
|
105
105
|
u64Padding: reader.readVec(function (reader) { return reader.read64(); }),
|
|
@@ -107,7 +107,7 @@ function readVecShares(bytes) {
|
|
|
107
107
|
return deactivatingShares;
|
|
108
108
|
}),
|
|
109
109
|
lastIncentivePriceIndex: reader.readVec(function (reader) { return [
|
|
110
|
-
{ name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
110
|
+
{ name: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))) },
|
|
111
111
|
reader.read64(),
|
|
112
112
|
]; }),
|
|
113
113
|
u64Padding: reader.readVec(function (reader) { return reader.read64(); }),
|
|
@@ -31,11 +31,11 @@ exports.withdrawIncentive = withdrawIncentive;
|
|
|
31
31
|
var __1 = require("..");
|
|
32
32
|
var util_1 = require("../../_framework/util");
|
|
33
33
|
function init(txb) {
|
|
34
|
-
return txb.moveCall({ target: "".concat(__1.
|
|
34
|
+
return txb.moveCall({ target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::init"), arguments: [] });
|
|
35
35
|
}
|
|
36
36
|
function unsubscribe(txb, typeArg, args) {
|
|
37
37
|
return txb.moveCall({
|
|
38
|
-
target: "".concat(__1.
|
|
38
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::unsubscribe"),
|
|
39
39
|
typeArguments: [typeArg],
|
|
40
40
|
arguments: [
|
|
41
41
|
(0, util_1.obj)(txb, args.version),
|
|
@@ -49,14 +49,14 @@ function unsubscribe(txb, typeArg, args) {
|
|
|
49
49
|
}
|
|
50
50
|
function activateIncentiveToken(txb, typeArg, args) {
|
|
51
51
|
return txb.moveCall({
|
|
52
|
-
target: "".concat(__1.
|
|
52
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::activate_incentive_token"),
|
|
53
53
|
typeArguments: [typeArg],
|
|
54
54
|
arguments: [(0, util_1.obj)(txb, args.version), (0, util_1.obj)(txb, args.registry), (0, util_1.pure)(txb, args.index, "u64")],
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
function addIncentiveToken(txb, typeArg, args) {
|
|
58
58
|
return txb.moveCall({
|
|
59
|
-
target: "".concat(__1.
|
|
59
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::add_incentive_token"),
|
|
60
60
|
typeArguments: [typeArg],
|
|
61
61
|
arguments: [
|
|
62
62
|
(0, util_1.obj)(txb, args.version),
|
|
@@ -70,81 +70,81 @@ function addIncentiveToken(txb, typeArg, args) {
|
|
|
70
70
|
}
|
|
71
71
|
function allocateIncentive(txb, args) {
|
|
72
72
|
return txb.moveCall({
|
|
73
|
-
target: "".concat(__1.
|
|
73
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::allocate_incentive"),
|
|
74
74
|
arguments: [(0, util_1.obj)(txb, args.version), (0, util_1.obj)(txb, args.registry), (0, util_1.pure)(txb, args.index, "u64"), (0, util_1.obj)(txb, args.clock)],
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
function calculateIncentive(txb, args) {
|
|
78
78
|
return txb.moveCall({
|
|
79
|
-
target: "".concat(__1.
|
|
79
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::calculate_incentive"),
|
|
80
80
|
arguments: [(0, util_1.obj)(txb, args.stakePool), (0, util_1.obj)(txb, args.incentiveToken), (0, util_1.obj)(txb, args.lpUserShare)],
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
function createUserLastIncentiveTsMs(txb, args) {
|
|
84
84
|
return txb.moveCall({
|
|
85
|
-
target: "".concat(__1.
|
|
85
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::create_user_last_incentive_ts_ms"),
|
|
86
86
|
arguments: [(0, util_1.obj)(txb, args.stakePool), (0, util_1.pure)(txb, args.currentTsMs, "u64")],
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
function deactivateIncentiveToken(txb, typeArg, args) {
|
|
90
90
|
return txb.moveCall({
|
|
91
|
-
target: "".concat(__1.
|
|
91
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::deactivate_incentive_token"),
|
|
92
92
|
typeArguments: [typeArg],
|
|
93
93
|
arguments: [(0, util_1.obj)(txb, args.version), (0, util_1.obj)(txb, args.registry), (0, util_1.pure)(txb, args.index, "u64")],
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
function depositIncentive(txb, typeArg, args) {
|
|
97
97
|
return txb.moveCall({
|
|
98
|
-
target: "".concat(__1.
|
|
98
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::deposit_incentive"),
|
|
99
99
|
typeArguments: [typeArg],
|
|
100
100
|
arguments: [(0, util_1.obj)(txb, args.version), (0, util_1.obj)(txb, args.registry), (0, util_1.pure)(txb, args.index, "u64"), (0, util_1.obj)(txb, args.coin)],
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
function getIncentive(txb, args) {
|
|
104
104
|
return txb.moveCall({
|
|
105
|
-
target: "".concat(__1.
|
|
105
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::get_incentive"),
|
|
106
106
|
arguments: [(0, util_1.obj)(txb, args.stakePool), (0, util_1.obj)(txb, args.tokenType)],
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
function getIncentiveTokens(txb, stakePool) {
|
|
110
|
-
return txb.moveCall({ target: "".concat(__1.
|
|
110
|
+
return txb.moveCall({ target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::get_incentive_tokens"), arguments: [(0, util_1.obj)(txb, stakePool)] });
|
|
111
111
|
}
|
|
112
112
|
function getLastIncentivePriceIndex(txb, stakePool) {
|
|
113
|
-
return txb.moveCall({ target: "".concat(__1.
|
|
113
|
+
return txb.moveCall({ target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::get_last_incentive_price_index"), arguments: [(0, util_1.obj)(txb, stakePool)] });
|
|
114
114
|
}
|
|
115
115
|
function getMutIncentive(txb, args) {
|
|
116
116
|
return txb.moveCall({
|
|
117
|
-
target: "".concat(__1.
|
|
117
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::get_mut_incentive"),
|
|
118
118
|
arguments: [(0, util_1.obj)(txb, args.stakePool), (0, util_1.obj)(txb, args.tokenType)],
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
function getMutStakePool(txb, args) {
|
|
122
122
|
return txb.moveCall({
|
|
123
|
-
target: "".concat(__1.
|
|
123
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::get_mut_stake_pool"),
|
|
124
124
|
arguments: [(0, util_1.obj)(txb, args.id), (0, util_1.pure)(txb, args.index, "u64")],
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
function getStakePool(txb, args) {
|
|
128
128
|
return txb.moveCall({
|
|
129
|
-
target: "".concat(__1.
|
|
129
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::get_stake_pool"),
|
|
130
130
|
arguments: [(0, util_1.obj)(txb, args.id), (0, util_1.pure)(txb, args.index, "u64")],
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
function getUserShareIds(txb, args) {
|
|
134
134
|
return txb.moveCall({
|
|
135
|
-
target: "".concat(__1.
|
|
135
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::get_user_share_ids"),
|
|
136
136
|
arguments: [(0, util_1.obj)(txb, args.stakePool), (0, util_1.pure)(txb, args.user, "address")],
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
function getUserShares(txb, args) {
|
|
140
140
|
return txb.moveCall({
|
|
141
|
-
target: "".concat(__1.
|
|
141
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::get_user_shares"),
|
|
142
142
|
arguments: [(0, util_1.obj)(txb, args.registry), (0, util_1.pure)(txb, args.index, "u64"), (0, util_1.pure)(txb, args.user, "address")],
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
function harvestPerUserShare(txb, typeArg, args) {
|
|
146
146
|
return txb.moveCall({
|
|
147
|
-
target: "".concat(__1.
|
|
147
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::harvest_per_user_share"),
|
|
148
148
|
typeArguments: [typeArg],
|
|
149
149
|
arguments: [
|
|
150
150
|
(0, util_1.obj)(txb, args.version),
|
|
@@ -157,33 +157,33 @@ function harvestPerUserShare(txb, typeArg, args) {
|
|
|
157
157
|
}
|
|
158
158
|
function newStakePool(txb, typeArg, args) {
|
|
159
159
|
return txb.moveCall({
|
|
160
|
-
target: "".concat(__1.
|
|
160
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::new_stake_pool"),
|
|
161
161
|
typeArguments: [typeArg],
|
|
162
162
|
arguments: [(0, util_1.obj)(txb, args.version), (0, util_1.obj)(txb, args.registry), (0, util_1.pure)(txb, args.unlockCountdownTsMs, "u64")],
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
function removeIncentive(txb, args) {
|
|
166
166
|
return txb.moveCall({
|
|
167
|
-
target: "".concat(__1.
|
|
167
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::remove_incentive"),
|
|
168
168
|
arguments: [(0, util_1.obj)(txb, args.stakePool), (0, util_1.obj)(txb, args.tokenType)],
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
function removeIncentiveToken(txb, typeArg, args) {
|
|
172
172
|
return txb.moveCall({
|
|
173
|
-
target: "".concat(__1.
|
|
173
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::remove_incentive_token"),
|
|
174
174
|
typeArguments: [typeArg],
|
|
175
175
|
arguments: [(0, util_1.obj)(txb, args.version), (0, util_1.obj)(txb, args.registry), (0, util_1.pure)(txb, args.index, "u64")],
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
178
|
function removeUserShareById(txb, args) {
|
|
179
179
|
return txb.moveCall({
|
|
180
|
-
target: "".concat(__1.
|
|
180
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::remove_user_share_by_id"),
|
|
181
181
|
arguments: [(0, util_1.obj)(txb, args.id), (0, util_1.pure)(txb, args.user, "address"), (0, util_1.pure)(txb, args.userShareId, "u64")],
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
184
|
function stake(txb, typeArg, args) {
|
|
185
185
|
return txb.moveCall({
|
|
186
|
-
target: "".concat(__1.
|
|
186
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::stake"),
|
|
187
187
|
typeArguments: [typeArg],
|
|
188
188
|
arguments: [
|
|
189
189
|
(0, util_1.obj)(txb, args.version),
|
|
@@ -197,7 +197,7 @@ function stake(txb, typeArg, args) {
|
|
|
197
197
|
}
|
|
198
198
|
function storeUserShares(txb, args) {
|
|
199
199
|
return txb.moveCall({
|
|
200
|
-
target: "".concat(__1.
|
|
200
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::store_user_shares"),
|
|
201
201
|
arguments: [
|
|
202
202
|
(0, util_1.obj)(txb, args.id),
|
|
203
203
|
(0, util_1.pure)(txb, args.user, "address"),
|
|
@@ -207,7 +207,7 @@ function storeUserShares(txb, args) {
|
|
|
207
207
|
}
|
|
208
208
|
function unstake(txb, typeArg, args) {
|
|
209
209
|
return txb.moveCall({
|
|
210
|
-
target: "".concat(__1.
|
|
210
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::unstake"),
|
|
211
211
|
typeArguments: [typeArg],
|
|
212
212
|
arguments: [
|
|
213
213
|
(0, util_1.obj)(txb, args.version),
|
|
@@ -221,7 +221,7 @@ function unstake(txb, typeArg, args) {
|
|
|
221
221
|
}
|
|
222
222
|
function updateIncentiveConfig(txb, typeArg, args) {
|
|
223
223
|
return txb.moveCall({
|
|
224
|
-
target: "".concat(__1.
|
|
224
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::update_incentive_config"),
|
|
225
225
|
typeArguments: [typeArg],
|
|
226
226
|
arguments: [
|
|
227
227
|
(0, util_1.obj)(txb, args.version),
|
|
@@ -235,7 +235,7 @@ function updateIncentiveConfig(txb, typeArg, args) {
|
|
|
235
235
|
}
|
|
236
236
|
function updateUnlockCountdownTsMs(txb, args) {
|
|
237
237
|
return txb.moveCall({
|
|
238
|
-
target: "".concat(__1.
|
|
238
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::update_unlock_countdown_ts_ms"),
|
|
239
239
|
arguments: [
|
|
240
240
|
(0, util_1.obj)(txb, args.version),
|
|
241
241
|
(0, util_1.obj)(txb, args.registry),
|
|
@@ -246,7 +246,7 @@ function updateUnlockCountdownTsMs(txb, args) {
|
|
|
246
246
|
}
|
|
247
247
|
function withdrawIncentive(txb, typeArg, args) {
|
|
248
248
|
return txb.moveCall({
|
|
249
|
-
target: "".concat(__1.
|
|
249
|
+
target: "".concat(__1.STAKE_POOL_PUBLISHED_AT, "::stake_pool::withdraw_incentive"),
|
|
250
250
|
typeArguments: [typeArg],
|
|
251
251
|
arguments: [
|
|
252
252
|
(0, util_1.obj)(txb, args.version),
|
|
@@ -86,7 +86,7 @@ function createTradingOrder(config, tx, pythClient, input) {
|
|
|
86
86
|
_b = __read(tx.splitCoins(destination, [input.amount]), 1), coin = _b[0];
|
|
87
87
|
}
|
|
88
88
|
(0, functions_1.createTradingOrder)(tx, [cToken, baseToken], {
|
|
89
|
-
version: config.version.perp,
|
|
89
|
+
version: config.version.perp.perp,
|
|
90
90
|
registry: config.registry.perp.market,
|
|
91
91
|
poolRegistry: config.registry.perp.lpPool,
|
|
92
92
|
marketIndex: BigInt(0),
|
|
@@ -118,7 +118,7 @@ function cancelTradingOrder(config, tx, input) {
|
|
|
118
118
|
cToken = "0x" + input.order.collateralToken.name;
|
|
119
119
|
BASE_TOKEN = "0x" + input.order.symbol.baseToken.name;
|
|
120
120
|
coin = (0, functions_1.cancelTradingOrder)(tx, [cToken, BASE_TOKEN], {
|
|
121
|
-
version: config.version.perp,
|
|
121
|
+
version: config.version.perp.perp,
|
|
122
122
|
registry: config.registry.perp.market,
|
|
123
123
|
marketIndex: BigInt(0),
|
|
124
124
|
orderId: input.order.orderId,
|
|
@@ -154,7 +154,7 @@ function increaseCollateral(config, tx, pythClient, input) {
|
|
|
154
154
|
_b = __read(tx.splitCoins(destination, [input.amount]), 1), coin = _b[0];
|
|
155
155
|
}
|
|
156
156
|
(0, functions_1.increaseCollateral)(tx, [cToken, baseToken], {
|
|
157
|
-
version: config.version.perp,
|
|
157
|
+
version: config.version.perp.perp,
|
|
158
158
|
registry: config.registry.perp.market,
|
|
159
159
|
poolRegistry: config.registry.perp.lpPool,
|
|
160
160
|
marketIndex: BigInt(0),
|
|
@@ -185,7 +185,7 @@ function releaseCollateral(config, tx, pythClient, input) {
|
|
|
185
185
|
cToken = constants_2.tokenType[__1.NETWORK][TOKEN];
|
|
186
186
|
baseToken = constants_2.tokenType[__1.NETWORK][BASE_TOKEN];
|
|
187
187
|
coin = (0, functions_1.releaseCollateral)(tx, [cToken, baseToken], {
|
|
188
|
-
version: config.version.perp,
|
|
188
|
+
version: config.version.perp.perp,
|
|
189
189
|
registry: config.registry.perp.market,
|
|
190
190
|
poolRegistry: config.registry.perp.lpPool,
|
|
191
191
|
marketIndex: BigInt(0),
|
|
@@ -70,7 +70,7 @@ function createTradingOrderWithBidReceipt(config, tx, pythClient, input) {
|
|
|
70
70
|
collateralBidReceipt = input.bidReceipt;
|
|
71
71
|
}
|
|
72
72
|
(0, functions_1.createTradingOrderWithBidReceipt)(tx, [cToken, bToken, baseToken], {
|
|
73
|
-
version: config.version.perp,
|
|
73
|
+
version: config.version.perp.perp,
|
|
74
74
|
registry: config.registry.perp.market,
|
|
75
75
|
poolRegistry: config.registry.perp.lpPool,
|
|
76
76
|
marketIndex: BigInt(0),
|
|
@@ -120,7 +120,7 @@ function reduceOptionCollateralPositionSize(config, tx, pythClient, input) {
|
|
|
120
120
|
collateralBidReceipt = input.bidReceipt;
|
|
121
121
|
}
|
|
122
122
|
(0, functions_1.reduceOptionCollateralPositionSize)(tx, [cToken, bToken, baseToken], {
|
|
123
|
-
version: config.version.perp,
|
|
123
|
+
version: config.version.perp.perp,
|
|
124
124
|
registry: config.registry.perp.market,
|
|
125
125
|
poolRegistry: config.registry.perp.lpPool,
|
|
126
126
|
marketIndex: BigInt(0),
|
|
@@ -90,7 +90,7 @@ function mintStakeLp(config, tx, pythClient, input) {
|
|
|
90
90
|
for (tokens_1 = __values(tokens), tokens_1_1 = tokens_1.next(); !tokens_1_1.done; tokens_1_1 = tokens_1.next()) {
|
|
91
91
|
token = tokens_1_1.value;
|
|
92
92
|
(0, functions_1.updateLiquidityValue)(tx, constants_2.tokenType[__1.NETWORK][token], {
|
|
93
|
-
version: config.version.perp,
|
|
93
|
+
version: config.version.perp.perp,
|
|
94
94
|
registry: config.registry.perp.lpPool,
|
|
95
95
|
index: BigInt(0),
|
|
96
96
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
@@ -117,7 +117,7 @@ function mintStakeLp(config, tx, pythClient, input) {
|
|
|
117
117
|
_c = __read(tx.splitCoins(destination, [input.amount]), 1), coin = _c[0];
|
|
118
118
|
}
|
|
119
119
|
lpCoin = (0, functions_1.mintLp)(tx, [cToken, config.token.tlp], {
|
|
120
|
-
version: config.version.perp,
|
|
120
|
+
version: config.version.perp.perp,
|
|
121
121
|
registry: config.registry.perp.lpPool,
|
|
122
122
|
treasuryCaps: config.object.tlpTreasuryCap,
|
|
123
123
|
index: BigInt(0),
|
|
@@ -127,7 +127,7 @@ function mintStakeLp(config, tx, pythClient, input) {
|
|
|
127
127
|
clock: constants_1.CLOCK,
|
|
128
128
|
});
|
|
129
129
|
(0, functions_2.stake)(tx, config.token.tlp, {
|
|
130
|
-
version: config.version.perp,
|
|
130
|
+
version: config.version.perp.perp,
|
|
131
131
|
registry: config.registry.perp.stakePool,
|
|
132
132
|
index: BigInt(0),
|
|
133
133
|
lpToken: lpCoin,
|
|
@@ -156,7 +156,7 @@ function unstakeBurn(config, tx, pythClient, input) {
|
|
|
156
156
|
for (tokens_2 = __values(tokens), tokens_2_1 = tokens_2.next(); !tokens_2_1.done; tokens_2_1 = tokens_2.next()) {
|
|
157
157
|
token = tokens_2_1.value;
|
|
158
158
|
(0, functions_1.updateLiquidityValue)(tx, constants_2.tokenType[__1.NETWORK][token], {
|
|
159
|
-
version: config.version.perp,
|
|
159
|
+
version: config.version.perp.perp,
|
|
160
160
|
registry: config.registry.perp.lpPool,
|
|
161
161
|
index: BigInt(0),
|
|
162
162
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
@@ -173,7 +173,7 @@ function unstakeBurn(config, tx, pythClient, input) {
|
|
|
173
173
|
finally { if (e_2) throw e_2.error; }
|
|
174
174
|
}
|
|
175
175
|
lpCoin = (0, functions_2.unstake)(tx, config.token.tlp, {
|
|
176
|
-
version: config.version.perp,
|
|
176
|
+
version: config.version.perp.perp,
|
|
177
177
|
registry: config.registry.perp.stakePool,
|
|
178
178
|
index: BigInt(0),
|
|
179
179
|
userShareId: BigInt(input.userShareId),
|
|
@@ -181,7 +181,7 @@ function unstakeBurn(config, tx, pythClient, input) {
|
|
|
181
181
|
unstakedShares: input.share ? BigInt(input.share) : null,
|
|
182
182
|
});
|
|
183
183
|
coin = (0, functions_1.burnLp)(tx, [cToken, config.token.tlp], {
|
|
184
|
-
version: config.version.perp,
|
|
184
|
+
version: config.version.perp.perp,
|
|
185
185
|
registry: config.registry.perp.lpPool,
|
|
186
186
|
treasuryCaps: config.object.tlpTreasuryCap,
|
|
187
187
|
index: BigInt(0),
|
|
@@ -218,7 +218,7 @@ function swap(config, tx, pythClient, input) {
|
|
|
218
218
|
_b = __read(tx.splitCoins(destination, [input.amount]), 1), coin = _b[0];
|
|
219
219
|
}
|
|
220
220
|
token = (0, functions_1.swap)(tx, [fromToken, toToken], {
|
|
221
|
-
version: config.version.perp,
|
|
221
|
+
version: config.version.perp.perp,
|
|
222
222
|
registry: config.registry.perp.lpPool,
|
|
223
223
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
224
224
|
clock: constants_1.CLOCK,
|
|
@@ -238,7 +238,7 @@ function unsubscribe(config, tx, input) {
|
|
|
238
238
|
return __awaiter(this, void 0, void 0, function () {
|
|
239
239
|
return __generator(this, function (_a) {
|
|
240
240
|
(0, functions_2.unsubscribe)(tx, config.token.tlp, {
|
|
241
|
-
version: config.version.perp,
|
|
241
|
+
version: config.version.perp.perp,
|
|
242
242
|
registry: config.registry.perp.stakePool,
|
|
243
243
|
index: BigInt(0),
|
|
244
244
|
userShareId: BigInt(input.userShareId),
|
|
@@ -253,7 +253,7 @@ function harvest(config, tx, input) {
|
|
|
253
253
|
return __awaiter(this, void 0, void 0, function () {
|
|
254
254
|
return __generator(this, function (_a) {
|
|
255
255
|
(0, functions_2.harvestPerUserShare)(tx, "0x2::sui::SUI", {
|
|
256
|
-
version: config.version.perp,
|
|
256
|
+
version: config.version.perp.perp,
|
|
257
257
|
registry: config.registry.perp.stakePool,
|
|
258
258
|
index: BigInt(0),
|
|
259
259
|
userShareId: BigInt(input.userShareId),
|
|
@@ -165,7 +165,7 @@ function parseTxHistory(datas) {
|
|
|
165
165
|
// skip the event without tokenType
|
|
166
166
|
if (event.parsedJson.bcs_padding.length > 0) {
|
|
167
167
|
reader = new bcs_1.BcsReader(new Uint8Array(event.parsedJson.bcs_padding[0]));
|
|
168
|
-
Token = String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
168
|
+
Token = String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB())));
|
|
169
169
|
asset = (0, constants_1.typeArgToAsset)(Token);
|
|
170
170
|
decimal = (0, constants_1.assetToDecimal)(asset);
|
|
171
171
|
// console.log(asset, decimal);
|
|
@@ -65,9 +65,9 @@ function getVaultData(config, input) {
|
|
|
65
65
|
reader.readVec(function (reader) {
|
|
66
66
|
reader.readULEB();
|
|
67
67
|
var id = (0, utils_1.AddressFromBytes)(reader.readBytes(32));
|
|
68
|
-
var depositToken = String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
68
|
+
var depositToken = String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB())));
|
|
69
69
|
var rewardToken = reader.readVec(function (reader) {
|
|
70
|
-
return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
70
|
+
return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB())));
|
|
71
71
|
});
|
|
72
72
|
var infoArray = reader.readVec(function (reader) {
|
|
73
73
|
return reader.read64();
|
|
@@ -139,7 +139,7 @@ function getVaultData(config, input) {
|
|
|
139
139
|
id: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
140
140
|
vid: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
141
141
|
index: reader.read64(),
|
|
142
|
-
metadata: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.
|
|
142
|
+
metadata: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))),
|
|
143
143
|
u64_padding: reader.readVec(function (reader) {
|
|
144
144
|
return reader.read64();
|
|
145
145
|
}),
|
|
@@ -17,7 +17,10 @@ export interface Package {
|
|
|
17
17
|
framework: string;
|
|
18
18
|
nft: string;
|
|
19
19
|
oracle: string;
|
|
20
|
-
perp:
|
|
20
|
+
perp: {
|
|
21
|
+
perp: string;
|
|
22
|
+
stakePool: string;
|
|
23
|
+
};
|
|
21
24
|
safu: string;
|
|
22
25
|
typus: string;
|
|
23
26
|
launch: {
|
|
@@ -30,7 +33,10 @@ export interface Package {
|
|
|
30
33
|
};
|
|
31
34
|
}
|
|
32
35
|
export interface Version {
|
|
33
|
-
perp:
|
|
36
|
+
perp: {
|
|
37
|
+
perp: string;
|
|
38
|
+
stakePool: string;
|
|
39
|
+
};
|
|
34
40
|
safu: string;
|
|
35
41
|
typus: string;
|
|
36
42
|
launch: {
|