@typus/typus-sdk 1.0.78 → 1.0.81
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 +22 -13
- package/lib/utils/typus-dov-single/portfolio-vault.js +0 -1
- package/lib/utils/typus-dov-single/user-entry.d.ts +1 -1
- package/lib/utils/typus-dov-single/user-entry.js +15 -3
- package/lib/utils/typus-dov-single/user-history.js +1 -1
- package/lib/utils/typus-dov-single/view-function.d.ts +6 -1
- package/lib/utils/typus-dov-single/view-function.js +82 -40
- package/package.json +1 -1
package/lib/config.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"VERSION": "2.
|
|
2
|
+
"VERSION": "2.17.1",
|
|
3
3
|
"DB_NAME": "testnet_2_8_0",
|
|
4
|
-
"RPC_ENDPOINT": "https://
|
|
5
|
-
"SINGLE_COLLATERAL_PACKAGE": "
|
|
4
|
+
"RPC_ENDPOINT": "https://api.shinami.com:443/node/v1/sui_testnet_c702de54dad05016124f2cfabc1de7e8",
|
|
5
|
+
"SINGLE_COLLATERAL_PACKAGE": "0xb3ec573f0a541cccde140094e8c72383c8db327b49114708687b26cf4ba36d2d",
|
|
6
6
|
"SINGLE_COLLATERAL_PACKAGE_ORIGIN": "0x867a84b70d1f44ea10c02cb099dad5a46c074675afa3b728bd0c11f653e2cb18",
|
|
7
7
|
"SINGLE_COLLATERAL_MANAGER_CAP": "0x7040e5c1a4691d7df2208a577802b05784b8926ad157ebf99b46a185636f2e07",
|
|
8
8
|
"SINGLE_COLLATERAL_REGISTRY": "0x7808d2e668101969e67b6713df9dd96a57deba23baf4cd6754258756f332ef88",
|
|
@@ -12,21 +12,30 @@
|
|
|
12
12
|
"SINGLE_COLLATERAL_DEPOSIT_VAULT_USER_SHARE_REGISTRY": "0x3d8ddc0f8eadb2cb4ab0ecd62b8437bfb40b75fe5368c04fa6f3382c0975c4c6",
|
|
13
13
|
"SINGLE_COLLATERAL_BID_VAULT_USER_SHARE_REGISTRY": "0x0a0c530ffbad0ff9d9d1707dc1ea4c2e123ffdd5bd6c6c842f71cd449263202e",
|
|
14
14
|
"TOKEN_PACKAGE": "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"WBTC_TOKEN_REGISTRY": "0xcf5184b85f47cb1ffe421249e48b2cd34807534e1a4b4ad384009295bbbd3bf4",
|
|
16
|
+
"WETH_TOKEN_REGISTRY": "0x5cd3726a1d1ef32bffaaeb2ec4964f0ffac56cfb919f7d13d4672aed5059bfa1",
|
|
17
17
|
"USDC_TOKEN_REGISTRY": "0xf7df3c68a7d3ffc54065565c94a9fa3f5342957340bce78be74373846241a833",
|
|
18
18
|
"CETUS_TOKEN_REGISTRY": "0x24a7a5297a3656ebea71ed72a4974a7710943d9a598fda60fe60b44262da9f27",
|
|
19
|
-
"BUCK_TOKEN_REGISTRY": "
|
|
19
|
+
"BUCK_TOKEN_REGISTRY": "0x441cf46a499c6e4d0560c4c9000351f34a928e53018d65857a1591ca1aa2bd58",
|
|
20
|
+
"WSOL_TOKEN_REGISTRY": "0x1186a198ebd006e4f444ff88334307d6b376c02a040cfdad380ca06090f52472",
|
|
20
21
|
"ORACLE_PACKAGE": "0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73",
|
|
21
22
|
"ORACLE_MANAGER_CAP": "0x4e118b46fc39fd8961b8bac6a7f668e12c63ef28fbd2cb6f9b6a40cb0a41dfaf",
|
|
22
23
|
"SUI_USDC_ORACLE": "0x770f17817e809f22d3cf3ba5f452056622a31dd6a1db7c60c94c5a598aff9a29",
|
|
23
24
|
"CETUS_USDC_ORACLE": "0xe8142c490363475a4ad0b9af02ac5a543962584f3a99cdb8754d909be6ec550d",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"SUI_BUCK_ORACLE": "
|
|
27
|
-
"
|
|
28
|
-
"PYTH_SUI/USDC": "0xe38dbe2ff3322f1500fff45d0046101f371eebce47c067c5e9233248c4878c28",
|
|
29
|
-
"SWITCHBOARD_SUI/USDC": "0x84d2b7e435d6e6a5b137bf6f78f34b2c5515ae61cd8591d5ff6cd121a21aa6b7",
|
|
25
|
+
"WBTC_USDC_ORACLE": "0xaa72a2b370cf45a7b1363a2b9e3f0c57c05863375b984e2ca0928973574404f2",
|
|
26
|
+
"WETH_USDC_ORACLE": "0x0ac9f9275eb0ac33b7f59741b1df67a6783af2db6d2a4e5aba8ce350d5b6b260",
|
|
27
|
+
"SUI_BUCK_ORACLE": "0x6444a8c8bca73411426121a35702599d3bec24ded14025c1cc2d7cfe6199b514",
|
|
28
|
+
"WSOL_USDC_ORACLE": "0x0edabd97c679967e00d508c766fb4be0195890f96343bd3a58e10fa5e8063c96",
|
|
30
29
|
"CETUS_ORACLE": "0xfa4720fa516760b2de899dc74e078d8cc1cc6af6c74805b069b31dc3935aa119",
|
|
31
|
-
"
|
|
30
|
+
"PYTH_STATE": "0xd8afde3a48b4ff7212bd6829a150f43f59043221200d63504d981f62bff2e27a",
|
|
31
|
+
"PYTH_SUIUSDC": "0xe38dbe2ff3322f1500fff45d0046101f371eebce47c067c5e9233248c4878c28",
|
|
32
|
+
"SWITCHBOARD_SUIUSDC": "0x84d2b7e435d6e6a5b137bf6f78f34b2c5515ae61cd8591d5ff6cd121a21aa6b7",
|
|
33
|
+
"PYTH_EVM_SUI": "0x23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744",
|
|
34
|
+
"PYTH_EVM_CETUS": "0xe5b274b2611143df055d6e7cd8d93fe1961716bcd4dca1cad87a83bc1e78c1ef",
|
|
35
|
+
"PYTH_EVM_USDC": "0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a",
|
|
36
|
+
"PYTH_EVM_WBTC": "0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43",
|
|
37
|
+
"PYTH_EVM_WETH": "0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace",
|
|
38
|
+
"PYTH_EVM_WSOL": "0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d",
|
|
39
|
+
"mainnet": false,
|
|
40
|
+
"excludes": []
|
|
32
41
|
}
|
|
@@ -68,7 +68,6 @@ function getPortfolioVaults(provider, registry, deposit_vault_registry, bid_vaul
|
|
|
68
68
|
case 0: return [4 /*yield*/, promise];
|
|
69
69
|
case 1:
|
|
70
70
|
map = _a.sent();
|
|
71
|
-
console.log(JSON.stringify(portfolioVault, null, 4));
|
|
72
71
|
vaultId = portfolioVault.data.content.fields.id.id;
|
|
73
72
|
auctionDelayTsMs = "0";
|
|
74
73
|
typeArgs = new RegExp(".*<(.*), (.*), (.*)>").exec(portfolioVault.data.content.type).slice(1, 4);
|
|
@@ -9,7 +9,7 @@ import { TransactionBlock } from "@mysten/sui.js";
|
|
|
9
9
|
)
|
|
10
10
|
@param typeArguments [Deposit Vault Token, Bid Vault Token, Oracle Token]
|
|
11
11
|
*/
|
|
12
|
-
export declare function getDepositTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, coins: string[], amount: string, usingSponsoredGasCoin?: boolean): Promise<TransactionBlock>;
|
|
12
|
+
export declare function getDepositTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, additional_config_registry: string, index: string, coins: string[], amount: string, usingSponsoredGasCoin?: boolean): Promise<TransactionBlock>;
|
|
13
13
|
/**
|
|
14
14
|
public(friend) entry fun withdraw<TOKEN>(
|
|
15
15
|
registry: &mut Registry,
|
|
@@ -64,7 +64,7 @@ var sui_js_1 = require("@mysten/sui.js");
|
|
|
64
64
|
)
|
|
65
65
|
@param typeArguments [Deposit Vault Token, Bid Vault Token, Oracle Token]
|
|
66
66
|
*/
|
|
67
|
-
function getDepositTx(gasBudget, packageId, typeArguments, registry, index, coins, amount, usingSponsoredGasCoin) {
|
|
67
|
+
function getDepositTx(gasBudget, packageId, typeArguments, registry, additional_config_registry, index, coins, amount, 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;
|
|
@@ -77,14 +77,26 @@ function getDepositTx(gasBudget, packageId, typeArguments, registry, index, coin
|
|
|
77
77
|
tx.moveCall({
|
|
78
78
|
target: "".concat(packageId, "::typus_dov_single::deposit"),
|
|
79
79
|
typeArguments: typeArguments,
|
|
80
|
-
arguments: [
|
|
80
|
+
arguments: [
|
|
81
|
+
tx.pure(registry),
|
|
82
|
+
tx.pure(additional_config_registry),
|
|
83
|
+
tx.pure(index),
|
|
84
|
+
tx.makeMoveVec({ objects: [coin] }),
|
|
85
|
+
tx.pure(amount),
|
|
86
|
+
],
|
|
81
87
|
});
|
|
82
88
|
}
|
|
83
89
|
else {
|
|
84
90
|
tx.moveCall({
|
|
85
91
|
target: "".concat(packageId, "::typus_dov_single::deposit"),
|
|
86
92
|
typeArguments: typeArguments,
|
|
87
|
-
arguments: [
|
|
93
|
+
arguments: [
|
|
94
|
+
tx.pure(registry),
|
|
95
|
+
tx.pure(additional_config_registry),
|
|
96
|
+
tx.pure(index),
|
|
97
|
+
tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
|
|
98
|
+
tx.pure(amount),
|
|
99
|
+
],
|
|
88
100
|
});
|
|
89
101
|
}
|
|
90
102
|
tx.setGasBudget(gasBudget);
|
|
@@ -97,7 +97,7 @@ function parseTxHistory(datas, originPackage) {
|
|
|
97
97
|
action = functionType[2];
|
|
98
98
|
matches = new RegExp("<([^>]+)>").exec(event.type);
|
|
99
99
|
if (matches) {
|
|
100
|
-
typeArgs = matches[1].split(",");
|
|
100
|
+
typeArgs = matches[1].split(", ");
|
|
101
101
|
assets = (0, token_1.typeArgsToAssets)(typeArgs);
|
|
102
102
|
asset = action == "NewBid" ? assets[2] : assets[0];
|
|
103
103
|
parsedJson = event.parsedJson;
|
|
@@ -33,6 +33,11 @@ export interface AdditionalConfig {
|
|
|
33
33
|
auction_benchmark_price: string;
|
|
34
34
|
oracle_id: string;
|
|
35
35
|
risk_level: string;
|
|
36
|
+
min_bid_size: string;
|
|
37
|
+
min_deposit: string;
|
|
38
|
+
incentive_flag: string;
|
|
39
|
+
incentive_rate_bp: string;
|
|
40
|
+
current_portfolio_step: string;
|
|
36
41
|
}
|
|
37
42
|
export declare function getUserShares(provider: JsonRpcProvider, packageId: string, registry: string, indexes: string[], user: string): Promise<Map<string, UserShare>>;
|
|
38
43
|
export declare function getAuctionMaxSize(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, additional_config_registry: string, index: string, priceOracle: string): Promise<BigInt>;
|
|
@@ -40,4 +45,4 @@ export declare function getMaxLossPerUnit(provider: JsonRpcProvider, packageId:
|
|
|
40
45
|
export declare function getAuctionTotalBidSize(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, index: string): Promise<BigInt>;
|
|
41
46
|
export declare function getAuctionBids(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, index: string): Promise<UserBid[]>;
|
|
42
47
|
export declare function getVaultUserShares(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, index: string): Promise<VaultUserShares>;
|
|
43
|
-
export declare function getAdditionalConfigs(provider: JsonRpcProvider, packageId: string, additional_config_registry: string, indexes: string[]): Promise<Map<string, AdditionalConfig
|
|
48
|
+
export declare function getAdditionalConfigs(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, additional_config_registry: string, indexes: string[]): Promise<[string, Map<string, AdditionalConfig>]>;
|
|
@@ -316,18 +316,23 @@ function parseVaultUserShares(bytes) {
|
|
|
316
316
|
}
|
|
317
317
|
return result.reverse();
|
|
318
318
|
}
|
|
319
|
-
function getAdditionalConfigs(provider, packageId, additional_config_registry, indexes) {
|
|
319
|
+
function getAdditionalConfigs(provider, packageId, typeArguments, registry, additional_config_registry, indexes) {
|
|
320
320
|
return __awaiter(this, void 0, void 0, function () {
|
|
321
|
-
var transactionBlock, target, transactionBlockArguments, bytes, reader, result;
|
|
321
|
+
var transactionBlock, target, transactionBlockArguments, bytes, reader, result, incentive_balance;
|
|
322
322
|
return __generator(this, function (_a) {
|
|
323
323
|
switch (_a.label) {
|
|
324
324
|
case 0:
|
|
325
325
|
transactionBlock = new sui_js_1.TransactionBlock();
|
|
326
326
|
target = "".concat(packageId, "::typus_dov_single::get_additional_configs");
|
|
327
|
-
transactionBlockArguments = [
|
|
327
|
+
transactionBlockArguments = [
|
|
328
|
+
transactionBlock.pure(registry),
|
|
329
|
+
transactionBlock.pure(additional_config_registry),
|
|
330
|
+
transactionBlock.pure(indexes),
|
|
331
|
+
];
|
|
328
332
|
// let transactionBlockArguments = [];
|
|
329
333
|
transactionBlock.moveCall({
|
|
330
334
|
target: target,
|
|
335
|
+
typeArguments: typeArguments,
|
|
331
336
|
arguments: transactionBlockArguments,
|
|
332
337
|
});
|
|
333
338
|
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: constants_1.SENDER })];
|
|
@@ -339,50 +344,87 @@ function getAdditionalConfigs(provider, packageId, additional_config_registry, i
|
|
|
339
344
|
map[key] = value;
|
|
340
345
|
return map;
|
|
341
346
|
}, {});
|
|
347
|
+
incentive_balance = "0";
|
|
342
348
|
// index: u64
|
|
343
349
|
// auction_start_delay_ts_ms: Option<u64>
|
|
344
350
|
// auction_lot_size: Option<u64>
|
|
345
351
|
// auction_benchmark_price: Option<u64>
|
|
346
352
|
// oracle_id: Option<address>
|
|
347
|
-
reader.readVec(function (reader) {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
.
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
353
|
+
reader.readVec(function (reader, i) {
|
|
354
|
+
if (i == 0) {
|
|
355
|
+
reader.read8();
|
|
356
|
+
incentive_balance = reader.read64();
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
reader.read8();
|
|
360
|
+
var index = reader.read64();
|
|
361
|
+
var auction_start_delay_ts_ms = reader
|
|
362
|
+
.readVec(function (reader) {
|
|
363
|
+
return reader.read64();
|
|
364
|
+
})
|
|
365
|
+
.at(0);
|
|
366
|
+
var auction_lot_size = reader
|
|
367
|
+
.readVec(function (reader) {
|
|
368
|
+
return reader.read64();
|
|
369
|
+
})
|
|
370
|
+
.at(0);
|
|
371
|
+
var auction_benchmark_price = reader
|
|
372
|
+
.readVec(function (reader) {
|
|
373
|
+
return reader.read64();
|
|
374
|
+
})
|
|
375
|
+
.at(0);
|
|
376
|
+
var oracle_id = reader
|
|
377
|
+
.readVec(function (reader) {
|
|
378
|
+
return (0, tools_1.AddressFromBytes)(reader.readBytes(32));
|
|
379
|
+
})
|
|
380
|
+
.at(0);
|
|
381
|
+
var risk_level = reader
|
|
382
|
+
.readVec(function (reader) {
|
|
383
|
+
return reader.read8();
|
|
384
|
+
})
|
|
385
|
+
.at(0);
|
|
386
|
+
var min_bid_size = reader
|
|
387
|
+
.readVec(function (reader) {
|
|
388
|
+
return reader.read64();
|
|
389
|
+
})
|
|
390
|
+
.at(0);
|
|
391
|
+
var min_deposit = reader
|
|
392
|
+
.readVec(function (reader) {
|
|
393
|
+
return reader.read64();
|
|
394
|
+
})
|
|
395
|
+
.at(0);
|
|
396
|
+
var incentive_flag = reader
|
|
397
|
+
.readVec(function (reader) {
|
|
398
|
+
return reader.read8();
|
|
399
|
+
})
|
|
400
|
+
.at(0);
|
|
401
|
+
var incentive_rate_bp = reader
|
|
402
|
+
.readVec(function (reader) {
|
|
403
|
+
return reader.read64();
|
|
404
|
+
})
|
|
405
|
+
.at(0);
|
|
406
|
+
var current_portfolio_step = reader
|
|
407
|
+
.readVec(function (reader) {
|
|
408
|
+
return reader.read64();
|
|
409
|
+
})
|
|
410
|
+
.at(0);
|
|
411
|
+
result[index] = {
|
|
412
|
+
index: index,
|
|
413
|
+
auction_start_delay_ts_ms: auction_start_delay_ts_ms ? auction_start_delay_ts_ms : "0",
|
|
414
|
+
auction_lot_size: auction_lot_size ? auction_lot_size : "0",
|
|
415
|
+
auction_benchmark_price: auction_benchmark_price ? auction_benchmark_price : "0",
|
|
416
|
+
oracle_id: oracle_id ? oracle_id : "0",
|
|
417
|
+
risk_level: risk_level ? risk_level : "0",
|
|
418
|
+
min_bid_size: min_bid_size ? min_bid_size : "0",
|
|
419
|
+
min_deposit: min_deposit ? min_deposit : "0",
|
|
420
|
+
incentive_flag: incentive_flag ? incentive_flag : "0",
|
|
421
|
+
incentive_rate_bp: incentive_rate_bp ? incentive_rate_bp : "0",
|
|
422
|
+
current_portfolio_step: current_portfolio_step ? current_portfolio_step : "0",
|
|
423
|
+
};
|
|
424
|
+
}
|
|
383
425
|
});
|
|
384
426
|
// @ts-ignore
|
|
385
|
-
return [2 /*return*/, result];
|
|
427
|
+
return [2 /*return*/, [incentive_balance, result]];
|
|
386
428
|
}
|
|
387
429
|
});
|
|
388
430
|
});
|