@typus/typus-sdk 1.4.20 → 1.4.21
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/token-user-entry.d.ts +46 -8
- package/dist/src/auto-bid/token-user-entry.js +117 -74
- package/dist/src/auto-bid/user-entry.d.ts +42 -8
- package/dist/src/auto-bid/user-entry.js +92 -93
- package/dist/src/auto-bid/view-function.d.ts +8 -5
- package/dist/src/auto-bid/view-function.js +26 -15
- package/dist/src/constants/constant.d.ts +1 -0
- package/dist/src/constants/constant.js +2 -1
- package/dist/src/dice/api.d.ts +13 -1
- package/dist/src/dice/api.js +25 -14
- package/dist/src/dice/fetch.d.ts +8 -12
- package/dist/src/dice/fetch.js +77 -30
- package/dist/src/dice/user-entry.d.ts +29 -17
- package/dist/src/dice/user-entry.js +114 -79
- package/dist/src/dice/view-function.d.ts +14 -1
- package/dist/src/dice/view-function.js +34 -25
- package/dist/src/typus/airdrop/view-function.d.ts +1 -2
- package/dist/src/typus/airdrop/view-function.js +6 -3
- package/dist/src/typus/leaderboard/view-function.d.ts +1 -2
- package/dist/src/typus/leaderboard/view-function.js +6 -3
- package/dist/src/typus/tails-staking/authority-entry.js +2 -2
- package/dist/src/typus/tails-staking/view-function.d.ts +2 -3
- package/dist/src/typus/tails-staking/view-function.js +10 -6
- package/dist/src/typus/user/view-function.d.ts +1 -2
- package/dist/src/typus/user/view-function.js +6 -4
- package/dist/src/typus-dov-single-v2/authority-entry.d.ts +0 -25
- package/dist/src/typus-dov-single-v2/authority-entry.js +26 -0
- package/dist/src/typus-dov-single-v2/function/bidding.d.ts +5 -3
- package/dist/src/typus-dov-single-v2/function/bidding.js +17 -14
- package/dist/src/typus-dov-single-v2/history/vault-history.d.ts +3 -2
- package/dist/src/typus-dov-single-v2/history/vault-history.js +6 -4
- package/dist/src/typus-dov-single-v2/token-user-entry.js +10 -10
- package/dist/src/typus-dov-single-v2/view-function.d.ts +6 -7
- package/dist/src/typus-dov-single-v2/view-function.js +26 -19
- package/dist/src/typus-nft/user-entry.d.ts +25 -6
- package/dist/src/typus-nft/user-entry.js +24 -36
- package/dist/src/typus-perp/fetch.d.ts +7 -8
- package/dist/src/typus-perp/fetch.js +35 -24
- package/dist/src/typus-perp/user/order.d.ts +4 -11
- package/dist/src/typus-perp/user/order.js +23 -23
- package/dist/src/typus-perp/user/orderWithBidReceipt.d.ts +9 -9
- package/dist/src/typus-perp/user/orderWithBidReceipt.js +50 -49
- package/dist/src/typus-perp/user/tlp.d.ts +5 -13
- package/dist/src/typus-perp/user/tlp.js +30 -30
- package/dist/src/typus-safu/user-entry.d.ts +4 -8
- package/dist/src/typus-safu/user-entry.js +56 -56
- package/dist/src/typus-safu/view-function.d.ts +0 -3
- package/dist/src/typus-safu/view-function.js +10 -7
- package/package.json +1 -1
|
@@ -37,6 +37,32 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getUpdateConfigTx = getUpdateConfigTx;
|
|
40
|
+
/**
|
|
41
|
+
public(friend) entry fun update_config(
|
|
42
|
+
registry: &mut Registry,
|
|
43
|
+
index: u64,
|
|
44
|
+
oracle_id: Option<address>,
|
|
45
|
+
deposit_lot_size: Option<u64>,
|
|
46
|
+
bid_lot_size: Option<u64>,
|
|
47
|
+
min_deposit_size: Option<u64>,
|
|
48
|
+
min_bid_size: Option<u64>,
|
|
49
|
+
max_deposit_entry: Option<u64>,
|
|
50
|
+
max_bid_entry: Option<u64>,
|
|
51
|
+
deposit_fee_bp: Option<u64>,
|
|
52
|
+
deposit_fee_share_bp: Option<u64>,
|
|
53
|
+
deposit_shared_fee_pool: Option<Option<vector<u8>>>,
|
|
54
|
+
bid_fee_bp: Option<u64>,
|
|
55
|
+
deposit_incentive_bp: Option<u64>,
|
|
56
|
+
bid_incentive_bp: Option<u64>,
|
|
57
|
+
auction_delay_ts_ms: Option<u64>,
|
|
58
|
+
auction_duration_ts_ms: Option<u64>,
|
|
59
|
+
recoup_delay_ts_ms: Option<u64>,
|
|
60
|
+
capacity: Option<u64>,
|
|
61
|
+
leverage: Option<u64>,
|
|
62
|
+
risk_level: Option<u64>,
|
|
63
|
+
ctx: &TxContext,
|
|
64
|
+
) {
|
|
65
|
+
*/
|
|
40
66
|
function getUpdateConfigTx(config, tx, requests) {
|
|
41
67
|
return __awaiter(this, void 0, void 0, function () {
|
|
42
68
|
return __generator(this, function (_a) {
|
|
@@ -130,7 +130,9 @@ export declare const parseBidReceipt: (vaults: Vault[], bidReceipts: {
|
|
|
130
130
|
bidVaultsInfo: BidVaultInfo[];
|
|
131
131
|
};
|
|
132
132
|
export declare const parseBid: (bidVaultInfo: BidVaultInfo, bidShare: BidShare, auction: Auction | null, oTokenPrice: string, isAutoBid: boolean) => Bid & OrderBy;
|
|
133
|
-
export declare const getUserBidReceipts: (
|
|
133
|
+
export declare const getUserBidReceipts: (config: TypusConfig, input: {
|
|
134
|
+
user: string;
|
|
135
|
+
}) => Promise<{
|
|
134
136
|
[key: string]: Receipt[];
|
|
135
137
|
}>;
|
|
136
138
|
/**
|
|
@@ -143,10 +145,10 @@ export declare const getUserBidReceipts: (provider: SuiClient, originFramworkAdd
|
|
|
143
145
|
* @param originFramworkAddress - Typus intial framwork package address.
|
|
144
146
|
* @param registryAddress - Typus registry package address.
|
|
145
147
|
* @param strategyPoolAddress - strategy pool package address.
|
|
146
|
-
* @param
|
|
148
|
+
* @param user - user's wallet address.
|
|
147
149
|
* @param prices - tokens prices (usd pair on Pyth)
|
|
148
150
|
* @return User Bids.
|
|
149
151
|
*/
|
|
150
|
-
export declare const fetchUserBids: (
|
|
152
|
+
export declare const fetchUserBids: (config: TypusConfig, user: string, prices?: {
|
|
151
153
|
[key: string]: CoinInfo;
|
|
152
154
|
}) => Promise<any>;
|
|
@@ -95,6 +95,7 @@ var auto_bid_1 = require("../../auto-bid");
|
|
|
95
95
|
var lodash_1 = require("lodash");
|
|
96
96
|
var client_1 = require("@pythnetwork/client");
|
|
97
97
|
var token_1 = require("./token");
|
|
98
|
+
var client_2 = require("@mysten/sui.js/dist/cjs/client");
|
|
98
99
|
var constants_1 = require("../../constants");
|
|
99
100
|
var bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
100
101
|
var moment_1 = __importDefault(require("moment"));
|
|
@@ -578,14 +579,15 @@ var parseBid = function (bidVaultInfo, bidShare, auction, oTokenPrice, isAutoBid
|
|
|
578
579
|
};
|
|
579
580
|
};
|
|
580
581
|
exports.parseBid = parseBid;
|
|
581
|
-
var getUserBidReceipts = function (
|
|
582
|
-
var bidReceipts, result, hasNextPage, data, nextCursor, data_1, data_1_1, object, content, typeStringComponents, subtype, typeComponents, type, typePackage, vaultIndex, receipt;
|
|
582
|
+
var getUserBidReceipts = function (config, input) { return __awaiter(void 0, void 0, void 0, function () {
|
|
583
|
+
var provider, bidReceipts, result, hasNextPage, data, nextCursor, data_1, data_1_1, object, content, typeStringComponents, subtype, typeComponents, type, typePackage, vaultIndex, receipt;
|
|
583
584
|
var e_1, _a;
|
|
584
585
|
return __generator(this, function (_b) {
|
|
585
586
|
switch (_b.label) {
|
|
586
587
|
case 0:
|
|
588
|
+
provider = new client_2.SuiClient({ url: config.rpcEndpoint });
|
|
587
589
|
bidReceipts = {};
|
|
588
|
-
return [4 /*yield*/, provider.getOwnedObjects({ owner:
|
|
590
|
+
return [4 /*yield*/, provider.getOwnedObjects({ owner: input.user, options: { showType: true, showContent: true } })];
|
|
589
591
|
case 1:
|
|
590
592
|
result = _b.sent();
|
|
591
593
|
hasNextPage = result.hasNextPage;
|
|
@@ -594,7 +596,7 @@ var getUserBidReceipts = function (provider, originFramworkAddress, userAddress)
|
|
|
594
596
|
_b.label = 2;
|
|
595
597
|
case 2:
|
|
596
598
|
if (!hasNextPage) return [3 /*break*/, 4];
|
|
597
|
-
return [4 /*yield*/, provider.getOwnedObjects({ owner:
|
|
599
|
+
return [4 /*yield*/, provider.getOwnedObjects({ owner: input.user, cursor: nextCursor, options: { showType: true, showContent: true } })];
|
|
598
600
|
case 3:
|
|
599
601
|
result = _b.sent();
|
|
600
602
|
data = __spreadArray(__spreadArray([], __read(data), false), __read(result.data), false);
|
|
@@ -617,7 +619,7 @@ var getUserBidReceipts = function (provider, originFramworkAddress, userAddress)
|
|
|
617
619
|
typeComponents = typeStringComponents[0].split("::");
|
|
618
620
|
type = typeComponents[typeComponents.length - 1];
|
|
619
621
|
typePackage = typeComponents[0];
|
|
620
|
-
if (type === "TypusBidReceipt" &&
|
|
622
|
+
if (type === "TypusBidReceipt" && config.packageOrigin.framework == typePackage) {
|
|
621
623
|
vaultIndex = content.fields.index;
|
|
622
624
|
receipt = {
|
|
623
625
|
// @ts-ignore
|
|
@@ -664,30 +666,31 @@ exports.getUserBidReceipts = getUserBidReceipts;
|
|
|
664
666
|
* @param originFramworkAddress - Typus intial framwork package address.
|
|
665
667
|
* @param registryAddress - Typus registry package address.
|
|
666
668
|
* @param strategyPoolAddress - strategy pool package address.
|
|
667
|
-
* @param
|
|
669
|
+
* @param user - user's wallet address.
|
|
668
670
|
* @param prices - tokens prices (usd pair on Pyth)
|
|
669
671
|
* @return User Bids.
|
|
670
672
|
*/
|
|
671
|
-
var fetchUserBids = function (
|
|
672
|
-
var packageAddress, registryAddress, originFramworkAddress,
|
|
673
|
+
var fetchUserBids = function (config, user, prices) { return __awaiter(void 0, void 0, void 0, function () {
|
|
674
|
+
var provider, packageAddress, registryAddress, originFramworkAddress, strategyPool, vaultsInfo, userReceipts, userStrategies, auctions, _a, sortedBidReceipts, bidVaultsInfo, bidShares, bidsFromBidShares, _loop_1, bidVaultsInfo_1, bidVaultsInfo_1_1, bidVaultInfo, autoBidsShares, vaultAutoBidReceipts, userStrategies_1, userStrategies_1_1, strategy, receipts, receipts_1, receipts_1_1, receiptItem, vaultIndex, receipt, autoBidVaultInfos, bidsFromStrategies, _loop_2, autoBidVaultInfos_1, autoBidVaultInfos_1_1, autoBidVaultInfo, byOrdered;
|
|
673
675
|
var e_2, _b, e_3, _c, e_4, _d, e_5, _e;
|
|
674
676
|
return __generator(this, function (_f) {
|
|
675
677
|
switch (_f.label) {
|
|
676
678
|
case 0:
|
|
679
|
+
provider = new client_2.SuiClient({ url: config.rpcEndpoint });
|
|
677
680
|
packageAddress = config.package.dovSingle;
|
|
678
681
|
registryAddress = config.registry.dov.dovSingle;
|
|
679
682
|
originFramworkAddress = config.packageOrigin.framework;
|
|
680
|
-
|
|
681
|
-
return [4 /*yield*/, (0, view_function_1.getVaults)(config,
|
|
683
|
+
strategyPool = config.object.strategyPool;
|
|
684
|
+
return [4 /*yield*/, (0, view_function_1.getVaults)(config, { indexes: [] })];
|
|
682
685
|
case 1:
|
|
683
686
|
vaultsInfo = _f.sent();
|
|
684
|
-
return [4 /*yield*/, (0, exports.getUserBidReceipts)(
|
|
687
|
+
return [4 /*yield*/, (0, exports.getUserBidReceipts)(config, { user: user })];
|
|
685
688
|
case 2:
|
|
686
689
|
userReceipts = _f.sent();
|
|
687
|
-
return [4 /*yield*/, (0, auto_bid_1.getUserStrategies)(
|
|
690
|
+
return [4 /*yield*/, (0, auto_bid_1.getUserStrategies)(config, { strategyPool: strategyPool, user: user })];
|
|
688
691
|
case 3:
|
|
689
692
|
userStrategies = _f.sent();
|
|
690
|
-
return [4 /*yield*/, (0, view_function_1.getAuctions)(config,
|
|
693
|
+
return [4 /*yield*/, (0, view_function_1.getAuctions)(config, { indexes: [] })];
|
|
691
694
|
case 4:
|
|
692
695
|
auctions = _f.sent();
|
|
693
696
|
if (!(typeof prices === "undefined")) return [3 /*break*/, 6];
|
|
@@ -697,7 +700,7 @@ var fetchUserBids = function (provider, config, userAddress, prices) { return __
|
|
|
697
700
|
_f.label = 6;
|
|
698
701
|
case 6:
|
|
699
702
|
_a = (0, exports.parseBidReceipt)(Object.values(vaultsInfo), userReceipts), sortedBidReceipts = _a.sortedBidReceipts, bidVaultsInfo = _a.bidVaultsInfo;
|
|
700
|
-
return [4 /*yield*/, (0, view_function_1.getMyBids)(config,
|
|
703
|
+
return [4 /*yield*/, (0, view_function_1.getMyBids)(config, { receipts: sortedBidReceipts })];
|
|
701
704
|
case 7:
|
|
702
705
|
bidShares = _f.sent();
|
|
703
706
|
bidsFromBidShares = [];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SuiEvent } from "@mysten/sui.js/client";
|
|
2
2
|
import { OracleInfo, VaultConfig } from "../view-function";
|
|
3
|
-
|
|
3
|
+
import { TypusConfig } from "src/utils";
|
|
4
|
+
export declare function getVaultHistoryEvents(config: TypusConfig, startTimeMs: number): Promise<SuiEvent[]>;
|
|
4
5
|
export declare function parseGroupEvents(datas: SuiEvent[]): Promise<Map<string, Map<string, GroupEvent>>>;
|
|
5
6
|
export declare function parseVaultHistory(inputMap: Map<string, Map<string, GroupEvent>>): Promise<Map<string, Map<string, VaultHistory | undefined>>>;
|
|
6
7
|
export declare function getVaultHistoryFromDB(index?: string, startTs?: string, endTs?: string, rounds?: number[]): Promise<Map<string, Map<string, VaultHistory | undefined>> | undefined>;
|
|
@@ -53,16 +53,18 @@ exports.parseVaultHistory = parseVaultHistory;
|
|
|
53
53
|
exports.getVaultHistoryFromDB = getVaultHistoryFromDB;
|
|
54
54
|
exports.convertGroupEventToVaultHistory = convertGroupEventToVaultHistory;
|
|
55
55
|
exports.parseBidEvents = parseBidEvents;
|
|
56
|
-
var
|
|
57
|
-
|
|
56
|
+
var client_1 = require("@mysten/sui.js/client");
|
|
57
|
+
var constants_1 = require("src/constants");
|
|
58
|
+
function getVaultHistoryEvents(config, startTimeMs) {
|
|
58
59
|
return __awaiter(this, void 0, void 0, function () {
|
|
59
|
-
var senderFilter, result, datas, hasNextPage, cursor, result;
|
|
60
|
+
var provider, senderFilter, result, datas, hasNextPage, cursor, result;
|
|
60
61
|
return __generator(this, function (_a) {
|
|
61
62
|
switch (_a.label) {
|
|
62
63
|
case 0:
|
|
64
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
63
65
|
senderFilter = {
|
|
64
66
|
MoveEventModule: {
|
|
65
|
-
package:
|
|
67
|
+
package: config.packageOrigin.dovSingle,
|
|
66
68
|
module: "typus_dov_single",
|
|
67
69
|
},
|
|
68
70
|
};
|
|
@@ -163,7 +163,7 @@ function getTokenNewBidTx(config, tx, input) {
|
|
|
163
163
|
console.log("No such token exists!");
|
|
164
164
|
break;
|
|
165
165
|
}
|
|
166
|
-
var
|
|
166
|
+
var mToken = tx.moveCall({
|
|
167
167
|
target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::mint"),
|
|
168
168
|
arguments: [
|
|
169
169
|
tx.object(typusTokenRegistry),
|
|
@@ -181,7 +181,7 @@ function getTokenNewBidTx(config, tx, input) {
|
|
|
181
181
|
tx.object(config.registry.typus.leaderboard),
|
|
182
182
|
tx.object(config.registry.dov.dovSingle),
|
|
183
183
|
tx.pure(input.index),
|
|
184
|
-
tx.makeMoveVec({ objects: [
|
|
184
|
+
tx.makeMoveVec({ objects: [mToken] }),
|
|
185
185
|
tx.pure(input.size),
|
|
186
186
|
tx.pure("0x6"),
|
|
187
187
|
],
|
|
@@ -216,16 +216,16 @@ function getTokenExerciseTx(config, tx, input) {
|
|
|
216
216
|
}),
|
|
217
217
|
],
|
|
218
218
|
});
|
|
219
|
-
var
|
|
219
|
+
var mToken = tx.moveCall({
|
|
220
220
|
target: "0x2::coin::from_balance",
|
|
221
221
|
typeArguments: [input.typeArguments[0]],
|
|
222
222
|
arguments: [tx.object(result[0])],
|
|
223
223
|
});
|
|
224
|
-
var
|
|
224
|
+
var token = tx.moveCall({
|
|
225
225
|
target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
|
|
226
|
-
arguments: [tx.object(typusTokenRegistry), tx.object(
|
|
226
|
+
arguments: [tx.object(typusTokenRegistry), tx.object(mToken)],
|
|
227
227
|
});
|
|
228
|
-
tx.transferObjects([tx.object(
|
|
228
|
+
tx.transferObjects([tx.object(token)], input.user);
|
|
229
229
|
return tx;
|
|
230
230
|
}
|
|
231
231
|
function getTokenRebateTx(config, tx, input) {
|
|
@@ -248,16 +248,16 @@ function getTokenRebateTx(config, tx, input) {
|
|
|
248
248
|
typeArguments: ["0x2::balance::Balance<".concat(input.typeArgument, ">")],
|
|
249
249
|
arguments: [tx.object(result[0])],
|
|
250
250
|
});
|
|
251
|
-
var
|
|
251
|
+
var mToken = tx.moveCall({
|
|
252
252
|
target: "0x2::coin::from_balance",
|
|
253
253
|
typeArguments: [input.typeArgument],
|
|
254
254
|
arguments: [tx.object(balance)],
|
|
255
255
|
});
|
|
256
|
-
var
|
|
256
|
+
var token = tx.moveCall({
|
|
257
257
|
target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
|
|
258
|
-
arguments: [tx.object(typusTokenRegistry), tx.object(
|
|
258
|
+
arguments: [tx.object(typusTokenRegistry), tx.object(mToken)],
|
|
259
259
|
});
|
|
260
|
-
tx.transferObjects([tx.object(
|
|
260
|
+
tx.transferObjects([tx.object(token)], input.user);
|
|
261
261
|
return tx;
|
|
262
262
|
}
|
|
263
263
|
function getTokenCompoundWithRedeemTx(config, tx, input) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SuiClient } from "@mysten/sui.js/client";
|
|
2
1
|
import { TypusConfig } from "src/utils";
|
|
3
2
|
export interface Vault {
|
|
4
3
|
id: string;
|
|
@@ -129,7 +128,7 @@ export interface DepositVault {
|
|
|
129
128
|
u64Padding: string[];
|
|
130
129
|
bcsPadding: string[];
|
|
131
130
|
}
|
|
132
|
-
export declare function getVaults(config: TypusConfig,
|
|
131
|
+
export declare function getVaults(config: TypusConfig, input: {
|
|
133
132
|
indexes: string[];
|
|
134
133
|
}): Promise<{
|
|
135
134
|
[key: string]: Vault;
|
|
@@ -152,7 +151,7 @@ export interface Auction {
|
|
|
152
151
|
ableToRemoveBid: boolean;
|
|
153
152
|
bidIndex: string;
|
|
154
153
|
}
|
|
155
|
-
export declare function getAuctions(config: TypusConfig,
|
|
154
|
+
export declare function getAuctions(config: TypusConfig, input: {
|
|
156
155
|
indexes: string[];
|
|
157
156
|
}): Promise<{
|
|
158
157
|
[key: string]: Auction;
|
|
@@ -167,7 +166,7 @@ export interface AuctionBid {
|
|
|
167
166
|
feeDiscount: string;
|
|
168
167
|
tsMs: string;
|
|
169
168
|
}
|
|
170
|
-
export declare function getAuctionBids(config: TypusConfig,
|
|
169
|
+
export declare function getAuctionBids(config: TypusConfig, input: {
|
|
171
170
|
index: string;
|
|
172
171
|
}): Promise<AuctionBid[]>;
|
|
173
172
|
export interface DepositSnapshot {
|
|
@@ -190,7 +189,7 @@ export interface RRR {
|
|
|
190
189
|
};
|
|
191
190
|
b: DepositSnapshot;
|
|
192
191
|
}
|
|
193
|
-
export declare function getDepositShares(config: TypusConfig,
|
|
192
|
+
export declare function getDepositShares(config: TypusConfig, input: {
|
|
194
193
|
receipts: string[];
|
|
195
194
|
user: string;
|
|
196
195
|
}): Promise<{
|
|
@@ -214,12 +213,12 @@ export interface BidShare {
|
|
|
214
213
|
bidVault: BidVault;
|
|
215
214
|
share: string;
|
|
216
215
|
}
|
|
217
|
-
export declare function getMyBids(config: TypusConfig,
|
|
216
|
+
export declare function getMyBids(config: TypusConfig, input: {
|
|
218
217
|
receipts: string[];
|
|
219
218
|
}): Promise<{
|
|
220
219
|
[key: string]: BidShare;
|
|
221
220
|
}>;
|
|
222
|
-
export declare function getRefundShares(config: TypusConfig,
|
|
221
|
+
export declare function getRefundShares(config: TypusConfig, input: {
|
|
223
222
|
typeArguments: string[];
|
|
224
223
|
}): Promise<{
|
|
225
224
|
[key: string]: string;
|
|
@@ -59,15 +59,17 @@ exports.getDepositShares = getDepositShares;
|
|
|
59
59
|
exports.getMyBids = getMyBids;
|
|
60
60
|
exports.getRefundShares = getRefundShares;
|
|
61
61
|
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
62
|
+
var client_1 = require("@mysten/sui.js/client");
|
|
62
63
|
var bcs_1 = require("@mysten/bcs");
|
|
63
64
|
var utils_1 = require("src/utils");
|
|
64
|
-
var
|
|
65
|
-
function getVaults(config,
|
|
65
|
+
var constants_1 = require("src/constants");
|
|
66
|
+
function getVaults(config, input) {
|
|
66
67
|
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
-
var transactionBlock, target, transactionBlockArguments, results, bytes, reader, result;
|
|
68
|
+
var provider, transactionBlock, target, transactionBlockArguments, results, bytes, reader, result;
|
|
68
69
|
return __generator(this, function (_a) {
|
|
69
70
|
switch (_a.label) {
|
|
70
71
|
case 0:
|
|
72
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
71
73
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
72
74
|
target = "".concat(config.package.dovSingle, "::tds_view_function::get_vault_data_bcs");
|
|
73
75
|
transactionBlockArguments = [transactionBlock.pure(config.registry.dov.dovSingle), transactionBlock.pure(input.indexes)];
|
|
@@ -76,7 +78,7 @@ function getVaults(config, provider, input) {
|
|
|
76
78
|
typeArguments: [],
|
|
77
79
|
arguments: transactionBlockArguments,
|
|
78
80
|
});
|
|
79
|
-
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: SENDER })];
|
|
81
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: constants_1.SENDER })];
|
|
80
82
|
case 1:
|
|
81
83
|
results = (_a.sent()).results;
|
|
82
84
|
bytes = results[results.length - 1].returnValues[0][0];
|
|
@@ -292,12 +294,13 @@ function getVaults(config, provider, input) {
|
|
|
292
294
|
});
|
|
293
295
|
});
|
|
294
296
|
}
|
|
295
|
-
function getAuctions(config,
|
|
297
|
+
function getAuctions(config, input) {
|
|
296
298
|
return __awaiter(this, void 0, void 0, function () {
|
|
297
|
-
var transactionBlock, target, transactionBlockArguments, results, bytes, reader, result;
|
|
299
|
+
var provider, transactionBlock, target, transactionBlockArguments, results, bytes, reader, result;
|
|
298
300
|
return __generator(this, function (_a) {
|
|
299
301
|
switch (_a.label) {
|
|
300
302
|
case 0:
|
|
303
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
301
304
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
302
305
|
target = "".concat(config.package.dovSingle, "::tds_view_function::get_auction_bcs");
|
|
303
306
|
transactionBlockArguments = [transactionBlock.pure(config.registry.dov.dovSingle), transactionBlock.pure(input.indexes)];
|
|
@@ -306,7 +309,7 @@ function getAuctions(config, provider, input) {
|
|
|
306
309
|
typeArguments: [],
|
|
307
310
|
arguments: transactionBlockArguments,
|
|
308
311
|
});
|
|
309
|
-
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: SENDER })];
|
|
312
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: constants_1.SENDER })];
|
|
310
313
|
case 1:
|
|
311
314
|
results = (_a.sent()).results;
|
|
312
315
|
bytes = results[results.length - 1].returnValues[0][0];
|
|
@@ -359,12 +362,13 @@ function getAuctions(config, provider, input) {
|
|
|
359
362
|
});
|
|
360
363
|
});
|
|
361
364
|
}
|
|
362
|
-
function getAuctionBids(config,
|
|
365
|
+
function getAuctionBids(config, input) {
|
|
363
366
|
return __awaiter(this, void 0, void 0, function () {
|
|
364
|
-
var transactionBlock, target, transactionBlockArguments, results, bytes, reader, result;
|
|
367
|
+
var provider, transactionBlock, target, transactionBlockArguments, results, bytes, reader, result;
|
|
365
368
|
return __generator(this, function (_a) {
|
|
366
369
|
switch (_a.label) {
|
|
367
370
|
case 0:
|
|
371
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
368
372
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
369
373
|
target = "".concat(config.package.dovSingle, "::tds_view_function::get_auction_bids_bcs");
|
|
370
374
|
transactionBlockArguments = [transactionBlock.pure(config.registry.dov.dovSingle), transactionBlock.pure(input.index)];
|
|
@@ -373,7 +377,7 @@ function getAuctionBids(config, provider, input) {
|
|
|
373
377
|
typeArguments: [],
|
|
374
378
|
arguments: transactionBlockArguments,
|
|
375
379
|
});
|
|
376
|
-
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: SENDER })];
|
|
380
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: constants_1.SENDER })];
|
|
377
381
|
case 1:
|
|
378
382
|
results = (_a.sent()).results;
|
|
379
383
|
bytes = results[results.length - 1].returnValues[0][0];
|
|
@@ -397,12 +401,13 @@ function getAuctionBids(config, provider, input) {
|
|
|
397
401
|
});
|
|
398
402
|
});
|
|
399
403
|
}
|
|
400
|
-
function getDepositShares(config,
|
|
404
|
+
function getDepositShares(config, input) {
|
|
401
405
|
return __awaiter(this, void 0, void 0, function () {
|
|
402
|
-
var transactionBlock, target, transactionBlockArguments, results, bytes, reader, depositShare, depositSnapshot;
|
|
406
|
+
var provider, transactionBlock, target, transactionBlockArguments, results, bytes, reader, depositShare, depositSnapshot;
|
|
403
407
|
return __generator(this, function (_a) {
|
|
404
408
|
switch (_a.label) {
|
|
405
409
|
case 0:
|
|
410
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
406
411
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
407
412
|
target = "".concat(config.package.dovSingle, "::tds_view_function::get_deposit_shares_bcs");
|
|
408
413
|
transactionBlockArguments = [
|
|
@@ -418,7 +423,7 @@ function getDepositShares(config, provider, input) {
|
|
|
418
423
|
typeArguments: [],
|
|
419
424
|
arguments: transactionBlockArguments,
|
|
420
425
|
});
|
|
421
|
-
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: SENDER })];
|
|
426
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: constants_1.SENDER })];
|
|
422
427
|
case 1:
|
|
423
428
|
results = (_a.sent()).results;
|
|
424
429
|
bytes = results[results.length - 1].returnValues[0][0];
|
|
@@ -467,12 +472,13 @@ function getDepositShares(config, provider, input) {
|
|
|
467
472
|
});
|
|
468
473
|
});
|
|
469
474
|
}
|
|
470
|
-
function getMyBids(config,
|
|
475
|
+
function getMyBids(config, input) {
|
|
471
476
|
return __awaiter(this, void 0, void 0, function () {
|
|
472
|
-
var transactionBlock, target, transactionBlockArguments, results, bytes, reader, result;
|
|
477
|
+
var provider, transactionBlock, target, transactionBlockArguments, results, bytes, reader, result;
|
|
473
478
|
return __generator(this, function (_a) {
|
|
474
479
|
switch (_a.label) {
|
|
475
480
|
case 0:
|
|
481
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
476
482
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
477
483
|
target = "".concat(config.package.dovSingle, "::tds_view_function::get_my_bids_bcs");
|
|
478
484
|
transactionBlockArguments = [
|
|
@@ -487,7 +493,7 @@ function getMyBids(config, provider, input) {
|
|
|
487
493
|
typeArguments: [],
|
|
488
494
|
arguments: transactionBlockArguments,
|
|
489
495
|
});
|
|
490
|
-
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: SENDER })];
|
|
496
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: constants_1.SENDER })];
|
|
491
497
|
case 1:
|
|
492
498
|
results = (_a.sent()).results;
|
|
493
499
|
bytes = results[results.length - 1].returnValues[0][0];
|
|
@@ -529,12 +535,13 @@ function getMyBids(config, provider, input) {
|
|
|
529
535
|
});
|
|
530
536
|
});
|
|
531
537
|
}
|
|
532
|
-
function getRefundShares(config,
|
|
538
|
+
function getRefundShares(config, input) {
|
|
533
539
|
return __awaiter(this, void 0, void 0, function () {
|
|
534
|
-
var transactionBlock, target, transactionBlockArguments, results, refundShares;
|
|
540
|
+
var provider, transactionBlock, target, transactionBlockArguments, results, refundShares;
|
|
535
541
|
return __generator(this, function (_a) {
|
|
536
542
|
switch (_a.label) {
|
|
537
543
|
case 0:
|
|
544
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
538
545
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
539
546
|
target = "".concat(config.package.dovSingle, "::tds_view_function::get_refund_shares_bcs");
|
|
540
547
|
transactionBlockArguments = [transactionBlock.pure(config.registry.dov.dovSingle)];
|
|
@@ -547,7 +554,7 @@ function getRefundShares(config, provider, input) {
|
|
|
547
554
|
});
|
|
548
555
|
return [4 /*yield*/, provider.devInspectTransactionBlock({
|
|
549
556
|
transactionBlock: transactionBlock,
|
|
550
|
-
sender: SENDER,
|
|
557
|
+
sender: constants_1.SENDER,
|
|
551
558
|
})];
|
|
552
559
|
case 1:
|
|
553
560
|
results = (_a.sent()).results;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TransactionArgument, TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { TypusConfig } from "src/utils";
|
|
2
3
|
/**
|
|
3
4
|
entry fun free_mint(
|
|
4
5
|
pool: &mut Pool,
|
|
@@ -6,7 +7,10 @@ import { TransactionArgument, TransactionBlock } from "@mysten/sui.js/transactio
|
|
|
6
7
|
ctx: &mut TxContext,
|
|
7
8
|
)
|
|
8
9
|
*/
|
|
9
|
-
export declare function getMintTx(
|
|
10
|
+
export declare function getMintTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
11
|
+
pool: string;
|
|
12
|
+
whitelist_token: string;
|
|
13
|
+
}): Promise<TransactionBlock>;
|
|
10
14
|
/**
|
|
11
15
|
entry fun free_mint_into_kiosk(
|
|
12
16
|
pool: &mut Pool,
|
|
@@ -16,15 +20,23 @@ export declare function getMintTx(gasBudget: number, nftPackageId: string, polic
|
|
|
16
20
|
ctx: &mut TxContext,
|
|
17
21
|
)
|
|
18
22
|
*/
|
|
19
|
-
export declare function getMintToKioskTx(
|
|
23
|
+
export declare function getMintToKioskTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
24
|
+
pool: string;
|
|
25
|
+
whitelist_token: string;
|
|
26
|
+
kiosk: string;
|
|
27
|
+
kiosk_cap: string;
|
|
28
|
+
}): Promise<TransactionBlock>;
|
|
20
29
|
/**
|
|
21
30
|
public fun pay<T>(
|
|
22
|
-
|
|
31
|
+
config.object.nftTransferPolicy: &mut TransferPolicy<T>,
|
|
23
32
|
request: &mut TransferRequest<T>,
|
|
24
33
|
payment: Coin<SUI>
|
|
25
34
|
)
|
|
26
35
|
*/
|
|
27
|
-
export declare function getPayRoyaltyTx(
|
|
36
|
+
export declare function getPayRoyaltyTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
37
|
+
request: TransactionArgument;
|
|
38
|
+
coin: string;
|
|
39
|
+
}): Promise<TransactionBlock>;
|
|
28
40
|
/**
|
|
29
41
|
entry fun request_mint(
|
|
30
42
|
pool: &mut Pool,
|
|
@@ -34,5 +46,12 @@ export declare function getPayRoyaltyTx(tx: TransactionBlock, nftPackageId: stri
|
|
|
34
46
|
ctx: & TxContext
|
|
35
47
|
)
|
|
36
48
|
*/
|
|
37
|
-
export declare function getRequestMintTx(
|
|
38
|
-
|
|
49
|
+
export declare function getRequestMintTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
50
|
+
pool: string;
|
|
51
|
+
seed: string;
|
|
52
|
+
price: string;
|
|
53
|
+
}): Promise<TransactionBlock>;
|
|
54
|
+
export declare function getIsWhitelistTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
55
|
+
pool: string;
|
|
56
|
+
user: string;
|
|
57
|
+
}): Promise<TransactionBlock>;
|
|
@@ -57,8 +57,7 @@ exports.getMintToKioskTx = getMintToKioskTx;
|
|
|
57
57
|
exports.getPayRoyaltyTx = getPayRoyaltyTx;
|
|
58
58
|
exports.getRequestMintTx = getRequestMintTx;
|
|
59
59
|
exports.getIsWhitelistTx = getIsWhitelistTx;
|
|
60
|
-
var
|
|
61
|
-
var constants_1 = require("../constants");
|
|
60
|
+
var constants_1 = require("src/constants");
|
|
62
61
|
/**
|
|
63
62
|
entry fun free_mint(
|
|
64
63
|
pool: &mut Pool,
|
|
@@ -66,17 +65,14 @@ var constants_1 = require("../constants");
|
|
|
66
65
|
ctx: &mut TxContext,
|
|
67
66
|
)
|
|
68
67
|
*/
|
|
69
|
-
function getMintTx(
|
|
68
|
+
function getMintTx(config, tx, input) {
|
|
70
69
|
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
-
var tx;
|
|
72
70
|
return __generator(this, function (_a) {
|
|
73
|
-
tx = new transactions_1.TransactionBlock();
|
|
74
71
|
tx.moveCall({
|
|
75
|
-
target: "".concat(
|
|
72
|
+
target: "".concat(config.package.nft, "::typus_nft::free_mint"),
|
|
76
73
|
typeArguments: [],
|
|
77
|
-
arguments: [tx.object(pool), tx.object(
|
|
74
|
+
arguments: [tx.object(input.pool), tx.object(config.object.nftTransferPolicy), tx.object(input.whitelist_token), tx.object(constants_1.CLOCK)],
|
|
78
75
|
});
|
|
79
|
-
tx.setGasBudget(gasBudget);
|
|
80
76
|
return [2 /*return*/, tx];
|
|
81
77
|
});
|
|
82
78
|
});
|
|
@@ -90,42 +86,39 @@ function getMintTx(gasBudget, nftPackageId, policy, pool, whitelist_token) {
|
|
|
90
86
|
ctx: &mut TxContext,
|
|
91
87
|
)
|
|
92
88
|
*/
|
|
93
|
-
function getMintToKioskTx(
|
|
89
|
+
function getMintToKioskTx(config, tx, input) {
|
|
94
90
|
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
-
var tx;
|
|
96
91
|
return __generator(this, function (_a) {
|
|
97
|
-
tx = new transactions_1.TransactionBlock();
|
|
98
92
|
tx.moveCall({
|
|
99
|
-
target: "".concat(
|
|
93
|
+
target: "".concat(config.package.nft, "::typus_nft::free_mint_into_kiosk"),
|
|
100
94
|
typeArguments: [],
|
|
101
95
|
arguments: [
|
|
102
|
-
tx.object(pool),
|
|
103
|
-
tx.object(
|
|
104
|
-
tx.object(whitelist_token),
|
|
105
|
-
tx.object(kiosk),
|
|
106
|
-
tx.object(kiosk_cap),
|
|
96
|
+
tx.object(input.pool),
|
|
97
|
+
tx.object(config.object.nftTransferPolicy),
|
|
98
|
+
tx.object(input.whitelist_token),
|
|
99
|
+
tx.object(input.kiosk),
|
|
100
|
+
tx.object(input.kiosk_cap),
|
|
107
101
|
tx.object(constants_1.CLOCK),
|
|
108
102
|
],
|
|
109
103
|
});
|
|
110
|
-
tx.setGasBudget(gasBudget);
|
|
111
104
|
return [2 /*return*/, tx];
|
|
112
105
|
});
|
|
113
106
|
});
|
|
114
107
|
}
|
|
115
108
|
/**
|
|
116
109
|
public fun pay<T>(
|
|
117
|
-
|
|
110
|
+
config.object.nftTransferPolicy: &mut TransferPolicy<T>,
|
|
118
111
|
request: &mut TransferRequest<T>,
|
|
119
112
|
payment: Coin<SUI>
|
|
120
113
|
)
|
|
121
114
|
*/
|
|
122
|
-
function getPayRoyaltyTx(
|
|
115
|
+
function getPayRoyaltyTx(config, tx, input) {
|
|
123
116
|
return __awaiter(this, void 0, void 0, function () {
|
|
124
117
|
return __generator(this, function (_a) {
|
|
125
118
|
tx.moveCall({
|
|
126
|
-
target: "".concat(
|
|
127
|
-
typeArguments: ["".concat(
|
|
128
|
-
arguments: [tx.object(
|
|
119
|
+
target: "".concat(config.package.nft, "::royalty_rule::pay"),
|
|
120
|
+
typeArguments: ["".concat(config.package.nft, "::typus_nft::Tails")],
|
|
121
|
+
arguments: [tx.object(config.object.nftTransferPolicy), input.request, tx.object(input.coin)],
|
|
129
122
|
});
|
|
130
123
|
return [2 /*return*/, tx];
|
|
131
124
|
});
|
|
@@ -140,33 +133,28 @@ function getPayRoyaltyTx(tx, nftPackageId, policy, request, coin) {
|
|
|
140
133
|
ctx: & TxContext
|
|
141
134
|
)
|
|
142
135
|
*/
|
|
143
|
-
function getRequestMintTx(
|
|
136
|
+
function getRequestMintTx(config, tx, input) {
|
|
144
137
|
return __awaiter(this, void 0, void 0, function () {
|
|
145
|
-
var
|
|
138
|
+
var _a, coin;
|
|
146
139
|
return __generator(this, function (_b) {
|
|
147
|
-
|
|
148
|
-
_a = __read(tx.splitCoins(tx.gas, [tx.pure(price)]), 1), coin = _a[0];
|
|
140
|
+
_a = __read(tx.splitCoins(tx.gas, [tx.pure(input.price)]), 1), coin = _a[0];
|
|
149
141
|
tx.moveCall({
|
|
150
|
-
target: "".concat(
|
|
142
|
+
target: "".concat(config.package.nft, "::discount_mint::request_mint"),
|
|
151
143
|
typeArguments: [],
|
|
152
|
-
arguments: [tx.object(pool), tx.pure(seed), coin, tx.object(constants_1.CLOCK)],
|
|
144
|
+
arguments: [tx.object(input.pool), tx.pure(input.seed), coin, tx.object(constants_1.CLOCK)],
|
|
153
145
|
});
|
|
154
|
-
tx.setGasBudget(gasBudget);
|
|
155
146
|
return [2 /*return*/, tx];
|
|
156
147
|
});
|
|
157
148
|
});
|
|
158
149
|
}
|
|
159
|
-
function getIsWhitelistTx(
|
|
150
|
+
function getIsWhitelistTx(config, tx, input) {
|
|
160
151
|
return __awaiter(this, void 0, void 0, function () {
|
|
161
|
-
var tx;
|
|
162
152
|
return __generator(this, function (_a) {
|
|
163
|
-
tx = new transactions_1.TransactionBlock();
|
|
164
153
|
tx.moveCall({
|
|
165
|
-
target: "".concat(
|
|
154
|
+
target: "".concat(config.package.nft, "::discount_mint::is_whitelist"),
|
|
166
155
|
typeArguments: [],
|
|
167
|
-
arguments: [tx.object(pool), tx.pure(user)],
|
|
156
|
+
arguments: [tx.object(input.pool), tx.pure(input.user)],
|
|
168
157
|
});
|
|
169
|
-
tx.setGasBudget(gasBudget);
|
|
170
158
|
return [2 /*return*/, tx];
|
|
171
159
|
});
|
|
172
160
|
});
|