@sonarwatch/portfolio-plugins 0.11.90 → 0.11.91
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 +2 -2
- package/src/Cache.d.ts +1 -0
- package/src/Cache.js +12 -0
- package/src/Cache.js.map +1 -1
- package/src/plugins/circuit/constants.d.ts +1 -3
- package/src/plugins/circuit/constants.js +2 -17
- package/src/plugins/circuit/constants.js.map +1 -1
- package/src/plugins/circuit/depositsFetcher.js +10 -4
- package/src/plugins/circuit/depositsFetcher.js.map +1 -1
- package/src/plugins/circuit/filters.d.ts +1 -0
- package/src/plugins/circuit/filters.js +4 -1
- package/src/plugins/circuit/filters.js.map +1 -1
- package/src/plugins/circuit/index.js +2 -1
- package/src/plugins/circuit/index.js.map +1 -1
- package/src/plugins/circuit/types.d.ts +1 -47
- package/src/plugins/circuit/vaultsJob.d.ts +3 -0
- package/src/plugins/circuit/vaultsJob.js +42 -0
- package/src/plugins/circuit/vaultsJob.js.map +1 -0
- package/src/plugins/drift/deposits.js +1 -1
- package/src/plugins/drift/deposits.js.map +1 -1
- package/src/plugins/drift/helpers.d.ts +0 -1
- package/src/plugins/drift/helpers.js +1 -6
- package/src/plugins/drift/helpers.js.map +1 -1
- package/src/plugins/flash/poolJob.js +1 -2
- package/src/plugins/flash/poolJob.js.map +1 -1
- package/src/plugins/mango/collateralFetcher.js +1 -2
- package/src/plugins/mango/collateralFetcher.js.map +1 -1
- package/src/plugins/mango/helpers.d.ts +0 -1
- package/src/plugins/mango/helpers.js +1 -7
- package/src/plugins/mango/helpers.js.map +1 -1
- package/src/plugins/navi/collateralFetcher.js +20 -24
- package/src/plugins/navi/collateralFetcher.js.map +1 -1
- package/src/plugins/navi/constants.d.ts +0 -1
- package/src/plugins/navi/constants.js +10 -2
- package/src/plugins/navi/constants.js.map +1 -1
- package/src/plugins/navi/reservesJob.js +12 -50
- package/src/plugins/navi/reservesJob.js.map +1 -1
- package/src/plugins/navi/types.d.ts +42 -44
- package/src/utils/solana/index.d.ts +1 -0
- package/src/utils/solana/index.js +1 -0
- package/src/utils/solana/index.js.map +1 -1
- package/src/utils/solana/u8ArrayToString.d.ts +1 -0
- package/src/utils/solana/u8ArrayToString.js +11 -0
- package/src/utils/solana/u8ArrayToString.js.map +1 -0
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [0.11.91](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.90...plugins-0.11.91) (2024-03-01)
|
6
|
+
|
7
|
+
|
8
|
+
|
5
9
|
## [0.11.90](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.89...plugins-0.11.90) (2024-02-28)
|
6
10
|
|
7
11
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.91",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"web3-v1": "npm:web3@^1.5.0"
|
42
42
|
},
|
43
43
|
"peerDependencies": {
|
44
|
-
"@sonarwatch/portfolio-core": "0.11.
|
44
|
+
"@sonarwatch/portfolio-core": "0.11.91"
|
45
45
|
},
|
46
46
|
"main": "./src/index.js",
|
47
47
|
"types": "./src/index.d.ts"
|
package/src/Cache.d.ts
CHANGED
@@ -80,6 +80,7 @@ export declare class Cache {
|
|
80
80
|
private setTokenPriceLocal;
|
81
81
|
getTokenPrice(address: string, networkId: NetworkIdType): Promise<TokenPrice | undefined>;
|
82
82
|
getTokenPrices(addresses: string[], networkId: NetworkIdType): Promise<(TokenPrice | undefined)[]>;
|
83
|
+
getTokenPricesAsMap(addresses: string[], networkId: NetworkIdType): Promise<Map<string, TokenPrice>>;
|
83
84
|
private getTokenPriceSources;
|
84
85
|
private getTokenPricesSources;
|
85
86
|
getItems<K extends StorageValue>(keys: string[], opts: TransactionOptions): Promise<(K | undefined)[]>;
|
package/src/Cache.js
CHANGED
@@ -135,6 +135,18 @@ class Cache {
|
|
135
135
|
return fAddresses.map((address) => tokenPriceByAddress.get(address));
|
136
136
|
});
|
137
137
|
}
|
138
|
+
getTokenPricesAsMap(addresses, networkId) {
|
139
|
+
return __awaiter(this, void 0, void 0, function* () {
|
140
|
+
const tokenPrices = yield this.getTokenPrices(addresses, networkId);
|
141
|
+
const tokenPricesMap = new Map();
|
142
|
+
tokenPrices.forEach((tp) => {
|
143
|
+
if (!tp)
|
144
|
+
return;
|
145
|
+
tokenPricesMap.set(tp.address, tp);
|
146
|
+
});
|
147
|
+
return tokenPricesMap;
|
148
|
+
});
|
149
|
+
}
|
138
150
|
getTokenPriceSources(address, networkId) {
|
139
151
|
return __awaiter(this, void 0, void 0, function* () {
|
140
152
|
const fAddress = (0, portfolio_core_1.formatTokenAddress)(address, networkId);
|
package/src/Cache.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../../../packages/plugins/src/Cache.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAyE;AACzE,8DAA4C;AAC5C,oEAAkD;AAClD,kEAAgD;AAChD,+DAUoC;AACpC,oEAA4C;AAC5C,+DAGwB;AAiBxB,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AAgElD,MAAa,KAAK;IAKhB,YAAY,WAAwB;QAClC,IAAI,CAAC,MAAM,GAAG,wBAAwB,CAAC,WAAW,CAAC,CAAC;QACpD,IAAI,CAAC,OAAO,GAAG,IAAA,yBAAa,EAAC;YAC3B,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAC;QACH,IAAI,CAAC,iBAAiB,GAAG,IAAA,yBAAa,EAAC;YACrC,MAAM,EAAE,IAAA,sBAAY,EAAC;gBACnB,GAAG,EAAE,K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AC7D,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC;wBACxC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,EAAE,EAAE,CAAC;wBACrD,CAAC,CAAC,SAAS;iBACd;aACF,CAAC;QACJ,KAAK,MAAM;YACT,OAAO;gBACL,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE;oBACN,IAAI,EACF,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC;wBACrC,6DAA6D;oBAC/D,OAAO,EAAE;wBACP,aAAa,EAAE,UACb,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,IAAI,kCAC7C,EAAE;qBACH;iBACF;aACF,CAAC;QACJ;YACE,OAAO;gBACL,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,EAAE;aACX,CAAC;IACN,CAAC;AACH,CAAC;AA/DD,wCA+DC;AAED,SAAgB,QAAQ;IACtB,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,OAAO,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;AAChC,CAAC;AAHD,4BAGC"}
|
@@ -1,9 +1,7 @@
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
2
2
|
import { Platform } from '@sonarwatch/portfolio-core';
|
3
|
-
import { VaultInfo } from './types';
|
4
3
|
export declare const platformId = "circuit";
|
5
4
|
export declare const platform: Platform;
|
6
5
|
export declare const circuitPid: PublicKey;
|
7
6
|
export declare const jitoSOLMint = "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn";
|
8
|
-
export declare const
|
9
|
-
export declare const nameOfVauilts: Map<string, VaultInfo>;
|
7
|
+
export declare const prefixVaults = "circuitVaults";
|
@@ -1,8 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.prefixVaults = exports.jitoSOLMint = exports.circuitPid = exports.platform = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
|
-
const solana_1 = require("../../utils/solana");
|
6
5
|
exports.platformId = 'circuit';
|
7
6
|
exports.platform = {
|
8
7
|
id: exports.platformId,
|
@@ -14,19 +13,5 @@ exports.platform = {
|
|
14
13
|
};
|
15
14
|
exports.circuitPid = new web3_js_1.PublicKey('vAuLTsyrvSfZRuRB3XgvkPwNGgYSs9YRYymVebLKoxR');
|
16
15
|
exports.jitoSOLMint = 'J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn';
|
17
|
-
exports.
|
18
|
-
exports.nameOfVauilts = new Map([
|
19
|
-
[
|
20
|
-
'F3no8aqNZRSkxvMEARC4feHJfvvrST2ZrHzr2NBVyJUr',
|
21
|
-
{ name: 'Turbocharger', mint: solana_1.usdcSolanaMint, decimals: 6 },
|
22
|
-
],
|
23
|
-
[
|
24
|
-
'GXyE3Snk3pPYX4Nz9QRVBrnBfbJRTAQYxuy5DRdnebAn',
|
25
|
-
{ name: 'Supercharger', mint: solana_1.usdcSolanaMint, decimals: 6 },
|
26
|
-
],
|
27
|
-
[
|
28
|
-
'ACmnVY5gf1z9UGhzBgnr2bf3h2ZwXW2EDW1w8RC9cQk4',
|
29
|
-
{ name: 'JitoSol Basis', mint: exports.jitoSOLMint, decimals: 9 },
|
30
|
-
],
|
31
|
-
]);
|
16
|
+
exports.prefixVaults = 'circuitVaults';
|
32
17
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/circuit/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/circuit/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,+CAA+C;IACtD,qEAAqE;IACrE,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,qCAAqC;CAC/C,CAAC;AAEW,QAAA,UAAU,GAAG,IAAI,mBAAS,CACrC,6CAA6C,CAC9C,CAAC;AACW,QAAA,WAAW,GAAG,8CAA8C,CAAC;AAC7D,QAAA,YAAY,GAAG,eAAe,CAAC"}
|
@@ -25,7 +25,13 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
25
25
|
const depositAccounts = yield (0, solana_1.getParsedProgramAccounts)(client, structs_1.vaultDepositorStruct, constants_1.circuitPid, (0, filters_1.vaultDepositorFilter)(owner));
|
26
26
|
if (depositAccounts.length === 0)
|
27
27
|
return [];
|
28
|
-
const
|
28
|
+
const vaultsInfo = yield cache.getItems(depositAccounts.map((deposit) => deposit.vault.toString()), { prefix: constants_1.prefixVaults, networkId: portfolio_core_1.NetworkId.solana });
|
29
|
+
const vaultById = new Map();
|
30
|
+
for (const vaultInfo of vaultsInfo) {
|
31
|
+
if (vaultInfo)
|
32
|
+
vaultById.set(vaultInfo.pubkey, vaultInfo);
|
33
|
+
}
|
34
|
+
const tokenPrices = yield cache.getTokenPrices(vaultsInfo.map((vault) => (vault ? vault.mint : [])).flat(), portfolio_core_1.NetworkId.solana);
|
29
35
|
const tokenPriceById = new Map();
|
30
36
|
tokenPrices.forEach((tp) => tp ? tokenPriceById.set(tp.address, tp) : undefined);
|
31
37
|
const elements = [];
|
@@ -34,7 +40,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
34
40
|
if (depositAccount.lastWithdrawRequest.value.isZero() &&
|
35
41
|
depositAccount.netDeposits.isZero())
|
36
42
|
continue;
|
37
|
-
const vaultInfo =
|
43
|
+
const vaultInfo = vaultById.get(depositAccount.vault.toString());
|
38
44
|
if (!vaultInfo)
|
39
45
|
continue;
|
40
46
|
const { decimals, name, mint } = vaultInfo;
|
@@ -42,7 +48,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
42
48
|
let amountLeft = depositAccount.netDeposits.plus(depositAccount.cumulativeProfitShareAmount);
|
43
49
|
if (!depositAccount.lastWithdrawRequest.value.isZero()) {
|
44
50
|
amountLeft = amountLeft.minus(depositAccount.lastWithdrawRequest.value);
|
45
|
-
assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(
|
51
|
+
assets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(mint, depositAccount.lastWithdrawRequest.value
|
46
52
|
.dividedBy(Math.pow(10, decimals))
|
47
53
|
.toNumber(), portfolio_core_1.NetworkId.solana, tokenPrice)), { attributes: {
|
48
54
|
lockedUntil: depositAccount.lastWithdrawRequest.ts
|
@@ -51,7 +57,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
51
57
|
.toNumber(),
|
52
58
|
} }));
|
53
59
|
}
|
54
|
-
assets.push((0, tokenPriceToAssetToken_1.default)(
|
60
|
+
assets.push((0, tokenPriceToAssetToken_1.default)(mint, amountLeft.dividedBy(Math.pow(10, decimals)).toNumber(), portfolio_core_1.NetworkId.solana, tokenPrice));
|
55
61
|
if (assets.length === 0)
|
56
62
|
continue;
|
57
63
|
elements.push({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/circuit/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AAGpC,
|
1
|
+
{"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/circuit/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AAGpC,2CAAmE;AACnE,iDAAsD;AACtD,+CAA8D;AAC9D,uCAAiD;AACjD,uCAAiD;AACjD,qGAA6E;AAC7E,8DAA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EACJ,UAAU,CAAC,SAAS,CAAC,SAAA,EAAE,EAAI,QAAQ,CAAA,CAAC,CAAC,QAAQ,EAAE,EAC/C,0BAAS,CAAC,MAAM,EAChB,UAAU,CACX,CACF,CAAC;QACF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAElC,QAAQ,CAAC,IAAI,CAAC;YACZ,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,IAAI;YACJ,IAAI,EAAE,EAAE,MAAM,EAAE;YAChB,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC1D,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -1,3 +1,4 @@
|
|
1
1
|
import { GetProgramAccountsFilter } from '@solana/web3.js';
|
2
2
|
export declare const vaultsFilter: GetProgramAccountsFilter[];
|
3
3
|
export declare const vaultDepositorFilter: (owner: string) => GetProgramAccountsFilter[];
|
4
|
+
export declare const vaultFilter: GetProgramAccountsFilter[];
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.vaultDepositorFilter = exports.vaultsFilter = void 0;
|
3
|
+
exports.vaultFilter = exports.vaultDepositorFilter = exports.vaultsFilter = void 0;
|
4
4
|
const structs_1 = require("./structs");
|
5
5
|
exports.vaultsFilter = [
|
6
6
|
{ dataSize: structs_1.vaultStruct.byteSize },
|
@@ -15,4 +15,7 @@ const vaultDepositorFilter = (owner) => [
|
|
15
15
|
},
|
16
16
|
];
|
17
17
|
exports.vaultDepositorFilter = vaultDepositorFilter;
|
18
|
+
exports.vaultFilter = [
|
19
|
+
{ dataSize: structs_1.vaultStruct.byteSize },
|
20
|
+
];
|
18
21
|
//# sourceMappingURL=filters.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/circuit/filters.ts"],"names":[],"mappings":";;;AACA,uCAA8D;AAEjD,QAAA,YAAY,GAA+B;IACtD,EAAE,QAAQ,EAAE,qBAAW,CAAC,QAAQ,EAAE;CACnC,CAAC;AAEK,MAAM,oBAAoB,GAAG,CAClC,KAAa,EACe,EAAE,CAAC;IAC/B,EAAE,QAAQ,EAAE,8BAAoB,CAAC,QAAQ,EAAE;IAC3C;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;CACF,CAAC;AAVW,QAAA,oBAAoB,wBAU/B"}
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/circuit/filters.ts"],"names":[],"mappings":";;;AACA,uCAA8D;AAEjD,QAAA,YAAY,GAA+B;IACtD,EAAE,QAAQ,EAAE,qBAAW,CAAC,QAAQ,EAAE;CACnC,CAAC;AAEK,MAAM,oBAAoB,GAAG,CAClC,KAAa,EACe,EAAE,CAAC;IAC/B,EAAE,QAAQ,EAAE,8BAAoB,CAAC,QAAQ,EAAE;IAC3C;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;CACF,CAAC;AAVW,QAAA,oBAAoB,wBAU/B;AAEW,QAAA,WAAW,GAA+B;IACrD,EAAE,QAAQ,EAAE,qBAAW,CAAC,QAAQ,EAAE;CACnC,CAAC"}
|
@@ -6,7 +6,8 @@ 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 depositsFetcher_1 = __importDefault(require("./depositsFetcher"));
|
9
|
+
const vaultsJob_1 = __importDefault(require("./vaultsJob"));
|
9
10
|
exports.platforms = [constants_1.platform];
|
10
|
-
exports.jobs = [];
|
11
|
+
exports.jobs = [vaultsJob_1.default];
|
11
12
|
exports.fetchers = [depositsFetcher_1.default];
|
12
13
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/circuit/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,wEAAgD;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/circuit/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,wEAAgD;AAChD,4DAAoC;AAEvB,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,mBAAS,CAAC,CAAC;AAC1B,QAAA,QAAQ,GAAc,CAAC,yBAAe,CAAC,CAAC"}
|
@@ -1,52 +1,6 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
type WithdrawRequest = {
|
3
|
-
shares: string;
|
4
|
-
value: string;
|
5
|
-
ts: string;
|
6
|
-
};
|
7
|
-
type Vault = {
|
8
|
-
buffer: Buffer;
|
9
|
-
name: number[];
|
10
|
-
pubkey: string;
|
11
|
-
manager: string;
|
12
|
-
tokenAccount: string;
|
13
|
-
userStats: string;
|
14
|
-
user: string;
|
15
|
-
delegate: string;
|
16
|
-
liquidationDelegate: string;
|
17
|
-
userShares: string;
|
18
|
-
totalShares: string;
|
19
|
-
lastFeeUpdateTs: string;
|
20
|
-
liquidationStartTs: string;
|
21
|
-
redeemPeriod: string;
|
22
|
-
totalWithdrawRequested: string;
|
23
|
-
maxTokens: string;
|
24
|
-
managementFee: string;
|
25
|
-
initTs: string;
|
26
|
-
netDeposits: string;
|
27
|
-
managerNetDeposits: string;
|
28
|
-
totalDeposits: string;
|
29
|
-
totalWithdraws: string;
|
30
|
-
managerTotalDeposits: string;
|
31
|
-
managerTotalWithdraws: string;
|
32
|
-
managerTotalFee: string;
|
33
|
-
managerTotalProfitShare: string;
|
34
|
-
minDepositAmount: string;
|
35
|
-
lastManagerWithdrawRequest: WithdrawRequest;
|
36
|
-
sharesBase: number;
|
37
|
-
profitShare: number;
|
38
|
-
hurdleRate: number;
|
39
|
-
spotMarketIndex: number;
|
40
|
-
bump: number;
|
41
|
-
permissioned: boolean;
|
42
|
-
padding: string[];
|
43
|
-
};
|
44
|
-
export type VaultEnhanced = Vault & {
|
45
|
-
publicKey: string;
|
46
|
-
};
|
47
1
|
export type VaultInfo = {
|
2
|
+
pubkey: string;
|
48
3
|
mint: string;
|
49
4
|
decimals: number;
|
50
5
|
name: string;
|
51
6
|
};
|
52
|
-
export {};
|
@@ -0,0 +1,42 @@
|
|
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 portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
|
+
const clients_1 = require("../../utils/clients");
|
14
|
+
const solana_1 = require("../../utils/solana");
|
15
|
+
const constants_1 = require("../drift/constants");
|
16
|
+
const constants_2 = require("./constants");
|
17
|
+
const filters_1 = require("./filters");
|
18
|
+
const structs_1 = require("./structs");
|
19
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
20
|
+
const client = (0, clients_1.getClientSolana)();
|
21
|
+
const vaults = yield (0, solana_1.getParsedProgramAccounts)(client, structs_1.vaultStruct, constants_2.circuitPid, filters_1.vaultFilter);
|
22
|
+
for (const vault of vaults) {
|
23
|
+
const name = (0, solana_1.u8ArrayToString)(vault.name);
|
24
|
+
const spotMarket = yield cache.getItem(vault.spotMarketIndex.toString(), {
|
25
|
+
prefix: constants_1.prefixSpotMarkets,
|
26
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
27
|
+
});
|
28
|
+
if (!spotMarket)
|
29
|
+
continue;
|
30
|
+
const mint = spotMarket.mint.toString();
|
31
|
+
const { decimals } = spotMarket;
|
32
|
+
const pubkey = vault.pubkey.toString();
|
33
|
+
yield cache.setItem(pubkey, { pubkey, name, mint, decimals }, { prefix: constants_2.prefixVaults, networkId: portfolio_core_1.NetworkId.solana });
|
34
|
+
}
|
35
|
+
});
|
36
|
+
const job = {
|
37
|
+
id: `${constants_2.platformId}-vaults`,
|
38
|
+
executor,
|
39
|
+
label: 'normal',
|
40
|
+
};
|
41
|
+
exports.default = job;
|
42
|
+
//# sourceMappingURL=vaultsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"vaultsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/circuit/vaultsJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,iDAAsD;AACtD,+CAA+E;AAC/E,kDAAuD;AACvD,2CAAmE;AACnE,uCAAwC;AACxC,uCAAwC;AAIxC,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,MAAM,GAAG,MAAM,IAAA,iCAAwB,EAC3C,MAAM,EACN,qBAAW,EACX,sBAAU,EACV,qBAAW,CACZ,CAAC;IAEF,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,IAAA,wBAAe,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,OAAO,CACpC,KAAK,CAAC,eAAe,CAAC,QAAQ,EAAE,EAChC;YACE,MAAM,EAAE,6BAAiB;YACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;SAC5B,CACF,CAAC;QACF,IAAI,CAAC,UAAU;YAAE,SAAS;QAE1B,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACxC,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC;QAChC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACvC,MAAM,KAAK,CAAC,OAAO,CACjB,MAAM,EACN,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,EAChC,EAAE,MAAM,EAAE,wBAAY,EAAE,SAAS,EAAE,0BAAS,CAAC,MAAM,EAAE,CACtD,CAAC;IACJ,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,SAAS;IAC1B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -160,7 +160,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
160
160
|
healthRatio,
|
161
161
|
value,
|
162
162
|
},
|
163
|
-
name: (0,
|
163
|
+
name: (0, solana_1.u8ArrayToString)(userAccount.name),
|
164
164
|
});
|
165
165
|
}
|
166
166
|
return elements;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"deposits.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/deposits.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAUoC;AACpC,gEAAqC;AACrC,6CAA4C;AAG5C,2CAA0E;AAC1E,qCAIkB;AAClB,
|
1
|
+
{"version":3,"file":"deposits.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/deposits.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAUoC;AACpC,gEAAqC;AACrC,6CAA4C;AAG5C,2CAA0E;AAC1E,qCAIkB;AAClB,uCAMmB;AAEnB,+CAG4B;AAC5B,iDAAsD;AACtD,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAAC,WAAW,CAAqB;QACnE,MAAM,EAAE,6BAAiB;QACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IAEH,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE7C,MAAM,iBAAiB,GAAoC,IAAI,GAAG,EAAE,CAAC;IACrE,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,MAAM,mCAAmC,GAAgB,EAAE,CAAC;IAC5D,KAAK,MAAM,cAAc,IAAI,gBAAgB,EAAE,CAAC;QAC9C,mCAAmC,CAAC,cAAc,CAAC,WAAW,CAAC;YAC7D,IAAA,mDAAyC,EACvC,wBAAY,EACZ,IAAI,mBAAS,CAAC,KAAK,CAAC,EACpB,cAAc,CAAC,WAAW,CAC3B,CAAC;QACJ,iBAAiB,CAAC,GAAG,CAAC,cAAc,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAClE,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,KAAK,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EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,SAAS;YAChB,KAAK;YACL,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,eAAe,EAAE,IAAI;gBAErB,YAAY;gBACZ,WAAW;gBACX,KAAK;aACN;YACD,IAAI,EAAE,IAAA,wBAAe,EAAC,WAAW,CAAC,IAAI,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -20,7 +20,6 @@ export declare function calculateBorrowRate(bank: SpotMarket): BigNumber;
|
|
20
20
|
export declare function calculateDepositRate(bank: SpotMarket): BigNumber;
|
21
21
|
export declare function calculateInterestRate(bank: SpotMarket, delta?: BigNumber): BigNumber;
|
22
22
|
export declare function isSpotPositionAvailable(position: SpotPosition): boolean;
|
23
|
-
export declare function decodeName(bytes: number[]): string;
|
24
23
|
export declare function getUserAccountPublicKey(programId: PublicKey, owner: PublicKey, subAccountId: number): PublicKey;
|
25
24
|
export declare function getUserMainAccountPublicKey(programId: PublicKey, owner: PublicKey): PublicKey;
|
26
25
|
export declare function getUserAccountsPublicKeys(programId: PublicKey, owner: PublicKey, startId: number, endId: number): PublicKey[];
|
@@ -3,7 +3,7 @@ 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.getUserInsuranceFundStakeAccountPublicKey = exports.getUserAccountsPublicKeys = exports.getUserMainAccountPublicKey = exports.getUserAccountPublicKey = exports.
|
6
|
+
exports.getUserInsuranceFundStakeAccountPublicKey = exports.getUserAccountsPublicKeys = exports.getUserMainAccountPublicKey = exports.getUserAccountPublicKey = exports.isSpotPositionAvailable = exports.calculateInterestRate = exports.calculateDepositRate = exports.calculateBorrowRate = exports.calculateUtilization = exports.getSignedTokenAmount = exports.getTokenAmount = exports.divCeil = exports.CONCENTRATION_PRECISION = exports.PERCENTAGE_PRECISION = exports.PERCENTAGE_PRECISION_EXP = exports.SPOT_MARKET_RATE_PRECISION = exports.SPOT_MARKET_RATE_PRECISION_EXP = exports.SPOT_MARKET_UTILIZATION_PRECISION = exports.SPOT_MARKET_UTILIZATION_PRECISION_EXP = exports.QUOTE_SPOT_MARKET_INDEX = exports.TEN = exports.ONE = exports.ZERO = void 0;
|
7
7
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
8
8
|
const web3_js_1 = require("@solana/web3.js");
|
9
9
|
const bn_js_1 = require("bn.js");
|
@@ -111,11 +111,6 @@ function isSpotPositionAvailable(position) {
|
|
111
111
|
return position.scaledBalance.eq(exports.ZERO) && position.openOrders === 0;
|
112
112
|
}
|
113
113
|
exports.isSpotPositionAvailable = isSpotPositionAvailable;
|
114
|
-
function decodeName(bytes) {
|
115
|
-
const buffer = Buffer.from(bytes);
|
116
|
-
return buffer.toString('utf8').trim();
|
117
|
-
}
|
118
|
-
exports.decodeName = decodeName;
|
119
114
|
function getUserAccountPublicKey(programId, owner, subAccountId) {
|
120
115
|
return web3_js_1.PublicKey.findProgramAddressSync([
|
121
116
|
Buffer.from('user', 'utf8'),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AACrC,6CAA4C;AAC5C,iCAA2B;AAC3B,qCAAqE;AAExD,QAAA,IAAI,GAAG,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC;AACxB,QAAA,GAAG,GAAG,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I,EAAE,CAAC,CAAC;KAClD,EACD,SAAS,CACV,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AAbD,0DAaC;AAED,SAAgB,2BAA2B,CACzC,SAAoB,EACpB,KAAgB;IAEhB,OAAO,uBAAuB,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AACtD,CAAC;AALD,kEAKC;AAED,SAAgB,yBAAyB,CACvC,SAAoB,EACpB,KAAgB,EAChB,OAAe,EACf,KAAa;IAEb,MAAM,IAAI,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,CAAC,IAAI,CACP,mBAAS,CAAC,sBAAsB,CAC9B;YACE,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;YAC3B,KAAK,CAAC,QAAQ,EAAE;YAChB,IAAI,UAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;SACvC,EACD,SAAS,CACV,CAAC,CAAC,CAAC,CACL,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AApBD,8DAoBC;AAED,SAAgB,yCAAyC,CACvD,SAAoB,EACpB,KAAgB,EAChB,WAAmB;IAEnB,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,MAAM,CAAC,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC;QAC3C,KAAK,CAAC,QAAQ,EAAE;QAChB,IAAI,UAAE,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;KACjD,EACD,SAAS,CACV,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AAbD,8FAaC"}
|
@@ -19,7 +19,6 @@ const getLpTokenSource_1 = __importDefault(require("../../utils/misc/getLpTokenS
|
|
19
19
|
const getMultipleAccountsInfoSafe_1 = require("../../utils/solana/getMultipleAccountsInfoSafe");
|
20
20
|
const constants_1 = require("./constants");
|
21
21
|
const structs_1 = require("./structs");
|
22
|
-
const helpers_1 = require("../mango/helpers");
|
23
22
|
const fetchTokenSupplyAndDecimals_1 = require("../../utils/solana/fetchTokenSupplyAndDecimals");
|
24
23
|
const solana_1 = require("../../utils/solana");
|
25
24
|
const constants_2 = require("../jupiter/constants");
|
@@ -97,7 +96,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
97
96
|
});
|
98
97
|
}
|
99
98
|
// eslint-disable-next-line prefer-const
|
100
|
-
let source = (0, getLpTokenSource_1.default)(portfolio_core_1.NetworkId.solana, constants_1.poolsPkeys[i].toString(), constants_1.platformId, (0,
|
99
|
+
let source = (0, getLpTokenSource_1.default)(portfolio_core_1.NetworkId.solana, constants_1.poolsPkeys[i].toString(), constants_1.platformId, (0, solana_1.u8ArrayToString)(pool.name), { address: mint, decimals, supply }, assets);
|
101
100
|
source.price = pool.aumUsd
|
102
101
|
.dividedBy(Math.pow(10, decimals))
|
103
102
|
.dividedBy(supply)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"poolJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flash/poolJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAmE;AACnE,6CAA4C;AAG5C,iDAAsD;AACtD,yFAAiE;AACjE,gGAA6F;AAC7F,2CAAqD;AACrD,uCAAqD;AACrD,
|
1
|
+
{"version":3,"file":"poolJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flash/poolJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAmE;AACnE,6CAA4C;AAG5C,iDAAsD;AACtD,yFAAiE;AACjE,gGAA6F;AAC7F,2CAAqD;AACrD,uCAAqD;AACrD,gGAA6F;AAE7F,+CAK4B;AAC5B,oDAAoD;AAEpD,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACn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AAC,KAAK,GAAG,IAAI,CAAC,MAAM;aACvB,SAAS,CAAC,SAAA,EAAE,EAAI,QAAQ,CAAA,CAAC;aACzB,SAAS,CAAC,MAAM,CAAC;aACjB,QAAQ,EAAE,CAAC;QAEd,MAAM,KAAK,CAAC,OAAO,CAAC,sBAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,EAAE;YACvE,MAAM,EAAE,sBAAU;YAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;SAC5B,CAAC,CAAC;QAEH,MAAM,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,OAAO;IACxB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -20,7 +20,6 @@ const struct_1 = require("./struct");
|
|
20
20
|
const filters_1 = require("./filters");
|
21
21
|
const solana_1 = require("../../utils/solana");
|
22
22
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
23
|
-
const helpers_1 = require("./helpers");
|
24
23
|
const runInBatch_1 = __importDefault(require("../../utils/misc/runInBatch"));
|
25
24
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
26
25
|
const client = (0, clients_1.getClientSolana)();
|
@@ -137,7 +136,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
137
136
|
rewardAssets,
|
138
137
|
value,
|
139
138
|
},
|
140
|
-
name: (0,
|
139
|
+
name: (0, solana_1.u8ArrayToString)(userAccount.name),
|
141
140
|
});
|
142
141
|
}
|
143
142
|
return elements;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"collateralFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mango/collateralFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAGrC,2CAAkE;AAClE,iDAAsD;AACtD,qCAA8C;AAC9C,uCAA2C;AAC3C,+
|
1
|
+
{"version":3,"file":"collateralFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mango/collateralFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAGrC,2CAAkE;AAClE,iDAAsD;AACtD,qCAA8C;AAC9C,uCAA2C;AAC3C,+CAA+E;AAC/E,qGAA6E;AAC7E,6EAAqD;AAGrD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,YAAY,GAAG,MAAM,IAAA,iCAAwB,EACjD,MAAM,EACN,2BAAkB,EAClB,sBAAU,EACV,IAAA,wBAAc,EAAC,KAAK,CAAC,CACtB,CAAC;IACF,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEzC,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,WAAW,CAAe;QAClD,MAAM,EAAE,uBAAW;QACnB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IACH,MAAM,WAAW,GAAgB,IAAI,GAAG,EAAE,CAAC;IAC3C,MAAM,WAAW,GAA8B,IAAI,GAAG,EAAE,CAAC;IACzD,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,IAAI,CAAC,IAAI;YAAE,OAAO;QAClB,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACvC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAA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a;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,eAAe,EAAE,IAAI;gBAErB,WAAW;gBACX,YAAY;gBACZ,KAAK;aACN;YACD,IAAI,EAAE,IAAA,wBAAe,EAAC,WAAW,CAAC,IAAI,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,aAAa;IAC9B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
2
2
|
import { Bank } from './struct';
|
3
|
-
export declare function decodeName(bytes: number[]): string;
|
4
3
|
export declare function getBorrowRateWithoutUpkeepRate(bank: Bank): BigNumber;
|
5
4
|
export declare function zeroI80F48(): BigNumber;
|
6
5
|
/**
|
@@ -3,16 +3,10 @@ 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.getDepositRate = exports.getBorrowRate = exports.zeroI80F48 = exports.getBorrowRateWithoutUpkeepRate =
|
6
|
+
exports.getDepositRate = exports.getBorrowRate = exports.zeroI80F48 = exports.getBorrowRateWithoutUpkeepRate = void 0;
|
7
7
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
8
8
|
const FRACTIONS = 48;
|
9
9
|
const MULTIPLIER_NUMBER = Math.pow(2, FRACTIONS);
|
10
|
-
function decodeName(bytes) {
|
11
|
-
return new TextDecoder('utf-8')
|
12
|
-
.decode(new Uint8Array(bytes))
|
13
|
-
.split('\x00')[0];
|
14
|
-
}
|
15
|
-
exports.decodeName = decodeName;
|
16
10
|
function getBorrowRateWithoutUpkeepRate(bank) {
|
17
11
|
const totalBorrows = bank.indexedBorrows.multipliedBy(bank.borrowIndex);
|
18
12
|
const totalDeposits = bank.indexedDeposits.multipliedBy(bank.depositIndex);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mango/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAGrC,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,iBAAiB,GAAG,SAAA,CAAC,EAAI,SAAS,CAAA,CAAC;AAEzC,SAAgB,
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mango/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAGrC,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,iBAAiB,GAAG,SAAA,CAAC,EAAI,SAAS,CAAA,CAAC;AAEzC,SAAgB,8BAA8B,CAAC,IAAU;IACvD,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACxE,MAAM,aAAa,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAE3E,IAAI,aAAa,CAAC,MAAM,EAAE,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC;QACpD,OAAO,UAAU,EAAE,CAAC;IACtB,CAAC;IAED,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACpD,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzC,OAAO,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,WAAW,CAAC,EAAE,CAAC,I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AAO,8BAA8B,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAC;AAChF,CAAC;AAFD,sCAEC;AAED,SAAgB,cAAc,CAAC,IAAU;IACvC,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACxE,MAAM,aAAa,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAE3E,IAAI,aAAa,CAAC,MAAM,EAAE,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC;QACpD,OAAO,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IACD,IAAI,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACpD,OAAO,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC;AACzD,CAAC;AAdD,wCAcC"}
|
@@ -18,6 +18,7 @@ const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
18
18
|
const constants_1 = require("./constants");
|
19
19
|
const clients_1 = require("../../utils/clients");
|
20
20
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
21
|
+
const amountFactor = new bignumber_js_1.default(Math.pow(10, 36));
|
21
22
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
22
23
|
const client = (0, clients_1.getClientSui)();
|
23
24
|
const borrowedAssets = [];
|
@@ -31,34 +32,29 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
31
32
|
});
|
32
33
|
if (!reservesData)
|
33
34
|
return [];
|
34
|
-
const
|
35
|
-
for (const
|
36
|
-
|
37
|
-
|
38
|
-
for (const pool of constants_1.poolsInfos) {
|
39
|
-
const reserve = reserveById.get(pool.reserveData);
|
40
|
-
if (!reserve)
|
41
|
-
continue;
|
42
|
-
const reserveData = reserve.value.fields;
|
43
|
-
const borrowBalance = yield client.getDynamicFieldObject({
|
44
|
-
parentId: pool.borrowBalanceParentId,
|
35
|
+
const tokenPrices = yield cache.getTokenPricesAsMap(reservesData.map((r) => r.value.fields.coin_type), portfolio_core_1.NetworkId.sui);
|
36
|
+
for (const rData of reservesData) {
|
37
|
+
const borrowBalancePromise = client.getDynamicFieldObject({
|
38
|
+
parentId: rData.value.fields.borrow_balance.fields.user_state.fields.id.id,
|
45
39
|
name: { type: 'address', value: owner },
|
46
40
|
});
|
47
|
-
const
|
48
|
-
parentId:
|
41
|
+
const supplyBalancePromise = client.getDynamicFieldObject({
|
42
|
+
parentId: rData.value.fields.supply_balance.fields.user_state.fields.id.id,
|
49
43
|
name: { type: 'address', value: owner },
|
50
44
|
});
|
51
|
-
const
|
52
|
-
|
53
|
-
|
45
|
+
const [borrowBalance, supplyBalance] = yield Promise.all([
|
46
|
+
borrowBalancePromise,
|
47
|
+
supplyBalancePromise,
|
48
|
+
]);
|
49
|
+
const tokenPrice = tokenPrices.get((0, portfolio_core_1.formatTokenAddress)(rData.value.fields.coin_type, portfolio_core_1.NetworkId.sui));
|
54
50
|
if (!borrowBalance.error && borrowBalance.data) {
|
55
51
|
const borrowInfo = (0, sui_js_1.getObjectFields)(borrowBalance.data);
|
56
52
|
if (borrowInfo.value) {
|
57
|
-
borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(
|
58
|
-
.
|
59
|
-
.
|
53
|
+
borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(rData.value.fields.coin_type, new bignumber_js_1.default(borrowInfo.value)
|
54
|
+
.times(rData.value.fields.current_borrow_index)
|
55
|
+
.dividedBy(amountFactor)
|
60
56
|
.toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice));
|
61
|
-
const apy = new bignumber_js_1.default(
|
57
|
+
const apy = new bignumber_js_1.default(rData.value.fields.current_borrow_rate)
|
62
58
|
.dividedBy(Math.pow(10, constants_1.rateFactor))
|
63
59
|
.toNumber();
|
64
60
|
borrowedYields.push([
|
@@ -72,11 +68,11 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
72
68
|
if (!supplyBalance.error && supplyBalance.data) {
|
73
69
|
const supplyInfo = (0, sui_js_1.getObjectFields)(supplyBalance.data);
|
74
70
|
if (supplyInfo.value) {
|
75
|
-
suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(
|
76
|
-
.
|
77
|
-
.
|
71
|
+
suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(rData.value.fields.coin_type, new bignumber_js_1.default(supplyInfo.value)
|
72
|
+
.times(rData.value.fields.current_supply_index)
|
73
|
+
.dividedBy(amountFactor)
|
78
74
|
.toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice));
|
79
|
-
const apy = new bignumber_js_1.default(
|
75
|
+
const apy = new bignumber_js_1.default(rData.value.fields.current_supply_rate)
|
80
76
|
.dividedBy(Math.pow(10, constants_1.rateFactor))
|
81
77
|
.toNumber();
|
82
78
|
suppliedYields.push([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"collateralFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/collateralFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"collateralFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/collateralFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,2CAAiD;AACjD,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAmD;AACnD,qGAA6E;AAG7E,MAAM,YAAY,GAAG,IAAI,sBAAS,CAAC,SAAA,EAA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E;YACJ,cAAc;YACd,aAAa;YACb,cAAc;YACd,cAAc;YACd,aAAa;YACb,cAAc;YACd,eAAe,EAAE,IAAI;YAErB,WAAW;YACX,YAAY;YACZ,KAAK;SACN;KACF,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,aAAa;IAC9B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -4,7 +4,6 @@ export declare const naviPlatform: Platform;
|
|
4
4
|
export declare const reservesPrefix = "navi";
|
5
5
|
export declare const reservesKey = "reserves";
|
6
6
|
export declare const reserveParentId = "0xe6d4c6610b86ce7735ea754596d71d72d10c7980b5052fc3c8cdf8d09fea9b4b";
|
7
|
-
export declare const indexFactor = 18;
|
8
7
|
export declare const rateFactor = 27;
|
9
8
|
export declare const poolsInfos: {
|
10
9
|
id: number;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.poolsInfos = exports.rateFactor = exports.
|
3
|
+
exports.poolsInfos = exports.rateFactor = exports.reserveParentId = exports.reservesKey = exports.reservesPrefix = exports.naviPlatform = exports.platformId = void 0;
|
4
4
|
exports.platformId = 'navi';
|
5
5
|
exports.naviPlatform = {
|
6
6
|
id: exports.platformId,
|
@@ -12,7 +12,6 @@ exports.naviPlatform = {
|
|
12
12
|
exports.reservesPrefix = exports.platformId;
|
13
13
|
exports.reservesKey = 'reserves';
|
14
14
|
exports.reserveParentId = '0xe6d4c6610b86ce7735ea754596d71d72d10c7980b5052fc3c8cdf8d09fea9b4b';
|
15
|
-
exports.indexFactor = 18;
|
16
15
|
exports.rateFactor = 27;
|
17
16
|
exports.poolsInfos = [
|
18
17
|
{
|
@@ -51,5 +50,14 @@ exports.poolsInfos = [
|
|
51
50
|
borrowBalanceParentId: '0x7568d06a1b6ffc416a36c82791e3daf0e621cf19d4a2724fc6f74842661b6323',
|
52
51
|
supplyBalanceParentId: '0xa668905b1ad445a3159b4d29b1181c4a62d864861b463dd9106cc0d97ffe8f7f',
|
53
52
|
},
|
53
|
+
{
|
54
|
+
id: 4,
|
55
|
+
name: 'cetus',
|
56
|
+
type: '0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS',
|
57
|
+
pool: '0x71b9f6e822c48ce827bceadce82201d6a7559f7b0350ed1daa1dc2ba3ac41b56',
|
58
|
+
reserveData: '0x66a807c06212537fe46aa6719a00e4fa1e85a932d0b53ce7c4b1041983645133',
|
59
|
+
borrowBalanceParentId: '0x4c3da45ffff6432b4592a39cdb3ce12f4a28034cbcb804bb071facc81fdd923d',
|
60
|
+
supplyBalanceParentId: '0x6adc72faf2a9a15a583c9fb04f457c6a5f0b456bc9b4832413a131dfd4faddae',
|
61
|
+
},
|
54
62
|
];
|
55
63
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,YAAY,GAAa;IACpC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,qCAAqC,kBAAU,MAAM;IAC5D,WAAW,EAAE,eAAe;IAC5B,OAAO,EAAE,8BAA8B;CACxC,CAAC;AAEW,QAAA,cAAc,GAAG,kBAAU,CAAC;AAC5B,QAAA,WAAW,GAAG,UAAU,CAAC;AAEzB,QAAA,eAAe,GAC1B,oEAAoE,CAAC;AAE1D,QAAA,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,MAAM,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;QAC1E,WAAW,EACT,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;KACvE;CACF,CAAC"}
|
@@ -8,71 +8,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
9
|
});
|
10
10
|
};
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
12
|
const sui_js_1 = require("@mysten/sui.js");
|
16
13
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
17
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
14
|
const clients_1 = require("../../utils/clients");
|
19
15
|
const constants_1 = require("./constants");
|
20
16
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
21
17
|
const client = (0, clients_1.getClientSui)();
|
22
18
|
const reservesDatas = [];
|
23
|
-
|
24
|
-
|
19
|
+
let error;
|
20
|
+
let index = 0;
|
21
|
+
do {
|
22
|
+
const reserve = yield client.getDynamicFieldObject({
|
25
23
|
parentId: constants_1.reserveParentId,
|
26
|
-
name: { type: 'u8', value:
|
24
|
+
name: { type: 'u8', value: index },
|
27
25
|
});
|
28
|
-
if (
|
29
|
-
const
|
30
|
-
if (
|
31
|
-
reservesDatas.push(
|
26
|
+
if (reserve.data) {
|
27
|
+
const reserveData = (0, sui_js_1.getObjectFields)(reserve.data);
|
28
|
+
if (reserveData.value)
|
29
|
+
reservesDatas.push(reserveData);
|
32
30
|
}
|
33
|
-
|
31
|
+
index += 1;
|
32
|
+
error = reserve.error;
|
33
|
+
} while (!error || index > 25);
|
34
34
|
yield cache.setItem(constants_1.reservesKey, reservesDatas, {
|
35
35
|
prefix: constants_1.reservesPrefix,
|
36
36
|
networkId: portfolio_core_1.NetworkId.sui,
|
37
37
|
});
|
38
|
-
for (const reserveData of reservesDatas) {
|
39
|
-
const reserve = reserveData.value.fields;
|
40
|
-
const tokenAddress = reserve.coin_type;
|
41
|
-
const poolName = 'Main Pool';
|
42
|
-
const depositedAmount = new bignumber_js_1.default(reserve.supply_balance.fields.total_supply)
|
43
|
-
.dividedBy(reserve.current_supply_index)
|
44
|
-
.multipliedBy(Math.pow(10, constants_1.indexFactor))
|
45
|
-
.toNumber();
|
46
|
-
const borrowedAmount = new bignumber_js_1.default(reserve.borrow_balance.fields.total_supply)
|
47
|
-
.dividedBy(reserve.current_borrow_index)
|
48
|
-
.multipliedBy(Math.pow(10, constants_1.indexFactor))
|
49
|
-
.toNumber();
|
50
|
-
const borrowingApy = new bignumber_js_1.default(reserve.current_borrow_rate)
|
51
|
-
.dividedBy(Math.pow(10, constants_1.rateFactor))
|
52
|
-
.toNumber();
|
53
|
-
const lendingApy = new bignumber_js_1.default(reserve.current_supply_rate)
|
54
|
-
.dividedBy(Math.pow(10, constants_1.rateFactor))
|
55
|
-
.toNumber();
|
56
|
-
const rate = {
|
57
|
-
tokenAddress,
|
58
|
-
borrowYield: {
|
59
|
-
apy: borrowingApy,
|
60
|
-
apr: (0, portfolio_core_1.apyToApr)(borrowingApy),
|
61
|
-
},
|
62
|
-
borrowedAmount,
|
63
|
-
depositYield: {
|
64
|
-
apy: lendingApy,
|
65
|
-
apr: (0, portfolio_core_1.apyToApr)(lendingApy),
|
66
|
-
},
|
67
|
-
depositedAmount,
|
68
|
-
platformId: constants_1.platformId,
|
69
|
-
poolName,
|
70
|
-
};
|
71
|
-
yield cache.setItem(`${reserveData.id.id}-${tokenAddress}`, rate, {
|
72
|
-
prefix: portfolio_core_1.borrowLendRatesPrefix,
|
73
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
74
|
-
});
|
75
|
-
}
|
76
38
|
});
|
77
39
|
const job = {
|
78
40
|
id: `${constants_1.platformId}-reserves`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"reservesJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/reservesJob.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"reservesJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/reservesJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2CAAiD;AACjD,+DAAuD;AAGvD,iDAAmD;AACnD,2CAKqB;AAGrB,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,aAAa,GAAkB,EAAE,CAAC;IAExC,IAAI,KAAK,CAAC;IACV,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,GAAG,CAAC;QACF,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC;YACjD,QAAQ,EAAE,2BAAe;YACzB,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;SACnC,CAAC,CAAC;QACH,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,WAAW,GAAG,IAAA,wBAAe,EAAC,OAAO,CAAC,IAAI,CAAgB,CAAC;YACjE,IAAI,WAAW,CAAC,KAAK;gBAAE,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACzD,CAAC;QACD,KAAK,IAAI,CAAC,CAAC;QACX,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IACxB,CAAC,QAAQ,CAAC,KAAK,IAAI,KAAK,GAAG,EAAE,EAAE;IAE/B,MAAM,KAAK,CAAC,OAAO,CAAC,uBAAW,EAAE,aAAa,EAAE;QAC9C,MAAM,EAAE,0BAAc;QACtB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -1,43 +1,3 @@
|
|
1
|
-
export type Balance = {
|
2
|
-
id: {
|
3
|
-
id: string;
|
4
|
-
};
|
5
|
-
name: string;
|
6
|
-
value: string;
|
7
|
-
};
|
8
|
-
export type ReserveBalance = {
|
9
|
-
type: string;
|
10
|
-
fields: {
|
11
|
-
total_supply: string;
|
12
|
-
user_state: {
|
13
|
-
type: string;
|
14
|
-
fields: {
|
15
|
-
id: {
|
16
|
-
id: string;
|
17
|
-
};
|
18
|
-
size: string;
|
19
|
-
};
|
20
|
-
};
|
21
|
-
};
|
22
|
-
};
|
23
|
-
export type BorrowRateFactors = {
|
24
|
-
type: string;
|
25
|
-
fields: {
|
26
|
-
base_rate: string;
|
27
|
-
jump_rate_multiplier: string;
|
28
|
-
multiplier: string;
|
29
|
-
optimal_utilization: string;
|
30
|
-
reserve_factor: string;
|
31
|
-
};
|
32
|
-
};
|
33
|
-
export type LiquidationFactors = {
|
34
|
-
type: string;
|
35
|
-
fields: {
|
36
|
-
bonus: string;
|
37
|
-
ratio: string;
|
38
|
-
threshold: string;
|
39
|
-
};
|
40
|
-
};
|
41
1
|
export type ReserveData = {
|
42
2
|
id: {
|
43
3
|
id: string;
|
@@ -46,9 +6,18 @@ export type ReserveData = {
|
|
46
6
|
value: {
|
47
7
|
type: string;
|
48
8
|
fields: {
|
49
|
-
borrow_balance:
|
9
|
+
borrow_balance: Balance;
|
50
10
|
borrow_cap_ceiling: string;
|
51
|
-
borrow_rate_factors:
|
11
|
+
borrow_rate_factors: {
|
12
|
+
type: string;
|
13
|
+
fields: {
|
14
|
+
base_rate: string;
|
15
|
+
jump_rate_multiplier: string;
|
16
|
+
multiplier: string;
|
17
|
+
optimal_utilization: string;
|
18
|
+
reserve_factor: string;
|
19
|
+
};
|
20
|
+
};
|
52
21
|
coin_type: string;
|
53
22
|
current_borrow_index: string;
|
54
23
|
current_borrow_rate: string;
|
@@ -57,16 +26,45 @@ export type ReserveData = {
|
|
57
26
|
id: number;
|
58
27
|
is_isolated: boolean;
|
59
28
|
last_update_timestamp: string;
|
60
|
-
liquidation_factors:
|
29
|
+
liquidation_factors: {
|
30
|
+
type: string;
|
31
|
+
fields: {
|
32
|
+
bonus: string;
|
33
|
+
ratio: string;
|
34
|
+
threshold: string;
|
35
|
+
};
|
36
|
+
};
|
61
37
|
ltv: string;
|
62
38
|
oracle_id: number;
|
63
39
|
reserve_field_a: string;
|
64
40
|
reserve_field_b: string;
|
65
41
|
reserve_field_c: string;
|
66
|
-
supply_balance:
|
42
|
+
supply_balance: Balance;
|
67
43
|
supply_cap_ceiling: string;
|
68
44
|
treasury_balance: string;
|
69
45
|
treasury_factor: string;
|
70
46
|
};
|
71
47
|
};
|
72
48
|
};
|
49
|
+
export type Balance = {
|
50
|
+
type: string;
|
51
|
+
fields: {
|
52
|
+
total_supply: string;
|
53
|
+
user_state: {
|
54
|
+
type: string;
|
55
|
+
fields: {
|
56
|
+
id: {
|
57
|
+
id: string;
|
58
|
+
};
|
59
|
+
size: string;
|
60
|
+
};
|
61
|
+
};
|
62
|
+
};
|
63
|
+
};
|
64
|
+
export type BalanceData = {
|
65
|
+
id: {
|
66
|
+
id: string;
|
67
|
+
};
|
68
|
+
name: string;
|
69
|
+
value: string;
|
70
|
+
};
|
@@ -5,5 +5,6 @@ export * from './getParsedProgramAccounts';
|
|
5
5
|
export * from './getParsedMultipleAccountsInfo';
|
6
6
|
export * from './getProgramAccountsSafe';
|
7
7
|
export * from './getTokenAccountsByOwner';
|
8
|
+
export * from './u8ArrayToString';
|
8
9
|
export * from './structs';
|
9
10
|
export * from './types';
|
@@ -21,6 +21,7 @@ __exportStar(require("./getParsedProgramAccounts"), exports);
|
|
21
21
|
__exportStar(require("./getParsedMultipleAccountsInfo"), exports);
|
22
22
|
__exportStar(require("./getProgramAccountsSafe"), exports);
|
23
23
|
__exportStar(require("./getTokenAccountsByOwner"), exports);
|
24
|
+
__exportStar(require("./u8ArrayToString"), exports);
|
24
25
|
__exportStar(require("./structs"), exports);
|
25
26
|
__exportStar(require("./types"), exports);
|
26
27
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,kDAAgC;AAChC,8CAA4B;AAC5B,6DAA2C;AAC3C,kEAAgD;AAChD,2DAAyC;AACzC,4DAA0C;AAC1C,4CAA0B;AAC1B,0CAAwB"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,kDAAgC;AAChC,8CAA4B;AAC5B,6DAA2C;AAC3C,kEAAgD;AAChD,2DAAyC;AACzC,4DAA0C;AAC1C,oDAAkC;AAClC,4CAA0B;AAC1B,0CAAwB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function u8ArrayToString(bytes: number[]): string;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.u8ArrayToString = void 0;
|
4
|
+
function u8ArrayToString(bytes) {
|
5
|
+
return new TextDecoder('utf-8')
|
6
|
+
.decode(new Uint8Array(bytes))
|
7
|
+
.split('\x00')[0]
|
8
|
+
.trim();
|
9
|
+
}
|
10
|
+
exports.u8ArrayToString = u8ArrayToString;
|
11
|
+
//# sourceMappingURL=u8ArrayToString.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"u8ArrayToString.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/u8ArrayToString.ts"],"names":[],"mappings":";;;AAAA,SAAgB,eAAe,CAAC,KAAe;IAC7C,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC;SAC5B,MAAM,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;SAC7B,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SAChB,IAAI,EAAE,CAAC;AACZ,CAAC;AALD,0CAKC"}
|