@typus/typus-sdk 1.0.110 → 1.0.111
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/nft-staking/user-entry.d.ts +12 -2
- package/lib/utils/nft-staking/user-entry.js +82 -19
- package/lib/utils/typus-dov-single/user-entry.d.ts +4 -0
- package/lib/utils/typus-dov-single/user-entry.js +19 -1
- package/lib/utils/typus-dov-single-v2/view-function.d.ts +21 -1
- package/lib/utils/typus-dov-single-v2/view-function.js +86 -1
- package/package.json +1 -1
package/lib/config.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"VERSION": "3.
|
|
2
|
+
"VERSION": "3.1.1",
|
|
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": "0x0cae36d4f80863416dc0d3842ecfde1e960f98776d11ca9744e41ed19e2e7542",
|
|
7
7
|
"SINGLE_COLLATERAL_PACKAGE_ORIGIN": "0x0334a2ae4b0c5cd007d3bf44925975726b94c1061eb45d660e8b79ec91c0599e",
|
|
8
8
|
"SINGLE_COLLATERAL_MANAGER_CAP": "0xdc092ced3f08dc31cbbdaa584a937d4e54555cb47a1dca1d756560809d92c0ba",
|
|
9
9
|
"SINGLE_COLLATERAL_REGISTRY": "0xcb757bd17a8daa75c2b12a5c5f19bd88e7e2e96b8a220bbe4cf0605affea7475",
|
|
@@ -41,9 +41,19 @@ export declare function getUnstakeNftTx(gasBudget: number, nftPackageId: string,
|
|
|
41
41
|
)
|
|
42
42
|
*/
|
|
43
43
|
export declare function getDailyAttendTx(gasBudget: number, nftPackageId: string, registry: string): Promise<TransactionBlock>;
|
|
44
|
-
|
|
44
|
+
/**
|
|
45
|
+
entry fun snapshot(
|
|
46
|
+
registry: &mut Registry,
|
|
47
|
+
clock: &Clock,
|
|
48
|
+
ctx: &mut TxContext
|
|
49
|
+
)
|
|
50
|
+
*/
|
|
51
|
+
export declare function getSanpshotTx(gasBudget: number, nftPackageId: string, registry: string): Promise<TransactionBlock>;
|
|
52
|
+
export declare function getNewBidTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, additional_config_registry: string, index: string, priceOracle: string, coins: string[], size: string, premium_required: string, // fe float * b_token_decimal
|
|
45
53
|
usingSponsoredGasCoin?: boolean): Promise<TransactionBlock>;
|
|
46
|
-
export declare function
|
|
54
|
+
export declare function getDepositTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, additional_config_registry: string, index: string, coins: string[], amount: string, usingSponsoredGasCoin?: boolean): Promise<TransactionBlock>;
|
|
55
|
+
export declare function getWithdrawTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, share?: string): Promise<TransactionBlock>;
|
|
56
|
+
export declare function getUnsubscribeTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, additional_config_registry: string, index: string, share?: string): Promise<TransactionBlock>;
|
|
47
57
|
/**
|
|
48
58
|
public fun level_up(
|
|
49
59
|
registry: &mut Registry,
|
|
@@ -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.getLevelUpTx = exports.
|
|
55
|
+
exports.getLevelUpTx = exports.getUnsubscribeTx = exports.getWithdrawTx = exports.getDepositTx = exports.getNewBidTx = exports.getSanpshotTx = exports.getDailyAttendTx = exports.getUnstakeNftTx = exports.getCreateKioskAndLockNftTx = exports.getStakeNftTx = exports.getTransferNftsTx = exports.getTransferNftTx = void 0;
|
|
56
56
|
var sui_js_1 = require("@mysten/sui.js");
|
|
57
57
|
var constants_1 = require("../../constants");
|
|
58
58
|
var kiosk_1 = require("@mysten/kiosk");
|
|
@@ -84,15 +84,23 @@ function getTransferNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap, n
|
|
|
84
84
|
exports.getTransferNftTx = getTransferNftTx;
|
|
85
85
|
function getTransferNftsTx(gasBudget, nftPackageId, registry, kiosks, kiosk_caps, nft_ids, receiver) {
|
|
86
86
|
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
-
var tx, i;
|
|
88
|
-
return __generator(this, function (
|
|
87
|
+
var tx, i, _a, coin;
|
|
88
|
+
return __generator(this, function (_b) {
|
|
89
89
|
tx = new sui_js_1.TransactionBlock();
|
|
90
90
|
i = 0;
|
|
91
91
|
while (i < kiosks.length) {
|
|
92
|
+
_a = __read(tx.splitCoins(tx.gas, [tx.pure(10000000)]), 1), coin = _a[0];
|
|
92
93
|
tx.moveCall({
|
|
93
94
|
target: "".concat(nftPackageId, "::tails_staking::transfer_nft"),
|
|
94
95
|
typeArguments: [],
|
|
95
|
-
arguments: [
|
|
96
|
+
arguments: [
|
|
97
|
+
tx.object(registry),
|
|
98
|
+
tx.object(kiosks[i]),
|
|
99
|
+
tx.object(kiosk_caps[i]),
|
|
100
|
+
tx.object(nft_ids[i]),
|
|
101
|
+
tx.pure(receiver),
|
|
102
|
+
coin,
|
|
103
|
+
],
|
|
96
104
|
});
|
|
97
105
|
i += 1;
|
|
98
106
|
}
|
|
@@ -114,13 +122,14 @@ exports.getTransferNftsTx = getTransferNftsTx;
|
|
|
114
122
|
*/
|
|
115
123
|
function getStakeNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap, nft_id) {
|
|
116
124
|
return __awaiter(this, void 0, void 0, function () {
|
|
117
|
-
var tx;
|
|
118
|
-
return __generator(this, function (
|
|
125
|
+
var tx, _a, coin;
|
|
126
|
+
return __generator(this, function (_b) {
|
|
119
127
|
tx = new sui_js_1.TransactionBlock();
|
|
128
|
+
_a = __read(tx.splitCoins(tx.gas, [tx.pure(50000000)]), 1), coin = _a[0];
|
|
120
129
|
tx.moveCall({
|
|
121
130
|
target: "".concat(nftPackageId, "::tails_staking::stake_nft"),
|
|
122
131
|
typeArguments: [],
|
|
123
|
-
arguments: [tx.object(registry), tx.object(kiosk), tx.object(kiosk_cap), tx.object(nft_id), tx.object(constants_1.CLOCK)],
|
|
132
|
+
arguments: [tx.object(registry), tx.object(kiosk), tx.object(kiosk_cap), tx.object(nft_id), tx.object(constants_1.CLOCK), coin],
|
|
124
133
|
});
|
|
125
134
|
tx.setGasBudget(gasBudget);
|
|
126
135
|
return [2 /*return*/, tx];
|
|
@@ -158,14 +167,13 @@ exports.getCreateKioskAndLockNftTx = getCreateKioskAndLockNftTx;
|
|
|
158
167
|
*/
|
|
159
168
|
function getUnstakeNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap) {
|
|
160
169
|
return __awaiter(this, void 0, void 0, function () {
|
|
161
|
-
var tx
|
|
162
|
-
return __generator(this, function (
|
|
170
|
+
var tx;
|
|
171
|
+
return __generator(this, function (_a) {
|
|
163
172
|
tx = new sui_js_1.TransactionBlock();
|
|
164
|
-
_a = __read(tx.splitCoins(tx.gas, [tx.pure(50000000)]), 1), coin = _a[0];
|
|
165
173
|
tx.moveCall({
|
|
166
174
|
target: "".concat(nftPackageId, "::tails_staking::unstake_nft"),
|
|
167
175
|
typeArguments: [],
|
|
168
|
-
arguments: [tx.object(registry), tx.object(kiosk), tx.object(kiosk_cap)
|
|
176
|
+
arguments: [tx.object(registry), tx.object(kiosk), tx.object(kiosk_cap)],
|
|
169
177
|
});
|
|
170
178
|
tx.setGasBudget(gasBudget);
|
|
171
179
|
return [2 /*return*/, tx];
|
|
@@ -196,7 +204,30 @@ function getDailyAttendTx(gasBudget, nftPackageId, registry) {
|
|
|
196
204
|
});
|
|
197
205
|
}
|
|
198
206
|
exports.getDailyAttendTx = getDailyAttendTx;
|
|
199
|
-
|
|
207
|
+
/**
|
|
208
|
+
entry fun snapshot(
|
|
209
|
+
registry: &mut Registry,
|
|
210
|
+
clock: &Clock,
|
|
211
|
+
ctx: &mut TxContext
|
|
212
|
+
)
|
|
213
|
+
*/
|
|
214
|
+
function getSanpshotTx(gasBudget, nftPackageId, registry) {
|
|
215
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
216
|
+
var tx;
|
|
217
|
+
return __generator(this, function (_a) {
|
|
218
|
+
tx = new sui_js_1.TransactionBlock();
|
|
219
|
+
tx.moveCall({
|
|
220
|
+
target: "".concat(nftPackageId, "::tails_staking::snapshot"),
|
|
221
|
+
typeArguments: [],
|
|
222
|
+
arguments: [tx.object(registry), tx.object(constants_1.CLOCK)],
|
|
223
|
+
});
|
|
224
|
+
tx.setGasBudget(gasBudget);
|
|
225
|
+
return [2 /*return*/, tx];
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
exports.getSanpshotTx = getSanpshotTx;
|
|
230
|
+
function getNewBidTx(gasBudget, packageId, typeArguments, registry, additional_config_registry, index, priceOracle, coins, size, premium_required, // fe float * b_token_decimal
|
|
200
231
|
usingSponsoredGasCoin) {
|
|
201
232
|
if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
|
|
202
233
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -208,7 +239,7 @@ usingSponsoredGasCoin) {
|
|
|
208
239
|
typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
|
|
209
240
|
_a = __read(tx.splitCoins(tx.gas, [tx.pure(premium_required)]), 1), coin = _a[0];
|
|
210
241
|
tx.moveCall({
|
|
211
|
-
target: "".concat(packageId, "::tails_staking::
|
|
242
|
+
target: "".concat(packageId, "::tails_staking::new_bid"),
|
|
212
243
|
typeArguments: typeArguments,
|
|
213
244
|
arguments: [
|
|
214
245
|
tx.pure(registry),
|
|
@@ -223,7 +254,7 @@ usingSponsoredGasCoin) {
|
|
|
223
254
|
}
|
|
224
255
|
else {
|
|
225
256
|
tx.moveCall({
|
|
226
|
-
target: "".concat(packageId, "::tails_staking::
|
|
257
|
+
target: "".concat(packageId, "::tails_staking::new_bid"),
|
|
227
258
|
typeArguments: typeArguments,
|
|
228
259
|
arguments: [
|
|
229
260
|
tx.pure(registry),
|
|
@@ -241,8 +272,8 @@ usingSponsoredGasCoin) {
|
|
|
241
272
|
});
|
|
242
273
|
});
|
|
243
274
|
}
|
|
244
|
-
exports.
|
|
245
|
-
function
|
|
275
|
+
exports.getNewBidTx = getNewBidTx;
|
|
276
|
+
function getDepositTx(gasBudget, packageId, typeArguments, registry, additional_config_registry, index, coins, amount, usingSponsoredGasCoin) {
|
|
246
277
|
if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
|
|
247
278
|
return __awaiter(this, void 0, void 0, function () {
|
|
248
279
|
var tx, _a, coin;
|
|
@@ -253,7 +284,7 @@ function getDepositWithNftTx(gasBudget, packageId, typeArguments, registry, addi
|
|
|
253
284
|
typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
|
|
254
285
|
_a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), coin = _a[0];
|
|
255
286
|
tx.moveCall({
|
|
256
|
-
target: "".concat(packageId, "::tails_staking::
|
|
287
|
+
target: "".concat(packageId, "::tails_staking::deposit"),
|
|
257
288
|
typeArguments: typeArguments,
|
|
258
289
|
arguments: [
|
|
259
290
|
tx.pure(registry),
|
|
@@ -266,7 +297,7 @@ function getDepositWithNftTx(gasBudget, packageId, typeArguments, registry, addi
|
|
|
266
297
|
}
|
|
267
298
|
else {
|
|
268
299
|
tx.moveCall({
|
|
269
|
-
target: "".concat(packageId, "::tails_staking::
|
|
300
|
+
target: "".concat(packageId, "::tails_staking::deposit"),
|
|
270
301
|
typeArguments: typeArguments,
|
|
271
302
|
arguments: [
|
|
272
303
|
tx.pure(registry),
|
|
@@ -282,7 +313,39 @@ function getDepositWithNftTx(gasBudget, packageId, typeArguments, registry, addi
|
|
|
282
313
|
});
|
|
283
314
|
});
|
|
284
315
|
}
|
|
285
|
-
exports.
|
|
316
|
+
exports.getDepositTx = getDepositTx;
|
|
317
|
+
function getWithdrawTx(gasBudget, packageId, typeArguments, registry, index, share) {
|
|
318
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
319
|
+
var tx;
|
|
320
|
+
return __generator(this, function (_a) {
|
|
321
|
+
tx = new sui_js_1.TransactionBlock();
|
|
322
|
+
tx.moveCall({
|
|
323
|
+
target: "".concat(packageId, "::tails_staking::withdraw"),
|
|
324
|
+
typeArguments: typeArguments,
|
|
325
|
+
arguments: [tx.pure(registry), tx.pure(index), tx.pure(share ? [share] : [])],
|
|
326
|
+
});
|
|
327
|
+
tx.setGasBudget(gasBudget);
|
|
328
|
+
return [2 /*return*/, tx];
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
exports.getWithdrawTx = getWithdrawTx;
|
|
333
|
+
function getUnsubscribeTx(gasBudget, packageId, typeArguments, registry, additional_config_registry, index, share) {
|
|
334
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
335
|
+
var tx;
|
|
336
|
+
return __generator(this, function (_a) {
|
|
337
|
+
tx = new sui_js_1.TransactionBlock();
|
|
338
|
+
tx.moveCall({
|
|
339
|
+
target: "".concat(packageId, "::tails_staking::unsubscribe"),
|
|
340
|
+
typeArguments: typeArguments,
|
|
341
|
+
arguments: [tx.pure(registry), tx.pure(additional_config_registry), tx.pure(index), tx.pure(share ? [share] : [])],
|
|
342
|
+
});
|
|
343
|
+
tx.setGasBudget(gasBudget);
|
|
344
|
+
return [2 /*return*/, tx];
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
exports.getUnsubscribeTx = getUnsubscribeTx;
|
|
286
349
|
/**
|
|
287
350
|
public fun level_up(
|
|
288
351
|
registry: &mut Registry,
|
|
@@ -29,6 +29,10 @@ export declare function getWithdrawTx(gasBudget: number, packageId: string, type
|
|
|
29
29
|
@param typeArguments [Deposit Vault Token]
|
|
30
30
|
*/
|
|
31
31
|
export declare function getClaimTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, additional_config_registry: string, index: string): Promise<TransactionBlock>;
|
|
32
|
+
export declare function getBatchClaimTx(gasBudget: number, packageId: string, registry: string, additional_config_registry: string, requests: [{
|
|
33
|
+
typeArguments: string[];
|
|
34
|
+
index: string;
|
|
35
|
+
}]): Promise<TransactionBlock>;
|
|
32
36
|
/**
|
|
33
37
|
public(friend) entry fun harvest<TOKEN>(
|
|
34
38
|
registry: &mut Registry,
|
|
@@ -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.getNewBidTx = exports.getUnsubscribeTx = exports.getCompoundTx = exports.getClaimAndHarvestTx = exports.getHarvestTx = exports.getClaimTx = exports.getWithdrawTx = exports.getDepositTx = void 0;
|
|
55
|
+
exports.getNewBidTx = exports.getUnsubscribeTx = exports.getCompoundTx = exports.getClaimAndHarvestTx = exports.getHarvestTx = exports.getBatchClaimTx = exports.getClaimTx = exports.getWithdrawTx = exports.getDepositTx = void 0;
|
|
56
56
|
var sui_js_1 = require("@mysten/sui.js");
|
|
57
57
|
/**
|
|
58
58
|
public(friend) entry fun deposit<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
@@ -154,6 +154,24 @@ function getClaimTx(gasBudget, packageId, typeArguments, registry, additional_co
|
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
exports.getClaimTx = getClaimTx;
|
|
157
|
+
function getBatchClaimTx(gasBudget, packageId, registry, additional_config_registry, requests) {
|
|
158
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
159
|
+
var tx;
|
|
160
|
+
return __generator(this, function (_a) {
|
|
161
|
+
tx = new sui_js_1.TransactionBlock();
|
|
162
|
+
requests.forEach(function (request) {
|
|
163
|
+
tx.moveCall({
|
|
164
|
+
target: "".concat(packageId, "::typus_dov_single::claim"),
|
|
165
|
+
typeArguments: request.typeArguments,
|
|
166
|
+
arguments: [tx.pure(registry), tx.pure(additional_config_registry), tx.pure(request.index)],
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
tx.setGasBudget(gasBudget);
|
|
170
|
+
return [2 /*return*/, tx];
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
exports.getBatchClaimTx = getBatchClaimTx;
|
|
157
175
|
/**
|
|
158
176
|
public(friend) entry fun harvest<TOKEN>(
|
|
159
177
|
registry: &mut Registry,
|
|
@@ -149,6 +149,17 @@ export interface Auction {
|
|
|
149
149
|
export declare function getAuctions(provider: JsonRpcProvider, packageId: string, registry: string, indexes: string[]): Promise<{
|
|
150
150
|
[key: string]: Auction;
|
|
151
151
|
}>;
|
|
152
|
+
export interface Bid {
|
|
153
|
+
index: string;
|
|
154
|
+
bidder: string;
|
|
155
|
+
price: string;
|
|
156
|
+
size: string;
|
|
157
|
+
bidderBalance: string;
|
|
158
|
+
incentiveBalance: string;
|
|
159
|
+
feeDiscount: string;
|
|
160
|
+
tsMs: string;
|
|
161
|
+
}
|
|
162
|
+
export declare function getAuctionBids(provider: JsonRpcProvider, packageId: string, registry: string, index: string): Promise<Bid[]>;
|
|
152
163
|
export interface DepositShare {
|
|
153
164
|
index: string;
|
|
154
165
|
activeSubVaultUserShare: string;
|
|
@@ -158,4 +169,13 @@ export interface DepositShare {
|
|
|
158
169
|
premiumSubVaultUserShare: string;
|
|
159
170
|
performanceFeeSubVaultUserShare: string;
|
|
160
171
|
}
|
|
161
|
-
export declare function getDepositShares(provider: JsonRpcProvider, typusFrameworkPackageId: string, packageId: string, registry: string, receipts: string[]): Promise<
|
|
172
|
+
export declare function getDepositShares(provider: JsonRpcProvider, typusFrameworkPackageId: string, packageId: string, registry: string, receipts: string[]): Promise<{
|
|
173
|
+
[key: string]: DepositShare;
|
|
174
|
+
}>;
|
|
175
|
+
export interface BidShare {
|
|
176
|
+
index: string;
|
|
177
|
+
share: string;
|
|
178
|
+
}
|
|
179
|
+
export declare function getBidShares(provider: JsonRpcProvider, typusFrameworkPackageId: string, packageId: string, registry: string, receipts: string[]): Promise<{
|
|
180
|
+
[key: string]: BidShare;
|
|
181
|
+
}>;
|
|
@@ -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.getDepositShares = exports.getAuctions = exports.getVaults = exports.SENDER = void 0;
|
|
55
|
+
exports.getBidShares = 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");
|
|
@@ -339,6 +339,45 @@ function getAuctions(provider, packageId, registry, indexes) {
|
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
341
|
exports.getAuctions = getAuctions;
|
|
342
|
+
function getAuctionBids(provider, packageId, registry, index) {
|
|
343
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
344
|
+
var transactionBlock, target, transactionBlockArguments, results, bytes, reader, result;
|
|
345
|
+
return __generator(this, function (_a) {
|
|
346
|
+
switch (_a.label) {
|
|
347
|
+
case 0:
|
|
348
|
+
transactionBlock = new sui_js_1.TransactionBlock();
|
|
349
|
+
target = "".concat(packageId, "::typus_dov_single::get_auction_bids_bcs");
|
|
350
|
+
transactionBlockArguments = [transactionBlock.pure(registry), transactionBlock.pure(index)];
|
|
351
|
+
transactionBlock.moveCall({
|
|
352
|
+
target: target,
|
|
353
|
+
typeArguments: [],
|
|
354
|
+
arguments: transactionBlockArguments,
|
|
355
|
+
});
|
|
356
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: exports.SENDER })];
|
|
357
|
+
case 1:
|
|
358
|
+
results = (_a.sent()).results;
|
|
359
|
+
bytes = results[results.length - 1].returnValues[0][0];
|
|
360
|
+
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
361
|
+
result = reader.readVec(function (reader, i) {
|
|
362
|
+
reader.read8();
|
|
363
|
+
var bid = {
|
|
364
|
+
index: reader.read64(),
|
|
365
|
+
bidder: (0, tools_1.AddressFromBytes)(reader.readBytes(32)),
|
|
366
|
+
price: reader.read64(),
|
|
367
|
+
size: reader.read64(),
|
|
368
|
+
bidderBalance: reader.read64(),
|
|
369
|
+
incentiveBalance: reader.read64(),
|
|
370
|
+
feeDiscount: reader.read64(),
|
|
371
|
+
tsMs: reader.read64(),
|
|
372
|
+
};
|
|
373
|
+
return bid;
|
|
374
|
+
});
|
|
375
|
+
return [2 /*return*/, result];
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
exports.getAuctionBids = getAuctionBids;
|
|
342
381
|
function getDepositShares(provider, typusFrameworkPackageId, packageId, registry, receipts) {
|
|
343
382
|
return __awaiter(this, void 0, void 0, function () {
|
|
344
383
|
var transactionBlock, target, transactionBlockArguments, results, bytes, reader, result;
|
|
@@ -395,3 +434,49 @@ function getDepositShares(provider, typusFrameworkPackageId, packageId, registry
|
|
|
395
434
|
});
|
|
396
435
|
}
|
|
397
436
|
exports.getDepositShares = getDepositShares;
|
|
437
|
+
function getBidShares(provider, typusFrameworkPackageId, packageId, registry, receipts) {
|
|
438
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
439
|
+
var transactionBlock, target, transactionBlockArguments, results, bytes, reader, result;
|
|
440
|
+
return __generator(this, function (_a) {
|
|
441
|
+
switch (_a.label) {
|
|
442
|
+
case 0:
|
|
443
|
+
transactionBlock = new sui_js_1.TransactionBlock();
|
|
444
|
+
target = "".concat(packageId, "::typus_dov_single::get_bid_shares_bcs");
|
|
445
|
+
transactionBlockArguments = [
|
|
446
|
+
transactionBlock.pure(registry),
|
|
447
|
+
transactionBlock.makeMoveVec({
|
|
448
|
+
type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
|
|
449
|
+
objects: receipts.map(function (id) { return transactionBlock.object(id); }),
|
|
450
|
+
}),
|
|
451
|
+
];
|
|
452
|
+
transactionBlock.moveCall({
|
|
453
|
+
target: target,
|
|
454
|
+
typeArguments: [],
|
|
455
|
+
arguments: transactionBlockArguments,
|
|
456
|
+
});
|
|
457
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: exports.SENDER })];
|
|
458
|
+
case 1:
|
|
459
|
+
results = (_a.sent()).results;
|
|
460
|
+
bytes = results[results.length - 1].returnValues[0][0];
|
|
461
|
+
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
462
|
+
result = Array.from(new Map()).reduce(function (map, _a) {
|
|
463
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
464
|
+
map[key] = value;
|
|
465
|
+
return map;
|
|
466
|
+
}, {});
|
|
467
|
+
reader.readVec(function (reader, i) {
|
|
468
|
+
reader.read8();
|
|
469
|
+
var index = reader.read64();
|
|
470
|
+
var share = reader.read64();
|
|
471
|
+
result[index] = {
|
|
472
|
+
index: reader.read64(),
|
|
473
|
+
share: reader.read64(),
|
|
474
|
+
};
|
|
475
|
+
});
|
|
476
|
+
// @ts-ignore
|
|
477
|
+
return [2 /*return*/, result];
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
exports.getBidShares = getBidShares;
|