@typus/typus-sdk 1.0.123 → 1.1.0
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.js +39 -41
- 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),
|
|
@@ -288,47 +288,45 @@ function getAuctions(provider, packageId, registry, indexes) {
|
|
|
288
288
|
result = {};
|
|
289
289
|
reader.readVec(function (reader) {
|
|
290
290
|
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
|
-
});
|
|
291
|
+
var id = (0, tools_1.AddressFromBytes)(reader.readBytes(32));
|
|
292
|
+
var index = reader.read64();
|
|
293
|
+
var token = String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8())));
|
|
294
|
+
var startTsMs = reader.read64();
|
|
295
|
+
var endTsMs = reader.read64();
|
|
296
|
+
var size = reader.read64();
|
|
297
|
+
var decaySpeed = reader.read64();
|
|
298
|
+
var initialPrice = reader.read64();
|
|
299
|
+
var finalPrice = reader.read64();
|
|
300
|
+
var feeBp = reader.read64();
|
|
301
|
+
var incentiveBp = reader.read64();
|
|
302
|
+
var tokenDecimal = reader.read64();
|
|
303
|
+
var sizeDecimal = reader.read64();
|
|
304
|
+
var totalBidSize = reader.read64();
|
|
305
|
+
var ableToRemoveBid = reader.read8() > 0;
|
|
306
|
+
// skip bids bytes
|
|
307
|
+
reader.readBytes(32); // id
|
|
308
|
+
reader.read64(); // slice_count
|
|
309
|
+
reader.read64(); // slice_size
|
|
310
|
+
reader.read64(); // length
|
|
311
|
+
var bidIndex = reader.read64();
|
|
312
|
+
result[index] = {
|
|
313
|
+
id: id,
|
|
314
|
+
index: index,
|
|
315
|
+
token: token,
|
|
316
|
+
startTsMs: startTsMs,
|
|
317
|
+
endTsMs: endTsMs,
|
|
318
|
+
size: size,
|
|
319
|
+
decaySpeed: decaySpeed,
|
|
320
|
+
initialPrice: initialPrice,
|
|
321
|
+
finalPrice: finalPrice,
|
|
322
|
+
feeBp: feeBp,
|
|
323
|
+
incentiveBp: incentiveBp,
|
|
324
|
+
tokenDecimal: tokenDecimal,
|
|
325
|
+
sizeDecimal: sizeDecimal,
|
|
326
|
+
totalBidSize: totalBidSize,
|
|
327
|
+
ableToRemoveBid: ableToRemoveBid,
|
|
328
|
+
bidIndex: bidIndex,
|
|
329
|
+
};
|
|
332
330
|
});
|
|
333
331
|
return [2 /*return*/, result];
|
|
334
332
|
}
|