@typus/typus-sdk 1.0.14 → 1.0.16

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.
Files changed (30) hide show
  1. package/lib/config.json +29 -20
  2. package/lib/constants.d.ts +3 -3
  3. package/lib/constants.js +6 -6
  4. package/lib/mnemonic.json +3 -0
  5. package/lib/test/getUserInfo.js +1 -13
  6. package/lib/test/multiple-collateral/getAuctionMaxSize.d.ts +1 -0
  7. package/lib/{utils/portfolio/single-collateral/helper/getUserStatus.js → test/multiple-collateral/getAuctionMaxSize.js} +22 -60
  8. package/lib/test/multiple-collateral/getMaxLossPerUnit.d.ts +1 -0
  9. package/lib/test/multiple-collateral/getMaxLossPerUnit.js +62 -0
  10. package/lib/test/multiple-collateral/getUserShares.js +1 -1
  11. package/lib/test/single-collateral/getAuctionMaxSize.d.ts +1 -0
  12. package/lib/{utils/portfolio/single-collateral/helper → test/single-collateral}/getAuctionMaxSize.js +22 -25
  13. package/lib/test/single-collateral/getMaxLossPerUnit.d.ts +1 -0
  14. package/lib/test/single-collateral/getMaxLossPerUnit.js +62 -0
  15. package/lib/test/single-collateral/getUserShares.js +1 -1
  16. package/lib/test/single-collateral/helper/getAuctionMaxSize.js +1 -11
  17. package/lib/test/single-collateral/helper/getUserStatus.js +1 -45
  18. package/lib/test/single-collateral/user/testDeposit.js +8 -4
  19. package/lib/test/sponsorTransaction.d.ts +1 -0
  20. package/lib/test/sponsorTransaction.js +130 -0
  21. package/lib/utils/portfolio/multiple-collateral/user-share.js +17 -3
  22. package/lib/utils/portfolio/multiple-collateral/view-function.d.ts +9 -0
  23. package/lib/utils/portfolio/multiple-collateral/view-function.js +88 -0
  24. package/lib/utils/portfolio/single-collateral/portfolio-vault.js +0 -2
  25. package/lib/utils/portfolio/single-collateral/user-share.js +11 -2
  26. package/lib/utils/portfolio/single-collateral/view-function.d.ts +9 -0
  27. package/lib/utils/portfolio/single-collateral/view-function.js +98 -0
  28. package/package.json +3 -2
  29. package/lib/utils/portfolio/single-collateral/helper/getAuctionMaxSize.d.ts +0 -10
  30. package/lib/utils/portfolio/single-collateral/helper/getUserStatus.d.ts +0 -30
package/lib/config.json CHANGED
@@ -1,24 +1,33 @@
1
1
  {
2
+ "VERSION": "1.1.5",
3
+ "DB_NAME": "testnet_0_32_0",
2
4
  "RPC_ENDPOINT": "https://fullnode.testnet.sui.io:443",
3
- "PORTFOLIO_PACKAGE": "0xab7e0bab5980ad0b55d3fae9d64c1bd41043a3bf383ff41dbc7f0c4ffe766213",
4
- "SINGLE_COLLATERAL_REGISTRY": "0x2cd75564b22f6ce4232d59d1780c13cfb95d4b9e859c937c07bd84cda89461e0",
5
- "SINGLE_COLLATERAL_DEPOSIT_VAULT_REGISTRY": "0xa8c34c8ce2acc207c34118aa86e14ad40f50a35f4b40d1013d87c6790b934100",
6
- "SINGLE_COLLATERAL_BID_VAULT_REGISTRY": "0x3961d77242ab5aa9f667feac353ffcdcd22f76eca8bbe6bafd06c1802695a88e",
7
- "MULTIPLE_COLLATERAL_REGISTRY": "0x5083936779bd8bbc26f374baf90981ad5af8f57fe22920105aa47d4e012364de",
8
- "MULTIPLE_COLLATERAL_TOKEN_DEPOSIT_VAULT_REGISTRY": "0x5a2a467af76e2fc84e98336478224ae81c222e5a8162af4a575302867edbcb56",
9
- "MULTIPLE_COLLATERAL_USD_DEPOSIT_VAULT_REGISTRY": "0xe33913a1152396ea7efb726d1333e54efae3e48fe1ae3fd8ea5a9d5cfeae3f2f",
10
- "MULTIPLE_COLLATERAL_BID_VAULT_REGISTRY": "0xd492fe560cba6f9aa061d4f4dbdfb48f13f5d1536a1583b2cf583b5a1e944fc6",
11
- "MANAGER_CAP": "0x8bd51e439b837bcde15c1d4a462324ca555982db289439c6287d907cacb5ea12",
5
+ "PORTFOLIO_PACKAGE": "0x8e3be3caa0bc8c461e78252e360407d44962db2afd67fd38fd98bab9d327baf1",
6
+ "SINGLE_COLLATERAL_MANAGER_CAP": "0xa4189b00966beb3659484c510304569202520db67c783bd728aefa776a8ab017",
7
+ "SINGLE_COLLATERAL_REGISTRY": "0x0aea6911732b61a0fa89cbbb16c713844d5e7682d6c01f957f938dd1e17c5760",
8
+ "SINGLE_COLLATERAL_DEPOSIT_VAULT_REGISTRY": "0xda81da4f3679cff5d146278434c3fa907f547f44fc31bd5e362cb3c84e00f1c8",
9
+ "SINGLE_COLLATERAL_BID_VAULT_REGISTRY": "0x3ce8665b0c374c4c7d71ec11a9e71c5c64eaf8684c24f0077ba05d16e32d58b4",
10
+ "MULTIPLE_COLLATERAL_MANAGER_CAP": "0x007696a2e387c3fc08fbe6e3fd9670aaf7d5ad1f1280df7a7a8cd988a6f47b9d",
11
+ "MULTIPLE_COLLATERAL_REGISTRY": "0x756f490c57433c0712d736e8fa12623e9e42eb7a41e50678a85b9fcf800c3640",
12
+ "MULTIPLE_COLLATERAL_TOKEN_DEPOSIT_VAULT_REGISTRY": "0x613e0de7f61ff00147f1649fa852e599348702abc89937fb718ad3f202909365",
13
+ "MULTIPLE_COLLATERAL_USD_DEPOSIT_VAULT_REGISTRY": "0x981560caf7feccb3279adb3cf78706f27d8f3b4ebfd9029ea66e034b527f048e",
14
+ "MULTIPLE_COLLATERAL_BID_VAULT_REGISTRY": "0xdaddcf7b4007b324fa411862b48b30d1b07e6c360ec8b05b79ba84129313c6bc",
12
15
  "TOKEN_PACKAGE": "0xd175cff04f1d49574efb6f138bc3b9b7313915a57b5ca04141fb1cb4f66984b2",
13
- "ORACLE_PACKAGE": "0x18af8421386189acff2ac883265885a127c1b9a168be954a786c14ec4c1655f4",
14
- "BTC_ORACLE": "0xa3a57e717a11033f1bedef144a84965e843670488941e490f02e42181d08e617",
15
- "BTC_ORACLE_KEY": "0x32cdfe1c0fde1d579922fdc0646d33edbb90262448c0b896bff2d4cd8172a910",
16
- "ETH_ORACLE": "0x4b8af6c243f31388e2b65345d24f5c4d57997f6ccde4ae7f8cb0105f23b90cb0",
17
- "ETH_ORACLE_KEY": "0x3d6a5650e0b3e94e6b8c514c209c9e902ed2c64db42ef20ad34093b1512534e6",
18
- "SUI_ORACLE": "0x51e69223524d9d5f1da5caee5dd046a5cd2c210be194201897341d91fec774ed",
19
- "SUI_ORACLE_KEY": "0xf044fba97b04bf729b9bae04df5d37abeb6d2e4185dd89ed9cbea578b9baef4d",
20
- "APT_ORACLE": "0x4d9c9c5b820a1aa858ac74e0dfed78c42c217145f2167121cf843c700877e832",
21
- "APT_ORACLE_KEY": "0x41a2ca18d3846496ed79327ad2b5b9dcb67cf0921dc28e92a659c18bd6fadfb4",
22
- "DOGE_ORACLE": "0x77ae067077e1b29fd8d5cb01c7cfc61801cb6cb193d7b2c2b0837f2b115672ac",
23
- "DOGE_ORACLE_KEY": "0xcc8154602d52a48c3efa9c3cf2a6efc218768c824101002ac9528986f9991856"
16
+ "BTC_TOKEN_REGISTRY": "0x15b4c8c7a3fb5aa84fd1bfa4f419dbe065c5628cbfacdc812926c1c004444a54",
17
+ "ETH_TOKEN_REGISTRY": "0x823ad0a5c8de5a6bef7bb1112b623765b8d178c5708d6360be49da572226f5c2",
18
+ "SUI_TOKEN_REGISTRY": "0xf979fdd672a8c3578563087295a9a878b52c33cfb57077a1cb827829aa52d3cc",
19
+ "USDC_TOKEN_REGISTRY": "0xbf453a89a9aa37fdd377e2e014f2777003a1594a289738ca63fccf8429729d81",
20
+ "APT_TOKEN_REGISTRY": "0x2bbca3fe6829d84ef8bf74fb5420924384d5368f0de5cc1ba2159eaeffab028c",
21
+ "DOGE_TOKEN_REGISTRY": "0xefb88c143d453005d862fddda58c05c9749110dfa0ae6277b8e96a70e12b8166",
22
+ "ORACLE_PACKAGE": "0x4144cc4bf374646f45927ca82482ab99920b78477bce572d10b7e49d746108c9",
23
+ "BTC_ORACLE": "0x7517f836e6ad37b168c31efafd7c708045cb4d4de6975e4ea6033e79574d0244",
24
+ "BTC_ORACLE_KEY": "0xe8e24e5590fd3b5f6021742a6188514e35f9e2cc6fa0d6938268955460ef14af",
25
+ "ETH_ORACLE": "0x1749868f767680bbe409dbabb94094bc691f09d1e55958ad4dc1a718b701465f",
26
+ "ETH_ORACLE_KEY": "0x6ec01fa9fe697ed56f1d27bada9d96e4b3da1f3e99abe18db0b7265350c6ca74",
27
+ "SUI_ORACLE": "0x579b4006caca220b703c2e919f5b8fa26a600a349a42624577d49e8802506456",
28
+ "SUI_ORACLE_KEY": "0xa06bb17223a82ca842735e249d99b658567196a72ad85a3a6a9ab115a36fa89b",
29
+ "APT_ORACLE": "0x5de8d72df3fe762a2d5d0a51ce1bd6d0c1b2975c4e7414a4a2eb5c410035c66e",
30
+ "APT_ORACLE_KEY": "0xf3e598e304e444f9827d20a0918969dc824314102c143ee67f25f1c80d54d988",
31
+ "DOGE_ORACLE": "0xe43157e6cf9d4090245c7710e1a015cded9c376e25742b590ee9c06989826972",
32
+ "DOGE_ORACLE_KEY": "0x7df1df5bbe3b5086a7318fceea6bee603d03b917574fff894fd6408f5956d1fb"
24
33
  }
@@ -3,6 +3,8 @@ export declare const TOKEN_PACKAGE: string;
3
3
  export declare const TOKEN_REGISTRY_SUI = "0x3b87b3f0403f527d28fd1301074a12446f43817a";
4
4
  export declare const ORACLE_PACKAGE: string;
5
5
  export declare const TIME_ORACLE = "0x6";
6
+ export declare const CLOCK = "0x6";
7
+ export declare const SENDER = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
6
8
  export declare const BTC_ORACLE: string;
7
9
  export declare const ETH_ORACLE: string;
8
10
  export declare const SUI_ORACLE: string;
@@ -10,17 +12,15 @@ export declare const APT_ORACLE: string;
10
12
  export declare const DOGE_ORACLE: string;
11
13
  export declare const PORTFOLIO_PACKAGE: string;
12
14
  export declare const REGISTRY: string;
13
- export declare const MANAGER_CAP: string;
14
15
  export declare const MODULE = "single_collateral";
15
16
  export declare const SINGLE_COLLATERAL_DEPOSIT_VAULT_REGISTRY: string;
16
17
  export declare const SINGLE_COLLATERAL_BID_VAULT_REGISTRY: string;
17
- export declare const USER_SHARE_REGISTRY = "0xe9cba6f5b1793937b94d1494034d4d3491dc9efdffdabe9eb011e726600db9e6";
18
18
  export declare const TEST_MINT_TOKEN = "0x672612858fcb5c6abf944638253142820c251753";
19
19
  export declare const PRICE_DECIMAL = 8;
20
20
  export declare const TOKEN_DECIMAL = 9;
21
- export declare const TEST_MNEMONIC = "";
22
21
  export declare const DEFAULT_TYPE_ARGUMENT = "0x2::sui::SUI";
23
22
  export declare const FAKE_TOKEN_TYPE_ARGUMENT = "0x27b3674c685046f66cad1d5496d2967894fa5329::token::USDC";
23
+ export declare const TEST_MNEMONIC: string;
24
24
  export declare const TOKEN_NAME: string[];
25
25
  export declare const TOKEN_NAME_TO_MODULE: {
26
26
  BTC: string;
package/lib/constants.js CHANGED
@@ -3,16 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PERFORMANCE_FEE_SUB_VAULT_TAG = exports.PREMIUM_SUB_VAULT_TAG = exports.BIDDER_SUB_VAULT_TAG = exports.WARMUP_SUB_VAULT_TAG = exports.INACTIVE_SUB_VAULT_TAG = exports.DEACTIVATING_SUB_VAULT_TAG = exports.ACTIVE_SUB_VAULT_TAG = exports.testnetConnection = exports.TOKEN_NAME_TO_MODULE = exports.TOKEN_NAME = exports.FAKE_TOKEN_TYPE_ARGUMENT = exports.DEFAULT_TYPE_ARGUMENT = exports.TEST_MNEMONIC = exports.TOKEN_DECIMAL = exports.PRICE_DECIMAL = exports.TEST_MINT_TOKEN = exports.USER_SHARE_REGISTRY = exports.SINGLE_COLLATERAL_BID_VAULT_REGISTRY = exports.SINGLE_COLLATERAL_DEPOSIT_VAULT_REGISTRY = exports.MODULE = exports.MANAGER_CAP = exports.REGISTRY = exports.PORTFOLIO_PACKAGE = exports.DOGE_ORACLE = exports.APT_ORACLE = exports.SUI_ORACLE = exports.ETH_ORACLE = exports.BTC_ORACLE = exports.TIME_ORACLE = exports.ORACLE_PACKAGE = exports.TOKEN_REGISTRY_SUI = exports.TOKEN_PACKAGE = void 0;
6
+ exports.PERFORMANCE_FEE_SUB_VAULT_TAG = exports.PREMIUM_SUB_VAULT_TAG = exports.BIDDER_SUB_VAULT_TAG = exports.WARMUP_SUB_VAULT_TAG = exports.INACTIVE_SUB_VAULT_TAG = exports.DEACTIVATING_SUB_VAULT_TAG = exports.ACTIVE_SUB_VAULT_TAG = exports.testnetConnection = exports.TOKEN_NAME_TO_MODULE = exports.TOKEN_NAME = exports.TEST_MNEMONIC = exports.FAKE_TOKEN_TYPE_ARGUMENT = exports.DEFAULT_TYPE_ARGUMENT = exports.TOKEN_DECIMAL = exports.PRICE_DECIMAL = exports.TEST_MINT_TOKEN = exports.SINGLE_COLLATERAL_BID_VAULT_REGISTRY = exports.SINGLE_COLLATERAL_DEPOSIT_VAULT_REGISTRY = exports.MODULE = exports.REGISTRY = exports.PORTFOLIO_PACKAGE = exports.DOGE_ORACLE = exports.APT_ORACLE = exports.SUI_ORACLE = exports.ETH_ORACLE = exports.BTC_ORACLE = exports.SENDER = exports.CLOCK = exports.TIME_ORACLE = exports.ORACLE_PACKAGE = exports.TOKEN_REGISTRY_SUI = exports.TOKEN_PACKAGE = void 0;
7
7
  var sui_js_1 = require("@mysten/sui.js");
8
8
  var config_json_1 = __importDefault(require("./config.json"));
9
- // import mnemonic from "./mnemonic.json";
9
+ var mnemonic_json_1 = __importDefault(require("./mnemonic.json"));
10
10
  //publish from sui-dev-token
11
11
  exports.TOKEN_PACKAGE = config_json_1.default.TOKEN_PACKAGE;
12
12
  exports.TOKEN_REGISTRY_SUI = "0x3b87b3f0403f527d28fd1301074a12446f43817a";
13
13
  //publish from typus-oracle
14
14
  exports.ORACLE_PACKAGE = config_json_1.default.ORACLE_PACKAGE;
15
15
  exports.TIME_ORACLE = "0x6";
16
+ exports.CLOCK = "0x6";
17
+ exports.SENDER = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
16
18
  exports.BTC_ORACLE = config_json_1.default.BTC_ORACLE;
17
19
  exports.ETH_ORACLE = config_json_1.default.ETH_ORACLE;
18
20
  exports.SUI_ORACLE = config_json_1.default.SUI_ORACLE;
@@ -21,19 +23,17 @@ exports.DOGE_ORACLE = config_json_1.default.DOGE_ORACLE;
21
23
  //publish from typus-dov/cover_call
22
24
  exports.PORTFOLIO_PACKAGE = config_json_1.default.PORTFOLIO_PACKAGE;
23
25
  exports.REGISTRY = config_json_1.default.SINGLE_COLLATERAL_REGISTRY;
24
- exports.MANAGER_CAP = config_json_1.default.MANAGER_CAP;
26
+ // export const MANAGER_CAP = config.MANAGER_CAP;
25
27
  exports.MODULE = "single_collateral";
26
28
  exports.SINGLE_COLLATERAL_DEPOSIT_VAULT_REGISTRY = config_json_1.default.SINGLE_COLLATERAL_DEPOSIT_VAULT_REGISTRY;
27
29
  exports.SINGLE_COLLATERAL_BID_VAULT_REGISTRY = config_json_1.default.SINGLE_COLLATERAL_BID_VAULT_REGISTRY;
28
- exports.USER_SHARE_REGISTRY = "0xe9cba6f5b1793937b94d1494034d4d3491dc9efdffdabe9eb011e726600db9e6";
29
30
  //publish from typus-dov/typus-dov
30
31
  exports.TEST_MINT_TOKEN = "0x672612858fcb5c6abf944638253142820c251753";
31
32
  exports.PRICE_DECIMAL = 8;
32
33
  exports.TOKEN_DECIMAL = 9;
33
- exports.TEST_MNEMONIC = "";
34
34
  exports.DEFAULT_TYPE_ARGUMENT = "0x2::sui::SUI";
35
35
  exports.FAKE_TOKEN_TYPE_ARGUMENT = "0x27b3674c685046f66cad1d5496d2967894fa5329::token::USDC";
36
- // export const TEST_MNEMONIC = mnemonic.MNEMONIC;
36
+ exports.TEST_MNEMONIC = mnemonic_json_1.default.MNEMONIC;
37
37
  exports.TOKEN_NAME = ["BTC", "ETH", "SUI", "USDC", "USDT", "APT", "DOGE"];
38
38
  exports.TOKEN_NAME_TO_MODULE = {
39
39
  BTC: "btc",
@@ -0,0 +1,3 @@
1
+ {
2
+ "MNEMONIC": "alien job hollow island travel bargain dust appear gold rural ceiling bronze"
3
+ }
@@ -36,23 +36,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- var constants_1 = require("../constants");
40
- var getVaultData_1 = require("../utils/portfolio/single-collateral/getVaultData");
41
39
  var sui_js_1 = require("@mysten/sui.js");
42
40
  var connection = new sui_js_1.Connection({ fullnode: "https://rpc-testnet.suiscan.xyz:443" });
43
41
  var provider = new sui_js_1.JsonRpcProvider(connection); //for read only operations
44
42
  (function () { return __awaiter(void 0, void 0, void 0, function () {
45
- var res;
46
43
  return __generator(this, function (_a) {
47
- switch (_a.label) {
48
- case 0: return [4 /*yield*/, (0, getVaultData_1.getUserInfo)(constants_1.USER_SHARE_REGISTRY, provider)];
49
- case 1:
50
- res = _a.sent();
51
- res.forEach(function (r) {
52
- console.log(r.user, r.shares);
53
- });
54
- console.log(res.length);
55
- return [2 /*return*/];
56
- }
44
+ return [2 /*return*/];
57
45
  });
58
46
  }); })();
@@ -35,66 +35,28 @@ 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 __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
38
41
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.U64FromBytes = exports.parseUserStatusResult = exports.getUserStatus = void 0;
40
42
  var sui_js_1 = require("@mysten/sui.js");
41
- /**
42
- struct GetUserStatusResult has copy, drop {
43
- active: u64,
44
- deactivating: u64,
45
- inactive: u64,
46
- warmup: u64,
47
- bidder: u64,
48
- premium: u64,
49
- performance_fee: u64,
50
- }
51
- public fun get_user_status<D_TOKEN, B_TOKEN, O_TOKEN>(
52
- registry: &Registry,
53
- index: u64,
54
- user: address,
55
- ): GetUserStatusResult
56
- */
57
- function getUserStatus(packageId, module, typeArguments, registry, index, userAddress) {
58
- return __awaiter(this, void 0, void 0, function () {
59
- var tx, target, txArguments;
60
- return __generator(this, function (_a) {
61
- tx = new sui_js_1.TransactionBlock();
62
- target = "".concat(packageId, "::").concat(module, "::get_user_status");
63
- txArguments = [tx.pure(registry), tx.pure(index), tx.pure(userAddress)];
64
- tx.moveCall({
65
- target: target,
66
- typeArguments: typeArguments,
67
- arguments: txArguments,
68
- });
69
- return [2 /*return*/, tx];
70
- });
43
+ var config_json_1 = __importDefault(require("../../config.json"));
44
+ var view_function_1 = require("../../utils/portfolio/multiple-collateral/view-function");
45
+ var portfolio_vault_1 = require("../../utils/portfolio/multiple-collateral/portfolio-vault");
46
+ var provider = new sui_js_1.JsonRpcProvider(new sui_js_1.Connection({ fullnode: config_json_1.default.RPC_ENDPOINT }));
47
+ var index = "5";
48
+ (function () { return __awaiter(void 0, void 0, void 0, function () {
49
+ var portfolioVaults, result;
50
+ return __generator(this, function (_a) {
51
+ switch (_a.label) {
52
+ case 0: return [4 /*yield*/, (0, portfolio_vault_1.getPortfolioVaults)(provider, config_json_1.default.MULTIPLE_COLLATERAL_REGISTRY, config_json_1.default.MULTIPLE_COLLATERAL_TOKEN_DEPOSIT_VAULT_REGISTRY, config_json_1.default.MULTIPLE_COLLATERAL_TOKEN_DEPOSIT_VAULT_REGISTRY, config_json_1.default.MULTIPLE_COLLATERAL_BID_VAULT_REGISTRY)];
53
+ case 1:
54
+ portfolioVaults = _a.sent();
55
+ return [4 /*yield*/, (0, view_function_1.getAuctionMaxSize)(provider, config_json_1.default.PORTFOLIO_PACKAGE, portfolioVaults[index].typeArgs, config_json_1.default.MULTIPLE_COLLATERAL_REGISTRY, index)];
56
+ case 2:
57
+ result = _a.sent();
58
+ console.log(JSON.stringify(result, function (_, v) { return (typeof v === "bigint" ? "".concat(v) : v); }, 2));
59
+ return [2 /*return*/];
60
+ }
71
61
  });
72
- }
73
- exports.getUserStatus = getUserStatus;
74
- function parseUserStatusResult(rawData) {
75
- var temp = [];
76
- for (var i = 0; i < rawData.length / 8; ++i) {
77
- // console.log(i)
78
- temp.push(U64FromBytes(rawData.slice(i * 8, (i + 1) * 8).reverse()));
79
- }
80
- var userStatusResult = {
81
- active: temp[0],
82
- deactivating: temp[1],
83
- inactive: temp[2],
84
- warmup: temp[3],
85
- bidder: temp[4],
86
- premium: temp[5],
87
- performanceFee: temp[6],
88
- };
89
- return userStatusResult;
90
- }
91
- exports.parseUserStatusResult = parseUserStatusResult;
92
- function U64FromBytes(x) {
93
- var val = BigInt(0);
94
- for (var i = 0; i < x.length; i++) {
95
- val = val << BigInt(8);
96
- val += BigInt(x[i]);
97
- }
98
- return val;
99
- }
100
- exports.U64FromBytes = U64FromBytes;
62
+ }); })();
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ var sui_js_1 = require("@mysten/sui.js");
43
+ var config_json_1 = __importDefault(require("../../config.json"));
44
+ var view_function_1 = require("../../utils/portfolio/multiple-collateral/view-function");
45
+ var portfolio_vault_1 = require("../../utils/portfolio/multiple-collateral/portfolio-vault");
46
+ var provider = new sui_js_1.JsonRpcProvider(new sui_js_1.Connection({ fullnode: config_json_1.default.RPC_ENDPOINT }));
47
+ var index = "5";
48
+ (function () { return __awaiter(void 0, void 0, void 0, function () {
49
+ var portfolioVaults, result;
50
+ return __generator(this, function (_a) {
51
+ switch (_a.label) {
52
+ case 0: return [4 /*yield*/, (0, portfolio_vault_1.getPortfolioVaults)(provider, config_json_1.default.MULTIPLE_COLLATERAL_REGISTRY, config_json_1.default.MULTIPLE_COLLATERAL_TOKEN_DEPOSIT_VAULT_REGISTRY, config_json_1.default.MULTIPLE_COLLATERAL_TOKEN_DEPOSIT_VAULT_REGISTRY, config_json_1.default.MULTIPLE_COLLATERAL_BID_VAULT_REGISTRY)];
53
+ case 1:
54
+ portfolioVaults = _a.sent();
55
+ return [4 /*yield*/, (0, view_function_1.getMaxLossPerUnit)(provider, config_json_1.default.PORTFOLIO_PACKAGE, portfolioVaults[index].typeArgs, config_json_1.default.MULTIPLE_COLLATERAL_REGISTRY, index)];
56
+ case 2:
57
+ result = _a.sent();
58
+ console.log(JSON.stringify(result, function (_, v) { return (typeof v === "bigint" ? "".concat(v) : v); }, 2));
59
+ return [2 /*return*/];
60
+ }
61
+ });
62
+ }); })();
@@ -52,7 +52,7 @@ var user = "0x603272d1e61de086a18751482684f882642eb080144aee425c4c34b5e56470b0";
52
52
  case 0: return [4 /*yield*/, (0, user_share_1.getUserShares)(provider, packageId, registry, indexes, user)];
53
53
  case 1:
54
54
  result = _a.sent();
55
- console.log(JSON.stringify(result, function (_, v) { return typeof v === 'bigint' ? "".concat(v) : v; }, 2));
55
+ console.log(JSON.stringify(result, function (_, v) { return (typeof v === "bigint" ? "".concat(v) : v); }, 2));
56
56
  return [2 /*return*/];
57
57
  }
58
58
  });
@@ -0,0 +1 @@
1
+ export {};
@@ -35,31 +35,28 @@ 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 __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
38
41
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getAuctionMaxSize = void 0;
40
42
  var sui_js_1 = require("@mysten/sui.js");
41
- /**
42
- public fun get_auction_max_size<D_TOKEN, B_TOKEN, O_TOKEN>(
43
- registry: &Registry,
44
- index: u64,
45
- price_oracle: &Oracle<O_TOKEN>,
46
- clock: &Clock,
47
- ): u64
48
- */
49
- function getAuctionMaxSize(packageId, module, typeArguments, registry, index, priceOracle) {
50
- return __awaiter(this, void 0, void 0, function () {
51
- var tx, target, txArguments;
52
- return __generator(this, function (_a) {
53
- tx = new sui_js_1.TransactionBlock();
54
- target = "".concat(packageId, "::").concat(module, "::get_auction_max_size");
55
- txArguments = [tx.pure(registry), tx.pure(index), tx.pure(priceOracle), tx.pure("0x6")];
56
- tx.moveCall({
57
- target: target,
58
- typeArguments: typeArguments,
59
- arguments: txArguments,
60
- });
61
- return [2 /*return*/, tx];
62
- });
43
+ var config_json_1 = __importDefault(require("../../config.json"));
44
+ var view_function_1 = require("../../utils/portfolio/single-collateral/view-function");
45
+ var portfolio_vault_1 = require("../../utils/portfolio/single-collateral/portfolio-vault");
46
+ var provider = new sui_js_1.JsonRpcProvider(new sui_js_1.Connection({ fullnode: config_json_1.default.RPC_ENDPOINT }));
47
+ var index = "5";
48
+ (function () { return __awaiter(void 0, void 0, void 0, function () {
49
+ var portfolioVaults, result;
50
+ return __generator(this, function (_a) {
51
+ switch (_a.label) {
52
+ case 0: return [4 /*yield*/, (0, portfolio_vault_1.getPortfolioVaults)(provider, config_json_1.default.SINGLE_COLLATERAL_REGISTRY, config_json_1.default.SINGLE_COLLATERAL_DEPOSIT_VAULT_REGISTRY, config_json_1.default.SINGLE_COLLATERAL_BID_VAULT_REGISTRY)];
53
+ case 1:
54
+ portfolioVaults = _a.sent();
55
+ return [4 /*yield*/, (0, view_function_1.getAuctionMaxSize)(provider, config_json_1.default.PORTFOLIO_PACKAGE, portfolioVaults[index].typeArgs, config_json_1.default.SINGLE_COLLATERAL_REGISTRY, index, config_json_1.default.ETH_ORACLE)];
56
+ case 2:
57
+ result = _a.sent();
58
+ console.log(JSON.stringify(result, function (_, v) { return (typeof v === "bigint" ? "".concat(v) : v); }, 2));
59
+ return [2 /*return*/];
60
+ }
63
61
  });
64
- }
65
- exports.getAuctionMaxSize = getAuctionMaxSize;
62
+ }); })();
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ var sui_js_1 = require("@mysten/sui.js");
43
+ var config_json_1 = __importDefault(require("../../config.json"));
44
+ var view_function_1 = require("../../utils/portfolio/single-collateral/view-function");
45
+ var portfolio_vault_1 = require("../../utils/portfolio/single-collateral/portfolio-vault");
46
+ var provider = new sui_js_1.JsonRpcProvider(new sui_js_1.Connection({ fullnode: config_json_1.default.RPC_ENDPOINT }));
47
+ var index = "5";
48
+ (function () { return __awaiter(void 0, void 0, void 0, function () {
49
+ var portfolioVaults, result;
50
+ return __generator(this, function (_a) {
51
+ switch (_a.label) {
52
+ case 0: return [4 /*yield*/, (0, portfolio_vault_1.getPortfolioVaults)(provider, config_json_1.default.SINGLE_COLLATERAL_REGISTRY, config_json_1.default.SINGLE_COLLATERAL_DEPOSIT_VAULT_REGISTRY, config_json_1.default.SINGLE_COLLATERAL_BID_VAULT_REGISTRY)];
53
+ case 1:
54
+ portfolioVaults = _a.sent();
55
+ return [4 /*yield*/, (0, view_function_1.getMaxLossPerUnit)(provider, config_json_1.default.PORTFOLIO_PACKAGE, portfolioVaults[index].typeArgs, config_json_1.default.SINGLE_COLLATERAL_REGISTRY, index, config_json_1.default.ETH_ORACLE)];
56
+ case 2:
57
+ result = _a.sent();
58
+ console.log(JSON.stringify(result, function (_, v) { return (typeof v === "bigint" ? "".concat(v) : v); }, 2));
59
+ return [2 /*return*/];
60
+ }
61
+ });
62
+ }); })();
@@ -44,7 +44,7 @@ var user_share_1 = require("../../utils/portfolio/single-collateral/user-share")
44
44
  var config_json_1 = __importDefault(require("../../config.json"));
45
45
  var provider = new sui_js_1.JsonRpcProvider(new sui_js_1.Connection({ fullnode: config_json_1.default.RPC_ENDPOINT }));
46
46
  var indexes = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"];
47
- var user = "0x8b21d27b7de562512b71ced257825f61fe51f2802e2896312ddc32764ed28cd5";
47
+ var user = "0xdc72506f269feb89822c13e66b282bc52c5724c27e575a04cbec949a13671d13";
48
48
  (function () { return __awaiter(void 0, void 0, void 0, function () {
49
49
  var result;
50
50
  return __generator(this, function (_a) {
@@ -38,12 +38,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  var constants_1 = require("../../../constants");
40
40
  var sui_js_1 = require("@mysten/sui.js");
41
- var getAuctionMaxSize_1 = require("../../../utils/portfolio/single-collateral/helper/getAuctionMaxSize");
42
- var getUserStatus_1 = require("../../../utils/portfolio/single-collateral/helper/getUserStatus");
43
41
  var portfolio_vault_1 = require("../../../utils/portfolio/single-collateral/portfolio-vault");
44
42
  var provider = new sui_js_1.JsonRpcProvider(constants_1.testnetConnection); //for read only operations
45
43
  (function () { return __awaiter(void 0, void 0, void 0, function () {
46
- var sender, oracle, index, portfolioVaults, portfolioVault, transactionBlock, res, rawData;
44
+ var sender, oracle, index, portfolioVaults, portfolioVault, rawData;
47
45
  return __generator(this, function (_a) {
48
46
  switch (_a.label) {
49
47
  case 0:
@@ -56,16 +54,8 @@ var provider = new sui_js_1.JsonRpcProvider(constants_1.testnetConnection); //fo
56
54
  portfolioVault = portfolioVaults[index];
57
55
  console.log(portfolioVault);
58
56
  console.log(portfolioVault.config.activeVaultConfig.payoffConfigs);
59
- return [4 /*yield*/, (0, getAuctionMaxSize_1.getAuctionMaxSize)(constants_1.PORTFOLIO_PACKAGE, constants_1.MODULE, portfolioVault.typeArgs, constants_1.REGISTRY, portfolioVault.info.index, oracle)];
60
- case 2:
61
- transactionBlock = _a.sent();
62
- return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: sender })];
63
- case 3:
64
- res = _a.sent();
65
- console.log(res);
66
57
  rawData = res.results[0].returnValues[0][0];
67
58
  console.log(rawData);
68
- console.log((0, getUserStatus_1.U64FromBytes)(rawData.reverse()));
69
59
  return [2 /*return*/];
70
60
  }
71
61
  });
@@ -39,10 +39,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  var constants_1 = require("../../../constants");
40
40
  var getVaultData_1 = require("../../../utils/portfolio/single-collateral/getVaultData");
41
41
  var sui_js_1 = require("@mysten/sui.js");
42
- var getUserStatus_1 = require("../../../utils/portfolio/single-collateral/helper/getUserStatus");
43
42
  var provider = new sui_js_1.JsonRpcProvider(constants_1.testnetConnection); //for read only operations
44
43
  (function () { return __awaiter(void 0, void 0, void 0, function () {
45
- var sender, index, portfolioVaults, portfolioVault, transactionBlock, res, rawData, userStatusResult;
44
+ var sender, index, portfolioVaults, portfolioVault;
46
45
  return __generator(this, function (_a) {
47
46
  switch (_a.label) {
48
47
  case 0:
@@ -53,49 +52,6 @@ var provider = new sui_js_1.JsonRpcProvider(constants_1.testnetConnection); //fo
53
52
  portfolioVaults = _a.sent();
54
53
  portfolioVault = portfolioVaults[0];
55
54
  console.log(portfolioVault);
56
- return [4 /*yield*/, (0, getUserStatus_1.getUserStatus)(constants_1.PORTFOLIO_PACKAGE, constants_1.MODULE, portfolioVault.typeArgs, constants_1.REGISTRY, portfolioVault.info.index, sender)];
57
- case 2:
58
- transactionBlock = _a.sent();
59
- return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: sender })];
60
- case 3:
61
- res = _a.sent();
62
- console.log(res);
63
- rawData = res.results[0].returnValues[0][0];
64
- // let rawData: Uint8Array = [
65
- // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
66
- // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
67
- // 0, 228, 11, 84, 2, 0, 0, 0, 0, 0, 0, 0,
68
- // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
69
- // 0, 0, 0, 0, 0, 0, 0, 0
70
- // ];
71
- // {
72
- // active: 0n,
73
- // deactivating: 0n,
74
- // inactive: 0n,
75
- // warmup: 10000000000n,
76
- // bidder: 0n,
77
- // premium: 0n,
78
- // performance_fee: 0n
79
- // }
80
- // let rawData: Uint8Array = [
81
- // 191, 19, 151, 0, 0, 0, 0, 0, 0, 0, 0, 0,
82
- // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
83
- // 65, 205, 94, 5, 0, 0, 0, 0, 128, 150, 152, 0,
84
- // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
85
- // 5, 23, 0, 0, 0, 0, 0, 0
86
- // ];
87
- // {
88
- // active: 9900991n,
89
- // deactivating: 0n,
90
- // inactive: 0n,
91
- // warmup: 90099009n,
92
- // bidder: 10000000n,
93
- // premium: 0n,
94
- // performance_fee: 5893n
95
- // }
96
- console.log(rawData);
97
- userStatusResult = (0, getUserStatus_1.parseUserStatusResult)(rawData);
98
- console.log(userStatusResult);
99
55
  return [2 /*return*/];
100
56
  }
101
57
  });
@@ -35,11 +35,15 @@ 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 __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
38
41
  Object.defineProperty(exports, "__esModule", { value: true });
39
42
  var constants_1 = require("../../../constants");
40
43
  var sui_js_1 = require("@mysten/sui.js");
41
44
  var getDepositTx_1 = require("../../../utils/portfolio/single-collateral/user/getDepositTx");
42
- var getVaultData_1 = require("../../../utils/portfolio/single-collateral/getVaultData");
45
+ var portfolio_vault_1 = require("../../../utils/portfolio/single-collateral/portfolio-vault");
46
+ var config_json_1 = __importDefault(require("../../../config.json"));
43
47
  var connection = new sui_js_1.Connection({ fullnode: "https://rpc-testnet.suiscan.xyz:443" });
44
48
  var provider = new sui_js_1.JsonRpcProvider(connection); //for read only operations
45
49
  var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
@@ -51,11 +55,11 @@ var signer = new sui_js_1.RawSigner(keypair, provider);
51
55
  switch (_d.label) {
52
56
  case 0:
53
57
  depositAmount = "100000000";
54
- index = "1";
55
- return [4 /*yield*/, (0, getVaultData_1.getVaultDataFromRegistry)(constants_1.REGISTRY, provider, index)];
58
+ index = "4";
59
+ return [4 /*yield*/, (0, portfolio_vault_1.getPortfolioVaults)(provider, config_json_1.default.SINGLE_COLLATERAL_REGISTRY, config_json_1.default.SINGLE_COLLATERAL_DEPOSIT_VAULT_REGISTRY, config_json_1.default.SINGLE_COLLATERAL_BID_VAULT_REGISTRY)];
56
60
  case 1:
57
61
  portfolioVaults = _d.sent();
58
- portfolioVault = portfolioVaults.find(function (portfolioVault) { return portfolioVault.info.index == index; });
62
+ portfolioVault = portfolioVaults[index];
59
63
  dToken = portfolioVault.typeArgs[0];
60
64
  typeArguments = portfolioVault.typeArgs;
61
65
  vaultIndex = portfolioVault.info.index;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ var sui_js_1 = require("@mysten/sui.js");
40
+ var typed_rpc_1 = require("typed-rpc");
41
+ var constants_1 = require("../constants");
42
+ var getDepositTx_1 = require("../utils/portfolio/single-collateral/user/getDepositTx");
43
+ // The initiator of the transaction
44
+ var SENDER_ADDRESS = "0xb6c7e3b1c61ee81516a8317f221daa035f1503e0ac3ae7a50b61834bc7a3ead9";
45
+ var SENDER_RECOVERY_PHRASE = constants_1.TEST_MNEMONIC;
46
+ // gas budget, in MIST
47
+ var GAS_BUDGET = 5000000;
48
+ // Gas Station endpoint:
49
+ var SPONSOR_RPC_URL = "https://api.shinami.com/gas/v1/sui_testnet_17aa4c66d7a325601abde1f043793003";
50
+ // Sui Node endpoint:
51
+ var connection = new sui_js_1.Connection({
52
+ fullnode: "https://fullnode.testnet.sui.io:443",
53
+ });
54
+ var suiProvider = new sui_js_1.JsonRpcProvider(connection);
55
+ // Create the sender's address key pair from the recovery phrase
56
+ var keyPair = sui_js_1.Ed25519Keypair.deriveKeypair(SENDER_RECOVERY_PHRASE);
57
+ // Create the sender's address key pair from the sender's private key
58
+ // const buf = Buffer.from(SENDER_PRIVATE_KEY, "base64");
59
+ // const keyPair = Ed25519Keypair.fromSecretKey(buf.slice(1));
60
+ // Create a signer for the sender's keypair
61
+ var signer = new sui_js_1.RawSigner(keyPair, suiProvider);
62
+ var sponsor = (0, typed_rpc_1.rpcClient)(SPONSOR_RPC_URL);
63
+ // Different examples of programmable transaction blocks that can be crafted.
64
+ var progTxnTransfer = function () { return __awaiter(void 0, void 0, void 0, function () {
65
+ var gasBudget, typeArguments, vaultIndex, coins, depositAmount, transactionBlock;
66
+ return __generator(this, function (_a) {
67
+ switch (_a.label) {
68
+ case 0:
69
+ gasBudget = 100000000;
70
+ typeArguments = [
71
+ "0xd175cff04f1d49574efb6f138bc3b9b7313915a57b5ca04141fb1cb4f66984b2::eth::ETH",
72
+ "0xd175cff04f1d49574efb6f138bc3b9b7313915a57b5ca04141fb1cb4f66984b2::eth::ETH",
73
+ "0xd175cff04f1d49574efb6f138bc3b9b7313915a57b5ca04141fb1cb4f66984b2::eth::ETH",
74
+ ];
75
+ vaultIndex = "4";
76
+ coins = [
77
+ "0x07bb1b0bd176a5e9e0377758282bd0eb27070f2684a88a2cf57964fb4da11c0d",
78
+ "0x2a908b66b02c450fefbede9ef02672dc2291163284e59fd90841a6024bf3aa82",
79
+ "0x99711f3c9a87b3ba9c9a61a6dbb4022f24799a8814c419f106cedc2c2f7b70b1",
80
+ "0xad5ae185437c4ef43d571e7efd188a849e6b5bf49cbd810e90b775458a8495e6",
81
+ "0xb9c0ef30cf9729d6ad54d3a17b524010d494eb5c16fa9b4d4859998dde485282",
82
+ "0xcbc37498f1be79ef68f8a01e025dfa7c83203c9e50f8eebef8b7108cacba1691",
83
+ "0xd162905fccb0332a99b5f5f00172a11d1e5c3e7feb9590165b02e19e5f7ba8b5",
84
+ "0xdd489edccfba1f64d02fd693c22d5faa069d6d3bb65b33b24e5a5d12f99dadce",
85
+ "0xf5426d21d861dc22aef1b78cb7ade67793ff1caa2d2004324954855c203a48bc",
86
+ ];
87
+ depositAmount = "100000000";
88
+ return [4 /*yield*/, (0, getDepositTx_1.getDepositTx)(gasBudget, constants_1.PORTFOLIO_PACKAGE, constants_1.MODULE, constants_1.REGISTRY, typeArguments, vaultIndex, coins, depositAmount)];
89
+ case 1:
90
+ transactionBlock = _a.sent();
91
+ return [2 /*return*/, transactionBlock];
92
+ }
93
+ });
94
+ }); };
95
+ var sponsorTransactionE2E = function () { return __awaiter(void 0, void 0, void 0, function () {
96
+ var gaslessTxb, gaslessPayloadBytes, gaslessPayloadBase64, sponsoredResponse, sponsoredStatus, senderSig, executeResponse;
97
+ var _a;
98
+ return __generator(this, function (_b) {
99
+ switch (_b.label) {
100
+ case 0:
101
+ gaslessTxb = progTxnTransfer();
102
+ return [4 /*yield*/, gaslessTxb];
103
+ case 1: return [4 /*yield*/, (_b.sent()).build({ provider: suiProvider, onlyTransactionKind: true })];
104
+ case 2:
105
+ gaslessPayloadBytes = _b.sent();
106
+ gaslessPayloadBase64 = btoa(gaslessPayloadBytes.reduce(function (data, byte) { return data + String.fromCharCode(byte); }, ""));
107
+ return [4 /*yield*/, sponsor.gas_sponsorTransactionBlock(gaslessPayloadBase64, SENDER_ADDRESS, GAS_BUDGET)];
108
+ case 3:
109
+ sponsoredResponse = _b.sent();
110
+ return [4 /*yield*/, sponsor.gas_getSponsoredTransactionBlockStatus(sponsoredResponse.txDigest)];
111
+ case 4:
112
+ sponsoredStatus = _b.sent();
113
+ console.log("Sponsorship Status:", sponsoredStatus);
114
+ return [4 /*yield*/, signer.signTransactionBlock({ transactionBlock: sui_js_1.TransactionBlock.from(sponsoredResponse.txBytes) })];
115
+ case 5:
116
+ senderSig = _b.sent();
117
+ return [4 /*yield*/, suiProvider.executeTransactionBlock({
118
+ transactionBlock: sponsoredResponse.txBytes,
119
+ signature: [senderSig.signature, sponsoredResponse.signature],
120
+ options: { showEffects: true },
121
+ requestType: "WaitForLocalExecution",
122
+ })];
123
+ case 6:
124
+ executeResponse = _b.sent();
125
+ console.log("Execution Status:", (_a = executeResponse.effects) === null || _a === void 0 ? void 0 : _a.status.status);
126
+ return [2 /*return*/];
127
+ }
128
+ });
129
+ }); };
130
+ sponsorTransactionE2E();
@@ -86,9 +86,23 @@ function getUserShares(provider, packageId, registry, indexes, user) {
86
86
  if (result[index] == undefined) {
87
87
  result[index] = {
88
88
  index: index,
89
- tokenDepositVaultUserShare: {},
90
- usdDepositVaultUserShare: {},
91
- bidVaultUserShare: {},
89
+ tokenDepositVaultUserShare: {
90
+ activeSubVaultUserShare: BigInt(0),
91
+ deactivatingSubVaultUserShare: BigInt(0),
92
+ inactiveSubVaultUserShare: BigInt(0),
93
+ warmupSubVaultUserShare: BigInt(0),
94
+ },
95
+ usdDepositVaultUserShare: {
96
+ activeSubVaultUserShare: BigInt(0),
97
+ deactivatingSubVaultUserShare: BigInt(0),
98
+ inactiveSubVaultUserShare: BigInt(0),
99
+ warmupSubVaultUserShare: BigInt(0),
100
+ },
101
+ bidVaultUserShare: {
102
+ bidderSubVaultUserShare: BigInt(0),
103
+ premiumSubVaultUserShare: BigInt(0),
104
+ performanceFeeSubVaultUserShare: BigInt(0),
105
+ },
92
106
  };
93
107
  }
94
108
  result[index].index = index;
@@ -0,0 +1,9 @@
1
+ import { JsonRpcProvider } from "@mysten/sui.js";
2
+ import { DepositVaultUserShare, BidVaultUserShare } from "../../typus-framework/vault";
3
+ export interface UserShare {
4
+ index: string;
5
+ depositVaultUserShare: DepositVaultUserShare;
6
+ bidVaultUserShare: BidVaultUserShare;
7
+ }
8
+ export declare function getAuctionMaxSize(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, index: string): Promise<BigInt>;
9
+ export declare function getMaxLossPerUnit(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, index: string): Promise<BigInt>;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getMaxLossPerUnit = exports.getAuctionMaxSize = void 0;
40
+ var sui_js_1 = require("@mysten/sui.js");
41
+ var tools_1 = require("../../tools");
42
+ var constants_1 = require("../../../constants");
43
+ function getAuctionMaxSize(provider, packageId, typeArguments, registry, index) {
44
+ return __awaiter(this, void 0, void 0, function () {
45
+ var transactionBlock, target, transactionBlockArguments, bytes;
46
+ return __generator(this, function (_a) {
47
+ switch (_a.label) {
48
+ case 0:
49
+ transactionBlock = new sui_js_1.TransactionBlock();
50
+ target = "".concat(packageId, "::multiple_collateral::get_auction_max_size");
51
+ transactionBlockArguments = [transactionBlock.pure(registry), transactionBlock.pure(index)];
52
+ transactionBlock.moveCall({
53
+ target: target,
54
+ typeArguments: typeArguments,
55
+ arguments: transactionBlockArguments,
56
+ });
57
+ return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: constants_1.SENDER })];
58
+ case 1:
59
+ bytes = (_a.sent()).results[0].returnValues[0][0];
60
+ return [2 /*return*/, (0, tools_1.U64FromBytes)(bytes.reverse())];
61
+ }
62
+ });
63
+ });
64
+ }
65
+ exports.getAuctionMaxSize = getAuctionMaxSize;
66
+ function getMaxLossPerUnit(provider, packageId, typeArguments, registry, index) {
67
+ return __awaiter(this, void 0, void 0, function () {
68
+ var transactionBlock, target, transactionBlockArguments, bytes;
69
+ return __generator(this, function (_a) {
70
+ switch (_a.label) {
71
+ case 0:
72
+ transactionBlock = new sui_js_1.TransactionBlock();
73
+ target = "".concat(packageId, "::multiple_collateral::get_max_loss_per_unit");
74
+ transactionBlockArguments = [transactionBlock.pure(registry), transactionBlock.pure(index)];
75
+ transactionBlock.moveCall({
76
+ target: target,
77
+ typeArguments: typeArguments,
78
+ arguments: transactionBlockArguments,
79
+ });
80
+ return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: constants_1.SENDER })];
81
+ case 1:
82
+ bytes = (_a.sent()).results[0].returnValues[0][0];
83
+ return [2 /*return*/, (0, tools_1.U64FromBytes)(bytes.reverse())];
84
+ }
85
+ });
86
+ });
87
+ }
88
+ exports.getMaxLossPerUnit = getMaxLossPerUnit;
@@ -179,8 +179,6 @@ function getPortfolioVaults(provider, registry, deposit_vault_registry, bid_vaul
179
179
  },
180
180
  };
181
181
  // @ts-ignore
182
- console.log(portfolioVault.data.content.fields);
183
- // @ts-ignore
184
182
  var auction = portfolioVault.data.content.fields.auction ? (0, dutch_1.parseAuction)(portfolioVault.data.content.fields.auction) : undefined;
185
183
  // @ts-ignore
186
184
  var authority = portfolioVault.data.content.fields.authority.fields.whitelist.fields.id.id;
@@ -85,8 +85,17 @@ function getUserShares(provider, packageId, registry, indexes, user) {
85
85
  if (result[index] == undefined) {
86
86
  result[index] = {
87
87
  index: index,
88
- depositVaultUserShare: {},
89
- bidVaultUserShare: {},
88
+ depositVaultUserShare: {
89
+ activeSubVaultUserShare: BigInt(0),
90
+ deactivatingSubVaultUserShare: BigInt(0),
91
+ inactiveSubVaultUserShare: BigInt(0),
92
+ warmupSubVaultUserShare: BigInt(0),
93
+ },
94
+ bidVaultUserShare: {
95
+ bidderSubVaultUserShare: BigInt(0),
96
+ premiumSubVaultUserShare: BigInt(0),
97
+ performanceFeeSubVaultUserShare: BigInt(0),
98
+ },
90
99
  };
91
100
  }
92
101
  result[index].index = index;
@@ -0,0 +1,9 @@
1
+ import { JsonRpcProvider } from "@mysten/sui.js";
2
+ import { DepositVaultUserShare, BidVaultUserShare } from "../../typus-framework/vault";
3
+ export interface UserShare {
4
+ index: string;
5
+ depositVaultUserShare: DepositVaultUserShare;
6
+ bidVaultUserShare: BidVaultUserShare;
7
+ }
8
+ export declare function getAuctionMaxSize(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, index: string, priceOracle: string): Promise<BigInt>;
9
+ export declare function getMaxLossPerUnit(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, index: string, priceOracle: string): Promise<BigInt>;
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getMaxLossPerUnit = exports.getAuctionMaxSize = void 0;
40
+ var sui_js_1 = require("@mysten/sui.js");
41
+ var tools_1 = require("../../tools");
42
+ var constants_1 = require("../../../constants");
43
+ function getAuctionMaxSize(provider, packageId, typeArguments, registry, index, priceOracle) {
44
+ return __awaiter(this, void 0, void 0, function () {
45
+ var transactionBlock, target, transactionBlockArguments, bytes;
46
+ return __generator(this, function (_a) {
47
+ switch (_a.label) {
48
+ case 0:
49
+ transactionBlock = new sui_js_1.TransactionBlock();
50
+ target = "".concat(packageId, "::single_collateral::get_auction_max_size");
51
+ transactionBlockArguments = [
52
+ transactionBlock.pure(registry),
53
+ transactionBlock.pure(index),
54
+ transactionBlock.pure(priceOracle),
55
+ transactionBlock.pure(constants_1.CLOCK),
56
+ ];
57
+ transactionBlock.moveCall({
58
+ target: target,
59
+ typeArguments: typeArguments,
60
+ arguments: transactionBlockArguments,
61
+ });
62
+ return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: constants_1.SENDER })];
63
+ case 1:
64
+ bytes = (_a.sent()).results[0].returnValues[0][0];
65
+ return [2 /*return*/, (0, tools_1.U64FromBytes)(bytes.reverse())];
66
+ }
67
+ });
68
+ });
69
+ }
70
+ exports.getAuctionMaxSize = getAuctionMaxSize;
71
+ function getMaxLossPerUnit(provider, packageId, typeArguments, registry, index, priceOracle) {
72
+ return __awaiter(this, void 0, void 0, function () {
73
+ var transactionBlock, target, transactionBlockArguments, bytes;
74
+ return __generator(this, function (_a) {
75
+ switch (_a.label) {
76
+ case 0:
77
+ transactionBlock = new sui_js_1.TransactionBlock();
78
+ target = "".concat(packageId, "::single_collateral::get_max_loss_per_unit");
79
+ transactionBlockArguments = [
80
+ transactionBlock.pure(registry),
81
+ transactionBlock.pure(index),
82
+ transactionBlock.pure(priceOracle),
83
+ transactionBlock.pure(constants_1.CLOCK),
84
+ ];
85
+ transactionBlock.moveCall({
86
+ target: target,
87
+ typeArguments: typeArguments,
88
+ arguments: transactionBlockArguments,
89
+ });
90
+ return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: constants_1.SENDER })];
91
+ case 1:
92
+ bytes = (_a.sent()).results[0].returnValues[0][0];
93
+ return [2 /*return*/, (0, tools_1.U64FromBytes)(bytes.reverse())];
94
+ }
95
+ });
96
+ });
97
+ }
98
+ exports.getMaxLossPerUnit = getMaxLossPerUnit;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typus/typus-sdk",
3
3
  "author": "Typus",
4
4
  "description": "typus sdk",
5
- "version": "1.0.14",
5
+ "version": "1.0.16",
6
6
  "dependencies": {
7
7
  "@mysten/sui.js": "^0.32.1",
8
8
  "@types/node": "^17.0.0",
@@ -50,7 +50,8 @@
50
50
  "tsutils": "^2.29.0",
51
51
  "wrappy": "^1.0.2",
52
52
  "ws": "^8.11.0",
53
- "xmlhttprequest": "^1.8.0"
53
+ "xmlhttprequest": "^1.8.0",
54
+ "typed-rpc": "^3.0.0"
54
55
  },
55
56
  "devDependencies": {
56
57
  "@types/bs58": "^4.0.1",
@@ -1,10 +0,0 @@
1
- import { TransactionBlock } from "@mysten/sui.js";
2
- /**
3
- public fun get_auction_max_size<D_TOKEN, B_TOKEN, O_TOKEN>(
4
- registry: &Registry,
5
- index: u64,
6
- price_oracle: &Oracle<O_TOKEN>,
7
- clock: &Clock,
8
- ): u64
9
- */
10
- export declare function getAuctionMaxSize(packageId: string, module: string, typeArguments: string[], registry: string, index: string, priceOracle: string): Promise<TransactionBlock>;
@@ -1,30 +0,0 @@
1
- import { TransactionBlock } from "@mysten/sui.js";
2
- /**
3
- struct GetUserStatusResult has copy, drop {
4
- active: u64,
5
- deactivating: u64,
6
- inactive: u64,
7
- warmup: u64,
8
- bidder: u64,
9
- premium: u64,
10
- performance_fee: u64,
11
- }
12
- public fun get_user_status<D_TOKEN, B_TOKEN, O_TOKEN>(
13
- registry: &Registry,
14
- index: u64,
15
- user: address,
16
- ): GetUserStatusResult
17
- */
18
- export declare function getUserStatus(packageId: string, module: string, typeArguments: string[], registry: string, index: string, userAddress: string): Promise<TransactionBlock>;
19
- interface GetUserStatusResult {
20
- active: bigint;
21
- deactivating: bigint;
22
- inactive: bigint;
23
- warmup: bigint;
24
- bidder: bigint;
25
- premium: bigint;
26
- performanceFee: bigint;
27
- }
28
- export declare function parseUserStatusResult(rawData: Uint8Array): GetUserStatusResult;
29
- export declare function U64FromBytes(x: any): bigint;
30
- export {};