@sonarwatch/portfolio-plugins 0.12.164 → 0.12.165
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/index.js +4 -4
- package/src/index.js.map +1 -1
- package/src/plugins/abex/types.d.ts +5 -12
- package/src/plugins/aftermath/types.d.ts +2 -6
- package/src/plugins/alphafi/types.d.ts +1 -3
- package/src/plugins/bucket/types.d.ts +2 -3
- package/src/plugins/cetus/clmmsFetcher.js +3 -3
- package/src/plugins/cetus/clmmsFetcher.js.map +1 -1
- package/src/plugins/cetus/constants.d.ts +2 -0
- package/src/plugins/cetus/constants.js +5 -1
- package/src/plugins/cetus/constants.js.map +1 -1
- package/src/plugins/cetus/farmsFetcher.js +118 -0
- package/src/plugins/cetus/farmsFetcher.js.map +1 -0
- package/src/plugins/cetus/helpers.js +3 -2
- package/src/plugins/cetus/helpers.js.map +1 -1
- package/src/plugins/cetus/index.js +4 -2
- package/src/plugins/cetus/index.js.map +1 -1
- package/src/plugins/cetus/types.d.ts +92 -3
- package/src/plugins/cetus/types.js.map +1 -1
- package/src/plugins/cetus/vaultsJob.d.ts +3 -0
- package/src/plugins/cetus/vaultsJob.js +101 -0
- package/src/plugins/cetus/vaultsJob.js.map +1 -0
- package/src/plugins/drift/index.js +2 -1
- package/src/plugins/drift/index.js.map +1 -1
- package/src/plugins/flowx/stakingPoolV3Fetcher.js +2 -2
- package/src/plugins/flowx/stakingPoolV3Fetcher.js.map +1 -1
- package/src/plugins/flowx/types.d.ts +2 -3
- package/src/plugins/haedal/types.d.ts +1 -3
- package/src/plugins/jewel/types.d.ts +1 -3
- package/src/plugins/kai/types.d.ts +3 -6
- package/src/plugins/kriya/types.d.ts +1 -3
- package/src/plugins/kriya/types.js.map +1 -1
- package/src/plugins/{flexlend → lulo}/constants.d.ts +1 -1
- package/src/plugins/{flexlend → lulo}/constants.js +2 -2
- package/src/plugins/lulo/constants.js.map +1 -0
- package/src/plugins/lulo/depositsFetcher.js.map +1 -0
- package/src/plugins/{flexlend → lulo}/helpers.js +1 -1
- package/src/plugins/lulo/helpers.js.map +1 -0
- package/src/plugins/{flexlend → lulo}/index.js +6 -1
- package/src/plugins/lulo/index.js.map +1 -0
- package/src/plugins/lulo/liftFetcher.d.ts +3 -0
- package/src/plugins/{flexlend → lulo}/liftFetcher.js +1 -1
- package/src/plugins/lulo/liftFetcher.js.map +1 -0
- package/src/plugins/lulo/rewardsFetcher.d.ts +3 -0
- package/src/plugins/lulo/rewardsFetcher.js +38 -0
- package/src/plugins/lulo/rewardsFetcher.js.map +1 -0
- package/src/plugins/lulo/struct.js.map +1 -0
- package/src/plugins/navi/types.d.ts +4 -9
- package/src/plugins/scallop/types/basic.d.ts +2 -3
- package/src/plugins/scallop/types/data.d.ts +1 -3
- package/src/plugins/tokens/fetchers/sui.js +1 -8
- package/src/plugins/tokens/fetchers/sui.js.map +1 -1
- package/src/plugins/tradeport/types.d.ts +1 -4
- package/src/plugins/turbos/clmmVaultFetcher.js +2 -2
- package/src/plugins/turbos/clmmVaultFetcher.js.map +1 -1
- package/src/plugins/turbos/clmmsPositionsFetcher.js +2 -1
- package/src/plugins/turbos/clmmsPositionsFetcher.js.map +1 -1
- package/src/plugins/turbos/helper.d.ts +0 -1
- package/src/plugins/turbos/helper.js +1 -6
- package/src/plugins/turbos/helper.js.map +1 -1
- package/src/plugins/turbos/types.d.ts +2 -6
- package/src/plugins/typus/constants.d.ts +8 -0
- package/src/plugins/typus/constants.js +12 -1
- package/src/plugins/typus/constants.js.map +1 -1
- package/src/plugins/typus/index.js +4 -2
- package/src/plugins/typus/index.js.map +1 -1
- package/src/plugins/typus/safuFetcher.d.ts +3 -0
- package/src/plugins/typus/safuFetcher.js +97 -0
- package/src/plugins/typus/safuFetcher.js.map +1 -0
- package/src/plugins/typus/safuVaultsJob.d.ts +3 -0
- package/src/plugins/typus/safuVaultsJob.js +30 -0
- package/src/plugins/typus/safuVaultsJob.js.map +1 -0
- package/src/plugins/typus/safu_helpers.d.ts +8 -0
- package/src/plugins/typus/safu_helpers.js +205 -0
- package/src/plugins/typus/safu_helpers.js.map +1 -0
- package/src/plugins/typus/safu_types.d.ts +55 -0
- package/src/plugins/typus/safu_types.js +3 -0
- package/src/plugins/typus/safu_types.js.map +1 -0
- package/src/plugins/typus/types.d.ts +1 -3
- package/src/utils/sui/bitsToNumber.d.ts +1 -0
- package/src/utils/sui/bitsToNumber.js +11 -0
- package/src/utils/sui/bitsToNumber.js.map +1 -0
- package/src/utils/sui/structs/id.d.ts +3 -0
- package/src/utils/sui/structs/id.js +3 -0
- package/src/utils/sui/structs/id.js.map +1 -0
- package/src/utils/sui/structs/nft.d.ts +2 -3
- package/src/utils/sui/types.d.ts +2 -3
- package/src/plugins/flexlend/constants.js.map +0 -1
- package/src/plugins/flexlend/depositsFetcher.js.map +0 -1
- package/src/plugins/flexlend/helpers.js.map +0 -1
- package/src/plugins/flexlend/index.js.map +0 -1
- package/src/plugins/flexlend/liftFetcher.js.map +0 -1
- package/src/plugins/flexlend/struct.js.map +0 -1
- /package/src/plugins/{flexlend/depositsFetcher.d.ts → cetus/farmsFetcher.d.ts} +0 -0
- /package/src/plugins/{flexlend/liftFetcher.d.ts → lulo/depositsFetcher.d.ts} +0 -0
- /package/src/plugins/{flexlend → lulo}/depositsFetcher.js +0 -0
- /package/src/plugins/{flexlend → lulo}/helpers.d.ts +0 -0
- /package/src/plugins/{flexlend → lulo}/index.d.ts +0 -0
- /package/src/plugins/{flexlend → lulo}/struct.d.ts +0 -0
- /package/src/plugins/{flexlend → lulo}/struct.js +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"clmmsPositionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/turbos/clmmsPositionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAmD;AAEnD,wFAAyF;AACzF,qGAA6E;AAC7E,
|
1
|
+
{"version":3,"file":"clm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5
5
|
export declare function parsePoolType(type: string): string[];
|
6
6
|
export declare function parsePool(pool: ObjectResponse<PoolFields>): Pool;
|
7
7
|
export declare function formatForNative(coin: string): string;
|
8
|
-
export declare function bitsToNumber(bits: number): number;
|
@@ -1,8 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.formatForNative = exports.parsePool = exports.parsePoolType = void 0;
|
4
4
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
5
|
-
const helpers_1 = require("../cetus/helpers");
|
6
5
|
function parsePoolType(type, length) {
|
7
6
|
var _a;
|
8
7
|
const types = ((_a = type.replace('>', '').split('<')[1]) === null || _a === void 0 ? void 0 : _a.split(/,\s*/)) || [];
|
@@ -27,8 +26,4 @@ function formatForNative(coin) {
|
|
27
26
|
return coin === portfolio_core_1.suiNativeAddress ? '0x2::sui::SUI' : coin;
|
28
27
|
}
|
29
28
|
exports.formatForNative = formatForNative;
|
30
|
-
function bitsToNumber(bits) {
|
31
|
-
return (0, helpers_1.asIntN)(BigInt(bits));
|
32
|
-
}
|
33
|
-
exports.bitsToNumber = bitsToNumber;
|
34
29
|
//# sourceMappingURL=helper.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/turbos/helper.ts"],"names":[],"mappings":";;;AAAA,+DAA8D;
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/turbos/helper.ts"],"names":[],"mappings":";;;AAAA,+DAA8D;AAO9D,SAAgB,aAAa,CAAC,IAAY,EAAE,MAAe;;IACzD,MAAM,KAAK,GAAG,CAAA,MAAA,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,0CAAE,KAAK,CAAC,MAAM,CAAC,KAAI,EAAE,CAAC;IAEvE,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AARD,sCAQC;AACD,SAAgB,SAAS,CAAC,IAAgC;;IACxD,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,OAAO,CAAA;QAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC;IAC1C,MAAM,QAAQ,GAAG,MAAA,IAAI,CAAC,IAAI,0CAAE,QAAQ,CAAC;IACrC,MAAM,IAAI,GAAG,MAAA,IAAI,CAAC,IAAI,0CAAE,IAAI,CAAC;IAC7B,uCACK,MAAM,KACT,QAAQ;QACR,IAAI,EACJ,KAAK,EAAE,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,IAC7B;AACJ,CAAC;AAXD,8BAWC;AAED,SAAgB,eAAe,CAAC,IAAY;IAC1C,OAAO,IAAI,KAAK,iCAAgB,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC;AAFD,0CAEC"}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
2
|
+
import { ID } from '../../utils/sui/structs/id';
|
2
3
|
export type PoolFields = {
|
3
4
|
coin_a: string;
|
4
5
|
coin_b: string;
|
@@ -19,9 +20,7 @@ export type PoolFields = {
|
|
19
20
|
fields: {
|
20
21
|
emissions_per_second: string;
|
21
22
|
growth_global: string;
|
22
|
-
id:
|
23
|
-
id: string;
|
24
|
-
};
|
23
|
+
id: ID;
|
25
24
|
manager: string;
|
26
25
|
vault: string;
|
27
26
|
vault_coin_type: string;
|
@@ -118,9 +117,6 @@ export type CoinTypeName = {
|
|
118
117
|
export type Fields = {
|
119
118
|
name: string;
|
120
119
|
};
|
121
|
-
export type ID = {
|
122
|
-
id: string;
|
123
|
-
};
|
124
120
|
export type VaultStrategy = {
|
125
121
|
accounts: Accounts;
|
126
122
|
base_tick_step_minimum: number;
|
@@ -7,3 +7,11 @@ export declare const sender = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
7
7
|
export declare const packageDovSingle = "0x9c907e9af7bedaab3382542f342cce21ca95fa72bedcc887edb478d17f8293d1";
|
8
8
|
export declare const registryDovSingle = "0x3d70b09359e3ca8301ae0abeda4f2fdf72ce313ba58c919ce568e5f535fd2ea8";
|
9
9
|
export declare const viewDepositSharesType = "0x9c907e9af7bedaab3382542f342cce21ca95fa72bedcc887edb478d17f8293d1::tds_view_function::get_deposit_shares_bcs";
|
10
|
+
export declare const safuPackage = "0x8bde4eedabbdaf0c4c463c4eb35f00456dbac5fdccb94ce9c2d7a77653aa481f";
|
11
|
+
export declare const frameworkPackage = "0x5c6648fb219c046256488486d23d4af7bc562d5ab5c382e1f4b558066a327fe8";
|
12
|
+
export declare const safuRegistryId = "0xdc970d638d1489385e49ddb76889748011bac4616b95a51aa63633972b841706";
|
13
|
+
export declare const safuVaultsKey = "safu-vaults";
|
14
|
+
export declare const vaultsIndexes: string[];
|
15
|
+
export declare const safuVaultsNames: {
|
16
|
+
[key: string]: string;
|
17
|
+
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.viewDepositSharesType = exports.registryDovSingle = exports.packageDovSingle = exports.sender = exports.depositReceiptType = exports.packageId = exports.platform = exports.platformId = void 0;
|
3
|
+
exports.safuVaultsNames = exports.vaultsIndexes = exports.safuVaultsKey = exports.safuRegistryId = exports.frameworkPackage = exports.safuPackage = exports.viewDepositSharesType = exports.registryDovSingle = exports.packageDovSingle = exports.sender = exports.depositReceiptType = exports.packageId = exports.platform = exports.platformId = void 0;
|
4
4
|
exports.platformId = 'typus';
|
5
5
|
exports.platform = {
|
6
6
|
id: exports.platformId,
|
@@ -16,4 +16,15 @@ exports.sender = '0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
16
16
|
exports.packageDovSingle = '0x9c907e9af7bedaab3382542f342cce21ca95fa72bedcc887edb478d17f8293d1';
|
17
17
|
exports.registryDovSingle = '0x3d70b09359e3ca8301ae0abeda4f2fdf72ce313ba58c919ce568e5f535fd2ea8';
|
18
18
|
exports.viewDepositSharesType = `${exports.packageDovSingle}::tds_view_function::get_deposit_shares_bcs`;
|
19
|
+
exports.safuPackage = '0x8bde4eedabbdaf0c4c463c4eb35f00456dbac5fdccb94ce9c2d7a77653aa481f';
|
20
|
+
exports.frameworkPackage = '0x5c6648fb219c046256488486d23d4af7bc562d5ab5c382e1f4b558066a327fe8';
|
21
|
+
exports.safuRegistryId = '0xdc970d638d1489385e49ddb76889748011bac4616b95a51aa63633972b841706';
|
22
|
+
exports.safuVaultsKey = 'safu-vaults';
|
23
|
+
exports.vaultsIndexes = ['0', '1', '2', '3'];
|
24
|
+
exports.safuVaultsNames = {
|
25
|
+
'0': 'Bull',
|
26
|
+
'1': 'Bear',
|
27
|
+
'2': 'All Weather SUI',
|
28
|
+
'3': 'All Weather USDC',
|
29
|
+
};
|
19
30
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/typus/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,8CAA8C;IACrD,WAAW,EAAE,eAAe,EAAE,sCAAsC;IACpE,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,kCAAkC;CAC5C,CAAC;AACW,QAAA,SAAS,GACpB,oEAAoE,CAAC;AAC1D,QAAA,kBAAkB,GAAG,GAAG,iBAAS,8BAA8B,CAAC;AAChE,QAAA,MAAM,GACjB,oEAAoE,CAAC;AAC1D,QAAA,gBAAgB,GAC3B,oEAAoE,CAAC;AAC1D,QAAA,iBAAiB,GAC5B,oEAAoE,CAAC;AAC1D,QAAA,qBAAqB,GAAG,GAAG,wBAAgB,6CAA6C,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/typus/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,8CAA8C;IACrD,WAAW,EAAE,eAAe,EAAE,sCAAsC;IACpE,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,kCAAkC;CAC5C,CAAC;AACW,QAAA,SAAS,GACpB,oEAAoE,CAAC;AAC1D,QAAA,kBAAkB,GAAG,GAAG,iBAAS,8BAA8B,CAAC;AAChE,QAAA,MAAM,GACjB,oEAAoE,CAAC;AAC1D,QAAA,gBAAgB,GAC3B,oEAAoE,CAAC;AAC1D,QAAA,iBAAiB,GAC5B,oEAAoE,CAAC;AAC1D,QAAA,qBAAqB,GAAG,GAAG,wBAAgB,6CAA6C,CAAC;AAEzF,QAAA,WAAW,GACtB,oEAAoE,CAAC;AAC1D,QAAA,gBAAgB,GAC3B,oEAAoE,CAAC;AAC1D,QAAA,cAAc,GACzB,oEAAoE,CAAC;AAC1D,QAAA,aAAa,GAAG,aAAa,CAAC;AAE9B,QAAA,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACrC,QAAA,eAAe,GAA8B;IACxD,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,kBAAkB;CACxB,CAAC"}
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
7
|
const constants_1 = require("./constants");
|
8
8
|
const vaultsFetcher_1 = __importDefault(require("./vaultsFetcher"));
|
9
|
+
const safuVaultsJob_1 = __importDefault(require("./safuVaultsJob"));
|
10
|
+
const safuFetcher_1 = __importDefault(require("./safuFetcher"));
|
9
11
|
exports.platforms = [constants_1.platform];
|
10
|
-
exports.jobs = [];
|
11
|
-
exports.fetchers = [vaultsFetcher_1.default];
|
12
|
+
exports.jobs = [safuVaultsJob_1.default];
|
13
|
+
exports.fetchers = [vaultsFetcher_1.default, safuFetcher_1.default];
|
12
14
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/typus/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,oEAA4C;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/typus/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,oEAA4C;AAC5C,oEAA4C;AAC5C,gEAAwC;AAE3B,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,uBAAa,CAAC,CAAC;AAC9B,QAAA,QAAQ,GAAc,CAAC,uBAAa,EAAE,qBAAW,CAAC,CAAC"}
|
@@ -0,0 +1,97 @@
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
+
const constants_1 = require("./constants");
|
17
|
+
const clients_1 = require("../../utils/clients");
|
18
|
+
const safu_helpers_1 = require("./safu_helpers");
|
19
|
+
const MemoizedCache_1 = require("../../utils/misc/MemoizedCache");
|
20
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
21
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
22
|
+
const vaultsMemo = new MemoizedCache_1.MemoizedCache(constants_1.safuVaultsKey, {
|
23
|
+
prefix: constants_1.platformId,
|
24
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
25
|
+
});
|
26
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
27
|
+
const client = (0, clients_1.getClientSui)();
|
28
|
+
const shareDatas = yield (0, safu_helpers_1.getShareData)(client, owner);
|
29
|
+
let hasPosition = false;
|
30
|
+
for (let i = 0; i < constants_1.vaultsIndexes.length; i++) {
|
31
|
+
const vaultIndex = constants_1.vaultsIndexes[i];
|
32
|
+
if (shareDatas[vaultIndex].length > 0) {
|
33
|
+
hasPosition = true;
|
34
|
+
break;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
if (!hasPosition)
|
38
|
+
return [];
|
39
|
+
const vaults = yield vaultsMemo.getItem(cache);
|
40
|
+
if (!vaults)
|
41
|
+
return [];
|
42
|
+
const tokenPrices = yield cache.getTokenPricesAsMap(Object.values(vaults).map((v) => (0, portfolio_core_1.formatMoveTokenAddress)(v[0].depositToken)), portfolio_core_1.NetworkId.sui);
|
43
|
+
const elements = [];
|
44
|
+
for (let i = 0; i < constants_1.vaultsIndexes.length; i++) {
|
45
|
+
const vaultIndex = constants_1.vaultsIndexes[i];
|
46
|
+
const share = shareDatas[vaultIndex];
|
47
|
+
if (share.length > 0) {
|
48
|
+
const [vault, bidReceipt] = vaults[vaultIndex];
|
49
|
+
if (!vault)
|
50
|
+
continue;
|
51
|
+
const amount = new bignumber_js_1.default(share[0].share.active_share)
|
52
|
+
.plus(share[0].share.deactivating_share)
|
53
|
+
.plus(share[0].share.inactive_share)
|
54
|
+
.plus(share[0].share.warmup_share);
|
55
|
+
if (amount.isZero())
|
56
|
+
continue;
|
57
|
+
const tokenPrice = tokenPrices.get((0, portfolio_core_1.formatMoveTokenAddress)(vault.depositToken));
|
58
|
+
if (!tokenPrice)
|
59
|
+
continue;
|
60
|
+
const assets = [];
|
61
|
+
const rewardAssets = [];
|
62
|
+
assets.push((0, tokenPriceToAssetToken_1.default)(tokenPrice.address, amount.dividedBy(Math.pow(10, tokenPrice.decimals)).toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice));
|
63
|
+
const assetsValue = (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value));
|
64
|
+
const rewardAssetsValue = (0, portfolio_core_1.getUsdValueSum)(rewardAssets.map((a) => a.value));
|
65
|
+
const value = (0, portfolio_core_1.getUsdValueSum)([...assets, ...rewardAssets].map((a) => a.value));
|
66
|
+
const liquidities = [
|
67
|
+
{
|
68
|
+
assets,
|
69
|
+
assetsValue,
|
70
|
+
rewardAssets,
|
71
|
+
rewardAssetsValue,
|
72
|
+
value,
|
73
|
+
yields: [],
|
74
|
+
},
|
75
|
+
];
|
76
|
+
elements.push({
|
77
|
+
type: portfolio_core_1.PortfolioElementType.liquidity,
|
78
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
79
|
+
platformId: constants_1.platformId,
|
80
|
+
label: 'Lending',
|
81
|
+
name: `SAFU ${constants_1.safuVaultsNames[vaultIndex] || ''}`,
|
82
|
+
value: (0, portfolio_core_1.getUsdValueSum)(liquidities.map((a) => a.value)),
|
83
|
+
data: {
|
84
|
+
liquidities,
|
85
|
+
},
|
86
|
+
});
|
87
|
+
}
|
88
|
+
}
|
89
|
+
return elements;
|
90
|
+
});
|
91
|
+
const fetcher = {
|
92
|
+
id: `${constants_1.platformId}-safu`,
|
93
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
94
|
+
executor,
|
95
|
+
};
|
96
|
+
exports.default = fetcher;
|
97
|
+
//# sourceMappingURL=safuFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"safuFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/typus/safuFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AAGpC,2CAKqB;AACrB,iDAAmD;AACnD,iDAA8C;AAC9C,kEAA+D;AAE/D,qGAA6E;AAC7E,gEAAqC;AAErC,MAAM,UAAU,GAAG,IAAI,6BAAa,CAEjC,yBAAa,EAAE;IAChB,MAAM,EAAE,sBAAU;IAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;CACzB,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,UAAU,GAAG,MAAM,IAAA,2BAAY,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAErD,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,yBAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9C,MAAM,UAAU,GAAG,yBAAa,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,UAAU,CAAC,UAAU,CAAC,CAA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gBACV,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,QAAQ,2BAAe,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE;gBACjD,KAAK,EAAE,IAAA,+BAAc,EAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;gBACtD,IAAI,EAAE;oBACJ,WAAW;iBACZ;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,OAAO;IACxB,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,30 @@
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const constants_1 = require("./constants");
|
13
|
+
const clients_1 = require("../../utils/clients");
|
14
|
+
const safu_helpers_1 = require("./safu_helpers");
|
15
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
17
|
+
const client = (0, clients_1.getClientSui)();
|
18
|
+
const vaultsData = yield (0, safu_helpers_1.getVaultData)(client);
|
19
|
+
yield cache.setItem(constants_1.safuVaultsKey, vaultsData, {
|
20
|
+
prefix: constants_1.platformId,
|
21
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
22
|
+
});
|
23
|
+
});
|
24
|
+
const job = {
|
25
|
+
id: `${constants_1.platformId}-safu-vaults`,
|
26
|
+
executor,
|
27
|
+
label: 'normal',
|
28
|
+
};
|
29
|
+
exports.default = job;
|
30
|
+
//# sourceMappingURL=safuVaultsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"safuVaultsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/typus/safuVaultsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2CAAwD;AAGxD,iDAAmD;AACnD,iDAA8C;AAC9C,+DAAuD;AAEvD,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,UAAU,GAAG,MAAM,IAAA,2BAAY,EAAC,MAAM,CAAC,CAAC;IAE9C,MAAM,KAAK,CAAC,OAAO,CAAC,yBAAa,EAAE,UAAU,EAAE;QAC7C,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,cAAc;IAC/B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { Share, TypusBidReceipt, Vault } from './safu_types';
|
2
|
+
import { SuiClient } from '../../utils/clients/types';
|
3
|
+
export declare function getVaultData(provider: SuiClient): Promise<{
|
4
|
+
[key: string]: [Vault, TypusBidReceipt | null];
|
5
|
+
}>;
|
6
|
+
export declare function getShareData(provider: SuiClient, owner: string): Promise<{
|
7
|
+
[key: string]: Share[];
|
8
|
+
}>;
|
@@ -0,0 +1,205 @@
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.getShareData = exports.getVaultData = void 0;
|
13
|
+
const transactions_1 = require("@mysten/sui.js/transactions");
|
14
|
+
const constants_1 = require("./constants");
|
15
|
+
const bcs_1 = require("@mysten/bcs");
|
16
|
+
const SENDER = '0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';
|
17
|
+
function getVaultData(provider) {
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
19
|
+
let transactionBlock = new transactions_1.TransactionBlock();
|
20
|
+
transactionBlock.moveCall({
|
21
|
+
target: `${constants_1.safuPackage}::view_function::get_vault_data_bcs`,
|
22
|
+
typeArguments: [`${constants_1.frameworkPackage}::vault::TypusBidReceipt`],
|
23
|
+
arguments: [
|
24
|
+
transactionBlock.pure(constants_1.safuRegistryId),
|
25
|
+
transactionBlock.pure(constants_1.vaultsIndexes),
|
26
|
+
],
|
27
|
+
});
|
28
|
+
let results = (yield provider.devInspectTransactionBlock({
|
29
|
+
sender: SENDER,
|
30
|
+
transactionBlock,
|
31
|
+
})).results;
|
32
|
+
// console.log(JSON.stringify(results));
|
33
|
+
// @ts-ignore
|
34
|
+
let bytes = results[results.length - 1].returnValues[0][0];
|
35
|
+
// console.log(JSON.stringify(bytes));
|
36
|
+
let reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
37
|
+
let result = {};
|
38
|
+
reader.readVec((reader) => {
|
39
|
+
reader.readULEB();
|
40
|
+
let id = AddressFromBytes(reader.readBytes(32));
|
41
|
+
let depositToken = String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8())));
|
42
|
+
let rewardToken = reader.readVec((reader) => {
|
43
|
+
return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8())));
|
44
|
+
});
|
45
|
+
let infoArray = reader.readVec((reader) => {
|
46
|
+
return reader.read64();
|
47
|
+
});
|
48
|
+
let configArray = reader.readVec((reader) => {
|
49
|
+
return reader.read64();
|
50
|
+
});
|
51
|
+
let info = {
|
52
|
+
index: infoArray[0],
|
53
|
+
round: infoArray[1],
|
54
|
+
portfolio_vault_index: infoArray[2],
|
55
|
+
refresh_ts_ms: infoArray[3],
|
56
|
+
status: infoArray[4],
|
57
|
+
lending_enabled: infoArray[5],
|
58
|
+
price_mbp: infoArray[6],
|
59
|
+
mbp_incentivised: infoArray[7],
|
60
|
+
fixed_incentivised: infoArray[8],
|
61
|
+
token_decimal: infoArray[9],
|
62
|
+
lending_apr_mbp: infoArray[10],
|
63
|
+
creation_ts_ms: infoArray[11],
|
64
|
+
};
|
65
|
+
let config = {
|
66
|
+
capacity: configArray[0],
|
67
|
+
lot_size: configArray[1],
|
68
|
+
min_size: configArray[2],
|
69
|
+
fee_bp: configArray[3],
|
70
|
+
utilization_rate_bp: configArray[4],
|
71
|
+
point_per_hour_bp: configArray[5],
|
72
|
+
incentive_mbp: configArray[6],
|
73
|
+
incentive_fixed: configArray[7],
|
74
|
+
};
|
75
|
+
// skip BigVector
|
76
|
+
reader.readBytes(32); // id
|
77
|
+
reader.readBytes(reader.read8()); // element_type
|
78
|
+
reader.read64(); // slice_idx
|
79
|
+
reader.read32(); // slice_size
|
80
|
+
reader.read64(); // length
|
81
|
+
let shareSupplyArray = reader.readVec((reader) => {
|
82
|
+
return reader.read64();
|
83
|
+
});
|
84
|
+
let shareSupply = {
|
85
|
+
active_share: shareSupplyArray[0],
|
86
|
+
deactivating_share: shareSupplyArray[1],
|
87
|
+
inactive_share: shareSupplyArray[2],
|
88
|
+
warmup_share: shareSupplyArray[3],
|
89
|
+
snapshot_share: shareSupplyArray[4],
|
90
|
+
reward_share: shareSupplyArray.slice(5),
|
91
|
+
};
|
92
|
+
let u64Padding = reader.readVec((reader) => {
|
93
|
+
return reader.read64();
|
94
|
+
});
|
95
|
+
let bcsPadding = reader.readVec((reader) => {
|
96
|
+
return reader.read8();
|
97
|
+
});
|
98
|
+
let has_bid_receipt = reader.read8() > 0;
|
99
|
+
if (has_bid_receipt) {
|
100
|
+
result[info.index] = [
|
101
|
+
{
|
102
|
+
id,
|
103
|
+
depositToken,
|
104
|
+
rewardToken,
|
105
|
+
info,
|
106
|
+
config,
|
107
|
+
shareSupply,
|
108
|
+
u64Padding,
|
109
|
+
bcsPadding,
|
110
|
+
},
|
111
|
+
{
|
112
|
+
id: AddressFromBytes(reader.readBytes(32)),
|
113
|
+
vid: AddressFromBytes(reader.readBytes(32)),
|
114
|
+
index: reader.read64(),
|
115
|
+
metadata: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
116
|
+
u64_padding: reader.readVec((reader) => {
|
117
|
+
return reader.read64();
|
118
|
+
}),
|
119
|
+
},
|
120
|
+
];
|
121
|
+
}
|
122
|
+
else {
|
123
|
+
result[info.index] = [
|
124
|
+
{
|
125
|
+
id,
|
126
|
+
depositToken,
|
127
|
+
rewardToken,
|
128
|
+
info,
|
129
|
+
config,
|
130
|
+
shareSupply,
|
131
|
+
u64Padding,
|
132
|
+
bcsPadding,
|
133
|
+
},
|
134
|
+
null,
|
135
|
+
];
|
136
|
+
}
|
137
|
+
});
|
138
|
+
return result;
|
139
|
+
});
|
140
|
+
}
|
141
|
+
exports.getVaultData = getVaultData;
|
142
|
+
function AddressFromBytes(x) {
|
143
|
+
let address = '0x';
|
144
|
+
for (let i = 0; i < x.length; i++) {
|
145
|
+
address = address.concat(x[i].toString(16).padStart(2, '0'));
|
146
|
+
}
|
147
|
+
return address;
|
148
|
+
}
|
149
|
+
function getShareData(provider, owner) {
|
150
|
+
return __awaiter(this, void 0, void 0, function* () {
|
151
|
+
let transactionBlock = new transactions_1.TransactionBlock();
|
152
|
+
const indexes = constants_1.vaultsIndexes.slice();
|
153
|
+
transactionBlock.moveCall({
|
154
|
+
target: `${constants_1.safuPackage}::view_function::get_share_data_bcs`,
|
155
|
+
typeArguments: [],
|
156
|
+
arguments: [
|
157
|
+
transactionBlock.pure(constants_1.safuRegistryId),
|
158
|
+
transactionBlock.pure(owner),
|
159
|
+
transactionBlock.pure(indexes),
|
160
|
+
],
|
161
|
+
});
|
162
|
+
let results = (yield provider.devInspectTransactionBlock({
|
163
|
+
sender: SENDER,
|
164
|
+
transactionBlock,
|
165
|
+
})).results;
|
166
|
+
// console.log(JSON.stringify(results));
|
167
|
+
// @ts-ignore
|
168
|
+
let bytes = results[results.length - 1].returnValues[0][0];
|
169
|
+
// console.log(JSON.stringify(bytes));
|
170
|
+
let reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
171
|
+
let result = {};
|
172
|
+
reader.readVec((reader, i) => {
|
173
|
+
reader.read8();
|
174
|
+
let share = reader.readVec((reader) => {
|
175
|
+
let user = AddressFromBytes(reader.readBytes(32));
|
176
|
+
let shareSupplyArray = reader.readVec((reader) => {
|
177
|
+
return reader.read64();
|
178
|
+
});
|
179
|
+
let shareSupply = {
|
180
|
+
active_share: shareSupplyArray[0],
|
181
|
+
deactivating_share: shareSupplyArray[1],
|
182
|
+
inactive_share: shareSupplyArray[2],
|
183
|
+
warmup_share: shareSupplyArray[3],
|
184
|
+
snapshot_share: shareSupplyArray[4],
|
185
|
+
reward_share: shareSupplyArray.slice(5),
|
186
|
+
};
|
187
|
+
return {
|
188
|
+
user,
|
189
|
+
share: shareSupply,
|
190
|
+
u64Padding: reader.readVec((reader) => {
|
191
|
+
return reader.read64();
|
192
|
+
}),
|
193
|
+
bcsPadding: reader.readVec((reader) => {
|
194
|
+
return reader.read8();
|
195
|
+
}),
|
196
|
+
};
|
197
|
+
});
|
198
|
+
let index = indexes.pop();
|
199
|
+
result[index] = share;
|
200
|
+
});
|
201
|
+
return result;
|
202
|
+
});
|
203
|
+
}
|
204
|
+
exports.getShareData = getShareData;
|
205
|
+
//# sourceMappingURL=safu_helpers.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"safu_helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/typus/safu_helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,8DAA+D;AAE/D,2CAKqB;AACrB,qCAAwC;AAExC,MAAM,MAAM,GACV,oEAAoE,CAAC;AAEvE,SAAsB,YAAY,CAChC,QAAmB;;QAEnB,IAAI,gBAAgB,GAAG,IAAI,+BAAgB,EAAE,CAAC;QAC9C,gBAAgB,CAAC,QAAQ,CAAC;YACxB,MAAM,EAAE,GAAG,uBAAW,qCAAqC;YAC3D,aAAa,EAAE,CAAC,GAAG,4BAAgB,0BAA0B,CAAC;YAC9D,SAAS,EAAE;gBACT,gBAAgB,CAAC,IAAI,CAAC,0BAAc,CAAC;gBACrC,gBAAgB,CAAC,IAAI,CAAC,yBAAa,CAAC;aACrC;SACF,CAAC,CAAC;QACH,IAAI,OAAO,GAAG,CACZ,MAAM,QAAQ,CAAC,0BAA0B,CAAC;YACxC,MAAM,EAAE,MAAM;YACd,gBAAgB;SACjB,CAAC,CACH,CAAC,OAAO,CAAC;QACV,wCAAwC;QACxC,aAAa;QACb,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,sCAAsC;QACtC,IAAI,MAAM,GAAG,IAAI,eAAS,CAAC,IAAI,UAAU,CAAC,KAAK,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E,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;wBACpC,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;oBACxB,CAAC,CAAC;iBACH,CAAC;YACJ,CAAC,CAAC,CAAC;YACH,IAAI,KAAK,GAAG,OAAO,CAAC,GAAG,EAAG,CAAC;YAC3B,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AA5DD,oCA4DC"}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
export interface Vault {
|
2
|
+
id: string;
|
3
|
+
depositToken: string;
|
4
|
+
rewardToken: string[];
|
5
|
+
info: Info;
|
6
|
+
config: Config;
|
7
|
+
shareSupply: ShareSupply;
|
8
|
+
u64Padding: string[];
|
9
|
+
bcsPadding: string[];
|
10
|
+
}
|
11
|
+
export interface Info {
|
12
|
+
index: string;
|
13
|
+
round: string;
|
14
|
+
portfolio_vault_index: string;
|
15
|
+
refresh_ts_ms: string;
|
16
|
+
status: string;
|
17
|
+
lending_enabled: string;
|
18
|
+
price_mbp: string;
|
19
|
+
mbp_incentivised: string;
|
20
|
+
fixed_incentivised: string;
|
21
|
+
token_decimal: string;
|
22
|
+
lending_apr_mbp: string;
|
23
|
+
creation_ts_ms: string;
|
24
|
+
}
|
25
|
+
export interface Config {
|
26
|
+
capacity: string;
|
27
|
+
lot_size: string;
|
28
|
+
min_size: string;
|
29
|
+
fee_bp: string;
|
30
|
+
utilization_rate_bp: string;
|
31
|
+
point_per_hour_bp: string;
|
32
|
+
incentive_mbp: string;
|
33
|
+
incentive_fixed: string;
|
34
|
+
}
|
35
|
+
export interface ShareSupply {
|
36
|
+
active_share: string;
|
37
|
+
deactivating_share: string;
|
38
|
+
inactive_share: string;
|
39
|
+
warmup_share: string;
|
40
|
+
snapshot_share: string;
|
41
|
+
reward_share: string[];
|
42
|
+
}
|
43
|
+
export interface TypusBidReceipt {
|
44
|
+
id: string;
|
45
|
+
vid: string;
|
46
|
+
index: string;
|
47
|
+
metadata: string;
|
48
|
+
u64_padding: string[];
|
49
|
+
}
|
50
|
+
export interface Share {
|
51
|
+
user: string;
|
52
|
+
share: ShareSupply;
|
53
|
+
u64Padding: string[];
|
54
|
+
bcsPadding: string[];
|
55
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"safu_types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/typus/safu_types.ts"],"names":[],"mappings":""}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { ID } from '../../utils/sui/structs/id';
|
1
2
|
export type DepositShare = {
|
2
3
|
index: string;
|
3
4
|
activeSubVaultUserShare: string;
|
@@ -14,9 +15,6 @@ export type DepositReceipt = {
|
|
14
15
|
u64_padding: any[];
|
15
16
|
vid: string;
|
16
17
|
};
|
17
|
-
export type ID = {
|
18
|
-
id: string;
|
19
|
-
};
|
20
18
|
export type Vault = {
|
21
19
|
active_share_supply: string;
|
22
20
|
bcs_padding: any[];
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function bitsToNumber(bits: number | string): number;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.bitsToNumber = void 0;
|
4
|
+
function bitsToNumber(bits) {
|
5
|
+
return asIntN(BigInt(bits));
|
6
|
+
}
|
7
|
+
exports.bitsToNumber = bitsToNumber;
|
8
|
+
function asIntN(int, bits = 32) {
|
9
|
+
return Number(BigInt.asIntN(bits, BigInt(int)));
|
10
|
+
}
|
11
|
+
//# sourceMappingURL=bitsToNumber.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bitsToNumber.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/sui/bitsToNumber.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY,CAAC,IAAqB;IAChD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9B,CAAC;AAFD,oCAEC;AAED,SAAS,MAAM,CAAC,GAAW,EAAE,IAAI,GAAG,EAAE;IACpC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"id.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/sui/structs/id.ts"],"names":[],"mappings":""}
|