@sonarwatch/portfolio-plugins 0.11.96 → 0.11.98

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. package/CHANGELOG.md +1095 -1087
  2. package/README.md +3 -3
  3. package/package.json +3 -3
  4. package/src/plugins/aftermath/poolsJob.js +22 -20
  5. package/src/plugins/aftermath/poolsJob.js.map +1 -1
  6. package/src/plugins/balancer/helpers/pools.js +21 -21
  7. package/src/plugins/bucket/collateralFetcher.js +5 -8
  8. package/src/plugins/bucket/collateralFetcher.js.map +1 -1
  9. package/src/plugins/cetus/clmmsFetcher.js +5 -5
  10. package/src/plugins/cetus/clmmsFetcher.js.map +1 -1
  11. package/src/plugins/cetus/helpers.d.ts +4 -4
  12. package/src/plugins/cetus/helpers.js +23 -12
  13. package/src/plugins/cetus/helpers.js.map +1 -1
  14. package/src/plugins/cetus/poolsJob.js +5 -10
  15. package/src/plugins/cetus/poolsJob.js.map +1 -1
  16. package/src/plugins/jupiter/constants.d.ts +2 -0
  17. package/src/plugins/jupiter/constants.js +3 -1
  18. package/src/plugins/jupiter/constants.js.map +1 -1
  19. package/src/plugins/jupiter/filters.d.ts +1 -0
  20. package/src/plugins/jupiter/filters.js +11 -1
  21. package/src/plugins/jupiter/filters.js.map +1 -1
  22. package/src/plugins/jupiter/helpers.d.ts +1 -0
  23. package/src/plugins/jupiter/helpers.js +10 -1
  24. package/src/plugins/jupiter/helpers.js.map +1 -1
  25. package/src/plugins/jupiter/index.js +6 -1
  26. package/src/plugins/jupiter/index.js.map +1 -1
  27. package/src/plugins/jupiter/structs.d.ts +14 -0
  28. package/src/plugins/jupiter/structs.js +14 -1
  29. package/src/plugins/jupiter/structs.js.map +1 -1
  30. package/src/plugins/jupiter/voteFetcher.d.ts +3 -0
  31. package/src/plugins/jupiter/voteFetcher.js +56 -0
  32. package/src/plugins/jupiter/voteFetcher.js.map +1 -0
  33. package/src/plugins/navi/collateralFetcher.js +8 -7
  34. package/src/plugins/navi/collateralFetcher.js.map +1 -1
  35. package/src/plugins/navi/reservesJob.js +5 -4
  36. package/src/plugins/navi/reservesJob.js.map +1 -1
  37. package/src/plugins/scallop/helpers.d.ts +0 -49
  38. package/src/plugins/scallop/helpers.js +1 -39
  39. package/src/plugins/scallop/helpers.js.map +1 -1
  40. package/src/plugins/scallop/lendingsFetcher.js +17 -14
  41. package/src/plugins/scallop/lendingsFetcher.js.map +1 -1
  42. package/src/plugins/scallop/marketJob.js +16 -16
  43. package/src/plugins/scallop/marketJob.js.map +1 -1
  44. package/src/plugins/scallop/obligationsFetcher.js +25 -21
  45. package/src/plugins/scallop/obligationsFetcher.js.map +1 -1
  46. package/src/plugins/scallop/poolsJob.js +7 -12
  47. package/src/plugins/scallop/poolsJob.js.map +1 -1
  48. package/src/plugins/scallop/spoolsMarketJob.js +8 -15
  49. package/src/plugins/scallop/spoolsMarketJob.js.map +1 -1
  50. package/src/plugins/scallop/types/coin.d.ts +1 -1
  51. package/src/plugins/scallop/types/market.d.ts +3 -4
  52. package/src/plugins/scallop/types/market.js.map +1 -1
  53. package/src/plugins/sushiswap/helpers.js +24 -24
  54. package/src/plugins/tokens/fetchers/sui-nfts.js +47 -107
  55. package/src/plugins/tokens/fetchers/sui-nfts.js.map +1 -1
  56. package/src/plugins/tokens/types.d.ts +0 -48
  57. package/src/plugins/turbos/clmmsPositionsFetcher.js +18 -16
  58. package/src/plugins/turbos/clmmsPositionsFetcher.js.map +1 -1
  59. package/src/plugins/turbos/helper.d.ts +3 -3
  60. package/src/plugins/turbos/helper.js +6 -4
  61. package/src/plugins/turbos/helper.js.map +1 -1
  62. package/src/plugins/turbos/poolsJob.js +10 -10
  63. package/src/plugins/turbos/poolsJob.js.map +1 -1
  64. package/src/plugins/uniswap-v2/helpers.js +22 -22
  65. package/src/utils/clients/getClientSui.d.ts +2 -2
  66. package/src/utils/clients/getClientSui.js +8 -3
  67. package/src/utils/clients/getClientSui.js.map +1 -1
  68. package/src/utils/clients/types.d.ts +2 -0
  69. package/src/utils/sei/constants.js +8 -8
  70. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
  71. package/src/utils/sui/getDynamicFieldObject.d.ts +4 -0
  72. package/src/utils/sui/{getMultipleObjectsSafe.js → getDynamicFieldObject.js} +9 -13
  73. package/src/utils/sui/getDynamicFieldObject.js.map +1 -0
  74. package/src/utils/sui/getDynamicFields.d.ts +3 -0
  75. package/src/utils/sui/getDynamicFields.js +38 -0
  76. package/src/utils/sui/getDynamicFields.js.map +1 -0
  77. package/src/utils/sui/getObject.d.ts +4 -0
  78. package/src/utils/sui/{getDynamicFieldsSafe.js → getObject.js} +8 -16
  79. package/src/utils/sui/getObject.js.map +1 -0
  80. package/src/utils/sui/getObjectDeletedResponse.d.ts +3 -0
  81. package/src/utils/sui/getObjectDeletedResponse.js +19 -0
  82. package/src/utils/sui/getObjectDeletedResponse.js.map +1 -0
  83. package/src/utils/sui/getObjectNotExistsResponse.d.ts +2 -0
  84. package/src/utils/sui/getObjectNotExistsResponse.js +14 -0
  85. package/src/utils/sui/getObjectNotExistsResponse.js.map +1 -0
  86. package/src/utils/sui/getOwnedObjects.d.ts +4 -0
  87. package/src/utils/sui/getOwnedObjects.js +36 -0
  88. package/src/utils/sui/getOwnedObjects.js.map +1 -0
  89. package/src/utils/sui/multiGetObjects.d.ts +4 -0
  90. package/src/utils/sui/multiGetObjects.js +32 -0
  91. package/src/utils/sui/multiGetObjects.js.map +1 -0
  92. package/src/utils/sui/queryEvents.d.ts +4 -0
  93. package/src/utils/sui/{queryEventSafe.js → queryEvents.js} +16 -12
  94. package/src/utils/sui/queryEvents.js.map +1 -0
  95. package/src/utils/sui/structs/kiosk.d.ts +7 -0
  96. package/src/utils/sui/structs/kiosk.js +3 -0
  97. package/src/utils/sui/structs/kiosk.js.map +1 -0
  98. package/src/utils/sui/structs/nft.d.ts +41 -0
  99. package/src/utils/sui/structs/nft.js +3 -0
  100. package/src/utils/sui/structs/nft.js.map +1 -0
  101. package/src/utils/sui/types.d.ts +23 -0
  102. package/src/utils/sui/types.js +3 -0
  103. package/src/utils/sui/types.js.map +1 -0
  104. package/src/utils/sui/getDynamicFieldsSafe.d.ts +0 -13
  105. package/src/utils/sui/getDynamicFieldsSafe.js.map +0 -1
  106. package/src/utils/sui/getFormattedCollectionNameAndId.d.ts +0 -4
  107. package/src/utils/sui/getFormattedCollectionNameAndId.js +0 -19
  108. package/src/utils/sui/getFormattedCollectionNameAndId.js.map +0 -1
  109. package/src/utils/sui/getMultipleObjectsSafe.d.ts +0 -67
  110. package/src/utils/sui/getMultipleObjectsSafe.js.map +0 -1
  111. package/src/utils/sui/queryEventSafe.d.ts +0 -14
  112. package/src/utils/sui/queryEventSafe.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/helpers.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAE5C,SAAgB,iBAAiB,CAC/B,QAAmB,EACnB,WAAsB,EACtB,SAAoB;IAEpB,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC,EACvE,SAAS,CACV,CAAC;AACJ,CAAC;AATD,8CASC"}
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/helpers.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,2CAA0D;AAE1D,SAAgB,iBAAiB,CAC/B,QAAmB,EACnB,WAAsB,EACtB,SAAoB;IAEpB,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC,EACvE,SAAS,CACV,CAAC;AACJ,CAAC;AATD,8CASC;AAED,SAAgB,UAAU,CAAC,KAAa;IACtC,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;QACrB,wBAAY,CAAC,OAAO,EAAE;QACtB,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE;KAC/B,EACD,yBAAa,CACd,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AATD,gCASC"}
@@ -7,6 +7,11 @@ exports.fetchers = exports.jobs = void 0;
7
7
  const perpetualFetcher_1 = __importDefault(require("./perpetualFetcher"));
8
8
  const custodiesJob_1 = __importDefault(require("./custodiesJob"));
9
9
  const airdropFetcher_1 = __importDefault(require("./airdropFetcher"));
10
+ const voteFetcher_1 = __importDefault(require("./voteFetcher"));
10
11
  exports.jobs = [custodiesJob_1.default];
11
- exports.fetchers = [perpetualFetcher_1.default, airdropFetcher_1.default];
12
+ exports.fetchers = [
13
+ perpetualFetcher_1.default,
14
+ airdropFetcher_1.default,
15
+ voteFetcher_1.default,
16
+ ];
12
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/index.ts"],"names":[],"mappings":";;;;;;AAEA,0EAAkD;AAClD,kEAA0C;AAC1C,sEAA8C;AAEjC,QAAA,IAAI,GAAU,CAAC,sBAAY,CAAC,CAAC;AAC7B,QAAA,QAAQ,GAAc,CAAC,0BAAgB,EAAE,wBAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/index.ts"],"names":[],"mappings":";;;;;;AAEA,0EAAkD;AAClD,kEAA0C;AAC1C,sEAA8C;AAC9C,gEAAwC;AAE3B,QAAA,IAAI,GAAU,CAAC,sBAAY,CAAC,CAAC;AAC7B,QAAA,QAAQ,GAAc;IACjC,0BAAgB;IAChB,wBAAc;IACd,qBAAW;CACZ,CAAC"}
@@ -137,3 +137,17 @@ export type ClaimStatus = {
137
137
  admin: PublicKey;
138
138
  };
139
139
  export declare const claimStatusStruct: BeetStruct<ClaimStatus, Partial<ClaimStatus>>;
140
+ export type Escrow = {
141
+ buffer: Buffer;
142
+ locker: PublicKey;
143
+ owner: PublicKey;
144
+ bump: number;
145
+ tokens: PublicKey;
146
+ amount: BigNumber;
147
+ escrowStartedAt: BigNumber;
148
+ escrowEndsAt: BigNumber;
149
+ voteDelegate: PublicKey;
150
+ isMaxLock: boolean;
151
+ buffers: BigNumber[];
152
+ };
153
+ export declare const escrowStruct: BeetStruct<Escrow, Partial<Escrow>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.claimStatusStruct = exports.positionStruct = exports.Side = exports.custodyStruct = exports.fundingRateStateStruct = exports.assetsStruct = exports.permissionsStruct = exports.pricingParamsStruct = exports.oracleParamsStruct = exports.OracleType = exports.perpetualPoolStruct = exports.feesStruct = exports.poolAprStruct = exports.limitStruct = void 0;
3
+ exports.escrowStruct = exports.claimStatusStruct = exports.positionStruct = exports.Side = exports.custodyStruct = exports.fundingRateStateStruct = exports.assetsStruct = exports.permissionsStruct = exports.pricingParamsStruct = exports.oracleParamsStruct = exports.OracleType = exports.perpetualPoolStruct = exports.feesStruct = exports.poolAprStruct = exports.limitStruct = void 0;
4
4
  const beet_1 = require("@metaplex-foundation/beet");
5
5
  const beet_solana_1 = require("@metaplex-foundation/beet-solana");
6
6
  const solana_1 = require("../../utils/solana");
@@ -129,4 +129,17 @@ exports.claimStatusStruct = new beet_1.BeetStruct([
129
129
  ['closable', (0, solana_1.blob)(1)],
130
130
  ['admin', beet_solana_1.publicKey],
131
131
  ], (args) => args);
132
+ exports.escrowStruct = new beet_1.BeetStruct([
133
+ ['buffer', (0, solana_1.blob)(8)],
134
+ ['locker', beet_solana_1.publicKey],
135
+ ['owner', beet_solana_1.publicKey],
136
+ ['bump', beet_1.u8],
137
+ ['tokens', beet_solana_1.publicKey],
138
+ ['amount', solana_1.u64],
139
+ ['escrowStartedAt', solana_1.i64],
140
+ ['escrowEndsAt', solana_1.i64],
141
+ ['voteDelegate', beet_solana_1.publicKey],
142
+ ['isMaxLock', beet_1.bool],
143
+ ['buffers', (0, beet_1.uniformFixedSizeArray)(solana_1.u128, 10)],
144
+ ], (args) => args);
132
145
  //# sourceMappingURL=structs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/structs.ts"],"names":[],"mappings":";;;AAAA,oDAOmC;AAGnC,kEAA6D;AAC7D,+CAA0D;AAQ7C,QAAA,WAAW,GAAG,IAAI,iBAAU,CACvC;IACE,CAAC,WAAW,EAAE,aAAI,CAAC;IACnB,CAAC,sBAAsB,EAAE,aAAI,CAAC;IAC9B,CAAC,gBAAgB,EAAE,YAAG,CAAC;CACxB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAa,CACxB,CAAC;AAQW,QAAA,aAAa,GAAG,IAAI,iBAAU,CACzC;IACE,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,WAAW,EAAE,YAAG,CAAC;IAClB,CAAC,gBAAgB,EAAE,YAAG,CAAC;CACxB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAe,CAC1B,CAAC;AAcW,QAAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,qBAAqB,EAAE,YAAG,CAAC;IAC5B,CAAC,qBAAqB,EAAE,YAAG,CAAC;IAC5B,CAAC,uBAAuB,EAAE,YAAG,CAAC;IAC9B,CAAC,SAAS,EAAE,YAAG,CAAC;IAChB,CAAC,QAAQ,EAAE,YAAG,CAAC;IACf,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,kBAAkB,EAAE,YAAG,CAAC;IACzB,CAAC,sBAAsB,EAAE,YAAG,CAAC;IAC7B,CAAC,kBAAkB,EAAE,YAAG,CAAC;CAC1B,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAY,CACvB,CAAC;AAgBW,QAAA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M,EAAE,SAAE,CAAC;CACb,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAgB,CAC3B,CAAC;AAYW,QAAA,iBAAiB,GAAG,IAAI,iBAAU,CAC7C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,UAAU,EAAE,uBAAS,CAAC;IACvB,CAAC,cAAc,EAAE,YAAG,CAAC;IACrB,CAAC,uBAAuB,EAAE,YAAG,CAAC;IAC9B,CAAC,gBAAgB,EAAE,YAAG,CAAC;IACvB,CAAC,UAAU,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACrB,CAAC,OAAO,EAAE,uBAAS,CAAC;CACrB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAmB,CAC9B,CAAC"}
1
+ {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/structs.ts"],"names":[],"mappings":";;;AAAA,oDAOmC;AAGnC,kEAA6D;AAC7D,+CAA0D;AAQ7C,QAAA,WAAW,GAAG,IAAI,iBAAU,CACvC;IACE,CAAC,WAAW,EAAE,aAAI,CAAC;IACnB,CAAC,sBAAsB,EAAE,aAAI,CAAC;IAC9B,CAAC,gBAAgB,EAAE,YAAG,CAAC;CACxB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAa,CACxB,CAAC;AAQW,QAAA,aAAa,GAAG,IAAI,iBAAU,CACzC;IACE,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,WAAW,EAAE,YAAG,CAAC;IAClB,CAAC,gBAAgB,EAAE,YAAG,CAAC;CACxB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAe,CAC1B,CAAC;AAcW,QAAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,qBAAqB,EAAE,YAAG,CAAC;IAC5B,CAAC,qBAAqB,EAAE,YAAG,CAAC;IAC5B,CAAC,uBAAuB,EAAE,YAAG,CAAC;IAC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;IACnB,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,aAAI,EAAE,EAAE,CAAC,CAAC;CAC7C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAc,CACzB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,56 @@
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 structs_1 = require("./structs");
18
+ const clients_1 = require("../../utils/clients");
19
+ const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
20
+ const helpers_1 = require("./helpers");
21
+ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
22
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
23
+ const client = (0, clients_1.getClientSolana)();
24
+ const escrowPubkey = (0, helpers_1.getVotePda)(owner);
25
+ const escrowAccount = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, structs_1.escrowStruct, escrowPubkey);
26
+ if (!escrowAccount)
27
+ return [];
28
+ const jupTokenPrice = yield cache.getTokenPrice(constants_1.jupMint, portfolio_core_1.NetworkId.solana);
29
+ if (!jupTokenPrice)
30
+ return [];
31
+ const { decimals } = jupTokenPrice;
32
+ if (escrowAccount.amount.isZero())
33
+ return [];
34
+ const asset = (0, tokenPriceToAssetToken_1.default)(constants_1.jupMint, escrowAccount.amount.dividedBy(Math.pow(10, decimals)).toNumber(), portfolio_core_1.NetworkId.solana, jupTokenPrice);
35
+ if (!escrowAccount.escrowStartedAt.isZero()) {
36
+ const unlockingAt = new Date(escrowAccount.escrowEndsAt.times(1000).toNumber());
37
+ asset.attributes = { lockedUntil: unlockingAt.getTime() };
38
+ }
39
+ return [
40
+ {
41
+ type: portfolio_core_1.PortfolioElementType.multiple,
42
+ label: 'Deposit',
43
+ networkId: portfolio_core_1.NetworkId.solana,
44
+ platformId: constants_1.platformId,
45
+ data: { assets: [asset] },
46
+ value: asset.value,
47
+ },
48
+ ];
49
+ });
50
+ const fetcher = {
51
+ id: `${constants_1.platformId}-vote`,
52
+ networkId: portfolio_core_1.NetworkId.solana,
53
+ executor,
54
+ };
55
+ exports.default = fetcher;
56
+ //# sourceMappingURL=voteFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voteFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/voteFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AAGpC,2CAAkD;AAClD,uCAAyC;AACzC,iDAAsD;AACtD,kFAA+E;AAC/E,uCAAuC;AACvC,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,YAAY,GAAG,IAAA,oBAAU,EAAC,KAAK,CAAC,CAAC;IACvC,MAAM,aAAa,GAAG,MAAM,IAAA,2CAAoB,EAC9C,MAAM,EACN,sBAAY,EACZ,YAAY,CACb,CAAC;IAEF,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,CAAC;IAE9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
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
- const sui_js_1 = require("@mysten/sui.js");
17
16
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
18
17
  const constants_1 = require("./constants");
19
18
  const clients_1 = require("../../utils/clients");
20
19
  const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
20
+ const getDynamicFieldObject_1 = require("../../utils/sui/getDynamicFieldObject");
21
21
  const amountFactor = new bignumber_js_1.default(Math.pow(10, 36));
22
22
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
23
+ var _a, _b, _c, _d;
23
24
  const client = (0, clients_1.getClientSui)();
24
25
  const borrowedAssets = [];
25
26
  const borrowedYields = [];
@@ -34,11 +35,11 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
34
35
  return [];
35
36
  const tokenPrices = yield cache.getTokenPricesAsMap(reservesData.map((r) => r.value.fields.coin_type), portfolio_core_1.NetworkId.sui);
36
37
  for (const rData of reservesData) {
37
- const borrowBalancePromise = client.getDynamicFieldObject({
38
+ const borrowBalancePromise = (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
38
39
  parentId: rData.value.fields.borrow_balance.fields.user_state.fields.id.id,
39
40
  name: { type: 'address', value: owner },
40
41
  });
41
- const supplyBalancePromise = client.getDynamicFieldObject({
42
+ const supplyBalancePromise = (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
42
43
  parentId: rData.value.fields.supply_balance.fields.user_state.fields.id.id,
43
44
  name: { type: 'address', value: owner },
44
45
  });
@@ -47,8 +48,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
47
48
  supplyBalancePromise,
48
49
  ]);
49
50
  const tokenPrice = tokenPrices.get((0, portfolio_core_1.formatTokenAddress)(rData.value.fields.coin_type, portfolio_core_1.NetworkId.sui));
50
- if (!borrowBalance.error && borrowBalance.data) {
51
- const borrowInfo = (0, sui_js_1.getObjectFields)(borrowBalance.data);
51
+ if (!borrowBalance.error && ((_a = borrowBalance.data) === null || _a === void 0 ? void 0 : _a.content)) {
52
+ const borrowInfo = (_b = borrowBalance.data.content) === null || _b === void 0 ? void 0 : _b.fields;
52
53
  if (borrowInfo.value) {
53
54
  borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(rData.value.fields.coin_type, new bignumber_js_1.default(borrowInfo.value)
54
55
  .times(rData.value.fields.current_borrow_index)
@@ -65,8 +66,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
65
66
  ]);
66
67
  }
67
68
  }
68
- if (!supplyBalance.error && supplyBalance.data) {
69
- const supplyInfo = (0, sui_js_1.getObjectFields)(supplyBalance.data);
69
+ if (!supplyBalance.error && ((_d = (_c = supplyBalance.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.fields)) {
70
+ const supplyInfo = supplyBalance.data.content.fields;
70
71
  if (supplyInfo.value) {
71
72
  suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(rData.value.fields.coin_type, new bignumber_js_1.default(supplyInfo.value)
72
73
  .times(rData.value.fields.current_supply_index)
@@ -1 +1 @@
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,EAAE,EAAI,EAAE,CAAA,CAAC,CAAC;AAE7C,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,cAAc,GAAqB,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAc,EAAE,CAAC;IACr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IACvB,EAAE,EAAE,GAAG,sBAAU,aAAa;IAC9B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"collateralFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/collateralFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAmD;AACnD,qGAA6E;AAE7E,iFAA8E;AAE9E,MAAM,YAAY,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,EAAE,CAAA,CAAC,CAAC;AAE7C,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,cAAc,GAAqB,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAc,EAAE,CAAC;IACrC,MAAM,cAAc,GAAqB,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAc,EAAE,CAAC;IACrC,MAAM,YAAY,GAAqB,EAAE,CAAC;IAE1C,MAAM,YAAY,GAAG,MAAM,KAAK,CAAC,OAAO,CAAgB,uBAAW,EAAE;QACnE,MAAM,EAAE,0BAAc;QACtB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;IACH,IAAI,CAAC,YAAY;QAAE,OAAO,EAAE,CAAC;IAE7B,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,mBAAmB,CACjD,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,EACjD,0BAAS,CAAC,GAAG,CACd,CAAC;IAEF,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE,CAAC;QACjC,MAAM,oBAAoB,GAAG,IAAA,6CAAqB,EAAc,MAAM,EAAE;YACtE,QAAQ,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J;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE1E,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,GACxD,IAAA,wCAAuB,EAAC,cAAc,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;IACxE,MAAM,OAAO,GAAqB;QAChC,IAAI,EAAE,qCAAoB,CAAC,UAAU;QACrC,SAAS,EAAE,0BAAS,CAAC,GAAG;QACxB,UAAU,EAAV,sBAAU;QACV,KAAK,EAAE,SAAS;QAChB,KAAK;QACL,IAAI,EAAE;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"}
@@ -9,22 +9,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const sui_js_1 = require("@mysten/sui.js");
13
12
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
14
13
  const clients_1 = require("../../utils/clients");
15
14
  const constants_1 = require("./constants");
15
+ const getDynamicFieldObject_1 = require("../../utils/sui/getDynamicFieldObject");
16
16
  const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
17
+ var _a, _b;
17
18
  const client = (0, clients_1.getClientSui)();
18
19
  const reservesDatas = [];
19
20
  let error;
20
21
  let index = 0;
21
22
  do {
22
- const reserve = yield client.getDynamicFieldObject({
23
+ const reserve = yield (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
23
24
  parentId: constants_1.reserveParentId,
24
25
  name: { type: 'u8', value: index },
25
26
  });
26
- if (reserve.data) {
27
- const reserveData = (0, sui_js_1.getObjectFields)(reserve.data);
27
+ if ((_b = (_a = reserve.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields) {
28
+ const reserveData = reserve.data.content.fields;
28
29
  if (reserveData.value)
29
30
  reservesDatas.push(reserveData);
30
31
  }
@@ -1 +1 @@
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,CA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AAQ,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,51 +1,2 @@
1
- import { SuiObjectResponseQuery } from '@mysten/sui.js';
2
- export declare function getOwnerObject(owner: string, query?: SuiObjectResponseQuery): Promise<{
3
- objectId: string;
4
- version: string;
5
- digest: string;
6
- type?: string | undefined;
7
- bcs?: {
8
- type: string;
9
- version: number;
10
- hasPublicTransfer: boolean;
11
- dataType: "moveObject";
12
- bcsBytes: string;
13
- } | {
14
- id: string;
15
- dataType: "package";
16
- moduleMap: Record<string, string>;
17
- } | undefined;
18
- owner?: "Immutable" | {
19
- AddressOwner: string;
20
- } | {
21
- ObjectOwner: string;
22
- } | {
23
- Shared: {
24
- initial_shared_version: number;
25
- };
26
- } | undefined;
27
- storageRebate?: string | undefined;
28
- previousTransaction?: string | undefined;
29
- content?: {
30
- type: string;
31
- fields: Record<string, any>;
32
- hasPublicTransfer: boolean;
33
- dataType: "moveObject";
34
- } | {
35
- disassembled: Record<string, string>;
36
- dataType: "package";
37
- } | undefined;
38
- display?: Record<string, string> | {
39
- data: Record<string, string> | null;
40
- error: {
41
- code: string;
42
- version?: number | undefined;
43
- digest?: string | undefined;
44
- error?: string | undefined;
45
- object_id?: string | undefined;
46
- parent_object_id?: string | undefined;
47
- } | null;
48
- } | undefined;
49
- }[]>;
50
1
  export declare function formatDecimal(amount: number, decimal: number): number;
51
2
  export declare function shortenAddress(address: string, start?: number, end?: number): string;
@@ -1,44 +1,6 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.shortenAddress = exports.formatDecimal = exports.getOwnerObject = void 0;
13
- const clients_1 = require("../../utils/clients");
14
- const client = (0, clients_1.getClientSui)();
15
- function getOwnerObject(owner, query) {
16
- var _a;
17
- return __awaiter(this, void 0, void 0, function* () {
18
- const objects = [];
19
- let cursor = null;
20
- do {
21
- const { data, nextCursor } = yield client.getOwnedObjects({
22
- owner,
23
- filter: query === null || query === void 0 ? void 0 : query.filter,
24
- options: (_a = query === null || query === void 0 ? void 0 : query.options) !== null && _a !== void 0 ? _a : {
25
- showType: true,
26
- showContent: true,
27
- showDisplay: true,
28
- },
29
- cursor,
30
- });
31
- if (!data || !data.length) {
32
- break;
33
- }
34
- const objectDatas = data.map((obj) => obj.data);
35
- objects.push(...objectDatas);
36
- cursor = nextCursor;
37
- } while (cursor);
38
- return objects;
39
- });
40
- }
41
- exports.getOwnerObject = getOwnerObject;
3
+ exports.shortenAddress = exports.formatDecimal = void 0;
42
4
  function formatDecimal(amount, decimal) {
43
5
  return amount / Math.pow(10, decimal);
44
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,iDAAmD;AAEnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;AAE9B,SAAsB,cAAc,CAClC,KAAa,EACb,KAA8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/helpers.ts"],"names":[],"mappings":";;;AAAA,SAAgB,aAAa,CAAC,MAAc,EAAE,OAAe;IAC3D,OAAO,MAAM,GAAG,SAAA,EAAE,EAAI,OAAO,CAAA,CAAC;AAChC,CAAC;AAFD,sCAEC;AAED,SAAgB,cAAc,CAAC,OAAe,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC;IAChE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;AAC9D,CAAC;AAFD,wCAEC"}
@@ -13,13 +13,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
- const sui_js_1 = require("@mysten/sui.js");
16
+ const utils_1 = require("@mysten/sui.js/utils");
17
17
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
18
18
  const constants_1 = require("./constants");
19
- const helpers_1 = require("./helpers");
20
19
  const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
20
+ const getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
21
+ const clients_1 = require("../../utils/clients");
21
22
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
22
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
23
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
23
24
  const elements = [];
24
25
  const borrowedAssets = [];
25
26
  const borrowedYields = [];
@@ -35,6 +36,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
35
36
  const poolValues = Object.values(pools);
36
37
  if (poolValues.length === 0)
37
38
  return [];
39
+ const client = (0, clients_1.getClientSui)();
38
40
  const filterOwnerObject = {
39
41
  MatchAny: [
40
42
  ...poolValues.map((value) => ({
@@ -46,7 +48,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
46
48
  ],
47
49
  };
48
50
  const [allOwnedObjects, marketData, spoolData] = yield Promise.all([
49
- (0, helpers_1.getOwnerObject)(owner, { filter: filterOwnerObject }),
51
+ (0, getOwnedObjects_1.getOwnedObjects)(client, owner, { filter: filterOwnerObject }),
50
52
  cache.getItem(constants_1.marketKey, {
51
53
  prefix: constants_1.marketPrefix,
52
54
  networkId: portfolio_core_1.NetworkId.sui,
@@ -73,14 +75,15 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
73
75
  const lendingAssets = {};
74
76
  const stakedAccount = {};
75
77
  for (const ownedMarketCoin of allOwnedObjects) {
76
- const objType = (0, sui_js_1.getObjectType)(ownedMarketCoin);
78
+ const objType = (_a = ownedMarketCoin.data) === null || _a === void 0 ? void 0 : _a.type;
77
79
  if (!objType)
78
80
  continue;
79
- const parsed = (0, sui_js_1.parseStructTag)(objType);
80
- const coinType = (0, sui_js_1.normalizeStructTag)(objType.substring(objType.indexOf('MarketCoin<') + 11, objType.indexOf('>')));
81
- const fields = (0, sui_js_1.getObjectFields)(ownedMarketCoin);
82
- const coinName = (_b = (_a = poolValues
83
- .find((value) => value.coinType === coinType)) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.symbol.toLowerCase();
81
+ const parsed = (0, utils_1.parseStructTag)(objType);
82
+ const coinType = (0, utils_1.normalizeStructTag)(objType.substring(objType.indexOf('MarketCoin<') + 11, objType.indexOf('>')));
83
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
84
+ const fields = (_c = (_b = ownedMarketCoin.data) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.fields;
85
+ const coinName = (_e = (_d = poolValues
86
+ .find((value) => value.coinType === coinType)) === null || _d === void 0 ? void 0 : _d.metadata) === null || _e === void 0 ? void 0 : _e.symbol.toLowerCase();
84
87
  if (!coinName || !fields)
85
88
  continue;
86
89
  if (!lendingAssets[coinName]) {
@@ -96,7 +99,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
96
99
  stakes: fields['stakes'],
97
100
  });
98
101
  }
99
- const balance = (0, bignumber_js_1.default)((_c = (parsed.name === 'Coin' ? fields['balance'] : fields['stakes'])) !== null && _c !== void 0 ? _c : 0);
102
+ const balance = (0, bignumber_js_1.default)((_f = (parsed.name === 'Coin' ? fields['balance'] : fields['stakes'])) !== null && _f !== void 0 ? _f : 0);
100
103
  lendingAssets[coinName] = Object.assign(Object.assign({}, lendingAssets[coinName]), { amount: lendingAssets[coinName].amount.plus(balance) });
101
104
  }
102
105
  let pendingReward = (0, bignumber_js_1.default)(0);
@@ -124,7 +127,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
124
127
  });
125
128
  if (pendingReward.isGreaterThan(0)) {
126
129
  const pendingRewardAmount = pendingReward
127
- .shiftedBy(-1 * ((_f = (_e = (_d = pools['sui']) === null || _d === void 0 ? void 0 : _d.metadata) === null || _e === void 0 ? void 0 : _e.decimals) !== null && _f !== void 0 ? _f : 0))
130
+ .shiftedBy(-1 * ((_j = (_h = (_g = pools['sui']) === null || _g === void 0 ? void 0 : _g.metadata) === null || _h === void 0 ? void 0 : _h.decimals) !== null && _j !== void 0 ? _j : 0))
128
131
  .toNumber();
129
132
  const rewardTokenAddress = (0, portfolio_core_1.formatMoveTokenAddress)(pools['sui'].coinType);
130
133
  const rewardTokenPrice = tokenPrices.get(rewardTokenAddress);
@@ -140,8 +143,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
140
143
  const addressMove = (0, portfolio_core_1.formatMoveTokenAddress)(assetValue.coinType);
141
144
  const tokenPrice = tokenPrices.get(addressMove);
142
145
  const lendingAmount = assetValue.amount
143
- .multipliedBy((_g = lendingRate.get(assetName)) !== null && _g !== void 0 ? _g : 0)
144
- .shiftedBy(-1 * ((_k = (_j = (_h = pools[assetName]) === null || _h === void 0 ? void 0 : _h.metadata) === null || _j === void 0 ? void 0 : _j.decimals) !== null && _k !== void 0 ? _k : 0))
146
+ .multipliedBy((_k = lendingRate.get(assetName)) !== null && _k !== void 0 ? _k : 0)
147
+ .shiftedBy(-1 * ((_o = (_m = (_l = pools[assetName]) === null || _l === void 0 ? void 0 : _l.metadata) === null || _m === void 0 ? void 0 : _m.decimals) !== null && _o !== void 0 ? _o : 0))
145
148
  .toNumber();
146
149
  const assetToken = (0, tokenPriceToAssetToken_1.default)(addressMove, lendingAmount, portfolio_core_1.NetworkId.sui, tokenPrice);
147
150
  suppliedYields.push([
@@ -1 +1 @@
1
- {"version":3,"file":"lendingsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/lendingsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAUoC;AACpC,2CAMwB;AACxB,gEAAqC;AAGrC,2CAWqB;AACrB,uCAA2C;AAC3C,qGAA6E;AAS7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,QAAQ,GAAuB,EAAE,CAAC;IACxC,MAAM,cAAc,GAAqB,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAc,EAAE,CAAC;IACrC,MAAM,cAAc,GAAqB,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAc,EAAE,CAAC;IACrC,MAAM,YAAY,GAAqB,EAAE,CAAC;IAE1C,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,OAAO,CAAQ,oBAAQ,EAAE;QACjD,MAAM,EAAE,uBAAW;QACnB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IAEtB,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEvC,MAAM,iBAAiB,GAAwB;QAC7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M,KAAK,CAAC;QAC3B,YAAY,CAAC,MAAM,KAAK,CAAC;QAEzB,OAAO,EAAE,CAAC;IACZ,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,GACxD,IAAA,wCAAuB,EAAC,cAAc,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;IACxE,QAAQ,CAAC,IAAI,CAAC;QACZ,IAAI,EAAE,qCAAoB,CAAC,UAAU;QACrC,SAAS,EAAE,0BAAS,CAAC,GAAG;QACxB,UAAU,EAAV,sBAAU;QACV,KAAK,EAAE,SAAS;QAChB,KAAK;QACL,IAAI,EAAE;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,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"lendingsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/scallop/lendingsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAUoC;AACpC,gDAA0E;AAC1E,gEAAqC;AAIrC,2CAWqB;AACrB,qGAA6E;AAQ7E,qEAAkE;AAClE,iDAAmD;AAEnD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,QAAQ,GAAuB,EAAE,CAAC;IACxC,MAAM,cAAc,GAAqB,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAc,EAAE,CAAC;IACrC,MAAM,cAAc,GAAqB,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAc,EAAE,CAAC;IACrC,MAAM,YA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O,CAAC"}
@@ -13,13 +13,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
- const sui_js_1 = require("@mysten/sui.js");
17
16
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
18
17
  const clients_1 = require("../../utils/clients");
19
18
  const constants_1 = require("./constants");
20
19
  const runInBatch_1 = __importDefault(require("../../utils/misc/runInBatch"));
20
+ const getObject_1 = require("../../utils/sui/getObject");
21
+ const getDynamicFieldObject_1 = require("../../utils/sui/getDynamicFieldObject");
21
22
  const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
22
- var _a, _b;
23
+ var _a, _b, _c, _d, _e, _f;
23
24
  const client = (0, clients_1.getClientSui)();
24
25
  const addressData = yield cache.getItem(constants_1.addressKey, {
25
26
  prefix: constants_1.addressPrefix,
@@ -36,18 +37,16 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
36
37
  return;
37
38
  const marketId = addressData.mainnet.core.market;
38
39
  // get market data
39
- const marketObject = yield client.getObject({
40
- id: marketId,
41
- options: {
42
- showContent: true,
43
- },
44
- });
45
- const marketData = (0, sui_js_1.getObjectFields)(marketObject);
40
+ const marketObject = yield (0, getObject_1.getObject)(client, marketId);
41
+ const marketData = (_b = (_a = marketObject.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields;
42
+ if (!marketData)
43
+ return;
46
44
  // get balance sheet
47
45
  const balanceSheets = {};
48
46
  const balanceSheetParentId = marketData.vault.fields.balance_sheets.fields.table.fields.id.id;
49
47
  const balanceSheetPromises = Object.keys(pools).map((coinName) => () => __awaiter(void 0, void 0, void 0, function* () {
50
- balanceSheets[coinName] = (0, sui_js_1.getObjectFields)(yield client.getDynamicFieldObject({
48
+ var _g, _h;
49
+ balanceSheets[coinName] = (_h = (_g = (yield (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
51
50
  parentId: balanceSheetParentId,
52
51
  name: {
53
52
  type: '0x1::type_name::TypeName',
@@ -55,14 +54,15 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
55
54
  name: pools[coinName].coinType.substring(2),
56
55
  },
57
56
  },
58
- }));
57
+ })).data) === null || _g === void 0 ? void 0 : _g.content) === null || _h === void 0 ? void 0 : _h.fields;
59
58
  }));
60
59
  yield (0, runInBatch_1.default)(balanceSheetPromises, 5);
61
60
  // get borrow indexes
62
61
  const borrowIndexes = {};
63
62
  const borrowIndexesParentId = marketData.borrow_dynamics.fields.table.fields.id.id;
64
63
  const borrowIndexesPromises = Object.keys(pools).map((coinName) => () => __awaiter(void 0, void 0, void 0, function* () {
65
- borrowIndexes[coinName] = (0, sui_js_1.getObjectFields)(yield client.getDynamicFieldObject({
64
+ var _j, _k;
65
+ borrowIndexes[coinName] = (_k = (_j = (yield (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
66
66
  parentId: borrowIndexesParentId,
67
67
  name: {
68
68
  type: '0x1::type_name::TypeName',
@@ -70,14 +70,14 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
70
70
  name: pools[coinName].coinType.substring(2),
71
71
  },
72
72
  },
73
- }));
73
+ })).data) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.fields;
74
74
  }));
75
75
  yield (0, runInBatch_1.default)(borrowIndexesPromises, 5);
76
76
  // get interest models
77
77
  const interestModels = {};
78
78
  const interestModelsParentId = marketData.interest_models.fields.table.fields.id.id;
79
79
  for (const coinName of Object.keys(pools)) {
80
- interestModels[coinName] = (0, sui_js_1.getObjectFields)(yield client.getDynamicFieldObject({
80
+ interestModels[coinName] = (_d = (_c = (yield (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
81
81
  parentId: interestModelsParentId,
82
82
  name: {
83
83
  type: '0x1::type_name::TypeName',
@@ -85,7 +85,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
85
85
  name: pools[coinName].coinType.substring(2),
86
86
  },
87
87
  },
88
- }));
88
+ })).data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.fields;
89
89
  }
90
90
  const market = {};
91
91
  const borrowYearFactor = 24 * 365 * 3600;
@@ -135,7 +135,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
135
135
  supplyRate = supplyRate.isFinite() ? supplyRate : (0, bignumber_js_1.default)(0);
136
136
  market[asset] = {
137
137
  coin: asset,
138
- decimal: (_b = (_a = pools[asset].metadata) === null || _a === void 0 ? void 0 : _a.decimals) !== null && _b !== void 0 ? _b : 0,
138
+ decimal: (_f = (_e = pools[asset].metadata) === null || _e === void 0 ? void 0 : _e.decimals) !== null && _f !== void 0 ? _f : 0,
139
139
  coinType: pools[asset].coinType,
140
140
  growthInterest: growthInterest.toNumber(),
141
141
  borrowInterestRate: Math.min(calculatedBorrowRate, calculatedMaxBorrowRate),