@typus/typus-perp-sdk 1.0.59 → 1.0.61-ut
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/api/sentio.d.ts +2 -2
- package/dist/src/api/sentio.js +8 -8
- package/dist/src/fetch.d.ts +6 -0
- package/dist/src/fetch.js +46 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +4 -3
- package/dist/src/typus_perp/admin/functions.d.ts +10 -0
- package/dist/src/typus_perp/admin/functions.js +17 -0
- package/dist/src/typus_perp/competition/functions.d.ts +24 -0
- package/dist/src/typus_perp/competition/functions.js +38 -0
- package/dist/src/typus_perp/competition/structs.d.ts +92 -0
- package/dist/src/typus_perp/competition/structs.js +288 -0
- package/dist/src/typus_perp/error/functions.d.ts +5 -0
- package/dist/src/typus_perp/error/functions.js +25 -0
- package/dist/src/typus_perp/lp-pool/functions.d.ts +44 -31
- package/dist/src/typus_perp/lp-pool/functions.js +69 -56
- package/dist/src/typus_perp/lp-pool/structs.d.ts +161 -210
- package/dist/src/typus_perp/lp-pool/structs.js +384 -284
- package/dist/src/typus_perp/position/functions.d.ts +8 -0
- package/dist/src/typus_perp/position/functions.js +8 -0
- package/dist/src/typus_perp/trading/functions.d.ts +186 -0
- package/dist/src/typus_perp/trading/functions.js +263 -0
- package/dist/src/typus_perp/trading/structs.d.ts +127 -0
- package/dist/src/typus_perp/trading/structs.js +395 -204
- package/dist/src/typus_stake_pool/stake-pool/functions.d.ts +9 -0
- package/dist/src/typus_stake_pool/stake-pool/functions.js +20 -0
- package/dist/src/user/order.js +3 -1
- package/dist/src/user/orderWithBidReceipt.js +6 -2
- package/dist/src/user/tlp.d.ts +16 -9
- package/dist/src/user/tlp.js +121 -61
- package/package.json +2 -2
package/dist/src/api/sentio.d.ts
CHANGED
|
@@ -8,12 +8,12 @@ export declare function getFromSentio(event: string, userAddress: string, startT
|
|
|
8
8
|
* key: base_token {'APT','BTC','CETUS','DEEP','ETH','NAVX','NS','SOL','SUI','WAL'}
|
|
9
9
|
* value: Volume[]
|
|
10
10
|
*/
|
|
11
|
-
export declare function getTradingVolumeFromSentio(fromTimestamp: number, interval: number): Promise<Map<string, Volume[]>>;
|
|
11
|
+
export declare function getTradingVolumeFromSentio(fromTimestamp: number, interval: number, toTimestamp?: number): Promise<Map<string, Volume[]>>;
|
|
12
12
|
export interface Volume {
|
|
13
13
|
timestamp: string;
|
|
14
14
|
value: number;
|
|
15
15
|
}
|
|
16
16
|
export declare function getTlpFeeFromSentio(): Promise<number>;
|
|
17
|
-
export declare function getTotalVolumeFromSentio(): Promise<number>;
|
|
17
|
+
export declare function getTotalVolumeFromSentio(fromTimestamp: number, toTimestamp: number): Promise<number>;
|
|
18
18
|
/** Returns Accumulated Users */
|
|
19
19
|
export declare function getAccumulatedUser(): Promise<number>;
|
package/dist/src/api/sentio.js
CHANGED
|
@@ -93,7 +93,7 @@ function getFromSentio(event, userAddress, startTimestamp) {
|
|
|
93
93
|
* key: base_token {'APT','BTC','CETUS','DEEP','ETH','NAVX','NS','SOL','SUI','WAL'}
|
|
94
94
|
* value: Volume[]
|
|
95
95
|
*/
|
|
96
|
-
function getTradingVolumeFromSentio(fromTimestamp, interval) {
|
|
96
|
+
function getTradingVolumeFromSentio(fromTimestamp, interval, toTimestamp) {
|
|
97
97
|
return __awaiter(this, void 0, void 0, function () {
|
|
98
98
|
var apiUrl, requestData, jsonData, response, data, samples, map;
|
|
99
99
|
return __generator(this, function (_a) {
|
|
@@ -105,7 +105,7 @@ function getTradingVolumeFromSentio(fromTimestamp, interval) {
|
|
|
105
105
|
requestData = {
|
|
106
106
|
timeRange: {
|
|
107
107
|
start: "".concat(fromTimestamp),
|
|
108
|
-
end: "now",
|
|
108
|
+
end: "".concat(toTimestamp !== null && toTimestamp !== void 0 ? toTimestamp : "now"),
|
|
109
109
|
step: 3600 * interval,
|
|
110
110
|
},
|
|
111
111
|
limit: 30 * 24,
|
|
@@ -227,7 +227,7 @@ function getTlpFeeFromSentio() {
|
|
|
227
227
|
});
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
|
-
function getTotalVolumeFromSentio() {
|
|
230
|
+
function getTotalVolumeFromSentio(fromTimestamp, toTimestamp) {
|
|
231
231
|
return __awaiter(this, void 0, void 0, function () {
|
|
232
232
|
var apiUrl, requestData, jsonData, response, data, result;
|
|
233
233
|
return __generator(this, function (_a) {
|
|
@@ -238,8 +238,8 @@ function getTotalVolumeFromSentio() {
|
|
|
238
238
|
: "https://app.sentio.xyz/api/v1/insights/typus/typus_perp/query";
|
|
239
239
|
requestData = {
|
|
240
240
|
timeRange: {
|
|
241
|
-
start: "
|
|
242
|
-
end: "
|
|
241
|
+
start: "".concat(fromTimestamp),
|
|
242
|
+
end: "".concat(toTimestamp),
|
|
243
243
|
step: 3600,
|
|
244
244
|
},
|
|
245
245
|
limit: 1,
|
|
@@ -275,7 +275,7 @@ function getTotalVolumeFromSentio() {
|
|
|
275
275
|
return [4 /*yield*/, response.json()];
|
|
276
276
|
case 2:
|
|
277
277
|
data = _a.sent();
|
|
278
|
-
result = data.results[0].matrix.samples[0].values.at(-1).value;
|
|
278
|
+
result = data.results[0].matrix.samples[0].values.at(-1).value - data.results[0].matrix.samples[0].values.at(0).value;
|
|
279
279
|
// console.log(result);
|
|
280
280
|
return [2 /*return*/, result];
|
|
281
281
|
}
|
|
@@ -349,5 +349,5 @@ function getAccumulatedUser() {
|
|
|
349
349
|
// getVolumeFromSentio();
|
|
350
350
|
// getTlpFeeFromSentio();
|
|
351
351
|
// getAccumulatedUser();
|
|
352
|
-
//
|
|
353
|
-
//
|
|
352
|
+
// getTradingVolumeFromSentio(1747008000, 1, 1747011600);
|
|
353
|
+
// getTotalVolumeFromSentio(1747008000, 1747011600);
|
package/dist/src/fetch.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Markets, SymbolMarket } from "./typus_perp/trading/structs";
|
|
|
2
2
|
import { LiquidityPool } from "./typus_perp/lp-pool/structs";
|
|
3
3
|
import { TradingOrder, Position } from "./typus_perp/position/structs";
|
|
4
4
|
import { LpUserShare, StakePool } from "./typus_stake_pool/stake-pool/structs";
|
|
5
|
+
import { TOKEN } from "@typus/typus-sdk/dist/src/constants";
|
|
5
6
|
import { PythClient, TypusConfig } from "@typus/typus-sdk/dist/src/utils";
|
|
6
7
|
import { TypusBidReceipt } from "./_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/vault/structs";
|
|
7
8
|
export declare function getLpPools(config: TypusConfig): Promise<LiquidityPool[]>;
|
|
@@ -29,3 +30,8 @@ export declare function getLiquidationPriceAndPnl(config: TypusConfig, pythClien
|
|
|
29
30
|
positions: Position[];
|
|
30
31
|
user: string;
|
|
31
32
|
}): Promise<(string | number)[][] | undefined>;
|
|
33
|
+
export declare function getAllPositions(config: TypusConfig, input: {
|
|
34
|
+
baseToken: TOKEN;
|
|
35
|
+
slice: string;
|
|
36
|
+
page: string;
|
|
37
|
+
}): Promise<Position[]>;
|
package/dist/src/fetch.js
CHANGED
|
@@ -57,6 +57,7 @@ exports.getUserPositions = getUserPositions;
|
|
|
57
57
|
exports.parseOptionBidReceipts = parseOptionBidReceipts;
|
|
58
58
|
exports.getUserStake = getUserStake;
|
|
59
59
|
exports.getLiquidationPriceAndPnl = getLiquidationPriceAndPnl;
|
|
60
|
+
exports.getAllPositions = getAllPositions;
|
|
60
61
|
var client_1 = require("@mysten/sui/client");
|
|
61
62
|
var transactions_1 = require("@mysten/sui/transactions");
|
|
62
63
|
var bcs_1 = require("@mysten/bcs");
|
|
@@ -493,3 +494,48 @@ function getLiquidationPriceAndPnl(config, pythClient, input) {
|
|
|
493
494
|
});
|
|
494
495
|
});
|
|
495
496
|
}
|
|
497
|
+
function getAllPositions(config, input) {
|
|
498
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
499
|
+
var provider, tx, res, raw, withoutMaxPage, reader, userPositionsLen, positions, i, fields, pos;
|
|
500
|
+
var _a, _b, _c, _d;
|
|
501
|
+
return __generator(this, function (_e) {
|
|
502
|
+
switch (_e.label) {
|
|
503
|
+
case 0:
|
|
504
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
505
|
+
tx = new transactions_1.Transaction();
|
|
506
|
+
(0, functions_1.getAllPositions)(tx, constants_1.tokenType[_1.NETWORK][input.baseToken], {
|
|
507
|
+
version: _1.PERP_VERSION,
|
|
508
|
+
registry: _1.MARKET,
|
|
509
|
+
marketIndex: BigInt(0),
|
|
510
|
+
slice: BigInt(input.slice),
|
|
511
|
+
page: BigInt(input.page),
|
|
512
|
+
});
|
|
513
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({
|
|
514
|
+
sender: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
515
|
+
transactionBlock: tx,
|
|
516
|
+
})];
|
|
517
|
+
case 1:
|
|
518
|
+
res = _e.sent();
|
|
519
|
+
console.log(res);
|
|
520
|
+
if (!((_d = (_c = (_b = (_a = res.results) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.returnValues) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d[0])) {
|
|
521
|
+
return [2 /*return*/, []];
|
|
522
|
+
}
|
|
523
|
+
raw = new Uint8Array(res.results[0].returnValues[0][0]);
|
|
524
|
+
// 1) 至少要有 8 bytes 的 max_page
|
|
525
|
+
if (raw.length < 8)
|
|
526
|
+
return [2 /*return*/, []];
|
|
527
|
+
withoutMaxPage = raw.slice(0, raw.length - 8);
|
|
528
|
+
reader = new bcs_1.BcsReader(withoutMaxPage);
|
|
529
|
+
userPositionsLen = reader.read8() - 1;
|
|
530
|
+
positions = [];
|
|
531
|
+
for (i = 0; i < userPositionsLen; i++) {
|
|
532
|
+
reader.read16();
|
|
533
|
+
fields = structs_3.Position.bcs.read(reader);
|
|
534
|
+
pos = structs_3.Position.fromFields(fields);
|
|
535
|
+
positions.push(pos);
|
|
536
|
+
}
|
|
537
|
+
return [2 /*return*/, positions];
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
});
|
|
541
|
+
}
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.STAKE_POOL_VERSION = exports.STAKE_POOL_0 = exports.STAKE_POOL = exports.TLP_TREASURY_CAP = exports.TLP_TOKEN = exports.TLP = exports.PERP_VERSION = exports.MARKET = exports.LIQUIDITY_POOL_0 = exports.LIQUIDITY_POOL = exports.LP_POOL = exports.STAKE_PKG_V1 = exports.STAKE_PUBLISHED_AT = exports.STAKE_PACKAGE_ID = exports.PERP_PKG_V1 = exports.PERP_PUBLISHED_AT = exports.PERP_PACKAGE_ID = exports.NETWORK = void 0;
|
|
20
|
+
exports.COMPETITION_CONFIG = exports.STAKE_POOL_VERSION = exports.STAKE_POOL_0 = exports.STAKE_POOL = exports.TLP_TREASURY_CAP = exports.TLP_TOKEN = exports.TLP = exports.PERP_VERSION = exports.MARKET = exports.LIQUIDITY_POOL_0 = exports.LIQUIDITY_POOL = exports.LP_POOL = exports.STAKE_PKG_V1 = exports.STAKE_PUBLISHED_AT = exports.STAKE_PACKAGE_ID = exports.PERP_PKG_V1 = exports.PERP_PUBLISHED_AT = exports.PERP_PACKAGE_ID = exports.NETWORK = void 0;
|
|
21
21
|
__exportStar(require("./fetch"), exports);
|
|
22
22
|
__exportStar(require("./user"), exports);
|
|
23
23
|
var dotenv_1 = __importDefault(require("dotenv"));
|
|
@@ -31,7 +31,7 @@ exports.PERP_PACKAGE_ID = exports.NETWORK == "MAINNET"
|
|
|
31
31
|
: "0x585924f160f83ef16f8927ec117e4d740abb6f4e571ecfa89ff3e973042cb1b9";
|
|
32
32
|
exports.PERP_PUBLISHED_AT = exports.NETWORK == "MAINNET"
|
|
33
33
|
? "0xeb018055af198e99a368ccda030e9aef07ffb86aa5de83e98734913064b0cff4"
|
|
34
|
-
: "
|
|
34
|
+
: "0xc6a0b5c9646c418152f2d11d7917d796a038a227565bdfb52fe81e0d6dcb8e0f";
|
|
35
35
|
exports.PERP_PKG_V1 = exports.NETWORK == "MAINNET"
|
|
36
36
|
? "0xe27969a70f93034de9ce16e6ad661b480324574e68d15a64b513fd90eb2423e5"
|
|
37
37
|
: "0x585924f160f83ef16f8927ec117e4d740abb6f4e571ecfa89ff3e973042cb1b9";
|
|
@@ -40,7 +40,7 @@ exports.STAKE_PACKAGE_ID = exports.NETWORK == "MAINNET"
|
|
|
40
40
|
: "0x220e7ba8923c0c30b57c0baab3bc15d781a39bb294cf7af318c0fc816b5cf7e6";
|
|
41
41
|
exports.STAKE_PUBLISHED_AT = exports.NETWORK == "MAINNET"
|
|
42
42
|
? "0xd9965c09d5ad7d69306b7c550b3b135d94b34f98c3adc379a7333fff2f05808b"
|
|
43
|
-
: "
|
|
43
|
+
: "0xf8fa4a303118328de2fb53f49a043fa5bf58b84f372db0d1e7cf7b1f1a47d10e";
|
|
44
44
|
exports.STAKE_PKG_V1 = exports.NETWORK == "MAINNET"
|
|
45
45
|
? "0xc427209145715a00a93d7e674a95c556a7147d79fda1bbaeb1a1cac5f9923966"
|
|
46
46
|
: "0x220e7ba8923c0c30b57c0baab3bc15d781a39bb294cf7af318c0fc816b5cf7e6";
|
|
@@ -81,3 +81,4 @@ exports.STAKE_POOL_0 = exports.NETWORK == "MAINNET"
|
|
|
81
81
|
exports.STAKE_POOL_VERSION = exports.NETWORK == "MAINNET"
|
|
82
82
|
? "0xdf3ed1599218b2415b2cd7fa06296f7f647676019b2873ec18e55a626c584f1b"
|
|
83
83
|
: "0xafb81680b9ac3d627eb733154c43d34e3ec758cf8e00a55c384df2c8150f7881";
|
|
84
|
+
exports.COMPETITION_CONFIG = exports.NETWORK == "MAINNET" ? "0x36056abf9adde86f81667dad680a8ac98868c9fc1cb4d519fd2222d5d4522906" : "";
|
|
@@ -4,6 +4,16 @@ export interface AddAuthorizedUserArgs {
|
|
|
4
4
|
userAddress: string | TransactionArgument;
|
|
5
5
|
}
|
|
6
6
|
export declare function addAuthorizedUser(tx: Transaction, args: AddAuthorizedUserArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
7
|
+
export interface AddCompetitionLeaderboardArgs {
|
|
8
|
+
version: TransactionObjectInput;
|
|
9
|
+
typusEcosystemVersion: TransactionObjectInput;
|
|
10
|
+
typusLeaderboardRegistry: TransactionObjectInput;
|
|
11
|
+
leaderboardKey: string | TransactionArgument;
|
|
12
|
+
user: string | TransactionArgument;
|
|
13
|
+
score: bigint | TransactionArgument;
|
|
14
|
+
clock: TransactionObjectInput;
|
|
15
|
+
}
|
|
16
|
+
export declare function addCompetitionLeaderboard(tx: Transaction, args: AddCompetitionLeaderboardArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
7
17
|
export interface AddExpLeaderboardArgs {
|
|
8
18
|
version: TransactionObjectInput;
|
|
9
19
|
typusEcosystemVersion: TransactionObjectInput;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addAuthorizedUser = addAuthorizedUser;
|
|
4
|
+
exports.addCompetitionLeaderboard = addCompetitionLeaderboard;
|
|
4
5
|
exports.addExpLeaderboard = addExpLeaderboard;
|
|
5
6
|
exports.addTailsExpAmount = addTailsExpAmount;
|
|
6
7
|
exports.chargeFee = chargeFee;
|
|
@@ -14,6 +15,7 @@ exports.upgrade = upgrade;
|
|
|
14
15
|
exports.verify = verify;
|
|
15
16
|
exports.versionCheck = versionCheck;
|
|
16
17
|
var __1 = require("..");
|
|
18
|
+
var structs_1 = require("../../_dependencies/source/0x1/ascii/structs");
|
|
17
19
|
var util_1 = require("../../_framework/util");
|
|
18
20
|
function addAuthorizedUser(tx, args, published_at) {
|
|
19
21
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
@@ -22,6 +24,21 @@ function addAuthorizedUser(tx, args, published_at) {
|
|
|
22
24
|
arguments: [(0, util_1.obj)(tx, args.version), (0, util_1.pure)(tx, args.userAddress, "address")],
|
|
23
25
|
});
|
|
24
26
|
}
|
|
27
|
+
function addCompetitionLeaderboard(tx, args, published_at) {
|
|
28
|
+
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
29
|
+
return tx.moveCall({
|
|
30
|
+
target: "".concat(published_at, "::admin::add_competition_leaderboard"),
|
|
31
|
+
arguments: [
|
|
32
|
+
(0, util_1.obj)(tx, args.version),
|
|
33
|
+
(0, util_1.obj)(tx, args.typusEcosystemVersion),
|
|
34
|
+
(0, util_1.obj)(tx, args.typusLeaderboardRegistry),
|
|
35
|
+
(0, util_1.pure)(tx, args.leaderboardKey, "".concat(structs_1.String.$typeName)),
|
|
36
|
+
(0, util_1.pure)(tx, args.user, "address"),
|
|
37
|
+
(0, util_1.pure)(tx, args.score, "u64"),
|
|
38
|
+
(0, util_1.obj)(tx, args.clock),
|
|
39
|
+
],
|
|
40
|
+
});
|
|
41
|
+
}
|
|
25
42
|
function addExpLeaderboard(tx, args, published_at) {
|
|
26
43
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
27
44
|
return tx.moveCall({
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Transaction, TransactionArgument, TransactionObjectInput } from "@mysten/sui/transactions";
|
|
2
|
+
export interface AddScoreArgs {
|
|
3
|
+
version: TransactionObjectInput;
|
|
4
|
+
ecosystemVersion: TransactionObjectInput;
|
|
5
|
+
typusLeaderboardRegistry: TransactionObjectInput;
|
|
6
|
+
tailsStakingRegistry: TransactionObjectInput;
|
|
7
|
+
competitionConfig: TransactionObjectInput;
|
|
8
|
+
volumeUsd: bigint | TransactionArgument;
|
|
9
|
+
user: string | TransactionArgument;
|
|
10
|
+
clock: TransactionObjectInput;
|
|
11
|
+
}
|
|
12
|
+
export declare function addScore(tx: Transaction, args: AddScoreArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
13
|
+
export interface NewCompetitionConfigArgs {
|
|
14
|
+
version: TransactionObjectInput;
|
|
15
|
+
boostBp: Array<bigint | TransactionArgument> | TransactionArgument;
|
|
16
|
+
programName: string | TransactionArgument;
|
|
17
|
+
}
|
|
18
|
+
export declare function newCompetitionConfig(tx: Transaction, args: NewCompetitionConfigArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
19
|
+
export interface SetBoostBpArgs {
|
|
20
|
+
version: TransactionObjectInput;
|
|
21
|
+
competitionConfig: TransactionObjectInput;
|
|
22
|
+
boostBp: Array<bigint | TransactionArgument> | TransactionArgument;
|
|
23
|
+
}
|
|
24
|
+
export declare function setBoostBp(tx: Transaction, args: SetBoostBpArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addScore = addScore;
|
|
4
|
+
exports.newCompetitionConfig = newCompetitionConfig;
|
|
5
|
+
exports.setBoostBp = setBoostBp;
|
|
6
|
+
var __1 = require("..");
|
|
7
|
+
var structs_1 = require("../../_dependencies/source/0x1/ascii/structs");
|
|
8
|
+
var util_1 = require("../../_framework/util");
|
|
9
|
+
function addScore(tx, args, published_at) {
|
|
10
|
+
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
11
|
+
return tx.moveCall({
|
|
12
|
+
target: "".concat(published_at, "::competition::add_score"),
|
|
13
|
+
arguments: [
|
|
14
|
+
(0, util_1.obj)(tx, args.version),
|
|
15
|
+
(0, util_1.obj)(tx, args.ecosystemVersion),
|
|
16
|
+
(0, util_1.obj)(tx, args.typusLeaderboardRegistry),
|
|
17
|
+
(0, util_1.obj)(tx, args.tailsStakingRegistry),
|
|
18
|
+
(0, util_1.obj)(tx, args.competitionConfig),
|
|
19
|
+
(0, util_1.pure)(tx, args.volumeUsd, "u64"),
|
|
20
|
+
(0, util_1.pure)(tx, args.user, "address"),
|
|
21
|
+
(0, util_1.obj)(tx, args.clock),
|
|
22
|
+
],
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function newCompetitionConfig(tx, args, published_at) {
|
|
26
|
+
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
27
|
+
return tx.moveCall({
|
|
28
|
+
target: "".concat(published_at, "::competition::new_competition_config"),
|
|
29
|
+
arguments: [(0, util_1.obj)(tx, args.version), (0, util_1.pure)(tx, args.boostBp, "vector<u64>"), (0, util_1.pure)(tx, args.programName, "".concat(structs_1.String.$typeName))],
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function setBoostBp(tx, args, published_at) {
|
|
33
|
+
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
34
|
+
return tx.moveCall({
|
|
35
|
+
target: "".concat(published_at, "::competition::set_boost_bp"),
|
|
36
|
+
arguments: [(0, util_1.obj)(tx, args.version), (0, util_1.obj)(tx, args.competitionConfig), (0, util_1.pure)(tx, args.boostBp, "vector<u64>")],
|
|
37
|
+
});
|
|
38
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as reified from "../../_framework/reified";
|
|
2
|
+
import { String } from "../../_dependencies/source/0x1/ascii/structs";
|
|
3
|
+
import { UID } from "../../_dependencies/source/0x2/object/structs";
|
|
4
|
+
import { PhantomReified, Reified, StructClass, ToField, ToTypeStr } from "../../_framework/reified";
|
|
5
|
+
import { FieldsWithTypes } from "../../_framework/util";
|
|
6
|
+
import { Vector } from "../../_framework/vector";
|
|
7
|
+
import { PKG_V1 } from "../index";
|
|
8
|
+
import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui/client";
|
|
9
|
+
export declare function isCompetitionConfig(type: string): boolean;
|
|
10
|
+
export interface CompetitionConfigFields {
|
|
11
|
+
id: ToField<UID>;
|
|
12
|
+
boostBp: ToField<Vector<"u64">>;
|
|
13
|
+
isActive: ToField<"bool">;
|
|
14
|
+
programName: ToField<String>;
|
|
15
|
+
u64Padding: ToField<Vector<"u64">>;
|
|
16
|
+
}
|
|
17
|
+
export type CompetitionConfigReified = Reified<CompetitionConfig, CompetitionConfigFields>;
|
|
18
|
+
export declare class CompetitionConfig implements StructClass {
|
|
19
|
+
__StructClass: true;
|
|
20
|
+
static readonly $typeName: string;
|
|
21
|
+
static readonly $numTypeParams = 0;
|
|
22
|
+
static readonly $isPhantom: readonly [];
|
|
23
|
+
readonly $typeName: string;
|
|
24
|
+
readonly $fullTypeName: `${typeof PKG_V1}::competition::CompetitionConfig`;
|
|
25
|
+
readonly $typeArgs: [];
|
|
26
|
+
readonly $isPhantom: readonly [];
|
|
27
|
+
readonly id: ToField<UID>;
|
|
28
|
+
readonly boostBp: ToField<Vector<"u64">>;
|
|
29
|
+
readonly isActive: ToField<"bool">;
|
|
30
|
+
readonly programName: ToField<String>;
|
|
31
|
+
readonly u64Padding: ToField<Vector<"u64">>;
|
|
32
|
+
private constructor();
|
|
33
|
+
static reified(): CompetitionConfigReified;
|
|
34
|
+
static get r(): reified.StructClassReified<CompetitionConfig, CompetitionConfigFields>;
|
|
35
|
+
static phantom(): PhantomReified<ToTypeStr<CompetitionConfig>>;
|
|
36
|
+
static get p(): reified.PhantomReified<"0xe27969a70f93034de9ce16e6ad661b480324574e68d15a64b513fd90eb2423e5::competition::CompetitionConfig" | "0x585924f160f83ef16f8927ec117e4d740abb6f4e571ecfa89ff3e973042cb1b9::competition::CompetitionConfig">;
|
|
37
|
+
static get bcs(): import("@mysten/sui/bcs").BcsType<{
|
|
38
|
+
id: {
|
|
39
|
+
id: {
|
|
40
|
+
bytes: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
boost_bp: string[];
|
|
44
|
+
is_active: boolean;
|
|
45
|
+
program_name: {
|
|
46
|
+
bytes: number[];
|
|
47
|
+
};
|
|
48
|
+
u64_padding: string[];
|
|
49
|
+
}, {
|
|
50
|
+
id: {
|
|
51
|
+
id: {
|
|
52
|
+
bytes: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
boost_bp: Iterable<string | number | bigint> & {
|
|
56
|
+
length: number;
|
|
57
|
+
};
|
|
58
|
+
is_active: boolean;
|
|
59
|
+
program_name: {
|
|
60
|
+
bytes: Iterable<number> & {
|
|
61
|
+
length: number;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
u64_padding: Iterable<string | number | bigint> & {
|
|
65
|
+
length: number;
|
|
66
|
+
};
|
|
67
|
+
}>;
|
|
68
|
+
static fromFields(fields: Record<string, any>): CompetitionConfig;
|
|
69
|
+
static fromFieldsWithTypes(item: FieldsWithTypes): CompetitionConfig;
|
|
70
|
+
static fromBcs(data: Uint8Array): CompetitionConfig;
|
|
71
|
+
toJSONField(): {
|
|
72
|
+
id: string;
|
|
73
|
+
boostBp: string[];
|
|
74
|
+
isActive: boolean;
|
|
75
|
+
programName: string;
|
|
76
|
+
u64Padding: string[];
|
|
77
|
+
};
|
|
78
|
+
toJSON(): {
|
|
79
|
+
id: string;
|
|
80
|
+
boostBp: string[];
|
|
81
|
+
isActive: boolean;
|
|
82
|
+
programName: string;
|
|
83
|
+
u64Padding: string[];
|
|
84
|
+
$typeName: string;
|
|
85
|
+
$typeArgs: [];
|
|
86
|
+
};
|
|
87
|
+
static fromJSONField(field: any): CompetitionConfig;
|
|
88
|
+
static fromJSON(json: Record<string, any>): CompetitionConfig;
|
|
89
|
+
static fromSuiParsedData(content: SuiParsedData): CompetitionConfig;
|
|
90
|
+
static fromSuiObjectData(data: SuiObjectData): CompetitionConfig;
|
|
91
|
+
static fetch(client: SuiClient, id: string): Promise<CompetitionConfig>;
|
|
92
|
+
}
|