@sonarwatch/portfolio-plugins 0.14.37 → 0.14.38

Sign up to get free protection for your applications and to get access to all the features.
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.14.38](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.37...plugins-0.14.38) (2024-11-20)
6
+
7
+
8
+
5
9
  ## [0.14.37](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.36...plugins-0.14.37) (2024-11-20)
6
10
 
7
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.14.37",
3
+ "version": "0.14.38",
4
4
  "type": "commonjs",
5
5
  "types": "./src/index.d.ts",
6
6
  "peerDependencies": {
@@ -0,0 +1,3 @@
1
+ import { Job } from '../../Job';
2
+ declare const job: Job;
3
+ export default job;
@@ -0,0 +1,49 @@
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 web3_js_1 = require("@solana/web3.js");
14
+ const constants_1 = require("./constants");
15
+ const clients_1 = require("../../utils/clients");
16
+ const structs_1 = require("./structs");
17
+ const getSupply_1 = require("../../utils/solana/getSupply");
18
+ const constants_2 = require("../abex/constants");
19
+ const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
20
+ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
21
+ const client = (0, clients_1.getClientSolana)();
22
+ const alpSupply = yield (0, getSupply_1.getSupply)(client, new web3_js_1.PublicKey(constants_1.alpMint));
23
+ if (!alpSupply)
24
+ throw new Error('Cannot get ALP supply');
25
+ const poolAccount = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, structs_1.poolStruct, new web3_js_1.PublicKey('4bQRutgDJs6vuh6ZcWaPVXiQaBzbHketjbCDjL4oRN34'));
26
+ if (!poolAccount)
27
+ throw new Error('Cannot get ALP pool');
28
+ const aumUsd = poolAccount.aumUsdLow.div(Math.pow(10, 6));
29
+ if (aumUsd.isZero())
30
+ throw new Error('Adrena aumUsd is 0');
31
+ const price = aumUsd.div(alpSupply).toNumber();
32
+ yield cache.setTokenPriceSource({
33
+ address: constants_1.alpMint,
34
+ decimals: constants_2.alpDecimals,
35
+ id: 'adrena',
36
+ networkId: portfolio_core_1.NetworkId.solana,
37
+ platformId: portfolio_core_1.walletTokensPlatformId,
38
+ price,
39
+ timestamp: Date.now(),
40
+ weight: 1,
41
+ });
42
+ });
43
+ const job = {
44
+ id: `${constants_1.platformId}-alp-price`,
45
+ executor,
46
+ label: 'realtime',
47
+ };
48
+ exports.default = job;
49
+ //# sourceMappingURL=alpPriceJob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alpPriceJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/adrena/alpPriceJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAA+E;AAC/E,6CAA4C;AAG5C,2CAAkD;AAClD,iDAAsD;AACtD,uCAAuC;AACvC,4DAAyD;AACzD,iDAAgD;AAChD,kFAA+E;AAE/E,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,SAAS,GAAG,MAAM,IAAA,qBAAS,EAAC,MAAM,EAAE,IAAI,mBAAS,CAAC,mBAAO,CAAC,CAAC,CAAC;IAClE,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAEzD,MAAM,WAAW,GAAG,MAAM,IAAA,2CAAoB,EAC5C,MAAM,EACN,oBAAU,EACV,IAAI,mBAAS,CAAC,8CAA8C,CAAC,CAC9D,CAAC;IACF,IAAI,CAAC,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,SAAA,EAAE,EAAI,CAAC,CAAA,CAAC,CAAC;IAClD,IAAI,MAAM,CAAC,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAE3D,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC/C,MAAM,KAAK,CAAC,mBAAmB,CAAC;QAC9B,OAAO,EAAE,mBAAO;QAChB,QAAQ,EAAE,uBAAW;QACrB,EAAE,EAAE,QAAQ;QACZ,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,UAAU,EAAE,uCAAsB;QAClC,KAAK;QACL,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,MAAM,EAAE,CAAC;KACV,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,QAAQ;IACR,KAAK,EAAE,UAAU;CAClB,CAAC;AACF,kBAAe,GAAG,CAAC"}
@@ -6,9 +6,10 @@ 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 custodiesJob_1 = __importDefault(require("./custodiesJob"));
9
+ const alpPriceJob_1 = __importDefault(require("./alpPriceJob"));
9
10
  const positionsFetcher_1 = __importDefault(require("./positionsFetcher"));
10
11
  const stakingFetcher_1 = __importDefault(require("./stakingFetcher"));
11
12
  exports.platforms = [constants_1.platform];
12
- exports.jobs = [custodiesJob_1.default];
13
+ exports.jobs = [custodiesJob_1.default, alpPriceJob_1.default];
13
14
  exports.fetchers = [positionsFetcher_1.default, stakingFetcher_1.default];
14
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/adrena/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,kEAA0C;AAC1C,0EAAkD;AAClD,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,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/adrena/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,kEAA0C;AAC1C,gEAAwC;AACxC,0EAAkD;AAClD,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,sBAAY,EAAE,qBAAW,CAAC,CAAC;AAC1C,QAAA,QAAQ,GAAc,CAAC,0BAAgB,EAAE,wBAAc,CAAC,CAAC"}
@@ -176,6 +176,27 @@ export type LiquidStake = {
176
176
  overlapAmount: BigNumber;
177
177
  };
178
178
  export declare const liquidStakeStruct: BeetStruct<LiquidStake, Partial<LiquidStake>>;
179
+ export type Pool = {
180
+ buffer: number;
181
+ padding: Buffer;
182
+ bump: number;
183
+ lpTokenBump: number;
184
+ nbStableCustody: number;
185
+ initialized: number;
186
+ allowTrade: number;
187
+ allowSwap: number;
188
+ liquidityState: number;
189
+ registeredCustodyCount: number;
190
+ name: Buffer;
191
+ custodies: PublicKey[];
192
+ padding1: number[];
193
+ whitelistedSwapper: PublicKey;
194
+ ratios: Buffer;
195
+ padding2: number[];
196
+ aumUsdHigh: BigNumber;
197
+ aumUsdLow: BigNumber;
198
+ };
199
+ export declare const poolStruct: FixableBeetStruct<Pool, Partial<Pool>>;
179
200
  export type UserStaking = {
180
201
  bump: number;
181
202
  threadAuthorityBump: number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.userStakingStruct = exports.liquidStakeStruct = exports.lockedStakeStruct = exports.positionStruct = exports.custodyStruct = exports.borrowRateStateStruct = exports.positionsAccountingStruct = exports.StableLockedAmountStatStruct = exports.u128SplitStruct = exports.tradeStatsStruct = exports.volumeStatsStruct = exports.assetsStruct = exports.feesStatsStruct = exports.borrowRateParamsStruct = exports.feesStruct = exports.pricingParamsStruct = void 0;
3
+ exports.userStakingStruct = exports.poolStruct = exports.liquidStakeStruct = exports.lockedStakeStruct = exports.positionStruct = exports.custodyStruct = exports.borrowRateStateStruct = exports.positionsAccountingStruct = exports.StableLockedAmountStatStruct = exports.u128SplitStruct = exports.tradeStatsStruct = exports.volumeStatsStruct = exports.assetsStruct = exports.feesStatsStruct = exports.borrowRateParamsStruct = exports.feesStruct = exports.pricingParamsStruct = 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");
@@ -164,6 +164,26 @@ exports.liquidStakeStruct = new beet_1.BeetStruct([
164
164
  ['overlapTime', solana_1.i64],
165
165
  ['overlapAmount', solana_1.u64],
166
166
  ], (args) => args);
167
+ exports.poolStruct = new beet_1.FixableBeetStruct([
168
+ // ['padding', blob(8 + 8 + 32 + 32 * 8 + 32 + 32 + 32 + 8 * 8 + 16 + 8)],
169
+ ['buffer', (0, solana_1.blob)(8)],
170
+ ['bump', beet_1.u8],
171
+ ['lpTokenBump', beet_1.u8],
172
+ ['nbStableCustody', beet_1.u8],
173
+ ['initialized', beet_1.u8],
174
+ ['allowTrade', beet_1.u8],
175
+ ['allowSwap', beet_1.u8],
176
+ ['liquidityState', beet_1.u8],
177
+ ['registeredCustodyCount', beet_1.u8],
178
+ ['name', (0, solana_1.blob)(32)],
179
+ ['custodies', (0, beet_1.uniformFixedSizeArray)(beet_solana_1.publicKey, 8)],
180
+ ['padding1', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 32)],
181
+ ['whitelistedSwapper', beet_solana_1.publicKey],
182
+ ['ratios', (0, solana_1.blob)(64)],
183
+ ['padding2', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 16)],
184
+ ['aumUsdHigh', solana_1.u64],
185
+ ['aumUsdLow', solana_1.u64],
186
+ ], (args) => args);
167
187
  exports.userStakingStruct = new beet_1.FixableBeetStruct([
168
188
  ['bump', beet_1.u8],
169
189
  ['threadAuthorityBump', beet_1.u8],
@@ -1 +1 @@
1
- {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/adrena/structs.ts"],"names":[],"mappings":";;;AAAA,oDAOmC;AACnC,kEAA6D;AAG7D,+CAAoD;AASvC,QAAA,mBAAmB,GAAG,IAAI,iBAAU,CAC/C;IACE,CAAC,oBAAoB,EAAE,UAAG,CAAC;IAC3B,CAAC,aAAa,EAAE,UAAG,CAAC;IACpB,CAAC,sBAAsB,EAAE,YAAG,CAAC;IAC7B,CAAC,mCAAmC,EAAE,YAAG,CAAC;CAC3C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAqB,CAChC,CAAC;AAgBW,QAAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,QAAQ,EAAE,UAAG,CAAC;IACf,CAAC,SAAS,EAAE,UAAG,CAAC;IAChB,CAAC,cAAc,EAAE,UAAG,CAAC;IACrB,CAAC,eAAe,EAAE,UAAG,CAAC;IACtB,CAAC,cAAc,EAAE,UAAG,CAAC;IACrB,CAAC,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AAG,CAAC;IAClB,CAAC,WAAW,EAAE,YAAG,CAAC;IAClB,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,eAAe,EAAE,YAAG,CAAC;CACvB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAmB,CAC9B,CAAC;AAWW,QAAA,iBAAiB,GAAG,IAAI,wBAAiB,CACpD;IACE,CAAC,MAAM,EAAE,SAAE,CAAC;IACZ,CAAC,qBAAqB,EAAE,SAAE,CAAC;IAC3B,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC,yBAAyB,EAAE,YAAG,CAAC;IAChC,CAAC,aAAa,EAAE,yBAAiB,CAAC;IAClC,CAAC,cAAc,EAAE,IAAA,4BAAqB,EAAC,yBAAiB,EAAE,EAAE,CAAC,CAAC;CAC/D,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAmB,CAC9B,CAAC"}
1
+ {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/adrena/structs.ts"],"names":[],"mappings":";;;AAAA,oDAOmC;AACnC,kEAA6D;AAG7D,+CAAoD;AASvC,QAAA,mBAAmB,GAAG,IAAI,iBAAU,CAC/C;IACE,CAAC,oBAAoB,EAAE,UAAG,CAAC;IAC3B,CAAC,aAAa,EAAE,UAAG,CAAC;IACpB,CAAC,sBAAsB,EAAE,YAAG,CAAC;IAC7B,CAAC,mCAAmC,EAAE,YAAG,CAAC;CAC3C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAqB,CAChC,CAAC;AAgBW,QAAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,QAAQ,EAAE,UAAG,CAAC;IACf,CAAC,SAAS,EAAE,UAAG,CAAC;IAChB,CAAC,cAAc,EAAE,UAAG,CAAC;IACrB,CAAC,eAAe,EAAE,UAAG,CAAC;IACtB,CAAC,cAAc,EAAE,UAAG,CAAC;IACrB,CAAC,iBAA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AC;IAC3B,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC,yBAAyB,EAAE,YAAG,CAAC;IAChC,CAAC,aAAa,EAAE,yBAAiB,CAAC;IAClC,CAAC,cAAc,EAAE,IAAA,4BAAqB,EAAC,yBAAiB,EAAE,EAAE,CAAC,CAAC;CAC/D,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAmB,CAC9B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ import BigNumber from 'bignumber.js';
3
+ import { SolanaClient } from '../clients/types';
4
+ export declare function getSupply(connection: SolanaClient, mint: PublicKey): Promise<BigNumber | null>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getSupply = void 0;
13
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
14
+ const getParsedAccountInfo_1 = require("./getParsedAccountInfo");
15
+ const structs_1 = require("./structs");
16
+ const solMints = [portfolio_core_1.solanaNativeAddress, portfolio_core_1.solanaNativeWrappedAddress];
17
+ function getSupply(connection, mint) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ if (solMints.includes(mint.toString()))
20
+ return null;
21
+ const mintAccount = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(connection, structs_1.mintAccountStruct, mint);
22
+ return mintAccount
23
+ ? mintAccount.supply.div(Math.pow(10, mintAccount.decimals))
24
+ : null;
25
+ });
26
+ }
27
+ exports.getSupply = getSupply;
28
+ //# sourceMappingURL=getSupply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSupply.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/getSupply.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+DAGoC;AAGpC,iEAA8D;AAC9D,uCAA8C;AAE9C,MAAM,QAAQ,GAAG,CAAC,oCAAmB,EAAE,2CAA0B,CAAC,CAAC;AAEnE,SAAsB,SAAS,CAC7B,UAAwB,EACxB,IAAe;;QAEf,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;QAEpD,MAAM,WAAW,GAAG,MAAM,IAAA,2CAAoB,EAC5C,UAAU,EACV,2BAAiB,EACjB,IAAI,CACL,CAAC;QACF,OAAO,WAAW;YAChB,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,SAAA,EAAE,EAAI,WAAW,CAAC,QAAQ,CAAA,CAAC;YACpD,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;CAAA;AAdD,8BAcC"}