@sonarwatch/portfolio-plugins 0.12.88 → 0.12.90
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +13 -0
- package/package.json +3 -2
- package/src/plugins/flash/constants.d.ts +2 -0
- package/src/plugins/flash/constants.js +3 -1
- package/src/plugins/flash/constants.js.map +1 -1
- package/src/plugins/flash/custodiesJob.js +1 -2
- package/src/plugins/flash/custodiesJob.js.map +1 -1
- package/src/plugins/flash/helpers.d.ts +4 -0
- package/src/plugins/flash/helpers.js +76 -1
- package/src/plugins/flash/helpers.js.map +1 -1
- package/src/plugins/flash/poolJob.js +23 -28
- package/src/plugins/flash/poolJob.js.map +1 -1
- package/src/plugins/flash/stakeFetcher.js +1 -2
- package/src/plugins/flash/stakeFetcher.js.map +1 -1
- package/src/utils/misc/snakeCase.d.ts +1 -0
- package/src/utils/misc/snakeCase.js +12 -0
- package/src/utils/misc/snakeCase.js.map +1 -0
- package/src/utils/solana/anchorSighash.d.ts +2 -0
- package/src/utils/solana/anchorSighash.js +12 -0
- package/src/utils/solana/anchorSighash.js.map +1 -0
- package/src/utils/solana/constants.d.ts +1 -0
- package/src/utils/solana/constants.js +2 -1
- package/src/utils/solana/constants.js.map +1 -1
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,19 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [0.12.90](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.89...plugins-0.12.90) (2024-07-25)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
## [0.12.89](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.88...plugins-0.12.89) (2024-07-25)
|
10
|
+
|
11
|
+
|
12
|
+
### Reverts
|
13
|
+
|
14
|
+
* Revert "fix" ([1da1323](https://github.com/sonarwatch/portfolio/commit/1da13233267c4db40155341d91752b4b4dba58d1))
|
15
|
+
|
16
|
+
|
17
|
+
|
5
18
|
## [0.12.88](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.87...plugins-0.12.88) (2024-07-24)
|
6
19
|
|
7
20
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.12.
|
3
|
+
"version": "0.12.90",
|
4
4
|
"type": "commonjs",
|
5
5
|
"types": "./src/index.d.ts",
|
6
6
|
"peerDependencies": {
|
@@ -40,7 +40,8 @@
|
|
40
40
|
"reflect-metadata": "^0.1.13",
|
41
41
|
"unstorage": "^1.10.1",
|
42
42
|
"viem": "^1.16.5",
|
43
|
-
"web3-v1": "npm:web3@^1.5.0"
|
43
|
+
"web3-v1": "npm:web3@^1.5.0",
|
44
|
+
"js-sha256": "^0.11.0"
|
44
45
|
},
|
45
46
|
"main": "./src/index.js"
|
46
47
|
}
|
@@ -3,6 +3,8 @@ import { Platform } from '@sonarwatch/portfolio-core';
|
|
3
3
|
export declare const platformId = "flash";
|
4
4
|
export declare const platform: Platform;
|
5
5
|
export declare const flashPid: PublicKey;
|
6
|
+
export declare const flashPerpetuals: PublicKey;
|
6
7
|
export declare const poolsPkeys: PublicKey[];
|
8
|
+
export declare const custodiesKey = "custodies";
|
7
9
|
export declare const marketsKey = "markets";
|
8
10
|
export declare const poolsKey = "pools";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.poolsKey = exports.marketsKey = exports.poolsPkeys = exports.flashPid = exports.platform = exports.platformId = void 0;
|
3
|
+
exports.poolsKey = exports.marketsKey = exports.custodiesKey = exports.poolsPkeys = exports.flashPerpetuals = exports.flashPid = exports.platform = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
exports.platformId = 'flash';
|
6
6
|
exports.platform = {
|
@@ -12,12 +12,14 @@ exports.platform = {
|
|
12
12
|
twitter: 'https://twitter.com/FlashTrade_',
|
13
13
|
};
|
14
14
|
exports.flashPid = new web3_js_1.PublicKey('FLASH6Lo6h3iasJKWDs2F8TkW2UKf3s15C8PMGuVfgBn');
|
15
|
+
exports.flashPerpetuals = new web3_js_1.PublicKey('7DWCtB5Z8rPiyBMKUwqyC95R9tJpbhoQhLM9LbK3Z5QZ');
|
15
16
|
exports.poolsPkeys = [
|
16
17
|
new web3_js_1.PublicKey('HfF7GCcEc76xubFCHLLXRdYcgRzwjEPdfKWqzRS8Ncog'),
|
17
18
|
new web3_js_1.PublicKey('KwhpybQPe9xuZFmAfcjLHj3ukownWex1ratyascAC1X'),
|
18
19
|
new web3_js_1.PublicKey('D6bfytnxoZBSzJM7fcixg5sgWJ2hj8SbwkPvb2r8XpbH'),
|
19
20
|
new web3_js_1.PublicKey('6HukhSeVVLQekKaGJYkwztBacjhKLKywVPrmcvccaYMz'),
|
20
21
|
];
|
22
|
+
exports.custodiesKey = 'custodies';
|
21
23
|
exports.marketsKey = 'markets';
|
22
24
|
exports.poolsKey = 'pools';
|
23
25
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flash/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,8CAA8C;IACrD,WAAW,EAAE,YAAY,EAAE,sCAAsC;IACjE,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,iCAAiC;CAC3C,CAAC;AAEW,QAAA,QAAQ,GAAG,IAAI,mBAAS,CACnC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,UAAU,GAAG;IACxB,IAAI,mBAAS,CAAC,8CAA8C,CAAC;IAC7D,IAAI,mBAAS,CAAC,6CAA6C,CAAC;IAC5D,IAAI,mBAAS,CAAC,8CAA8C,CAAC;IAC7D,IAAI,mBAAS,CAAC,8CAA8C,CAAC;CAC9D,CAAC;AAEW,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAG,OAAO,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flash/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,8CAA8C;IACrD,WAAW,EAAE,YAAY,EAAE,sCAAsC;IACjE,OAAO,EAAE,4BAA4B;IACrC,OAAO,EAAE,iCAAiC;CAC3C,CAAC;AAEW,QAAA,QAAQ,GAAG,IAAI,mBAAS,CACnC,8CAA8C,CAC/C,CAAC;AACW,QAAA,eAAe,GAAG,IAAI,mBAAS,CAC1C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,UAAU,GAAG;IACxB,IAAI,mBAAS,CAAC,8CAA8C,CAAC;IAC7D,IAAI,mBAAS,CAAC,6CAA6C,CAAC;IAC5D,IAAI,mBAAS,CAAC,8CAA8C,CAAC;IAC7D,IAAI,mBAAS,CAAC,8CAA8C,CAAC;CAC9D,CAAC;AAEW,QAAA,YAAY,GAAG,WAAW,CAAC;AAC3B,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAG,OAAO,CAAC"}
|
@@ -16,7 +16,6 @@ const constants_1 = require("./constants");
|
|
16
16
|
const structs_1 = require("./structs");
|
17
17
|
const filters_1 = require("./filters");
|
18
18
|
const getMultipleAccountsInfoSafe_1 = require("../../utils/solana/getMultipleAccountsInfoSafe");
|
19
|
-
const constants_2 = require("../jupiter/exchange/constants");
|
20
19
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
21
20
|
const client = (0, clients_1.getClientSolana)();
|
22
21
|
const markets = yield (0, solana_1.getParsedProgramAccounts)(client, structs_1.marketStruct, constants_1.flashPid, (0, filters_1.marketsFilter)());
|
@@ -52,7 +51,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
51
|
prefix: constants_1.platformId,
|
53
52
|
networkId: portfolio_core_1.NetworkId.solana,
|
54
53
|
});
|
55
|
-
yield cache.setItem(
|
54
|
+
yield cache.setItem(constants_1.custodiesKey, custodies, {
|
56
55
|
prefix: constants_1.platformId,
|
57
56
|
networkId: portfolio_core_1.NetworkId.solana,
|
58
57
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"custodiesJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flash/custodiesJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,iDAAsD;AACtD,+CAA8D;AAC9D,
|
1
|
+
{"version":3,"file":"custodiesJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flash/custodiesJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,iDAAsD;AACtD,+CAA8D;AAC9D,2CAA6E;AAC7E,uCAAiE;AACjE,uCAA0C;AAC1C,gGAA6F;AAG7F,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,OAAO,GAAG,MAAM,IAAA,iCAAwB,EAC5C,MAAM,EACN,sBAAY,EACZ,oBAAQ,EACR,IAAA,uBAAa,GAAE,CAChB,CAAC;IAEF,MAAM,gBAAgB,GAAG,OAAO;SAC7B,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;SACjE,IAAI,EAAE;SACN,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,kCAAkC,CAAC,CAAC;IAE1E,MA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M,KACT,wBAAwB,EAAE,UAAU,EACpC,oBAAoB,EAAE,aAAa,IACnC,CAAC;IACL,CAAC;IAED,MAAM,KAAK,CAAC,OAAO,CAAC,sBAAU,EAAE,WAAW,EAAE;QAC3C,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IAEH,MAAM,KAAK,CAAC,OAAO,CAAC,wBAAY,EAAE,SAAS,EAAE;QAC3C,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,YAAY;IAC7B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -1,2 +1,6 @@
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
2
|
+
import { SolanaClient } from '../../utils/clients/types';
|
3
|
+
import { FLPool } from './structs';
|
4
|
+
import { ParsedAccount } from '../../utils/solana';
|
2
5
|
export declare function getPdas(owner: string): PublicKey[];
|
6
|
+
export declare function getLpTokenPrice(connection: SolanaClient, pool: ParsedAccount<FLPool>, oracles: string[]): Promise<number | null>;
|
@@ -1,8 +1,19 @@
|
|
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
|
+
};
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getPdas = void 0;
|
12
|
+
exports.getLpTokenPrice = exports.getPdas = void 0;
|
4
13
|
const web3_js_1 = require("@solana/web3.js");
|
5
14
|
const constants_1 = require("./constants");
|
15
|
+
const anchorSighash_1 = require("../../utils/solana/anchorSighash");
|
16
|
+
const solana_1 = require("../../utils/solana");
|
6
17
|
function getPdas(owner) {
|
7
18
|
return constants_1.poolsPkeys.map((key) => web3_js_1.PublicKey.findProgramAddressSync([
|
8
19
|
Buffer.from('stake', 'utf8'),
|
@@ -11,4 +22,68 @@ function getPdas(owner) {
|
|
11
22
|
], constants_1.flashPid)[0]);
|
12
23
|
}
|
13
24
|
exports.getPdas = getPdas;
|
25
|
+
function getLpTokenPrice(connection, pool, oracles) {
|
26
|
+
var _a;
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
28
|
+
const keys = [
|
29
|
+
{
|
30
|
+
pubkey: constants_1.flashPerpetuals,
|
31
|
+
isSigner: false,
|
32
|
+
isWritable: false,
|
33
|
+
},
|
34
|
+
{
|
35
|
+
pubkey: pool.pubkey,
|
36
|
+
isSigner: false,
|
37
|
+
isWritable: false,
|
38
|
+
},
|
39
|
+
{
|
40
|
+
pubkey: pool.flpMint,
|
41
|
+
isSigner: false,
|
42
|
+
isWritable: false,
|
43
|
+
},
|
44
|
+
{
|
45
|
+
pubkey: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
46
|
+
isSigner: false,
|
47
|
+
isWritable: false,
|
48
|
+
},
|
49
|
+
...pool.custodies.map((c) => ({
|
50
|
+
pubkey: c,
|
51
|
+
isSigner: false,
|
52
|
+
isWritable: false,
|
53
|
+
})),
|
54
|
+
...oracles.map((o) => ({
|
55
|
+
pubkey: new web3_js_1.PublicKey(o),
|
56
|
+
isSigner: false,
|
57
|
+
isWritable: false,
|
58
|
+
})),
|
59
|
+
...pool.markets.map((m) => ({
|
60
|
+
pubkey: m,
|
61
|
+
isSigner: false,
|
62
|
+
isWritable: false,
|
63
|
+
})),
|
64
|
+
];
|
65
|
+
const data = Buffer.concat([(0, anchorSighash_1.anchorSighash)('global', 'getLpTokenPrice')]);
|
66
|
+
const messageV0 = new web3_js_1.TransactionMessage({
|
67
|
+
payerKey: new web3_js_1.PublicKey(solana_1.emptyWithSol),
|
68
|
+
recentBlockhash: (yield connection.getLatestBlockhash()).blockhash,
|
69
|
+
instructions: [
|
70
|
+
new web3_js_1.TransactionInstruction({
|
71
|
+
keys,
|
72
|
+
programId: constants_1.flashPid,
|
73
|
+
data,
|
74
|
+
}),
|
75
|
+
],
|
76
|
+
}).compileToV0Message();
|
77
|
+
const versionedTransaction = new web3_js_1.VersionedTransaction(messageV0);
|
78
|
+
const simulatedTransactionResponse = yield connection.simulateTransaction(versionedTransaction);
|
79
|
+
const returnedData = (_a = simulatedTransactionResponse.value.returnData) === null || _a === void 0 ? void 0 : _a.data[0];
|
80
|
+
if (returnedData)
|
81
|
+
return solana_1.u64
|
82
|
+
.read(Buffer.from(returnedData, 'base64'), 0)
|
83
|
+
.div(Math.pow(10, solana_1.usdcSolanaDecimals))
|
84
|
+
.toNumber();
|
85
|
+
return null;
|
86
|
+
});
|
87
|
+
}
|
88
|
+
exports.getLpTokenPrice = getLpTokenPrice;
|
14
89
|
//# sourceMappingURL=helpers.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flash/helpers.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flash/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAOyB;AACzB,2CAAoE;AAEpE,oEAAiE;AAEjE,+CAK4B;AAE5B,SAAgB,OAAO,CAAC,KAAa;IACnC,OAAO,sBAAU,CAAC,GAAG,CACnB,CAAC,GAAG,EAAE,EAAE,CACN,mBAAS,CAAC,sBAAsB,CAC9B;QACE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QACF,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAA,6BAAa,EAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACzE,MAAM,SAAS,GAAG,IAAI,4BAAkB,CAAC;YACvC,QAAQ,EAAE,IAAI,mBAAS,CAAC,qBAAY,CAAC;YACrC,eAAe,EAAE,CAAC,MAAM,UAAU,CAAC,kBAAkB,EAAE,CAAC,CAAC,SAAS;YAClE,YAAY,EAAE;gBACZ,IAAI,gCAAsB,CAAC;oBACzB,IAAI;oBACJ,SAAS,EAAE,oBAAQ;oBACnB,IAAI;iBACL,CAAC;aACH;SACF,CAAC,CAAC,kBAAkB,EAAE,CAAC;QACxB,MAAM,oBAAoB,GAAG,IAAI,8BAAoB,CAAC,SAAS,CAAC,CAAC;QACjE,MAAM,4BAA4B,GAAG,MAAM,UAAU,CAAC,mBAAmB,CACvE,oBAAoB,CACrB,CAAC;QAEF,MAAM,YAAY,GAAG,MAAA,4BAA4B,CAAC,KAAK,CAAC,UAAU,0CAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5E,IAAI,YAAY;YACd,OAAO,YAAG;iBACP,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;iBAC5C,GAAG,CAAC,SAAA,EAAE,EAAI,2BAAkB,CAAA,CAAC;iBAC7B,QAAQ,EAAE,CAAC;QAEhB,OAAO,IAAI,CAAC;;CACb;AAnED,0CAmEC"}
|
@@ -13,53 +13,48 @@ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
|
13
13
|
const clients_1 = require("../../utils/clients");
|
14
14
|
const constants_1 = require("./constants");
|
15
15
|
const structs_1 = require("./structs");
|
16
|
-
const fetchTokenSupplyAndDecimals_1 = require("../../utils/solana/fetchTokenSupplyAndDecimals");
|
17
16
|
const solana_1 = require("../../utils/solana");
|
18
17
|
const constants_2 = require("../tokens/constants");
|
19
|
-
const
|
18
|
+
const helpers_1 = require("./helpers");
|
19
|
+
const getDecimals_1 = require("../../utils/solana/getDecimals");
|
20
20
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
21
21
|
const client = (0, clients_1.getClientSolana)();
|
22
22
|
const poolsAccounts = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.flPoolStruct, constants_1.poolsPkeys);
|
23
|
-
const custodiesInfo = yield cache.getItem(
|
23
|
+
const custodiesInfo = yield cache.getItem(constants_1.custodiesKey, {
|
24
24
|
prefix: constants_1.platformId,
|
25
25
|
networkId: portfolio_core_1.NetworkId.solana,
|
26
26
|
});
|
27
27
|
if (!custodiesInfo)
|
28
28
|
return;
|
29
|
-
const
|
30
|
-
custodiesInfo.forEach((custody) =>
|
29
|
+
const custodyAccounts = new Map();
|
30
|
+
custodiesInfo.forEach((custody) => custodyAccounts.set(custody.pubkey, custody));
|
31
31
|
const poolsInfo = [];
|
32
32
|
for (let i = 0; i < poolsAccounts.length; i++) {
|
33
33
|
const pool = poolsAccounts[i];
|
34
34
|
if (!pool)
|
35
35
|
continue;
|
36
|
-
const
|
36
|
+
const lpPrice = yield (0, helpers_1.getLpTokenPrice)(client, pool, pool.custodies.map((c) => { var _a; return ((_a = custodyAccounts.get(c.toString())) === null || _a === void 0 ? void 0 : _a.oracle.oracleAccount) || ''; }));
|
37
|
+
const decimals = yield (0, getDecimals_1.getDecimals)(client, pool.flpMint);
|
38
|
+
if (decimals && lpPrice) {
|
39
|
+
console.log('lpPrice:', lpPrice);
|
40
|
+
yield cache.setTokenPriceSource({
|
41
|
+
address: pool.flpMint.toString(),
|
42
|
+
decimals,
|
43
|
+
id: constants_1.poolsPkeys[i].toString(),
|
44
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
45
|
+
platformId: constants_2.walletTokensPlatform.id,
|
46
|
+
price: lpPrice,
|
47
|
+
timestamp: Date.now(),
|
48
|
+
weight: 1,
|
49
|
+
elementName: (0, solana_1.u8ArrayToString)(pool.name),
|
50
|
+
});
|
51
|
+
}
|
37
52
|
let rewardPerLp;
|
38
|
-
custodies.forEach((custodyPkey) => {
|
39
|
-
const custody =
|
53
|
+
pool.custodies.forEach((custodyPkey) => {
|
54
|
+
const custody = custodyAccounts.get(custodyPkey.toString());
|
40
55
|
if ((custody === null || custody === void 0 ? void 0 : custody.mint) === solana_1.usdcSolanaMint)
|
41
56
|
rewardPerLp = Number(custody.feesStats.rewardPerLpStaked);
|
42
57
|
});
|
43
|
-
const supAndDecimals = yield (0, fetchTokenSupplyAndDecimals_1.fetchTokenSupplyAndDecimals)(pool.flpMint, client);
|
44
|
-
const mint = pool.flpMint.toString();
|
45
|
-
if (!supAndDecimals)
|
46
|
-
continue;
|
47
|
-
const { supply, decimals } = supAndDecimals;
|
48
|
-
const price = pool.aumUsd
|
49
|
-
.dividedBy(Math.pow(10, decimals))
|
50
|
-
.dividedBy(supply)
|
51
|
-
.toNumber();
|
52
|
-
yield cache.setTokenPriceSource({
|
53
|
-
address: mint,
|
54
|
-
decimals,
|
55
|
-
id: constants_1.poolsPkeys[i].toString(),
|
56
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
57
|
-
platformId: constants_2.walletTokensPlatform.id,
|
58
|
-
price,
|
59
|
-
timestamp: Date.now(),
|
60
|
-
weight: 1,
|
61
|
-
elementName: (0, solana_1.u8ArrayToString)(pool.name),
|
62
|
-
});
|
63
58
|
if (!rewardPerLp)
|
64
59
|
continue;
|
65
60
|
poolsInfo.push({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"poolJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flash/poolJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,iDAAsD;AACtD,
|
1
|
+
{"version":3,"file":"poolJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flash/poolJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,iDAAsD;AACtD,2CAA6E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AE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -19,7 +19,6 @@ const solana_1 = require("../../utils/solana");
|
|
19
19
|
const structs_1 = require("./structs");
|
20
20
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
21
21
|
const helpers_1 = require("./helpers");
|
22
|
-
const constants_2 = require("../jupiter/exchange/constants");
|
23
22
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
24
23
|
const client = (0, clients_1.getClientSolana)();
|
25
24
|
const stakeAccounts = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.flpStakeStruct, (0, helpers_1.getPdas)(owner));
|
@@ -31,7 +30,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
31
30
|
});
|
32
31
|
if (!poolsInfo)
|
33
32
|
return [];
|
34
|
-
const custodiesInfo = yield cache.getItem(
|
33
|
+
const custodiesInfo = yield cache.getItem(constants_1.custodiesKey, {
|
35
34
|
prefix: constants_1.platformId,
|
36
35
|
networkId: portfolio_core_1.NetworkId.solana,
|
37
36
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stakeFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flash/stakeFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AAGpC,
|
1
|
+
{"version":3,"file":"stakeFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flash/stakeFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AAGpC,2CAAiE;AACjE,iDAAsD;AACtD,+CAG4B;AAC5B,uCAA2C;AAC3C,qGAA6E;A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AAE,IACjC,CAAC;QAEL,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YACrB,QAAQ,CAAC,IAAI,CAAC;gBACZ,SAAS,EAAE,0BAAS,CAAC,MAAM;gBAC3B,KAAK,EAAE,QAAQ;gBACf,UAAU,EAAV,sBAAU;gBACV,IAAI,EAAE,qCAAoB,CAAC,QAAQ;gBACnC,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACzD,IAAI,EAAE;oBACJ,MAAM;iBACP;aACF,CAAC,CAAC;IACP,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function snakeCase(string: string): string;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.snakeCase = void 0;
|
4
|
+
function snakeCase(string) {
|
5
|
+
return string
|
6
|
+
.replace(/\W+/g, ' ')
|
7
|
+
.split(/ |\B(?=[A-Z])/)
|
8
|
+
.map((word) => word.toLowerCase())
|
9
|
+
.join('_');
|
10
|
+
}
|
11
|
+
exports.snakeCase = snakeCase;
|
12
|
+
//# sourceMappingURL=snakeCase.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"snakeCase.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/misc/snakeCase.ts"],"names":[],"mappings":";;;AAAA,SAAgB,SAAS,CAAC,MAAc;IACtC,OAAO,MAAM;SACV,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,KAAK,CAAC,eAAe,CAAC;SACtB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;SACjC,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAND,8BAMC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.anchorSighash = void 0;
|
4
|
+
const js_sha256_1 = require("js-sha256");
|
5
|
+
const snakeCase_1 = require("../misc/snakeCase");
|
6
|
+
function anchorSighash(nameSpace, ixName) {
|
7
|
+
const name = (0, snakeCase_1.snakeCase)(ixName);
|
8
|
+
const preimage = `${nameSpace}:${name}`;
|
9
|
+
return Buffer.from(js_sha256_1.sha256.digest(preimage)).subarray(0, 8);
|
10
|
+
}
|
11
|
+
exports.anchorSighash = anchorSighash;
|
12
|
+
//# sourceMappingURL=anchorSighash.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"anchorSighash.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/anchorSighash.ts"],"names":[],"mappings":";;;AAAA,yCAAmC;AACnC,iDAA8C;AAE9C,SAAgB,aAAa,CAAC,SAAiB,EAAE,MAAc;IAC7D,MAAM,IAAI,GAAG,IAAA,qBAAS,EAAC,MAAM,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,kBAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC7D,CAAC;AAJD,sCAIC"}
|
@@ -8,3 +8,4 @@ export declare const associatedTokenProgramId: PublicKey;
|
|
8
8
|
export declare const usdcSolanaMint = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
9
9
|
export declare const usdcSolanaDecimals = 6;
|
10
10
|
export declare const usdcSolanaFactor: BigNumber;
|
11
|
+
export declare const emptyWithSol = "empty11111111111111111111111111111111111111";
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.usdcSolanaFactor = exports.usdcSolanaDecimals = exports.usdcSolanaMint = exports.associatedTokenProgramId = exports.solanaToken2022PidPk = exports.solanaToken2022Pid = exports.solanaTokenPidPk = exports.solanaTokenPid = void 0;
|
6
|
+
exports.emptyWithSol = exports.usdcSolanaFactor = exports.usdcSolanaDecimals = exports.usdcSolanaMint = exports.associatedTokenProgramId = exports.solanaToken2022PidPk = exports.solanaToken2022Pid = exports.solanaTokenPidPk = exports.solanaTokenPid = void 0;
|
7
7
|
const web3_js_1 = require("@solana/web3.js");
|
8
8
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
9
9
|
exports.solanaTokenPid = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
@@ -14,4 +14,5 @@ exports.associatedTokenProgramId = new web3_js_1.PublicKey('ATokenGPvbdGVxr1b2hv
|
|
14
14
|
exports.usdcSolanaMint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v';
|
15
15
|
exports.usdcSolanaDecimals = 6;
|
16
16
|
exports.usdcSolanaFactor = new bignumber_js_1.default(Math.pow(10, 6));
|
17
|
+
exports.emptyWithSol = 'empty11111111111111111111111111111111111111';
|
17
18
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/constants.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;AAC5C,gEAAqC;AAExB,QAAA,cAAc,GAAG,6CAA6C,CAAC;AAC/D,QAAA,gBAAgB,GAAG,IAAI,mBAAS,CAAC,sBAAc,CAAC,CAAC;AAEjD,QAAA,kBAAkB,GAAG,6CAA6C,CAAC;AACnE,QAAA,oBAAoB,GAAG,IAAI,mBAAS,CAAC,0BAAkB,CAAC,CAAC;AAEzD,QAAA,wBAAwB,GAAG,IAAI,mBAAS,CACnD,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,8CAA8C,CAAC;AAChE,QAAA,kBAAkB,GAAG,CAAC,CAAC;AACvB,QAAA,gBAAgB,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,CAAC,CAAA,CAAC,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/constants.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;AAC5C,gEAAqC;AAExB,QAAA,cAAc,GAAG,6CAA6C,CAAC;AAC/D,QAAA,gBAAgB,GAAG,IAAI,mBAAS,CAAC,sBAAc,CAAC,CAAC;AAEjD,QAAA,kBAAkB,GAAG,6CAA6C,CAAC;AACnE,QAAA,oBAAoB,GAAG,IAAI,mBAAS,CAAC,0BAAkB,CAAC,CAAC;AAEzD,QAAA,wBAAwB,GAAG,IAAI,mBAAS,CACnD,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,8CAA8C,CAAC;AAChE,QAAA,kBAAkB,GAAG,CAAC,CAAC;AACvB,QAAA,gBAAgB,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,CAAC,CAAA,CAAC,CAAC;AAC1C,QAAA,YAAY,GAAG,6CAA6C,CAAC"}
|