@typus/typus-sdk 1.0.71 → 1.0.73
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
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"VERSION": "2.10.0",
|
|
3
|
+
"DB_NAME": "testnet_2_8_0",
|
|
4
|
+
"RPC_ENDPOINT": "https://fullnode.testnet.sui.io:443",
|
|
5
|
+
"SINGLE_COLLATERAL_PACKAGE": "0xc9a09a5d71159aec4fc43cdc80bc2e37b03c39151d72ae005921f3e5325a1cb5",
|
|
6
|
+
"SINGLE_COLLATERAL_PACKAGE_ORIGIN": "0x867a84b70d1f44ea10c02cb099dad5a46c074675afa3b728bd0c11f653e2cb18",
|
|
7
|
+
"SINGLE_COLLATERAL_MANAGER_CAP": "0x7040e5c1a4691d7df2208a577802b05784b8926ad157ebf99b46a185636f2e07",
|
|
8
|
+
"SINGLE_COLLATERAL_REGISTRY": "0x7808d2e668101969e67b6713df9dd96a57deba23baf4cd6754258756f332ef88",
|
|
9
|
+
"SINGLE_COLLATERAL_ADDITIONAL_CONFIG_REGISTRY": "0x3247cb9bde56b63cf4ce79670caed0f9ebc28f839586b07c5b1d79fb7450dde8",
|
|
10
|
+
"SINGLE_COLLATERAL_DEPOSIT_VAULT_REGISTRY": "0x6d63f91afacfdef3fb8e798b9bcda6b99e3e52730dab00c35ea195505c9efc2b",
|
|
11
|
+
"SINGLE_COLLATERAL_BID_VAULT_REGISTRY": "0x90e723d05a6f7da2b94bdc88772a205e3a3b90babf69b369adef024756c79da5",
|
|
12
|
+
"SINGLE_COLLATERAL_DEPOSIT_VAULT_USER_SHARE_REGISTRY": "0x3d8ddc0f8eadb2cb4ab0ecd62b8437bfb40b75fe5368c04fa6f3382c0975c4c6",
|
|
13
|
+
"SINGLE_COLLATERAL_BID_VAULT_USER_SHARE_REGISTRY": "0x0a0c530ffbad0ff9d9d1707dc1ea4c2e123ffdd5bd6c6c842f71cd449263202e",
|
|
14
|
+
"TOKEN_PACKAGE": "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519",
|
|
15
|
+
"BTC_TOKEN_REGISTRY": "0xcf5184b85f47cb1ffe421249e48b2cd34807534e1a4b4ad384009295bbbd3bf4",
|
|
16
|
+
"ETH_TOKEN_REGISTRY": "0x5cd3726a1d1ef32bffaaeb2ec4964f0ffac56cfb919f7d13d4672aed5059bfa1",
|
|
17
|
+
"USDC_TOKEN_REGISTRY": "0xf7df3c68a7d3ffc54065565c94a9fa3f5342957340bce78be74373846241a833",
|
|
18
|
+
"CETUS_TOKEN_REGISTRY": "0x24a7a5297a3656ebea71ed72a4974a7710943d9a598fda60fe60b44262da9f27",
|
|
19
|
+
"BUCK_TOKEN_REGISTRY": "0x445324cee50d98a949aab8e75ee44539ca9ef38ee431fed19d3eb7deb654536d",
|
|
20
|
+
"ORACLE_PACKAGE": "0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73",
|
|
21
|
+
"ORACLE_MANAGER_CAP": "0x4e118b46fc39fd8961b8bac6a7f668e12c63ef28fbd2cb6f9b6a40cb0a41dfaf",
|
|
22
|
+
"SUI_USDC_ORACLE": "0x770f17817e809f22d3cf3ba5f452056622a31dd6a1db7c60c94c5a598aff9a29",
|
|
23
|
+
"CETUS_USDC_ORACLE": "0xe8142c490363475a4ad0b9af02ac5a543962584f3a99cdb8754d909be6ec550d",
|
|
24
|
+
"BTC_USDC_ORACLE": "0xaa72a2b370cf45a7b1363a2b9e3f0c57c05863375b984e2ca0928973574404f2",
|
|
25
|
+
"ETH_USDC_ORACLE": "0x0ac9f9275eb0ac33b7f59741b1df67a6783af2db6d2a4e5aba8ce350d5b6b260",
|
|
26
|
+
"SUI_BUCK_ORACLE": "0x22ef75c17468f6ed24574f26011f7fcf61a7b983009c9ba6cacc28ae24ff1782",
|
|
27
|
+
"PYTH_STATE": "0xd8afde3a48b4ff7212bd6829a150f43f59043221200d63504d981f62bff2e27a",
|
|
28
|
+
"PYTH_SUI/USDC": "0xe38dbe2ff3322f1500fff45d0046101f371eebce47c067c5e9233248c4878c28",
|
|
29
|
+
"SWITCHBOARD_SUI/USDC": "0x84d2b7e435d6e6a5b137bf6f78f34b2c5515ae61cd8591d5ff6cd121a21aa6b7",
|
|
30
|
+
"CETUS_ORACLE": "0xfa4720fa516760b2de899dc74e078d8cc1cc6af6c74805b069b31dc3935aa119",
|
|
31
|
+
"mainnet": false
|
|
32
|
+
}
|
package/lib/utils/token.js
CHANGED
|
@@ -1,19 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.assetToDecimal = exports.typeArgsToAssets = void 0;
|
|
4
7
|
var sui_js_1 = require("@mysten/sui.js");
|
|
8
|
+
var config_json_1 = __importDefault(require("../config.json"));
|
|
5
9
|
function typeArgsToAssets(typeArgs) {
|
|
6
10
|
var assets = typeArgs.map(function (x) {
|
|
7
11
|
var typeArgs = x.split("::");
|
|
8
12
|
switch ((0, sui_js_1.normalizeSuiAddress)(typeArgs[0])) {
|
|
9
13
|
case "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881":
|
|
10
|
-
return "
|
|
14
|
+
return "WBTC";
|
|
11
15
|
case "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5":
|
|
12
|
-
return "
|
|
16
|
+
return "WETH";
|
|
17
|
+
case "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8":
|
|
18
|
+
return "WSOL";
|
|
13
19
|
case "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf":
|
|
14
20
|
return "USDC";
|
|
15
21
|
case "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c":
|
|
16
22
|
return "USDT";
|
|
23
|
+
case config_json_1.default.TOKEN_PACKAGE:
|
|
24
|
+
if (typeArgs[2] == "BTC") {
|
|
25
|
+
return "WBTC";
|
|
26
|
+
}
|
|
27
|
+
else if (typeArgs[2] == "ETH") {
|
|
28
|
+
return "WETH";
|
|
29
|
+
}
|
|
30
|
+
return typeArgs[2];
|
|
17
31
|
default:
|
|
18
32
|
return typeArgs[2];
|
|
19
33
|
}
|
|
@@ -29,6 +43,12 @@ function assetToDecimal(asset) {
|
|
|
29
43
|
return 8;
|
|
30
44
|
case "ETH":
|
|
31
45
|
return 8;
|
|
46
|
+
case "WBTC":
|
|
47
|
+
return 8;
|
|
48
|
+
case "WETH":
|
|
49
|
+
return 8;
|
|
50
|
+
case "WSOL":
|
|
51
|
+
return 8;
|
|
32
52
|
case "USDC":
|
|
33
53
|
return 6;
|
|
34
54
|
case "USDT":
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PortfolioVault } from "./portfolio-vault";
|
|
2
|
-
export declare function getDb(database: string, functionNames: string[], vaultIndex: string | undefined, startTsMs: string, limit: number): Promise<any>;
|
|
2
|
+
export declare function getDb(database: string, functionNames: string[], vaultIndex: string | undefined, startTsMs: string, limit: number, endTsMs?: string | undefined): Promise<any>;
|
|
3
3
|
export declare function getShowMap(database: string, portfolioVaults: Map<string, PortfolioVault>, vaultIndex?: string | undefined, startTsMs?: string, limit?: number): Promise<Map<string, Map<string, Show>>>;
|
|
4
4
|
interface Show {
|
|
5
5
|
ProjectedAPY: number;
|
|
@@ -38,7 +38,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getShowMap = exports.getDb = void 0;
|
|
40
40
|
var apiUrl = "https://us-central1-aqueous-freedom-378103.cloudfunctions.net/mongodb";
|
|
41
|
-
function getDb(database, functionNames, vaultIndex, startTsMs, limit) {
|
|
41
|
+
function getDb(database, functionNames, vaultIndex, startTsMs, limit, endTsMs) {
|
|
42
|
+
if (endTsMs === void 0) { endTsMs = undefined; }
|
|
42
43
|
return __awaiter(this, void 0, void 0, function () {
|
|
43
44
|
var jsonData, response, data;
|
|
44
45
|
return __generator(this, function (_a) {
|
|
@@ -49,6 +50,7 @@ function getDb(database, functionNames, vaultIndex, startTsMs, limit) {
|
|
|
49
50
|
functionNames: functionNames,
|
|
50
51
|
vaultIndex: vaultIndex,
|
|
51
52
|
startTsMs: startTsMs,
|
|
53
|
+
endTsMs: endTsMs,
|
|
52
54
|
limit: limit,
|
|
53
55
|
});
|
|
54
56
|
return [4 /*yield*/, fetch(apiUrl, {
|