@typus/typus-sdk 1.0.123 → 1.1.1
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/lib/config.json +2 -2
- package/lib/utils/typus-dov-single/user-entry.d.ts +10 -0
- package/lib/utils/typus-dov-single/user-entry.js +35 -1
- package/lib/utils/typus-dov-single-v2/authorized-entry.d.ts +18 -0
- package/lib/utils/typus-dov-single-v2/authorized-entry.js +127 -0
- package/lib/utils/typus-dov-single-v2/user-entry.js +2 -2
- package/lib/utils/typus-dov-single-v2/view-function.d.ts +6 -7
- package/lib/utils/typus-dov-single-v2/view-function.js +107 -88
- package/package.json +1 -1
package/lib/config.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"VERSION": "3.1.
|
|
2
|
+
"VERSION": "3.1.5",
|
|
3
3
|
"DB_NAME": "testnet_3_0_0",
|
|
4
4
|
"RPC_ENDPOINT": "https://api.shinami.com:443/node/v1/sui_testnet_c702de54dad05016124f2cfabc1de7e8",
|
|
5
5
|
"sponsorApi": "https://northamerica-northeast1-aqueous-freedom-378103.cloudfunctions.net/sponsor-testnet",
|
|
6
|
-
"SINGLE_COLLATERAL_PACKAGE": "
|
|
6
|
+
"SINGLE_COLLATERAL_PACKAGE": "0xa313edfbdef7baefa43abbf039463c6c756e82ad49dadaf4ef0143f16bfe20bf",
|
|
7
7
|
"SINGLE_COLLATERAL_PACKAGE_ORIGIN": "0x0334a2ae4b0c5cd007d3bf44925975726b94c1061eb45d660e8b79ec91c0599e",
|
|
8
8
|
"SINGLE_COLLATERAL_MANAGER_CAP": "0xdc092ced3f08dc31cbbdaa584a937d4e54555cb47a1dca1d756560809d92c0ba",
|
|
9
9
|
"SINGLE_COLLATERAL_REGISTRY": "0xcb757bd17a8daa75c2b12a5c5f19bd88e7e2e96b8a220bbe4cf0605affea7475",
|
|
@@ -40,6 +40,16 @@ export declare function getBatchClaimHarvestTx(gasBudget: number, packageId: str
|
|
|
40
40
|
typeArguments: string[];
|
|
41
41
|
index: string;
|
|
42
42
|
}[]): Promise<TransactionBlock>;
|
|
43
|
+
export declare function getBatchClaimHarvestWithdrawTx(gasBudget: number, packageId: string, registry: string, additional_config_registry: string, claimRequests: {
|
|
44
|
+
typeArguments: string[];
|
|
45
|
+
index: string;
|
|
46
|
+
}[], harvestRequests: {
|
|
47
|
+
typeArguments: string[];
|
|
48
|
+
index: string;
|
|
49
|
+
}[], withdrawRequests: {
|
|
50
|
+
typeArguments: string[];
|
|
51
|
+
index: string;
|
|
52
|
+
}[]): Promise<TransactionBlock>;
|
|
43
53
|
/**
|
|
44
54
|
public(friend) entry fun harvest<TOKEN>(
|
|
45
55
|
registry: &mut Registry,
|
|
@@ -52,8 +52,9 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
52
52
|
return ar;
|
|
53
53
|
};
|
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
-
exports.getNewBidTx = exports.getUnsubscribeTx = exports.getCompoundTx = exports.getClaimAndHarvestTx = exports.getHarvestTx = exports.getBatchClaimHarvestTx = exports.getBatchClaimTx = exports.getClaimTx = exports.getWithdrawTx = exports.getDepositTx = void 0;
|
|
55
|
+
exports.getNewBidTx = exports.getUnsubscribeTx = exports.getCompoundTx = exports.getClaimAndHarvestTx = exports.getHarvestTx = exports.getBatchClaimHarvestWithdrawTx = exports.getBatchClaimHarvestTx = exports.getBatchClaimTx = exports.getClaimTx = exports.getWithdrawTx = exports.getDepositTx = void 0;
|
|
56
56
|
var sui_js_1 = require("@mysten/sui.js");
|
|
57
|
+
var constants_1 = require("../../constants");
|
|
57
58
|
/**
|
|
58
59
|
public(friend) entry fun deposit<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
59
60
|
registry: &mut Registry,
|
|
@@ -197,6 +198,39 @@ function getBatchClaimHarvestTx(gasBudget, packageId, registry, additional_confi
|
|
|
197
198
|
});
|
|
198
199
|
}
|
|
199
200
|
exports.getBatchClaimHarvestTx = getBatchClaimHarvestTx;
|
|
201
|
+
function getBatchClaimHarvestWithdrawTx(gasBudget, packageId, registry, additional_config_registry, claimRequests, harvestRequests, withdrawRequests // D_TOKEN, B_TOKEN, O_TOKEN
|
|
202
|
+
) {
|
|
203
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
204
|
+
var tx;
|
|
205
|
+
return __generator(this, function (_a) {
|
|
206
|
+
tx = new sui_js_1.TransactionBlock();
|
|
207
|
+
claimRequests.forEach(function (request) {
|
|
208
|
+
tx.moveCall({
|
|
209
|
+
target: "".concat(packageId, "::typus_dov_single::claim"),
|
|
210
|
+
typeArguments: request.typeArguments,
|
|
211
|
+
arguments: [tx.object(registry), tx.object(additional_config_registry), tx.pure(request.index)],
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
harvestRequests.forEach(function (request) {
|
|
215
|
+
tx.moveCall({
|
|
216
|
+
target: "".concat(packageId, "::typus_dov_single::harvest"),
|
|
217
|
+
typeArguments: request.typeArguments,
|
|
218
|
+
arguments: [tx.object(registry), tx.object(additional_config_registry), tx.pure(request.index)],
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
withdrawRequests.forEach(function (request) {
|
|
222
|
+
tx.moveCall({
|
|
223
|
+
target: "".concat(packageId, "::tails_staking::withdraw"),
|
|
224
|
+
typeArguments: request.typeArguments,
|
|
225
|
+
arguments: [tx.object(registry), tx.object(additional_config_registry), tx.pure(request.index), tx.pure([]), tx.object(constants_1.CLOCK)],
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
tx.setGasBudget(gasBudget);
|
|
229
|
+
return [2 /*return*/, tx];
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
exports.getBatchClaimHarvestWithdrawTx = getBatchClaimHarvestWithdrawTx;
|
|
200
234
|
/**
|
|
201
235
|
public(friend) entry fun harvest<TOKEN>(
|
|
202
236
|
registry: &mut Registry,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js";
|
|
2
|
+
/**
|
|
3
|
+
public(friend) entry fun otc<D_TOKEN, B_TOKEN>(
|
|
4
|
+
registry: &mut Registry,
|
|
5
|
+
index: u64,
|
|
6
|
+
coins: vector<Coin<B_TOKEN>>,
|
|
7
|
+
delivery_price: u64,
|
|
8
|
+
delivery_size: u64,
|
|
9
|
+
bidder_bid_value: u64,
|
|
10
|
+
bidder_fee_balance_value: u64,
|
|
11
|
+
incentive_bid_value: u64,
|
|
12
|
+
incentive_fee_balance_value: u64,
|
|
13
|
+
depositor_incentive_value: u64,
|
|
14
|
+
clock: &Clock,
|
|
15
|
+
ctx: &mut TxContext,
|
|
16
|
+
)
|
|
17
|
+
*/
|
|
18
|
+
export declare function getOtcTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, coins: string[], deliveryPrice: string, deliverySize: string, bidderBidValue: string, bidderFeeBalanceValue: string, incentiveBidValue: string, incentiveFeeBalanceValue: string, depositorIncentiveValue: string, usingSponsoredGasCoin?: boolean): Promise<TransactionBlock>;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
39
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
40
|
+
if (!m) return o;
|
|
41
|
+
var i = m.call(o), r, ar = [], e;
|
|
42
|
+
try {
|
|
43
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
44
|
+
}
|
|
45
|
+
catch (error) { e = { error: error }; }
|
|
46
|
+
finally {
|
|
47
|
+
try {
|
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
+
}
|
|
50
|
+
finally { if (e) throw e.error; }
|
|
51
|
+
}
|
|
52
|
+
return ar;
|
|
53
|
+
};
|
|
54
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
+
exports.getOtcTx = void 0;
|
|
56
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
57
|
+
var constants_1 = require("../../constants");
|
|
58
|
+
/**
|
|
59
|
+
public(friend) entry fun otc<D_TOKEN, B_TOKEN>(
|
|
60
|
+
registry: &mut Registry,
|
|
61
|
+
index: u64,
|
|
62
|
+
coins: vector<Coin<B_TOKEN>>,
|
|
63
|
+
delivery_price: u64,
|
|
64
|
+
delivery_size: u64,
|
|
65
|
+
bidder_bid_value: u64,
|
|
66
|
+
bidder_fee_balance_value: u64,
|
|
67
|
+
incentive_bid_value: u64,
|
|
68
|
+
incentive_fee_balance_value: u64,
|
|
69
|
+
depositor_incentive_value: u64,
|
|
70
|
+
clock: &Clock,
|
|
71
|
+
ctx: &mut TxContext,
|
|
72
|
+
)
|
|
73
|
+
*/
|
|
74
|
+
function getOtcTx(gasBudget, packageId, typeArguments, registry, index, coins, deliveryPrice, deliverySize, bidderBidValue, bidderFeeBalanceValue, incentiveBidValue, incentiveFeeBalanceValue, depositorIncentiveValue, usingSponsoredGasCoin) {
|
|
75
|
+
if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
|
|
76
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
77
|
+
var tx, amount, _a, coin;
|
|
78
|
+
return __generator(this, function (_b) {
|
|
79
|
+
tx = new sui_js_1.TransactionBlock();
|
|
80
|
+
if (!usingSponsoredGasCoin &&
|
|
81
|
+
(typeArguments[0] == "0x2::sui::SUI" ||
|
|
82
|
+
typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
|
|
83
|
+
amount = BigInt(bidderBidValue) + BigInt(bidderFeeBalanceValue);
|
|
84
|
+
_a = __read(tx.splitCoins(tx.gas, [tx.pure(amount.toString())]), 1), coin = _a[0];
|
|
85
|
+
tx.moveCall({
|
|
86
|
+
target: "".concat(packageId, "::tds_authorized_entry::otc"),
|
|
87
|
+
typeArguments: typeArguments,
|
|
88
|
+
arguments: [
|
|
89
|
+
tx.object(registry),
|
|
90
|
+
tx.pure(index),
|
|
91
|
+
tx.makeMoveVec({ objects: [coin] }),
|
|
92
|
+
tx.pure(deliveryPrice),
|
|
93
|
+
tx.pure(deliverySize),
|
|
94
|
+
tx.pure(bidderBidValue),
|
|
95
|
+
tx.pure(bidderFeeBalanceValue),
|
|
96
|
+
tx.pure(incentiveBidValue),
|
|
97
|
+
tx.pure(incentiveFeeBalanceValue),
|
|
98
|
+
tx.pure(depositorIncentiveValue),
|
|
99
|
+
tx.pure(constants_1.CLOCK),
|
|
100
|
+
],
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
tx.moveCall({
|
|
105
|
+
target: "".concat(packageId, "::tds_authorized_entry::otc"),
|
|
106
|
+
typeArguments: typeArguments,
|
|
107
|
+
arguments: [
|
|
108
|
+
tx.object(registry),
|
|
109
|
+
tx.pure(index),
|
|
110
|
+
tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
|
|
111
|
+
tx.pure(deliveryPrice),
|
|
112
|
+
tx.pure(deliverySize),
|
|
113
|
+
tx.pure(bidderBidValue),
|
|
114
|
+
tx.pure(bidderFeeBalanceValue),
|
|
115
|
+
tx.pure(incentiveBidValue),
|
|
116
|
+
tx.pure(incentiveFeeBalanceValue),
|
|
117
|
+
tx.pure(depositorIncentiveValue),
|
|
118
|
+
tx.pure(constants_1.CLOCK),
|
|
119
|
+
],
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
tx.setGasBudget(gasBudget);
|
|
123
|
+
return [2 /*return*/, tx];
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
exports.getOtcTx = getOtcTx;
|
|
@@ -304,14 +304,14 @@ usingSponsoredGasCoin) {
|
|
|
304
304
|
typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
|
|
305
305
|
_a = __read(tx.splitCoins(tx.gas, [tx.pure(premium_required)]), 1), coin = _a[0];
|
|
306
306
|
tx.moveCall({
|
|
307
|
-
target: "".concat(packageId, "::
|
|
307
|
+
target: "".concat(packageId, "::tails_staking::new_bid"),
|
|
308
308
|
typeArguments: typeArguments,
|
|
309
309
|
arguments: [tx.object(registry), tx.pure(index), tx.makeMoveVec({ objects: [coin] }), tx.pure(size), tx.pure("0x6")],
|
|
310
310
|
});
|
|
311
311
|
}
|
|
312
312
|
else {
|
|
313
313
|
tx.moveCall({
|
|
314
|
-
target: "".concat(packageId, "::
|
|
314
|
+
target: "".concat(packageId, "::tails_staking::new_bid"),
|
|
315
315
|
typeArguments: typeArguments,
|
|
316
316
|
arguments: [
|
|
317
317
|
tx.object(registry),
|
|
@@ -44,8 +44,10 @@ export interface DeliveryInfos {
|
|
|
44
44
|
totalIncentiveBidValue: string;
|
|
45
45
|
totalIncentiveFee: string;
|
|
46
46
|
deliveryInfo: DeliveryInfo[];
|
|
47
|
+
u64Padding: string[];
|
|
47
48
|
}
|
|
48
49
|
export interface DeliveryInfo {
|
|
50
|
+
auctionType: string;
|
|
49
51
|
deliveryPrice: string;
|
|
50
52
|
deliverySize: string;
|
|
51
53
|
bidderBidValue: string;
|
|
@@ -53,6 +55,7 @@ export interface DeliveryInfo {
|
|
|
53
55
|
incentiveBidValue: string;
|
|
54
56
|
incentiveFee: string;
|
|
55
57
|
tsMs: string;
|
|
58
|
+
u64Padding: string[];
|
|
56
59
|
}
|
|
57
60
|
export interface SettlementInfo {
|
|
58
61
|
round: string;
|
|
@@ -63,6 +66,7 @@ export interface SettlementInfo {
|
|
|
63
66
|
sharePrice: string;
|
|
64
67
|
sharePriceDecimal: string;
|
|
65
68
|
tsMs: string;
|
|
69
|
+
u64Padding: string[];
|
|
66
70
|
}
|
|
67
71
|
export interface Config {
|
|
68
72
|
oracleId: string;
|
|
@@ -96,12 +100,14 @@ export interface VaultConfig {
|
|
|
96
100
|
decaySpeed: string;
|
|
97
101
|
initialPrice: string;
|
|
98
102
|
finalPrice: string;
|
|
103
|
+
u64Padding: string[];
|
|
99
104
|
}
|
|
100
105
|
export interface PayoffConfig {
|
|
101
106
|
strikeBp: string;
|
|
102
107
|
weight: string;
|
|
103
108
|
isBuyer: boolean;
|
|
104
109
|
strike: string | undefined;
|
|
110
|
+
u64Padding: string[];
|
|
105
111
|
}
|
|
106
112
|
export interface DepositVault {
|
|
107
113
|
id: string;
|
|
@@ -170,10 +176,3 @@ export interface DepositShare {
|
|
|
170
176
|
export declare function getDepositShares(provider: JsonRpcProvider, typusFrameworkPackageId: string, packageId: string, registry: string, receipts: string[]): Promise<{
|
|
171
177
|
[key: string]: DepositShare;
|
|
172
178
|
}>;
|
|
173
|
-
export interface BidShare {
|
|
174
|
-
index: string;
|
|
175
|
-
share: string;
|
|
176
|
-
}
|
|
177
|
-
export declare function getBidShares(provider: JsonRpcProvider, typusFrameworkPackageId: string, packageId: string, registry: string, receipts: string[]): Promise<{
|
|
178
|
-
[key: string]: BidShare;
|
|
179
|
-
}>;
|
|
@@ -52,7 +52,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
52
52
|
return ar;
|
|
53
53
|
};
|
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
-
exports.
|
|
55
|
+
exports.getDepositShares = exports.getAuctionBids = exports.getAuctions = exports.getVaults = exports.SENDER = void 0;
|
|
56
56
|
var sui_js_1 = require("@mysten/sui.js");
|
|
57
57
|
var bcs_1 = require("@mysten/bcs");
|
|
58
58
|
var tools_1 = require("../tools");
|
|
@@ -113,6 +113,7 @@ function getVaults(provider, packageId, registry, indexes) {
|
|
|
113
113
|
totalIncentiveFee: reader.read64(),
|
|
114
114
|
deliveryInfo: reader.readVec(function (reader) {
|
|
115
115
|
return {
|
|
116
|
+
auctionType: reader.read64(),
|
|
116
117
|
deliveryPrice: reader.read64(),
|
|
117
118
|
deliverySize: reader.read64(),
|
|
118
119
|
bidderBidValue: reader.read64(),
|
|
@@ -120,8 +121,14 @@ function getVaults(provider, packageId, registry, indexes) {
|
|
|
120
121
|
incentiveBidValue: reader.read64(),
|
|
121
122
|
incentiveFee: reader.read64(),
|
|
122
123
|
tsMs: reader.read64(),
|
|
124
|
+
u64Padding: reader.readVec(function (reader) {
|
|
125
|
+
return reader.read64();
|
|
126
|
+
}),
|
|
123
127
|
};
|
|
124
128
|
}),
|
|
129
|
+
u64Padding: reader.readVec(function (reader) {
|
|
130
|
+
return reader.read64();
|
|
131
|
+
}),
|
|
125
132
|
},
|
|
126
133
|
settlementInfo: reader
|
|
127
134
|
.readVec(function (reader) {
|
|
@@ -134,6 +141,9 @@ function getVaults(provider, packageId, registry, indexes) {
|
|
|
134
141
|
sharePrice: reader.read64(),
|
|
135
142
|
sharePriceDecimal: reader.read64(),
|
|
136
143
|
tsMs: reader.read64(),
|
|
144
|
+
u64Padding: reader.readVec(function (reader) {
|
|
145
|
+
return reader.read64();
|
|
146
|
+
}),
|
|
137
147
|
};
|
|
138
148
|
})
|
|
139
149
|
.at(0),
|
|
@@ -180,12 +190,18 @@ function getVaults(provider, packageId, registry, indexes) {
|
|
|
180
190
|
return reader.read64();
|
|
181
191
|
})
|
|
182
192
|
.at(0),
|
|
193
|
+
u64Padding: reader.readVec(function (reader) {
|
|
194
|
+
return reader.read64();
|
|
195
|
+
}),
|
|
183
196
|
};
|
|
184
197
|
}),
|
|
185
198
|
strikeIncrement: reader.read64(),
|
|
186
199
|
decaySpeed: reader.read64(),
|
|
187
200
|
initialPrice: reader.read64(),
|
|
188
201
|
finalPrice: reader.read64(),
|
|
202
|
+
u64Padding: reader.readVec(function (reader) {
|
|
203
|
+
return reader.read64();
|
|
204
|
+
}),
|
|
189
205
|
},
|
|
190
206
|
warmupVaultConfig: {
|
|
191
207
|
payoffConfigs: reader.readVec(function (reader) {
|
|
@@ -198,12 +214,18 @@ function getVaults(provider, packageId, registry, indexes) {
|
|
|
198
214
|
return reader.read64();
|
|
199
215
|
})
|
|
200
216
|
.at(0),
|
|
217
|
+
u64Padding: reader.readVec(function (reader) {
|
|
218
|
+
return reader.read64();
|
|
219
|
+
}),
|
|
201
220
|
};
|
|
202
221
|
}),
|
|
203
222
|
strikeIncrement: reader.read64(),
|
|
204
223
|
decaySpeed: reader.read64(),
|
|
205
224
|
initialPrice: reader.read64(),
|
|
206
225
|
finalPrice: reader.read64(),
|
|
226
|
+
u64Padding: reader.readVec(function (reader) {
|
|
227
|
+
return reader.read64();
|
|
228
|
+
}),
|
|
207
229
|
},
|
|
208
230
|
u64Padding: reader.readVec(function (reader) {
|
|
209
231
|
return reader.read64();
|
|
@@ -288,47 +310,45 @@ function getAuctions(provider, packageId, registry, indexes) {
|
|
|
288
310
|
result = {};
|
|
289
311
|
reader.readVec(function (reader) {
|
|
290
312
|
reader.read16();
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
};
|
|
331
|
-
});
|
|
313
|
+
var id = (0, tools_1.AddressFromBytes)(reader.readBytes(32));
|
|
314
|
+
var index = reader.read64();
|
|
315
|
+
var token = String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8())));
|
|
316
|
+
var startTsMs = reader.read64();
|
|
317
|
+
var endTsMs = reader.read64();
|
|
318
|
+
var size = reader.read64();
|
|
319
|
+
var decaySpeed = reader.read64();
|
|
320
|
+
var initialPrice = reader.read64();
|
|
321
|
+
var finalPrice = reader.read64();
|
|
322
|
+
var feeBp = reader.read64();
|
|
323
|
+
var incentiveBp = reader.read64();
|
|
324
|
+
var tokenDecimal = reader.read64();
|
|
325
|
+
var sizeDecimal = reader.read64();
|
|
326
|
+
var totalBidSize = reader.read64();
|
|
327
|
+
var ableToRemoveBid = reader.read8() > 0;
|
|
328
|
+
// skip bids bytes
|
|
329
|
+
reader.readBytes(32); // id
|
|
330
|
+
reader.read64(); // slice_count
|
|
331
|
+
reader.read64(); // slice_size
|
|
332
|
+
reader.read64(); // length
|
|
333
|
+
var bidIndex = reader.read64();
|
|
334
|
+
result[index] = {
|
|
335
|
+
id: id,
|
|
336
|
+
index: index,
|
|
337
|
+
token: token,
|
|
338
|
+
startTsMs: startTsMs,
|
|
339
|
+
endTsMs: endTsMs,
|
|
340
|
+
size: size,
|
|
341
|
+
decaySpeed: decaySpeed,
|
|
342
|
+
initialPrice: initialPrice,
|
|
343
|
+
finalPrice: finalPrice,
|
|
344
|
+
feeBp: feeBp,
|
|
345
|
+
incentiveBp: incentiveBp,
|
|
346
|
+
tokenDecimal: tokenDecimal,
|
|
347
|
+
sizeDecimal: sizeDecimal,
|
|
348
|
+
totalBidSize: totalBidSize,
|
|
349
|
+
ableToRemoveBid: ableToRemoveBid,
|
|
350
|
+
bidIndex: bidIndex,
|
|
351
|
+
};
|
|
332
352
|
});
|
|
333
353
|
return [2 /*return*/, result];
|
|
334
354
|
}
|
|
@@ -431,49 +451,48 @@ function getDepositShares(provider, typusFrameworkPackageId, packageId, registry
|
|
|
431
451
|
});
|
|
432
452
|
}
|
|
433
453
|
exports.getDepositShares = getDepositShares;
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
exports.getBidShares = getBidShares;
|
|
454
|
+
// export interface BidShare {
|
|
455
|
+
// index: string;
|
|
456
|
+
// share: string;
|
|
457
|
+
// }
|
|
458
|
+
// export async function getBidShares(
|
|
459
|
+
// provider: JsonRpcProvider,
|
|
460
|
+
// typusFrameworkPackageId: string,
|
|
461
|
+
// packageId: string,
|
|
462
|
+
// registry: string,
|
|
463
|
+
// receipts: string[]
|
|
464
|
+
// ): Promise<{ [key: string]: BidShare }> {
|
|
465
|
+
// let transactionBlock = new TransactionBlock();
|
|
466
|
+
// let target = `${packageId}::tds_view_function::get_bid_shares_bcs` as any;
|
|
467
|
+
// let transactionBlockArguments = [
|
|
468
|
+
// transactionBlock.pure(registry),
|
|
469
|
+
// transactionBlock.makeMoveVec({
|
|
470
|
+
// type: `${typusFrameworkPackageId}::vault::TypusBidReceipt`,
|
|
471
|
+
// objects: receipts.map((id) => transactionBlock.object(id)),
|
|
472
|
+
// }),
|
|
473
|
+
// ];
|
|
474
|
+
// transactionBlock.moveCall({
|
|
475
|
+
// target,
|
|
476
|
+
// typeArguments: [],
|
|
477
|
+
// arguments: transactionBlockArguments,
|
|
478
|
+
// });
|
|
479
|
+
// let results = (await provider.devInspectTransactionBlock({ transactionBlock, sender: SENDER })).results;
|
|
480
|
+
// // @ts-ignore
|
|
481
|
+
// let bytes = results[results.length - 1].returnValues[0][0];
|
|
482
|
+
// let reader = new BcsReader(new Uint8Array(bytes));
|
|
483
|
+
// let result = Array.from(new Map()).reduce((map, [key, value]) => {
|
|
484
|
+
// map[key] = value;
|
|
485
|
+
// return map;
|
|
486
|
+
// }, {});
|
|
487
|
+
// reader.readVec((reader, i) => {
|
|
488
|
+
// reader.read8();
|
|
489
|
+
// let index = reader.read64();
|
|
490
|
+
// let share = reader.read64();
|
|
491
|
+
// result[index] = {
|
|
492
|
+
// index: reader.read64(),
|
|
493
|
+
// share: reader.read64(),
|
|
494
|
+
// } as BidShare;
|
|
495
|
+
// });
|
|
496
|
+
// // @ts-ignore
|
|
497
|
+
// return result;
|
|
498
|
+
// }
|