@sonarwatch/portfolio-plugins 0.14.144 → 0.14.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/package.json +1 -1
- package/src/plugins/bskt/constants.d.ts +1 -0
- package/src/plugins/bskt/constants.js +2 -1
- package/src/plugins/bskt/constants.js.map +1 -1
- package/src/plugins/bskt/index.js +5 -1
- package/src/plugins/bskt/index.js.map +1 -1
- package/src/plugins/bskt/stakingFetcher.d.ts +3 -0
- package/src/plugins/bskt/stakingFetcher.js +58 -0
- package/src/plugins/bskt/stakingFetcher.js.map +1 -0
- package/src/plugins/bskt/structs.d.ts +12 -0
- package/src/plugins/bskt/structs.js +12 -1
- package/src/plugins/bskt/structs.js.map +1 -1
- package/src/plugins/orca/getWhirlpoolPositions.js +1 -1
- package/src/plugins/orca/getWhirlpoolPositions.js.map +1 -1
- package/src/plugins/orca/types.d.ts +6 -2
- package/src/plugins/orca/whirlpoolsStatsJob.js +7 -3
- package/src/plugins/orca/whirlpoolsStatsJob.js.map +1 -1
- package/src/plugins/ratex/getPool.d.ts +1 -2
- package/src/plugins/ratex/getPool.js +4 -3
- package/src/plugins/ratex/getPool.js.map +1 -1
- package/src/plugins/ratex/helpers.d.ts +7 -4
- package/src/plugins/ratex/helpers.js +11 -31
- package/src/plugins/ratex/helpers.js.map +1 -1
- package/src/plugins/ratex/marketsJob.js +4 -9
- package/src/plugins/ratex/marketsJob.js.map +1 -1
- package/src/plugins/ratex/positionsFetcher.js +2 -2
- package/src/plugins/ratex/positionsFetcher.js.map +1 -1
- package/src/plugins/ratex/structs.d.ts +211 -0
- package/src/plugins/ratex/structs.js +203 -0
- package/src/plugins/ratex/structs.js.map +1 -0
- package/src/plugins/ratex/types.d.ts +5 -76
- package/src/plugins/zeta/constants.d.ts +0 -2
- package/src/plugins/zeta/constants.js +1 -7
- package/src/plugins/zeta/constants.js.map +1 -1
- package/src/plugins/zeta/stakingFetcher.js +6 -3
- package/src/plugins/zeta/stakingFetcher.js.map +1 -1
- package/src/plugins/zeta/structs.d.ts +24 -1
- package/src/plugins/zeta/structs.js +30 -1
- package/src/plugins/zeta/structs.js.map +1 -1
- package/src/plugins/zeta/types.d.ts +0 -26
- package/src/plugins/zeta/types.js +0 -7
- package/src/plugins/zeta/types.js.map +1 -1
- package/src/plugins/ratex/idl.json +0 -8806
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,34 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [0.14.151](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.150...plugins-0.14.151) (2025-03-20)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
## [0.14.150](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.149...plugins-0.14.150) (2025-03-20)
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
## [0.14.149](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.148...plugins-0.14.149) (2025-03-20)
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
## [0.14.148](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.147...plugins-0.14.148) (2025-03-20)
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
## [0.14.147](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.146...plugins-0.14.147) (2025-03-20)
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
## [0.14.146](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.145...plugins-0.14.146) (2025-03-20)
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
## [0.14.145](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.144...plugins-0.14.145) (2025-03-18)
|
30
|
+
|
31
|
+
|
32
|
+
|
5
33
|
## [0.14.144](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.143...plugins-0.14.144) (2025-03-17)
|
6
34
|
|
7
35
|
|
package/package.json
CHANGED
@@ -6,4 +6,5 @@ export declare const platformId = "bskt";
|
|
6
6
|
export declare const bsktMint = "6gnCPhXtLnUD76HjQuSYPENLSZdG8RvDB1pTLM5aLSJA";
|
7
7
|
export declare const platform: Platform;
|
8
8
|
export declare const bsktPid: PublicKey;
|
9
|
+
export declare const bsktStakingPid: PublicKey;
|
9
10
|
export declare const bsktDecimals = 5;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.bsktDecimals = exports.bsktPid = exports.platform = exports.bsktMint = exports.platformId = void 0;
|
3
|
+
exports.bsktDecimals = exports.bsktStakingPid = exports.bsktPid = exports.platform = exports.bsktMint = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
exports.platformId = 'bskt';
|
6
6
|
exports.bsktMint = '6gnCPhXtLnUD76HjQuSYPENLSZdG8RvDB1pTLM5aLSJA';
|
@@ -18,5 +18,6 @@ exports.platform = {
|
|
18
18
|
tokens: [exports.bsktMint],
|
19
19
|
};
|
20
20
|
exports.bsktPid = new web3_js_1.PublicKey('BSKTvA6XG9QyqhW5Hgq8pG8pm5NnvuYyc4pYefSzM62X');
|
21
|
+
exports.bsktStakingPid = new web3_js_1.PublicKey('DF8vgzUDH2CGywD7Gd9jd9Y5Kwmrx97h4Viumjo4rrr6');
|
21
22
|
exports.bsktDecimals = 5;
|
22
23
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,QAAQ,GAAG,8CAA8C,CAAC;AAC1D,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EACH,0EAA0E;IAC5E,qEAAqE;IACrE,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,+BAA+B;IACxC,QAAQ,EAAE,cAAc;IACxB,WAAW,EACT,mEAAmE;IACrE,aAAa,EAAE,yCAAyC;IACxD,MAAM,EAAE,CAAC,gBAAQ,CAAC;CACnB,CAAC;AAEW,QAAA,OAAO,GAAG,IAAI,mBAAS,CAClC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,YAAY,GAAG,CAAC,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,QAAQ,GAAG,8CAA8C,CAAC;AAC1D,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EACH,0EAA0E;IAC5E,qEAAqE;IACrE,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,+BAA+B;IACxC,QAAQ,EAAE,cAAc;IACxB,WAAW,EACT,mEAAmE;IACrE,aAAa,EAAE,yCAAyC;IACxD,MAAM,EAAE,CAAC,gBAAQ,CAAC;CACnB,CAAC;AAEW,QAAA,OAAO,GAAG,IAAI,mBAAS,CAClC,8CAA8C,CAC/C,CAAC;AACW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,YAAY,GAAG,CAAC,CAAC"}
|
@@ -1,8 +1,12 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
4
7
|
const constants_1 = require("./constants");
|
8
|
+
const stakingFetcher_1 = __importDefault(require("./stakingFetcher"));
|
5
9
|
exports.platforms = [constants_1.platform];
|
6
10
|
exports.jobs = [];
|
7
|
-
exports.fetchers = [];
|
11
|
+
exports.fetchers = [stakingFetcher_1.default];
|
8
12
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,CAAC,wBAAc,CAAC,CAAC"}
|
@@ -0,0 +1,58 @@
|
|
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 structs_1 = require("./structs");
|
16
|
+
const clients_1 = require("../../utils/clients");
|
17
|
+
const ParsedGpa_1 = require("../../utils/solana/beets/ParsedGpa");
|
18
|
+
const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
|
19
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
20
|
+
const client = (0, clients_1.getClientSolana)();
|
21
|
+
const accounts = yield ParsedGpa_1.ParsedGpa.build(client, structs_1.stakingAccountStruct, constants_1.bsktStakingPid)
|
22
|
+
.addFilter('accountDiscriminator', [210, 98, 254, 196, 151, 68, 235, 0])
|
23
|
+
.addFilter('owner', new web3_js_1.PublicKey(owner))
|
24
|
+
.run();
|
25
|
+
if (!accounts.length)
|
26
|
+
return [];
|
27
|
+
const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
|
28
|
+
accounts.forEach((account) => {
|
29
|
+
const element = elementRegistry.addElementMultiple({
|
30
|
+
label: 'Staked',
|
31
|
+
ref: account.pubkey,
|
32
|
+
sourceRefs: [
|
33
|
+
{
|
34
|
+
name: 'Vault',
|
35
|
+
address: account.stakePool.toString(),
|
36
|
+
},
|
37
|
+
],
|
38
|
+
link: 'https://staking.bskt.fi/',
|
39
|
+
});
|
40
|
+
element.addAsset({
|
41
|
+
address: constants_1.bsktMint,
|
42
|
+
amount: account.depositAmount,
|
43
|
+
attributes: {
|
44
|
+
lockedUntil: account.depositTimestamp
|
45
|
+
.plus(account.lockupDuration)
|
46
|
+
.toNumber(),
|
47
|
+
},
|
48
|
+
});
|
49
|
+
});
|
50
|
+
return elementRegistry.getElements(cache);
|
51
|
+
});
|
52
|
+
const fetcher = {
|
53
|
+
id: `${constants_1.platformId}-staking`,
|
54
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
55
|
+
executor,
|
56
|
+
};
|
57
|
+
exports.default = fetcher;
|
58
|
+
//# sourceMappingURL=stakingFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"stakingFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/stakingFetcher.ts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c,CAAC;qBAC5B,QAAQ,EAAE;aACd;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -13,3 +13,15 @@ export type VestingAccount = {
|
|
13
13
|
isCanceled: boolean;
|
14
14
|
};
|
15
15
|
export declare const vestingAccountStruct: BeetStruct<VestingAccount, Partial<VestingAccount>>;
|
16
|
+
export type StakingAccount = {
|
17
|
+
accountDiscriminator: number[];
|
18
|
+
owner: PublicKey;
|
19
|
+
payer: PublicKey;
|
20
|
+
stakePool: PublicKey;
|
21
|
+
lockupDuration: BigNumber;
|
22
|
+
depositTimestamp: BigNumber;
|
23
|
+
depositAmount: BigNumber;
|
24
|
+
effectiveStake: BigNumber;
|
25
|
+
claimedAmounts: BigNumber[];
|
26
|
+
};
|
27
|
+
export declare const stakingAccountStruct: BeetStruct<StakingAccount, Partial<StakingAccount>>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.vestingAccountStruct = void 0;
|
3
|
+
exports.stakingAccountStruct = exports.vestingAccountStruct = 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");
|
@@ -12,4 +12,15 @@ exports.vestingAccountStruct = new beet_1.BeetStruct([
|
|
12
12
|
['amountClaimed', solana_1.u64],
|
13
13
|
['isCanceled', beet_1.bool],
|
14
14
|
], (args) => args);
|
15
|
+
exports.stakingAccountStruct = new beet_1.BeetStruct([
|
16
|
+
['accountDiscriminator', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 8)],
|
17
|
+
['owner', beet_solana_1.publicKey],
|
18
|
+
['payer', beet_solana_1.publicKey],
|
19
|
+
['stakePool', beet_solana_1.publicKey],
|
20
|
+
['lockupDuration', solana_1.u64],
|
21
|
+
['depositTimestamp', solana_1.i64],
|
22
|
+
['depositAmount', solana_1.u64],
|
23
|
+
['effectiveStake', solana_1.u128],
|
24
|
+
['claimedAmounts', (0, beet_1.uniformFixedSizeArray)(solana_1.u128, 10)],
|
25
|
+
], (args) => args);
|
15
26
|
//# sourceMappingURL=structs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/structs.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bskt/structs.ts"],"names":[],"mappings":";;;AAAA,oDAKmC;AACnC,kEAA6D;AAG7D,+CAA0D;AAW7C,QAAA,oBAAoB,GAAG,IAAI,iBAAU,CAChD;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,YAAY,EAAE,WAAI,CAAC;CACrB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAsB,CACjC,CAAC;AAcW,QAAA,oBAAoB,GAAG,IAAI,iBAAU,CAChD;IACE,CAAC,sBAAsB,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;IACtD,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,gBAAgB,EAAE,YAAG,CAAC;IACvB,CAAC,kBAAkB,EAAE,YAAG,CAAC;IACzB,CAAC,eAAe,EAAE,YAAG,CAAC;IACtB,CAAC,gBAAgB,EAAE,aAAI,CAAC;IACxB,CAAC,gBAAgB,EAAE,IAAA,4BAAqB,EAAC,aAAI,EAAE,EAAE,CAAC,CAAC;CACpD,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAsB,CACjC,CAAC"}
|
@@ -96,7 +96,7 @@ function getOrcaNftFetcher(platformId, programId) {
|
|
96
96
|
poolLiquidity: whirlpoolInfo.liquidity,
|
97
97
|
feeRate: (Number(whirlpoolInfo.feeRate) / 10000) *
|
98
98
|
(1 - whirlpoolInfo.protocolFeeRate / 10000),
|
99
|
-
swapVolume24h: (_a = allWhirlpoolsStats.find((p) => (p === null || p === void 0 ? void 0 : p.address) === positionInfo.whirlpool.toString())) === null || _a === void 0 ? void 0 : _a.
|
99
|
+
swapVolume24h: (_a = allWhirlpoolsStats.find((p) => (p === null || p === void 0 ? void 0 : p.address) === positionInfo.whirlpool.toString())) === null || _a === void 0 ? void 0 : _a.stats['24h'].volume,
|
100
100
|
});
|
101
101
|
const feesAndRewards = (0, helpers_fees_1.calcFeesAndRewards)(whirlpoolInfo, positionInfo, tickArrays);
|
102
102
|
if (feesAndRewards) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getWhirlpoolPositions.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/getWhirlpoolPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAIoC;AACpC,6CAA4C;AAC5C,2CAIqB;AACrB,iDAAsD;AACtD,+CAG4B;AAE5B,mDAAgE;AAEhE,iDAAwE;AACxE,gFAA6E;AAGhE,QAAA,qBAAqB,GAAG,iBAAiB,CACpD,sBAAc,EACd,4BAAgB,CACjB,CAAC;AAEF,SAAgB,iBAAiB,CAC/B,UAAkB,EAClB,SAAoB;IAEpB,OAAO,CACL,KAAY,EACZ,IAAi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IAAI,CAAC,aAAa;gBAAE,SAAS;YAE7B,IACE,CAAC,aAAa,CAAC,UAAU;gBACzB,CAAC,aAAa,CAAC,UAAU;gBACzB,CAAC,aAAa,CAAC,gBAAgB;gBAE/B,SAAS;YAEX,MAAM,OAAO,GAAG,eAAe,CAAC,+BAA+B,CAAC;gBAC9D,IAAI,EAAE,+BAA+B;gBACrC,GAAG,EAAE,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE;gBACnC,UAAU,EAAE;oBACV;wBACE,IAAI,EAAE,MAAM;wBACZ,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,QAAQ,EAAE;qBACzC;iBACF;aACF,CAAC,CAAC;YACH,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC;gBACrC,QAAQ,EAAE,aAAa,CAAC,UAAU;gBAClC,QAAQ,EAAE,aAAa,CAAC,UAAU;gBAClC,SAAS,EAAE,YAAY,CAAC,SAAS;gBACjC,gBAAgB,EAAE,aAAa,CAAC,gBAAgB;gBAChD,cAAc,EAAE,YAAY,CAAC,cAAc;gBAC3C,cAAc,EAAE,YAAY,CAAC,cAAc;gBAC3C,gBAAgB,EAAE,aAAa,CAAC,SAAS;gBACzC,aAAa,EAAE,aAAa,CAAC,SAAS;gBACtC,OAAO,EACL,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;oBACvC,CAAC,CAAC,GAAG,aAAa,CAAC,eAAe,GAAG,KAAK,CAAC;gBAC7C,aAAa,EAAE,MAAA,kBAAkB,CAAC,IAAI,CACpC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,OAAO,MAAK,YAAY,CAAC,SAAS,CAAC,QAAQ,EAAE,CACxD,0CAAE,
|
1
|
+
{"version":3,"file":"getWhirlpoolPositions.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/getWhirlpoolPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;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21
|
let cursor;
|
22
22
|
const cacheItems = [];
|
23
23
|
do {
|
24
|
-
const apiRes = yield axios_1.default.get(`https://
|
24
|
+
const apiRes = yield axios_1.default.get(`https://api.orca.so/v2/solana/pools?limit=1000&after=${cursor || ''}`);
|
25
25
|
apiRes.data.data.forEach((p) => {
|
26
26
|
cacheItems.push({
|
27
27
|
key: `${p.address}-stats`,
|
28
28
|
value: {
|
29
29
|
address: p.address,
|
30
|
-
|
30
|
+
stats: {
|
31
|
+
'24h': {
|
32
|
+
volume: p.stats['24h'].volume,
|
33
|
+
fees: p.stats['24h'].fees,
|
34
|
+
},
|
35
|
+
},
|
31
36
|
tvlUsdc: p.tvlUsdc,
|
32
|
-
feesUsdc24h: p.feesUsdc24h,
|
33
37
|
},
|
34
38
|
});
|
35
39
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"whirlpoolsStatsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/whirlpoolsStatsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA6C;AAG7C,2CAA0D;AAE1D,mEAA2C;AAY3C,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,MAAiC,CAAC;IAEtC,MAAM,UAAU,GAA4C,EAAE,CAAC;IAE/D,GAAG,CAAC;QACF,MAAM,MAAM,GAAgC,MAAM,eAAK,CAAC,GAAG,CACzD,
|
1
|
+
{"version":3,"file":"whirlpoolsStatsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/whirlpoolsStatsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA6C;AAG7C,2CAA0D;AAE1D,mEAA2C;AAY3C,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,MAAiC,C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2
|
/// <reference types="jito-ts/node_modules/@solana/web3.js" />
|
3
|
-
import { IdlItem } from '@solanafm/explorer-kit-idls';
|
4
3
|
import { PublicKey } from '@solana/web3.js';
|
5
4
|
import { Cache } from '../../Cache';
|
6
5
|
import { YieldMarketWithOracle } from './types';
|
7
|
-
export declare const getPool: (poolId: PublicKey,
|
6
|
+
export declare const getPool: (poolId: PublicKey, cache: Cache) => Promise<YieldMarketWithOracle | undefined>;
|
@@ -15,7 +15,8 @@ const web3_js_1 = require("@solana/web3.js");
|
|
15
15
|
const constants_1 = require("./constants");
|
16
16
|
const solana_1 = require("../../utils/solana");
|
17
17
|
const clients_1 = require("../../utils/clients");
|
18
|
-
const
|
18
|
+
const structs_1 = require("./structs");
|
19
|
+
const getPool = (poolId, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
19
20
|
const cacheOpts = {
|
20
21
|
prefix: constants_1.poolPrefix,
|
21
22
|
networkId: portfolio_core_1.NetworkId.solana,
|
@@ -24,10 +25,10 @@ const getPool = (poolId, idlItem, cache) => __awaiter(void 0, void 0, void 0, fu
|
|
24
25
|
if (cachedPool)
|
25
26
|
return cachedPool;
|
26
27
|
const connection = (0, clients_1.getClientSolana)();
|
27
|
-
const pools = yield (0, solana_1.
|
28
|
+
const pools = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.yieldMarketStruct, [poolId]);
|
28
29
|
if (!pools[0])
|
29
30
|
return undefined;
|
30
|
-
const oracles = yield (0, solana_1.
|
31
|
+
const oracles = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.oracleStruct, [new web3_js_1.PublicKey(pools[0].oracle)]);
|
31
32
|
if (!oracles[0])
|
32
33
|
return undefined;
|
33
34
|
const poolWithOracle = Object.assign(Object.assign({}, pools[0]), { rate: oracles[0].rate });
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getPool.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/ratex/getPool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAAuD;
|
1
|
+
{"version":3,"file":"getPool.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/ratex/getPool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAAuD;AACvD,6CAA4C;AAE5C,2CAAyC;AACzC,+CAAmE;AACnE,iDAAsD;AACtD,uCAA4D;AAGrD,MAAM,OAAO,GAAG,CACrB,MAAiB,EACjB,KAAY,EACgC,EAAE;IAC9C,MAAM,SAAS,GAAG;QAChB,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC;IACF,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,OAAO,CACpC,MAAM,CAAC,QAAQ,EAAE,EACjB,SAAS,CACV,CAAC;IACF,IAAI,UAAU;QAAE,OAAO,UAAU,CAAC;IAElC,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,KAAK,GAAG,MAAM,IAAA,sCAA6B,EAC/C,UAAU,EACV,2BAAiB,EACjB,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IAEhC,MAAM,OAAO,GAAG,MAAM,IAAA,sCAA6B,EACjD,UAAU,EACV,sBAAY,EACZ,CAAC,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CACjC,CAAC;IAEF,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IAElC,MAAM,cAAc,mCACf,KAAK,CAAC,CAAC,CAAC,KACX,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GACtB,CAAC;IAEF,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IAElE,OAAO,cAAc,CAAC;AACxB,CAAC,CAAA,CAAC;AAxCW,QAAA,OAAO,WAwClB"}
|
@@ -1,10 +1,13 @@
|
|
1
|
-
|
1
|
+
/// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
|
2
|
+
/// <reference types="jito-ts/node_modules/@solana/web3.js" />
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
2
4
|
import { ParsedAccount } from '../../utils/solana';
|
3
|
-
import {
|
5
|
+
import { Program, YieldMarketWithOracle } from './types';
|
4
6
|
import { Cache } from '../../Cache';
|
7
|
+
import { LP, User, UserStats } from './structs';
|
5
8
|
export declare const getUserStatsByProgram: (programs: Program[], owner: string) => Promise<Map<string, UserStats>>;
|
6
9
|
export declare const getUsersByProgram: (programs: Program[], userStatsByProgram: Map<string, UserStats>, owner: string) => Promise<Map<string, ParsedAccount<User>[]>>;
|
7
10
|
export declare const getLpDatasByProgram: (programs: Program[], userStatsByProgram: Map<string, UserStats>, owner: string) => Promise<Map<string, ParsedAccount<LP>[]>>;
|
8
11
|
export declare const getPools: (programs: Program[], lpDatasByProgram: Map<string, ParsedAccount<LP>[]>, cache: Cache) => Promise<Map<string, YieldMarketWithOracle>>;
|
9
|
-
export declare const getUsers: (owner: string, numberOfSubAccountsCreated: number,
|
10
|
-
export declare const getLpDatas: (owner: string, numberOfSubAccountsCreated: number,
|
12
|
+
export declare const getUsers: (owner: string, numberOfSubAccountsCreated: number, program: PublicKey) => Promise<(ParsedAccount<User> | null)[]>;
|
13
|
+
export declare const getLpDatas: (owner: string, numberOfSubAccountsCreated: number, programId: PublicKey) => Promise<(ParsedAccount<LP> | null)[]>;
|
@@ -17,19 +17,15 @@ const web3_js_1 = require("@solana/web3.js");
|
|
17
17
|
const bn_js_1 = __importDefault(require("bn.js"));
|
18
18
|
const solana_1 = require("../../utils/solana");
|
19
19
|
const clients_1 = require("../../utils/clients");
|
20
|
-
const idl_json_1 = __importDefault(require("./idl.json"));
|
21
20
|
const getPool_1 = require("./getPool");
|
21
|
+
const structs_1 = require("./structs");
|
22
22
|
const getUserStatsByProgram = (programs, owner) => __awaiter(void 0, void 0, void 0, function* () {
|
23
23
|
const connection = (0, clients_1.getClientSolana)();
|
24
24
|
const userStatsPdas = programs.map((program) => {
|
25
25
|
const [userStatsPda] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('user_stats'), new web3_js_1.PublicKey(owner).toBuffer()], new web3_js_1.PublicKey(program.programId));
|
26
26
|
return userStatsPda;
|
27
27
|
});
|
28
|
-
const userStatss = yield (0, solana_1.
|
29
|
-
programId: programs[0].programId,
|
30
|
-
idl: idl_json_1.default,
|
31
|
-
idlType: 'anchor',
|
32
|
-
}, userStatsPdas);
|
28
|
+
const userStatss = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.userStatsStruct, userStatsPdas);
|
33
29
|
const userStatsByProgram = new Map();
|
34
30
|
programs.forEach((program, i) => {
|
35
31
|
const userStats = userStatss[i];
|
@@ -45,12 +41,7 @@ const getUsersByProgram = (programs, userStatsByProgram, owner) => __awaiter(voi
|
|
45
41
|
const userStats = userStatsByProgram.get(program.programId);
|
46
42
|
if (!userStats || userStats.numberOfSubAccountsCreated === 0)
|
47
43
|
return null;
|
48
|
-
|
49
|
-
programId: program.programId,
|
50
|
-
idl: idl_json_1.default,
|
51
|
-
idlType: 'anchor',
|
52
|
-
};
|
53
|
-
return (0, exports.getUsers)(owner, userStats.numberOfSubAccountsCreated, idlItem);
|
44
|
+
return (0, exports.getUsers)(owner, userStats.numberOfSubAccountsCreated, new web3_js_1.PublicKey(program.programId));
|
54
45
|
}));
|
55
46
|
const usersByProgram = new Map();
|
56
47
|
programs.forEach((program, i) => {
|
@@ -67,12 +58,7 @@ const getLpDatasByProgram = (programs, userStatsByProgram, owner) => __awaiter(v
|
|
67
58
|
const userStats = userStatsByProgram.get(program.programId);
|
68
59
|
if (!userStats || userStats.numberOfSubAccountsCreated === 0)
|
69
60
|
return null;
|
70
|
-
|
71
|
-
programId: program.programId,
|
72
|
-
idl: idl_json_1.default,
|
73
|
-
idlType: 'anchor',
|
74
|
-
};
|
75
|
-
return (0, exports.getLpDatas)(owner, userStats.numberOfSubAccountsCreated, idlItem);
|
61
|
+
return (0, exports.getLpDatas)(owner, userStats.numberOfSubAccountsCreated, new web3_js_1.PublicKey(program.programId));
|
76
62
|
}));
|
77
63
|
const lpDatasByProgram = new Map();
|
78
64
|
programs.forEach((program, i) => {
|
@@ -90,13 +76,7 @@ const getPools = (programs, lpDatasByProgram, cache) => __awaiter(void 0, void 0
|
|
90
76
|
const lpDatas = lpDatasByProgram.get(program.programId);
|
91
77
|
if (!lpDatas)
|
92
78
|
return null;
|
93
|
-
|
94
|
-
programId: program.programId,
|
95
|
-
idl: idl_json_1.default,
|
96
|
-
idlType: 'anchor',
|
97
|
-
};
|
98
|
-
return Promise.all(lpDatas.map((lpData) => lpData &&
|
99
|
-
(0, getPool_1.getPool)(new web3_js_1.PublicKey(lpData.ammPosition.ammpool), idlItem, cache))).then((lpDatasPools) => {
|
79
|
+
return Promise.all(lpDatas.map((lpData) => lpData && (0, getPool_1.getPool)(new web3_js_1.PublicKey(lpData.ammPosition.ammpool), cache))).then((lpDatasPools) => {
|
100
80
|
lpDatasPools.forEach((p) => {
|
101
81
|
if (p) {
|
102
82
|
pools.set(p.pubkey.toString(), p);
|
@@ -107,32 +87,32 @@ const getPools = (programs, lpDatasByProgram, cache) => __awaiter(void 0, void 0
|
|
107
87
|
return pools;
|
108
88
|
});
|
109
89
|
exports.getPools = getPools;
|
110
|
-
const getUsers = (owner, numberOfSubAccountsCreated,
|
90
|
+
const getUsers = (owner, numberOfSubAccountsCreated, program) => {
|
111
91
|
const userPdas = [];
|
112
92
|
for (let subaccountId = 0; subaccountId < numberOfSubAccountsCreated; subaccountId++) {
|
113
93
|
const [userPda] = web3_js_1.PublicKey.findProgramAddressSync([
|
114
94
|
Buffer.from('user'),
|
115
95
|
new web3_js_1.PublicKey(owner).toBuffer(),
|
116
96
|
new bn_js_1.default(subaccountId).toArrayLike(Buffer, 'le', 2),
|
117
|
-
],
|
97
|
+
], program);
|
118
98
|
userPdas.push(userPda);
|
119
99
|
}
|
120
100
|
const connection = (0, clients_1.getClientSolana)();
|
121
|
-
return (0, solana_1.
|
101
|
+
return (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.userStruct, userPdas);
|
122
102
|
};
|
123
103
|
exports.getUsers = getUsers;
|
124
|
-
const getLpDatas = (owner, numberOfSubAccountsCreated,
|
104
|
+
const getLpDatas = (owner, numberOfSubAccountsCreated, programId) => {
|
125
105
|
const lpPdas = [];
|
126
106
|
for (let subaccountId = 0; subaccountId < numberOfSubAccountsCreated; subaccountId++) {
|
127
107
|
const [lpPda] = web3_js_1.PublicKey.findProgramAddressSync([
|
128
108
|
Buffer.from('lp'),
|
129
109
|
new web3_js_1.PublicKey(owner).toBuffer(),
|
130
110
|
new bn_js_1.default(subaccountId).toArrayLike(Buffer, 'le', 2),
|
131
|
-
],
|
111
|
+
], programId);
|
132
112
|
lpPdas.push(lpPda);
|
133
113
|
}
|
134
114
|
const connection = (0, clients_1.getClientSolana)();
|
135
|
-
return (0, solana_1.
|
115
|
+
return (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.lpStruct, lpPdas);
|
136
116
|
};
|
137
117
|
exports.getLpDatas = getLpDatas;
|
138
118
|
//# sourceMappingURL=helpers.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/ratex/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA4C;AAC5C,kDAAuB;
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/ratex/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA4C;AAC5C,kDAAuB;AACvB,+CAG4B;AAE5B,iDAAsD;AACtD,uCAAoC;AAEpC,uCAOmB;AAEZ,MAAM,qBAAqB,GAAG,CACnC,QAAmB,EACnB,K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GAAG,IAAA,yBAAe,GAAE,CAAC;IACrC,OAAO,IAAA,sCAA6B,EAAC,UAAU,EAAE,kBAAQ,EAAE,MAAM,CAAC,CAAC;AACrE,CAAC,CAAC;AAvBW,QAAA,UAAU,cAuBrB"}
|
@@ -17,8 +17,8 @@ const bn_js_1 = __importDefault(require("bn.js"));
|
|
17
17
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
18
18
|
const constants_1 = require("./constants");
|
19
19
|
const clients_1 = require("../../utils/clients");
|
20
|
-
const idl_json_1 = __importDefault(require("./idl.json"));
|
21
20
|
const solana_1 = require("../../utils/solana");
|
21
|
+
const structs_1 = require("./structs");
|
22
22
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
23
|
const connection = (0, clients_1.getClientSolana)();
|
24
24
|
const addressLookupTable = (yield connection.getAddressLookupTable(constants_1.programIdLookupTable)).value;
|
@@ -27,12 +27,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
27
|
const programs = [];
|
28
28
|
for (const programId of addressLookupTable.state.addresses) {
|
29
29
|
const [statePda] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('ratex_state')], programId);
|
30
|
-
const
|
31
|
-
programId: programId.toString(),
|
32
|
-
idl: idl_json_1.default,
|
33
|
-
idlType: 'anchor',
|
34
|
-
};
|
35
|
-
const states = yield (0, solana_1.getAutoParsedMultipleAccountsInfo)(connection, idlItem, [statePda]);
|
30
|
+
const states = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.stateStruct, [statePda]);
|
36
31
|
if (!states[0])
|
37
32
|
continue;
|
38
33
|
const marketIndexStart = states[0]['marketIndexStart'];
|
@@ -40,12 +35,12 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
35
|
Buffer.from('margin_market'),
|
41
36
|
new bn_js_1.default(marketIndexStart).toArrayLike(Buffer, 'le', 4),
|
42
37
|
], programId);
|
43
|
-
const marginMarkets = yield (0, solana_1.
|
38
|
+
const marginMarkets = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.marginMarketStruct, [marginMarketPda]);
|
44
39
|
if (!marginMarkets[0])
|
45
40
|
continue;
|
46
41
|
programs.push({
|
47
42
|
programId: programId.toString(),
|
48
|
-
mint: marginMarkets[0].mint,
|
43
|
+
mint: marginMarkets[0].mint.toString(),
|
49
44
|
});
|
50
45
|
}
|
51
46
|
yield cache.setItem(constants_1.programsCacheKey, programs, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/ratex/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,6CAA4C;
|
1
|
+
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/ratex/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,6CAA4C;AAC5C,kDAAuB;AACvB,+DAAuD;AAGvD,2CAIqB;AACrB,iDAAsD;AACtD,+CAAmE;AACnE,uCAKmB;AAEnB,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,kBAAkB,GAAG,CACzB,MAAM,UAAU,CAAC,qBAAqB,CAAC,gCAAoB,CAAC,CAC7D,CAAC,KAAK,CAAC;IAER,IAAI,CAAC,kBAAkB;QAAE,OAAO;IAEhC,MAAM,QAAQ,GAAG,EAAE,CAAC;IAEpB,KAAK,MAAM,SAAS,IAAI,kBAAkB,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QAC3D,MAAM,CAAC,QAAQ,CAAC,GAAG,mBAAS,CAAC,sBAAsB,CACjD,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,EAC5B,SAAS,CACV,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,IAAA,sCAA6B,EAChD,UAAU,EACV,qBAAW,EACX,CAAC,QAAQ,CAAC,CACX,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YAAE,SAAS;QAEzB,MAAM,gBAAgB,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAW,CAAC;QAEjE,MAAM,CAAC,eAAe,CAAC,GAAG,mBAAS,CAAC,sBAAsB,CACxD;YACE,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC;YAC5B,IAAI,eAAE,CAAC,gBAAgB,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;SACtD,EACD,SAAS,CACV,CAAC;QAEF,MAAM,aAAa,GAAG,MAAM,IAAA,sCAA6B,EACvD,UAAU,EACV,4BAAkB,EAClB,CAAC,eAAe,CAAC,CAClB,CAAC;QAEF,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;YAAE,SAAS;QAEhC,QAAQ,CAAC,IAAI,CAAC;YACZ,SAAS,EAAE,SAAS,CAAC,QAAQ,EAAE;YAC/B,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE;SACvC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,KAAK,CAAC,OAAO,CAAC,4BAAgB,EAAE,QAAQ,EAAE;QAC9C,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,MAAM,EAAE,CAAC,QAAQ,CAAC;CACnB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -42,7 +42,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
42
42
|
if (!user)
|
43
43
|
return;
|
44
44
|
user.marginPositions.forEach((marginPosition) => {
|
45
|
-
if (marginPosition.balance
|
45
|
+
if (!marginPosition.balance.isZero()) {
|
46
46
|
const element = elementRegistry.addElementMultiple({
|
47
47
|
label: 'Margin',
|
48
48
|
link: 'https://app.rate-x.io/trade',
|
@@ -61,7 +61,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
61
61
|
lpDatas.forEach((lpData) => {
|
62
62
|
if (!lpData)
|
63
63
|
return;
|
64
|
-
const ammpool = pools.get(lpData.ammPosition.ammpool);
|
64
|
+
const ammpool = pools.get(lpData.ammPosition.ammpool.toString());
|
65
65
|
if (!ammpool)
|
66
66
|
return;
|
67
67
|
const { tokenAmountA, tokenAmountB } = (0, tokenAmountFromLiquidity_1.getTokenAmountsFromLiquidity)(new bignumber_js_1.default(lpData.ammPosition.liquidity), ammpool.pool.tickCurrentIndex, lpData.ammPosition.tickLowerIndex, lpData.ammPosition.tickUpperIndex, true);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/ratex/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,gEAAqC;AAErC,2CAA2D;AAE3D,gFAA6E;AAC7E,kEAA+D;AAE/D,wFAAyF;AACzF,uCAKmB;AACnB,8EAA2E;AAE3E,MAAM,YAAY,GAAG,IAAI,6BAAa,CAAY,4BAAgB,EAAE;IAClE,MAAM,EAAE,sBAAU;IAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;CAC5B,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnD,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAEtD,MAAM,kBAAkB,GAAG,MAAM,IAAA,+BAAqB,EAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAExE,MAAM,CAAC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