@typus/typus-sdk 1.0.103 → 1.0.104
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 +33 -32
- package/lib/utils/nft-staking/fetch.d.ts +1 -6
- package/lib/utils/nft-staking/fetch.js +4 -7
- package/lib/utils/nft-staking/user-entry.d.ts +3 -2
- package/lib/utils/nft-staking/user-entry.js +95 -24
- package/lib/utils/typus-dov-single-v2/user-entry.d.ts +3 -2
- package/lib/utils/typus-dov-single-v2/user-entry.js +7 -5
- package/lib/utils/typus-nft/fetch.d.ts +3 -0
- package/lib/utils/typus-nft/fetch.js +24 -12
- package/package.json +1 -1
package/lib/config.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
"VERSION": "
|
|
3
|
-
"DB_NAME": "
|
|
2
|
+
"VERSION": "3.0.0",
|
|
3
|
+
"DB_NAME": "testnet_3_0_0",
|
|
4
4
|
"RPC_ENDPOINT": "https://api.shinami.com:443/node/v1/sui_testnet_c702de54dad05016124f2cfabc1de7e8",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
5
|
+
"sponsorApi": "https://northamerica-northeast1-aqueous-freedom-378103.cloudfunctions.net/sponsor-testnet",
|
|
6
|
+
"SINGLE_COLLATERAL_PACKAGE": "0x0334a2ae4b0c5cd007d3bf44925975726b94c1061eb45d660e8b79ec91c0599e",
|
|
7
|
+
"SINGLE_COLLATERAL_PACKAGE_ORIGIN": "0x0334a2ae4b0c5cd007d3bf44925975726b94c1061eb45d660e8b79ec91c0599e",
|
|
8
|
+
"SINGLE_COLLATERAL_MANAGER_CAP": "0xdc092ced3f08dc31cbbdaa584a937d4e54555cb47a1dca1d756560809d92c0ba",
|
|
9
|
+
"SINGLE_COLLATERAL_REGISTRY": "0xcb757bd17a8daa75c2b12a5c5f19bd88e7e2e96b8a220bbe4cf0605affea7475",
|
|
10
|
+
"SINGLE_COLLATERAL_AC_REGISTRY": "0xe6a7ec7f1cfffc85434a2dcc55306bc8c2c8f70672019e393f3e8facd7b7556f",
|
|
11
|
+
"SINGLE_COLLATERAL_DEPOSIT_VAULT_REGISTRY": "0x1b5d729933a1135820de7bbb3512134c8f92c665e7c9fd35168febc92c25a3a4",
|
|
12
|
+
"SINGLE_COLLATERAL_BID_VAULT_REGISTRY": "0x7fb5d3785c779f80f7c320a2454bf053209d6671ee7080bf85dd917ef508ef02",
|
|
13
|
+
"SINGLE_COLLATERAL_DEPOSIT_VAULT_USER_SHARE_REGISTRY": "0x25a4ba9d2ca02f9676ba4f4b152e742c8821f6731ecb8ee2230b90b8c37c9f03",
|
|
14
|
+
"SINGLE_COLLATERAL_BID_VAULT_USER_SHARE_REGISTRY": "0x8a26073f92baf3c3991669c34a0cc9202767465a9599f21ea5dd425956957c83",
|
|
14
15
|
"TOKEN_PACKAGE": "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519",
|
|
15
16
|
"BTC_TOKEN_REGISTRY": "0xcf5184b85f47cb1ffe421249e48b2cd34807534e1a4b4ad384009295bbbd3bf4",
|
|
16
17
|
"ETH_TOKEN_REGISTRY": "0x5cd3726a1d1ef32bffaaeb2ec4964f0ffac56cfb919f7d13d4672aed5059bfa1",
|
|
@@ -45,25 +46,25 @@
|
|
|
45
46
|
"keystore": "0.keystore",
|
|
46
47
|
"GAS_BUDGET": 1000000000,
|
|
47
48
|
"FOLDER": "/Users/waynekuo/Documents/GitHub/tails-by-typus-renderer-private/tails_by_typus_renderer/data",
|
|
48
|
-
"NFT_PACKAGE": "
|
|
49
|
-
"NFT_PACKAGE_UPGRADE": "
|
|
50
|
-
"NFT_MANAGER_CAP": "
|
|
51
|
-
"NFT_TRANSFER_POLICY": "
|
|
52
|
-
"NFT_ROYALTY": "
|
|
53
|
-
"NFT_TABLE": "
|
|
54
|
-
"bucket_protocol": "
|
|
55
|
-
"kriya_dex": "
|
|
56
|
-
"cetus_protocol": "
|
|
57
|
-
"ethos_wallet": "
|
|
58
|
-
"typus": "
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"none": "
|
|
49
|
+
"NFT_PACKAGE": "0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828",
|
|
50
|
+
"NFT_PACKAGE_UPGRADE": "0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828",
|
|
51
|
+
"NFT_MANAGER_CAP": "0xf02cfb741434e40e861f038c05f0c3cadae69ed07b089284afbd70870d145ddd",
|
|
52
|
+
"NFT_TRANSFER_POLICY": "0x1c62271ecc443c3d92a8fe8f5662e877856d26b971d967f66937a65f55160831",
|
|
53
|
+
"NFT_ROYALTY": "0xdca4c28f5c8d3654c99ad7cfad69bfa6ec457e6af6626a515537ff0c4b9c998d",
|
|
54
|
+
"NFT_TABLE": "0xc8df921e7403215c09228f2c32e7d16ffe0fb1c9f30c687ae9c228e1a6aa5498",
|
|
55
|
+
"bucket_protocol": "0xf9b2ba7d285e8313c24ea8038c74cffbe9e88075ea101e0338223917eb1fd5f5",
|
|
56
|
+
"kriya_dex": "0x0d3a59ff4c960eb0ba5ed80cebb49ed60d015a6237b55c9c472ff374599b9cf5",
|
|
57
|
+
"cetus_protocol": "0x656a7c12072692deefe3bc4e55109264111b0983d87d56e6f29f08aea18b00fa",
|
|
58
|
+
"ethos_wallet": "0x85c9caa7b180234beab21c128d48826d841ab1f117dfae21ec269848e6ec6b32",
|
|
59
|
+
"typus": "0x86a8505adbda8052b72ed48eba74e7cc2927849356207cf7c264c1819ab75cae",
|
|
60
|
+
"navi_protocol": "0xa60ebb20eb2cc0453b4b1aa8af852e07e825ff5f65247ebd7159d4d72ea94818",
|
|
61
|
+
"scallop_sui": "0x87e2eb4b10073c3174b0aafb1590e31b15a41fb4b63e2ca85984723cf5a5eb82",
|
|
62
|
+
"shinami_corp": "0x5d006db7f4d2129a68fa0d6002f5a1c36905651392acfcbb9787e26732bd0645",
|
|
63
|
+
"studio_mirai": "0xae2361fccbc3a8bf25a4d42bf8fdf7bdf36896f43075f256148a2c03d8bd9387",
|
|
64
|
+
"blockvision": "0x1b82e65fd7d4c4bca7a33ab2ef34ed33a3046c61a8c73234ec6b8b512c0c89ec",
|
|
65
|
+
"team": "0x2eaa09f247b9eb1e3ed60f42910402bfde43cb622cf7881e8a9c8c92cca88faf",
|
|
66
|
+
"nft_vault": "0x452744db33daa95567e5a98d1aa442c60aea40ed49ccf7ac7e633abf304a5ebe",
|
|
67
|
+
"sui_network": "0x1bef7b18be7d240f4370579236f64d4ac9685edc59df8ffda576cfc36c17d30c",
|
|
68
|
+
"mysten_labs": "0xf235242d2506bdb187033966e6f874d10b83a0cfaf11c0b0f574576c555c0ee7",
|
|
69
|
+
"none": "0x1af80eea9cc8c0de7b3aa547a39a78c95db5fc4efa2b21cb9c26d16463e873da"
|
|
69
70
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { JsonRpcProvider } from "@mysten/sui.js";
|
|
2
2
|
import { Tails } from "../typus-nft/fetch";
|
|
3
|
-
export declare function getUserStake(provider: JsonRpcProvider, nft_table: string, user: string): Promise<
|
|
4
|
-
export interface StakedTails {
|
|
5
|
-
nft: Tails;
|
|
6
|
-
snapshot_ms: string;
|
|
7
|
-
updating_url: boolean;
|
|
8
|
-
}
|
|
3
|
+
export declare function getUserStake(provider: JsonRpcProvider, nft_table: string, user: string): Promise<Tails | null>;
|
|
@@ -37,10 +37,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getUserStake = void 0;
|
|
40
|
+
var fetch_1 = require("../typus-nft/fetch");
|
|
40
41
|
function getUserStake(provider, nft_table, user) {
|
|
41
42
|
var _a;
|
|
42
43
|
return __awaiter(this, void 0, void 0, function () {
|
|
43
|
-
var res, fields,
|
|
44
|
+
var res, fields, tails;
|
|
44
45
|
return __generator(this, function (_b) {
|
|
45
46
|
switch (_b.label) {
|
|
46
47
|
case 0: return [4 /*yield*/, provider.getDynamicFieldObject({
|
|
@@ -56,12 +57,8 @@ function getUserStake(provider, nft_table, user) {
|
|
|
56
57
|
return [2 /*return*/, null];
|
|
57
58
|
}
|
|
58
59
|
fields = (_a = res.data) === null || _a === void 0 ? void 0 : _a.content.fields;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
snapshot_ms: fields.value.fields.snapshot_ms,
|
|
62
|
-
updating_url: fields.value.fields.updating_url,
|
|
63
|
-
};
|
|
64
|
-
return [2 /*return*/, staked_tails];
|
|
60
|
+
tails = (0, fetch_1.fieldsToTails)(fields);
|
|
61
|
+
return [2 /*return*/, tails];
|
|
65
62
|
}
|
|
66
63
|
});
|
|
67
64
|
});
|
|
@@ -39,8 +39,9 @@ export declare function getUnstakeNftTx(gasBudget: number, nftPackageId: string,
|
|
|
39
39
|
)
|
|
40
40
|
*/
|
|
41
41
|
export declare function getSnapshotTx(gasBudget: number, nftPackageId: string, registry: string): Promise<TransactionBlock>;
|
|
42
|
-
export declare function
|
|
43
|
-
|
|
42
|
+
export declare function getFirstNewBidTx(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
|
|
43
|
+
usingSponsoredGasCoin?: boolean): Promise<TransactionBlock>;
|
|
44
|
+
export declare function getFirstDepositTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, additional_config_registry: string, index: string, coins: string[], amount: string, usingSponsoredGasCoin?: boolean): Promise<TransactionBlock>;
|
|
44
45
|
/**
|
|
45
46
|
public fun level_up(
|
|
46
47
|
registry: &mut Registry,
|
|
@@ -35,8 +35,24 @@ 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 __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
|
+
};
|
|
38
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getLevelUpTx = exports.getFirstDepositTx = exports.
|
|
55
|
+
exports.getLevelUpTx = exports.getFirstDepositTx = exports.getFirstNewBidTx = exports.getSnapshotTx = exports.getUnstakeNftTx = exports.getStakeNftTx = exports.getTransferNftsTx = exports.getTransferNftTx = void 0;
|
|
40
56
|
var sui_js_1 = require("@mysten/sui.js");
|
|
41
57
|
var constants_1 = require("../../constants");
|
|
42
58
|
/**
|
|
@@ -55,7 +71,7 @@ function getTransferNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap, n
|
|
|
55
71
|
return __generator(this, function (_a) {
|
|
56
72
|
tx = new sui_js_1.TransactionBlock();
|
|
57
73
|
tx.moveCall({
|
|
58
|
-
target: "".concat(nftPackageId, "::
|
|
74
|
+
target: "".concat(nftPackageId, "::tails_staking::transfer_nft"),
|
|
59
75
|
typeArguments: [],
|
|
60
76
|
arguments: [tx.object(registry), tx.object(kiosk), tx.object(kiosk_cap), tx.object(nft_id), tx.pure(receiver)],
|
|
61
77
|
});
|
|
@@ -73,7 +89,7 @@ function getTransferNftsTx(gasBudget, nftPackageId, registry, kiosks, kiosk_caps
|
|
|
73
89
|
i = 0;
|
|
74
90
|
while (i < kiosks.length) {
|
|
75
91
|
tx.moveCall({
|
|
76
|
-
target: "".concat(nftPackageId, "::
|
|
92
|
+
target: "".concat(nftPackageId, "::tails_staking::transfer_nft"),
|
|
77
93
|
typeArguments: [],
|
|
78
94
|
arguments: [tx.object(registry), tx.object(kiosks[i]), tx.object(kiosk_caps[i]), tx.object(nft_ids[i]), tx.pure(receiver)],
|
|
79
95
|
});
|
|
@@ -101,7 +117,7 @@ function getStakeNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap, nft_
|
|
|
101
117
|
return __generator(this, function (_a) {
|
|
102
118
|
tx = new sui_js_1.TransactionBlock();
|
|
103
119
|
tx.moveCall({
|
|
104
|
-
target: "".concat(nftPackageId, "::
|
|
120
|
+
target: "".concat(nftPackageId, "::tails_staking::stake_nft"),
|
|
105
121
|
typeArguments: [],
|
|
106
122
|
arguments: [tx.object(registry), tx.object(kiosk), tx.object(kiosk_cap), tx.object(nft_id), tx.object(constants_1.CLOCK)],
|
|
107
123
|
});
|
|
@@ -125,7 +141,7 @@ function getUnstakeNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap) {
|
|
|
125
141
|
return __generator(this, function (_a) {
|
|
126
142
|
tx = new sui_js_1.TransactionBlock();
|
|
127
143
|
tx.moveCall({
|
|
128
|
-
target: "".concat(nftPackageId, "::
|
|
144
|
+
target: "".concat(nftPackageId, "::tails_staking::unstake_nft"),
|
|
129
145
|
typeArguments: [],
|
|
130
146
|
arguments: [tx.object(registry), tx.object(kiosk), tx.object(kiosk_cap)],
|
|
131
147
|
});
|
|
@@ -148,7 +164,7 @@ function getSnapshotTx(gasBudget, nftPackageId, registry) {
|
|
|
148
164
|
return __generator(this, function (_a) {
|
|
149
165
|
tx = new sui_js_1.TransactionBlock();
|
|
150
166
|
tx.moveCall({
|
|
151
|
-
target: "".concat(nftPackageId, "::
|
|
167
|
+
target: "".concat(nftPackageId, "::tails_staking::snapshot"),
|
|
152
168
|
typeArguments: [],
|
|
153
169
|
arguments: [tx.object(registry), tx.object(constants_1.CLOCK)],
|
|
154
170
|
});
|
|
@@ -158,32 +174,87 @@ function getSnapshotTx(gasBudget, nftPackageId, registry) {
|
|
|
158
174
|
});
|
|
159
175
|
}
|
|
160
176
|
exports.getSnapshotTx = getSnapshotTx;
|
|
161
|
-
function
|
|
177
|
+
function getFirstNewBidTx(gasBudget, packageId, typeArguments, registry, additional_config_registry, index, priceOracle, coins, size, premium_required, // fe float * b_token_decimal
|
|
178
|
+
usingSponsoredGasCoin) {
|
|
179
|
+
if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
|
|
162
180
|
return __awaiter(this, void 0, void 0, function () {
|
|
163
|
-
var tx;
|
|
164
|
-
return __generator(this, function (
|
|
181
|
+
var tx, _a, coin;
|
|
182
|
+
return __generator(this, function (_b) {
|
|
165
183
|
tx = new sui_js_1.TransactionBlock();
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
184
|
+
if (!usingSponsoredGasCoin &&
|
|
185
|
+
(typeArguments[1] == "0x2::sui::SUI" ||
|
|
186
|
+
typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
|
|
187
|
+
_a = __read(tx.splitCoins(tx.gas, [tx.pure(premium_required)]), 1), coin = _a[0];
|
|
188
|
+
tx.moveCall({
|
|
189
|
+
target: "".concat(packageId, "::tails_staking::first_new_bid"),
|
|
190
|
+
typeArguments: typeArguments,
|
|
191
|
+
arguments: [
|
|
192
|
+
tx.pure(registry),
|
|
193
|
+
tx.pure(additional_config_registry),
|
|
194
|
+
tx.pure(index),
|
|
195
|
+
tx.pure(priceOracle),
|
|
196
|
+
tx.pure("0x6"),
|
|
197
|
+
tx.makeMoveVec({ objects: [coin] }),
|
|
198
|
+
tx.pure(size),
|
|
199
|
+
],
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
tx.moveCall({
|
|
204
|
+
target: "".concat(packageId, "::tails_staking::first_new_bid"),
|
|
205
|
+
typeArguments: typeArguments,
|
|
206
|
+
arguments: [
|
|
207
|
+
tx.pure(registry),
|
|
208
|
+
tx.pure(additional_config_registry),
|
|
209
|
+
tx.pure(index),
|
|
210
|
+
tx.pure(priceOracle),
|
|
211
|
+
tx.pure("0x6"),
|
|
212
|
+
tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
|
|
213
|
+
tx.pure(size),
|
|
214
|
+
],
|
|
215
|
+
});
|
|
216
|
+
}
|
|
171
217
|
tx.setGasBudget(gasBudget);
|
|
172
218
|
return [2 /*return*/, tx];
|
|
173
219
|
});
|
|
174
220
|
});
|
|
175
221
|
}
|
|
176
|
-
exports.
|
|
177
|
-
function getFirstDepositTx(gasBudget,
|
|
222
|
+
exports.getFirstNewBidTx = getFirstNewBidTx;
|
|
223
|
+
function getFirstDepositTx(gasBudget, packageId, typeArguments, registry, additional_config_registry, index, coins, amount, usingSponsoredGasCoin) {
|
|
224
|
+
if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
|
|
178
225
|
return __awaiter(this, void 0, void 0, function () {
|
|
179
|
-
var tx;
|
|
180
|
-
return __generator(this, function (
|
|
226
|
+
var tx, _a, coin;
|
|
227
|
+
return __generator(this, function (_b) {
|
|
181
228
|
tx = new sui_js_1.TransactionBlock();
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
229
|
+
if (!usingSponsoredGasCoin &&
|
|
230
|
+
(typeArguments[0] == "0x2::sui::SUI" ||
|
|
231
|
+
typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
|
|
232
|
+
_a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), coin = _a[0];
|
|
233
|
+
tx.moveCall({
|
|
234
|
+
target: "".concat(packageId, "::tails_staking::first_deposit"),
|
|
235
|
+
typeArguments: typeArguments,
|
|
236
|
+
arguments: [
|
|
237
|
+
tx.pure(registry),
|
|
238
|
+
tx.pure(additional_config_registry),
|
|
239
|
+
tx.pure(index),
|
|
240
|
+
tx.makeMoveVec({ objects: [coin] }),
|
|
241
|
+
tx.pure(amount),
|
|
242
|
+
],
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
tx.moveCall({
|
|
247
|
+
target: "".concat(packageId, "::tails_staking::first_deposit"),
|
|
248
|
+
typeArguments: typeArguments,
|
|
249
|
+
arguments: [
|
|
250
|
+
tx.pure(registry),
|
|
251
|
+
tx.pure(additional_config_registry),
|
|
252
|
+
tx.pure(index),
|
|
253
|
+
tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
|
|
254
|
+
tx.pure(amount),
|
|
255
|
+
],
|
|
256
|
+
});
|
|
257
|
+
}
|
|
187
258
|
tx.setGasBudget(gasBudget);
|
|
188
259
|
return [2 /*return*/, tx];
|
|
189
260
|
});
|
|
@@ -202,7 +273,7 @@ function getLevelUpTx(gasBudget, nftPackageId, registry) {
|
|
|
202
273
|
return __generator(this, function (_a) {
|
|
203
274
|
tx = new sui_js_1.TransactionBlock();
|
|
204
275
|
tx.moveCall({
|
|
205
|
-
target: "".concat(nftPackageId, "::
|
|
276
|
+
target: "".concat(nftPackageId, "::tails_staking::level_up"),
|
|
206
277
|
typeArguments: [],
|
|
207
278
|
arguments: [tx.object(registry)],
|
|
208
279
|
});
|
|
@@ -9,7 +9,7 @@ import { TransactionBlock } from "@mysten/sui.js";
|
|
|
9
9
|
ctx: &mut TxContext,
|
|
10
10
|
)
|
|
11
11
|
*/
|
|
12
|
-
export declare function getDepositTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string,
|
|
12
|
+
export declare function getDepositTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, coins: string[], amount: string, receipts: string[], usingSponsoredGasCoin?: boolean): Promise<TransactionBlock>;
|
|
13
13
|
/**
|
|
14
14
|
public(friend) entry fun withdraw<D_TOKEN, B_TOKEN, O_TOKEN>(
|
|
15
15
|
registry: &mut Registry,
|
|
@@ -80,7 +80,8 @@ usingSponsoredGasCoin?: boolean): Promise<TransactionBlock>;
|
|
|
80
80
|
export declare function getExerciseTx(gasBudget: number, packageId: string, registry: string, requests: [{
|
|
81
81
|
typeArguments: string[];
|
|
82
82
|
index: string;
|
|
83
|
-
|
|
83
|
+
receipts: string[];
|
|
84
|
+
}]): Promise<TransactionBlock>;
|
|
84
85
|
/**
|
|
85
86
|
public(friend) entry fun refund<TOKEN>(
|
|
86
87
|
registry: &mut Registry,
|
|
@@ -64,7 +64,7 @@ var sui_js_1 = require("@mysten/sui.js");
|
|
|
64
64
|
ctx: &mut TxContext,
|
|
65
65
|
)
|
|
66
66
|
*/
|
|
67
|
-
function getDepositTx(gasBudget, packageId, typeArguments, registry,
|
|
67
|
+
function getDepositTx(gasBudget, packageId, typeArguments, registry, index, coins, amount, receipts, usingSponsoredGasCoin) {
|
|
68
68
|
if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
|
|
69
69
|
return __awaiter(this, void 0, void 0, function () {
|
|
70
70
|
var tx, _a, coin;
|
|
@@ -79,7 +79,6 @@ function getDepositTx(gasBudget, packageId, typeArguments, registry, additional_
|
|
|
79
79
|
typeArguments: typeArguments,
|
|
80
80
|
arguments: [
|
|
81
81
|
tx.pure(registry),
|
|
82
|
-
tx.pure(additional_config_registry),
|
|
83
82
|
tx.pure(index),
|
|
84
83
|
tx.makeMoveVec({ objects: [coin] }),
|
|
85
84
|
tx.pure(amount),
|
|
@@ -93,7 +92,6 @@ function getDepositTx(gasBudget, packageId, typeArguments, registry, additional_
|
|
|
93
92
|
typeArguments: typeArguments,
|
|
94
93
|
arguments: [
|
|
95
94
|
tx.pure(registry),
|
|
96
|
-
tx.pure(additional_config_registry),
|
|
97
95
|
tx.pure(index),
|
|
98
96
|
tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
|
|
99
97
|
tx.pure(amount),
|
|
@@ -293,7 +291,7 @@ exports.getNewBidTx = getNewBidTx;
|
|
|
293
291
|
ctx: &mut TxContext,
|
|
294
292
|
)
|
|
295
293
|
*/
|
|
296
|
-
function getExerciseTx(gasBudget, packageId, registry, requests
|
|
294
|
+
function getExerciseTx(gasBudget, packageId, registry, requests) {
|
|
297
295
|
return __awaiter(this, void 0, void 0, function () {
|
|
298
296
|
var tx;
|
|
299
297
|
return __generator(this, function (_a) {
|
|
@@ -302,7 +300,11 @@ function getExerciseTx(gasBudget, packageId, registry, requests, receipts) {
|
|
|
302
300
|
tx.moveCall({
|
|
303
301
|
target: "".concat(packageId, "::typus_dov_single::exercise"),
|
|
304
302
|
typeArguments: request.typeArguments,
|
|
305
|
-
arguments: [
|
|
303
|
+
arguments: [
|
|
304
|
+
tx.pure(registry),
|
|
305
|
+
tx.pure(request.index),
|
|
306
|
+
tx.makeMoveVec({ objects: request.receipts.map(function (id) { return tx.object(id); }) }),
|
|
307
|
+
],
|
|
306
308
|
});
|
|
307
309
|
});
|
|
308
310
|
tx.setGasBudget(gasBudget);
|
|
@@ -18,6 +18,7 @@ interface TailsId {
|
|
|
18
18
|
}
|
|
19
19
|
export declare function getTailsIds(provider: JsonRpcProvider, nftConfig: any, kiosks: OwnedKiosks): Promise<TailsId[]>;
|
|
20
20
|
export declare function getTails(provider: JsonRpcProvider, tailsIds: string[]): Promise<Tails[]>;
|
|
21
|
+
export declare function fieldsToTails(fields: any): Tails;
|
|
21
22
|
export interface Tails {
|
|
22
23
|
id: string;
|
|
23
24
|
name: string;
|
|
@@ -28,6 +29,8 @@ export interface Tails {
|
|
|
28
29
|
first_bid: string;
|
|
29
30
|
first_deposit: string;
|
|
30
31
|
first_deposit_nft: string;
|
|
32
|
+
attributes: Map<string, string>;
|
|
33
|
+
u64_padding: Map<string, string>;
|
|
31
34
|
}
|
|
32
35
|
export declare function getLevelExp(level: number): number | undefined;
|
|
33
36
|
export declare const LevelExpVec: number[];
|
|
@@ -47,7 +47,7 @@ var __values = (this && this.__values) || function(o) {
|
|
|
47
47
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.LevelExpVec = exports.getLevelExp = exports.getTails = exports.getTailsIds = exports.getWhitelistMap = exports.getPoolMap = exports.necklaces = exports.getPool = void 0;
|
|
50
|
+
exports.LevelExpVec = exports.getLevelExp = exports.fieldsToTails = exports.getTails = exports.getTailsIds = exports.getWhitelistMap = exports.getPoolMap = exports.necklaces = exports.getPool = void 0;
|
|
51
51
|
var kiosk_1 = require("@mysten/kiosk");
|
|
52
52
|
function getPool(provider, pool) {
|
|
53
53
|
var _a;
|
|
@@ -228,17 +228,7 @@ function getTails(provider, tailsIds) {
|
|
|
228
228
|
for (results_1 = (e_2 = void 0, __values(results)), results_1_1 = results_1.next(); !results_1_1.done; results_1_1 = results_1.next()) {
|
|
229
229
|
result = results_1_1.value;
|
|
230
230
|
fields = (_a = result.data) === null || _a === void 0 ? void 0 : _a.content.fields;
|
|
231
|
-
tails =
|
|
232
|
-
id: fields.id.id,
|
|
233
|
-
name: fields.name,
|
|
234
|
-
number: fields.number,
|
|
235
|
-
url: fields.url,
|
|
236
|
-
level: fields.level,
|
|
237
|
-
exp: fields.exp,
|
|
238
|
-
first_bid: fields.first_bid,
|
|
239
|
-
first_deposit: fields.first_deposit,
|
|
240
|
-
first_deposit_nft: fields.first_deposit_nft,
|
|
241
|
-
};
|
|
231
|
+
tails = fieldsToTails(fields);
|
|
242
232
|
Tails.push(tails);
|
|
243
233
|
}
|
|
244
234
|
}
|
|
@@ -256,6 +246,28 @@ function getTails(provider, tailsIds) {
|
|
|
256
246
|
});
|
|
257
247
|
}
|
|
258
248
|
exports.getTails = getTails;
|
|
249
|
+
function fieldsToTails(fields) {
|
|
250
|
+
// console.log(fields.attributes.fields.contents);
|
|
251
|
+
var attributes = new Map();
|
|
252
|
+
fields.attributes.fields.contents.forEach(function (f) { return attributes.set(f.fields.key, f.fields.value); });
|
|
253
|
+
var u64_padding = new Map();
|
|
254
|
+
fields.u64_padding.fields.contents.forEach(function (f) { return u64_padding.set(f.fields.key, f.fields.value); });
|
|
255
|
+
var tails = {
|
|
256
|
+
id: fields.id.id,
|
|
257
|
+
name: fields.name,
|
|
258
|
+
number: fields.number,
|
|
259
|
+
url: fields.url,
|
|
260
|
+
level: fields.level,
|
|
261
|
+
exp: fields.exp,
|
|
262
|
+
first_bid: fields.first_bid,
|
|
263
|
+
first_deposit: fields.first_deposit,
|
|
264
|
+
first_deposit_nft: fields.first_deposit_nft,
|
|
265
|
+
attributes: attributes,
|
|
266
|
+
u64_padding: u64_padding,
|
|
267
|
+
};
|
|
268
|
+
return tails;
|
|
269
|
+
}
|
|
270
|
+
exports.fieldsToTails = fieldsToTails;
|
|
259
271
|
function getLevelExp(level) {
|
|
260
272
|
switch (level) {
|
|
261
273
|
case 1:
|