@sonarwatch/portfolio-plugins 0.11.89 → 0.11.91

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +2 -2
  3. package/src/Cache.d.ts +1 -0
  4. package/src/Cache.js +12 -0
  5. package/src/Cache.js.map +1 -1
  6. package/src/plugins/circuit/constants.d.ts +1 -3
  7. package/src/plugins/circuit/constants.js +2 -17
  8. package/src/plugins/circuit/constants.js.map +1 -1
  9. package/src/plugins/circuit/depositsFetcher.js +10 -4
  10. package/src/plugins/circuit/depositsFetcher.js.map +1 -1
  11. package/src/plugins/circuit/filters.d.ts +1 -0
  12. package/src/plugins/circuit/filters.js +4 -1
  13. package/src/plugins/circuit/filters.js.map +1 -1
  14. package/src/plugins/circuit/index.js +2 -1
  15. package/src/plugins/circuit/index.js.map +1 -1
  16. package/src/plugins/circuit/types.d.ts +1 -47
  17. package/src/plugins/circuit/vaultsJob.d.ts +3 -0
  18. package/src/plugins/circuit/vaultsJob.js +42 -0
  19. package/src/plugins/circuit/vaultsJob.js.map +1 -0
  20. package/src/plugins/drift/deposits.js +1 -1
  21. package/src/plugins/drift/deposits.js.map +1 -1
  22. package/src/plugins/drift/helpers.d.ts +0 -1
  23. package/src/plugins/drift/helpers.js +1 -6
  24. package/src/plugins/drift/helpers.js.map +1 -1
  25. package/src/plugins/flash/poolJob.js +1 -2
  26. package/src/plugins/flash/poolJob.js.map +1 -1
  27. package/src/plugins/mango/banksJob.js +1 -1
  28. package/src/plugins/mango/banksJob.js.map +1 -1
  29. package/src/plugins/mango/boostBanksJob.d.ts +3 -0
  30. package/src/plugins/mango/boostBanksJob.js +42 -0
  31. package/src/plugins/mango/boostBanksJob.js.map +1 -0
  32. package/src/plugins/mango/boostFetcher.d.ts +3 -0
  33. package/src/plugins/mango/boostFetcher.js +113 -0
  34. package/src/plugins/mango/boostFetcher.js.map +1 -0
  35. package/src/plugins/mango/collateralFetcher.js +2 -3
  36. package/src/plugins/mango/collateralFetcher.js.map +1 -1
  37. package/src/plugins/mango/constants.d.ts +3 -1
  38. package/src/plugins/mango/constants.js +4 -2
  39. package/src/plugins/mango/constants.js.map +1 -1
  40. package/src/plugins/mango/filters.d.ts +2 -0
  41. package/src/plugins/mango/filters.js +31 -1
  42. package/src/plugins/mango/filters.js.map +1 -1
  43. package/src/plugins/mango/helpers.d.ts +0 -1
  44. package/src/plugins/mango/helpers.js +1 -7
  45. package/src/plugins/mango/helpers.js.map +1 -1
  46. package/src/plugins/mango/index.js +4 -2
  47. package/src/plugins/mango/index.js.map +1 -1
  48. package/src/plugins/mango/struct.d.ts +32 -0
  49. package/src/plugins/mango/struct.js +59 -1
  50. package/src/plugins/mango/struct.js.map +1 -1
  51. package/src/plugins/mango/types.d.ts +6 -0
  52. package/src/plugins/navi/collateralFetcher.js +20 -24
  53. package/src/plugins/navi/collateralFetcher.js.map +1 -1
  54. package/src/plugins/navi/constants.d.ts +0 -1
  55. package/src/plugins/navi/constants.js +10 -2
  56. package/src/plugins/navi/constants.js.map +1 -1
  57. package/src/plugins/navi/reservesJob.js +12 -50
  58. package/src/plugins/navi/reservesJob.js.map +1 -1
  59. package/src/plugins/navi/types.d.ts +42 -44
  60. package/src/utils/solana/index.d.ts +1 -0
  61. package/src/utils/solana/index.js +1 -0
  62. package/src/utils/solana/index.js.map +1 -1
  63. package/src/utils/solana/u8ArrayToString.d.ts +1 -0
  64. package/src/utils/solana/u8ArrayToString.js +11 -0
  65. package/src/utils/solana/u8ArrayToString.js.map +1 -0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.poolsInfos = exports.rateFactor = exports.indexFactor = exports.reserveParentId = exports.reservesKey = exports.reservesPrefix = exports.naviPlatform = exports.platformId = void 0;
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,WAAW,GAAG,EAAE,CAAC;AACjB,QAAA,UAAU,GAAG,EAAE,CAAC;AAEhB,QAAA,UAAU,GAAG;IACxB;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,8EAA8E;QACpF,WAAW,EACT,oEAAoE;QACtE,IAAI,EAAE,oEAAoE;QAC1E,qBAAqB,EACnB,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;KACvE;IACD;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,gFAAgF;QACtF,WAAW,EACT,oEAAoE;QACtE,IAAI,EAAE,oEAAoE;QAC1E,qBAAqB,EACnB,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;KACvE;IACD;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,gFAAgF;QACtF,WAAW,EACT,oEAAoE;QACtE,IAAI,EAAE,EAAE;QACR,qBAAqB,EACnB,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;KACvE;IACD;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,gFAAgF;QACtF,IAAI,EAAE,oEAAoE;QAC1E,WAAW,EACT,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;KACvE;CACF,CAAC"}
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;IA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|| 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
- for (const pool of constants_1.poolsInfos) {
24
- const reserves = yield client.getDynamicFieldObject({
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: pool.id.toString() },
24
+ name: { type: 'u8', value: index },
27
25
  });
28
- if (reserves.data) {
29
- const fields = (0, sui_js_1.getObjectFields)(reserves.data);
30
- if (fields.value)
31
- reservesDatas.push(fields);
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":";;;;;;;;;;;;;;AAAA,2CAAiD;AACjD,+DAKoC;AACpC,gEAAqC;AAGrC,iDAAmD;AACnD,2CAQqB;AAGrB,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,aAAa,GAAkB,EAAE,CAAC;IACxC,KAAK,MAAM,IAAI,IAAI,sBAAU,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC;YAClD,QAAQ,EAAE,2BAAe;YACzB,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EA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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: ReserveBalance;
9
+ borrow_balance: Balance;
50
10
  borrow_cap_ceiling: string;
51
- borrow_rate_factors: BorrowRateFactors;
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: LiquidationFactors;
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: ReserveBalance;
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"}