@sonarwatch/portfolio-plugins 0.14.60 → 0.14.61
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 +4 -0
- package/package.json +1 -1
- package/src/plugins/adrena/constants.js +1 -1
- package/src/plugins/adrena/constants.js.map +1 -1
- package/src/plugins/bluefin/constants.js +1 -1
- package/src/plugins/bluefin/constants.js.map +1 -1
- package/src/plugins/deepbook/constants.js +1 -1
- package/src/plugins/deepbook/constants.js.map +1 -1
- package/src/plugins/drift-market-maker-vault/index.js +1 -0
- package/src/plugins/drift-market-maker-vault/index.js.map +1 -1
- package/src/plugins/solayer/constants.js +1 -1
- package/src/plugins/solayer/constants.js.map +1 -1
- package/src/plugins/switchboard/helpers/getSwitchboardOnDemandPrice.d.ts +3 -0
- package/src/plugins/switchboard/helpers/getSwitchboardOnDemandPrice.js +43 -0
- package/src/plugins/switchboard/helpers/getSwitchboardOnDemandPrice.js.map +1 -0
- package/src/plugins/switchboard/helpers/getSwitchboardOnDemandPrices.d.ts +3 -0
- package/src/plugins/switchboard/helpers/getSwitchboardOnDemandPrices.js +32 -0
- package/src/plugins/switchboard/helpers/getSwitchboardOnDemandPrices.js.map +1 -0
- package/src/plugins/switchboard/index.js +2 -1
- package/src/plugins/switchboard/index.js.map +1 -1
- package/src/plugins/switchboard/onDemandPricingJob.d.ts +3 -0
- package/src/plugins/switchboard/onDemandPricingJob.js +67 -0
- package/src/plugins/switchboard/onDemandPricingJob.js.map +1 -0
- package/src/plugins/switchboard/types.d.ts +6 -0
- package/src/plugins/switchboard/types.js +3 -0
- package/src/plugins/switchboard/types.js.map +1 -0
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.61](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.60...plugins-0.14.61) (2024-12-09)
|
6
|
+
|
7
|
+
|
8
|
+
|
5
9
|
## [0.14.60](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.59...plugins-0.14.60) (2024-12-09)
|
6
10
|
|
7
11
|
|
package/package.json
CHANGED
@@ -9,7 +9,7 @@ exports.platform = {
|
|
9
9
|
image: 'https://sonar.watch/img/platforms/adrena.webp',
|
10
10
|
website: 'https://app.adrena.xyz/',
|
11
11
|
twitter: 'https://x.com/AdrenaProtocol',
|
12
|
-
defiLlamaId: 'adrena', // from https://defillama.com/docs/api
|
12
|
+
defiLlamaId: 'adrena-protocol', // from https://defillama.com/docs/api
|
13
13
|
};
|
14
14
|
exports.custodiesCacheKey = `custodies`;
|
15
15
|
exports.pid = new web3_js_1.PublicKey('13gDzEXCdocbj8iAiqrScGo47NiSuYENGsRqi3SEAwet');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/adrena/constants.ts"],"names":[],"mappings":";;;AACA,6CAA4C;AAE/B,QAAA,UAAU,GAAG,QAAQ,CAAC;AACtB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,+CAA+C;IACtD,OAAO,EAAE,yBAAyB;IAClC,OAAO,EAAE,8BAA8B;IACvC,WAAW,EAAE,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/adrena/constants.ts"],"names":[],"mappings":";;;AACA,6CAA4C;AAE/B,QAAA,UAAU,GAAG,QAAQ,CAAC;AACtB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,+CAA+C;IACtD,OAAO,EAAE,yBAAyB;IAClC,OAAO,EAAE,8BAA8B;IACvC,WAAW,EAAE,iBAAiB,EAAE,sCAAsC;CACvE,CAAC;AAEW,QAAA,iBAAiB,GAAG,WAAW,CAAC;AAChC,QAAA,GAAG,GAAG,IAAI,mBAAS,CAC9B,8CAA8C,CAC/C,CAAC;AACW,QAAA,OAAO,GAAG,8CAA8C,CAAC;AACzD,QAAA,OAAO,GAAG,8CAA8C,CAAC"}
|
@@ -6,7 +6,7 @@ exports.platform = {
|
|
6
6
|
id: exports.platformId,
|
7
7
|
name: 'Bluefin',
|
8
8
|
image: 'https://sonar.watch/img/platforms/bluefin.webp',
|
9
|
-
defiLlamaId: 'bluefin', // from https://defillama.com/docs/api
|
9
|
+
defiLlamaId: 'parent#bluefin', // from https://defillama.com/docs/api
|
10
10
|
website: 'https://trade.bluefin.io/',
|
11
11
|
twitter: 'https://x.com/bluefinapp',
|
12
12
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluefin/constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,gDAAgD;IACvD,WAAW,EAAE,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluefin/constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,gDAAgD;IACvD,WAAW,EAAE,gBAAgB,EAAE,sCAAsC;IACrE,OAAO,EAAE,2BAA2B;IACpC,OAAO,EAAE,0BAA0B;CACpC,CAAC;AAEW,QAAA,cAAc,GAAmB;IAC5C,SAAS,EAAE,kCAAkC;IAC7C,WAAW,EAAE,2BAA2B;IACxC,WAAW,EAAE,gBAAQ,CAAC,IAAI;IAC1B,EAAE,EAAE,iBAAiB;IACrB,KAAK,EAAE,gDAAgD;IACvD,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,SAAS;CACtB,CAAC;AAEW,QAAA,QAAQ,GAAG,SAAS,CAAC;AAErB,QAAA,UAAU,GACrB,2EAA2E,CAAC;AAEjE,QAAA,SAAS,GACpB,oEAAoE,CAAC;AAE1D,QAAA,YAAY,GACvB,oEAAoE,CAAC;AAE1D,QAAA,OAAO,GAAG,MAAM,CAAC;AACjB,QAAA,eAAe,GAAG,iBAAiB,CAAC;AAEpC,QAAA,OAAO,GAAG,2CAA2C,CAAC;AAEtD,QAAA,aAAa,GAAG,aAAa,CAAC;AAC9B,QAAA,wBAAwB,GAAG,yFAAyF,CAAC;AACrH,QAAA,eAAe,GAAG,wDAAwD,CAAC;AAC3E,QAAA,oBAAoB,GAC/B,wFAAwF,CAAC;AAC9E,QAAA,WAAW,GACtB,oEAAoE,CAAC"}
|
@@ -8,7 +8,7 @@ exports.platform = {
|
|
8
8
|
image: 'https://sonar.watch/img/platforms/deepbook.webp',
|
9
9
|
website: 'https://deepbook.tech/',
|
10
10
|
twitter: 'https://x.com/DeepBookonSui',
|
11
|
-
defiLlamaId: 'deepbook', // from https://defillama.com/docs/api
|
11
|
+
defiLlamaId: 'parent#deepbook', // from https://defillama.com/docs/api
|
12
12
|
};
|
13
13
|
exports.airdropStatics = {
|
14
14
|
emitterLink: 'https://deepbook.tech',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/deepbook/constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,iDAAiD;IACxD,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,6BAA6B;IACtC,WAAW,EAAE,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/deepbook/constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,iDAAiD;IACxD,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,6BAA6B;IACtC,WAAW,EAAE,iBAAiB,EAAE,sCAAsC;CACvE,CAAC;AACW,QAAA,cAAc,GAAmB;IAC5C,WAAW,EAAE,uBAAuB;IACpC,SAAS,EAAE,8BAA8B;IACzC,WAAW,EAAE,UAAU;IACvB,EAAE,EAAE,GAAG,kBAAU,eAAe;IAChC,KAAK,EAAE,iDAAiD;IACxD,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,aAAa;CAC1B,CAAC;AAEW,QAAA,QAAQ,GACnB,gFAAgF,CAAC;AACtE,QAAA,YAAY,GAAG,CAAC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift-market-maker-vault/index.ts"],"names":[],"mappings":";;;;;;AAGA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift-market-maker-vault/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAOqB;AACrB,wEAAgD;AAChD,4DAAoC;AAEvB,QAAA,SAAS,GAAe;IACnC,2BAAe;IACf,yBAAa;IACb,2BAAe;IACf,4BAAgB;IAChB,yBAAa;IACb,0BAAc;CACf,CAAC;AACW,QAAA,IAAI,GAAU,CAAC,mBAAS,CAAC,CAAC;AAC1B,QAAA,QAAQ,GAAc,CAAC,yBAAe,CAAC,CAAC"}
|
@@ -9,7 +9,7 @@ exports.platform = {
|
|
9
9
|
image: 'https://sonar.watch/img/platforms/solayer.webp',
|
10
10
|
website: 'https://solayer.org/',
|
11
11
|
twitter: 'https://x.com/solayer_labs',
|
12
|
-
defiLlamaId: 'solayer',
|
12
|
+
defiLlamaId: 'parent#solayer',
|
13
13
|
};
|
14
14
|
exports.programId = new web3_js_1.PublicKey('sSo1iU21jBrU9VaJ8PJib1MtorefUV4fzC9GURa2KNn');
|
15
15
|
// export const stakePoolProgramId = 'SPoo1Ku8WFXoNDMHPsrGSTSG1Y47rzgn41SLUNakuHy'
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solayer/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,gDAAgD;IACvD,OAAO,EAAE,sBAAsB;IAC/B,OAAO,EAAE,4BAA4B;IACrC,WAAW,EAAE,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solayer/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,gDAAgD;IACvD,OAAO,EAAE,sBAAsB;IAC/B,OAAO,EAAE,4BAA4B;IACrC,WAAW,EAAE,gBAAgB;CAC9B,CAAC;AAEW,QAAA,SAAS,GAAG,IAAI,mBAAS,CACpC,6CAA6C,CAC9C,CAAC;AAEF,kFAAkF;AACrE,QAAA,cAAc,GAAG,6CAA6C,CAAC;AAC/D,QAAA,cAAc,GAAG,6CAA6C,CAAC;AAC/D,QAAA,cAAc,GAAG,6CAA6C,CAAC;AAC/D,QAAA,kBAAkB,GAAG,CAAC,CAAC;AAEvB,QAAA,SAAS,GAAG;IACvB,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,8CAA8C;CAC/C,CAAC"}
|
@@ -0,0 +1,43 @@
|
|
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
|
+
exports.getSwitchboardOnDemandPrices = void 0;
|
16
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
|
+
const structs_1 = require("../structs");
|
18
|
+
const getMultipleAccountsInfoSafe_1 = require("../../../utils/solana/getMultipleAccountsInfoSafe");
|
19
|
+
const SB_PRECISION = new bignumber_js_1.default(Math.pow(10, 18));
|
20
|
+
function getSwitchboardOnDemandPrices(client, onDemandPubkeys) {
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
22
|
+
const slot = yield client.getSlot();
|
23
|
+
const prices = [];
|
24
|
+
const accounts = yield (0, getMultipleAccountsInfoSafe_1.getMultipleAccountsInfoSafe)(client, onDemandPubkeys);
|
25
|
+
for (const account of accounts) {
|
26
|
+
if (!account) {
|
27
|
+
prices.push(undefined);
|
28
|
+
continue;
|
29
|
+
}
|
30
|
+
const [pullFeedAccountData] = structs_1.pullFeedAccountDataStruct.deserialize(account.data);
|
31
|
+
// If the data is more than ~15 minutes old (1 slot = 400ms), dismiss it
|
32
|
+
if (pullFeedAccountData.result.slot.isLessThan(slot - 60 * 10 * 2.5)) {
|
33
|
+
prices.push(undefined);
|
34
|
+
}
|
35
|
+
else {
|
36
|
+
prices.push(pullFeedAccountData.result.value.dividedBy(SB_PRECISION).toNumber());
|
37
|
+
}
|
38
|
+
}
|
39
|
+
return prices;
|
40
|
+
});
|
41
|
+
}
|
42
|
+
exports.getSwitchboardOnDemandPrices = getSwitchboardOnDemandPrices;
|
43
|
+
//# sourceMappingURL=getSwitchboardOnDemandPrice.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getSwitchboardOnDemandPrice.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/switchboard/helpers/getSwitchboardOnDemandPrice.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,gEAAqC;AACrC,wCAAuD;AACvD,mGAAgG;AAGhG,MAAM,YAAY,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,EAAE,CAAA,CAAC,CAAC;AAE7C,SAAsB,4BAA4B,CAChD,MAAoB,EACpB,eAA4B;;QAE5B,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QAEpC,MAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,MAAM,QAAQ,GAAG,MAAM,IAAA,yDAA2B,EAAC,MAAM,EAAE,eAAe,CAAC,CAAC;QAE5E,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBACvB,SAAS;YACX,CAAC;YAED,MAAM,CAAC,mBAAmB,CAAC,GAAG,mCAAyB,CAAC,WAAW,CACjE,OAAO,CAAC,IAAI,CACb,CAAC;YAEF,wEAAwE;YACxE,IAAI,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC;gBACrE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACzB,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,CACT,mBAAmB,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CACpE,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AA9BD,oEA8BC"}
|
@@ -0,0 +1,32 @@
|
|
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
|
+
exports.getSwitchboardOnDemandPrice = void 0;
|
16
|
+
const bn_js_1 = __importDefault(require("bn.js"));
|
17
|
+
const toBN_1 = require("../../../utils/misc/toBN");
|
18
|
+
const structs_1 = require("../structs");
|
19
|
+
const constants_1 = require("../../drift/perpHelpers/constants");
|
20
|
+
const SB_PRECISION_EXP = new bn_js_1.default(18);
|
21
|
+
const SB_PRECISION = new bn_js_1.default(10).pow(SB_PRECISION_EXP.sub(constants_1.PRICE_PRECISION_EXP));
|
22
|
+
function getSwitchboardOnDemandPrice(client, onDemandPubkey) {
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
24
|
+
const account = yield client.getAccountInfo(onDemandPubkey);
|
25
|
+
if (!account)
|
26
|
+
return undefined;
|
27
|
+
const [pullFeedAccountData] = structs_1.pullFeedAccountDataStruct.deserialize(account.data);
|
28
|
+
return (0, toBN_1.toBN)(pullFeedAccountData.result.value).div(SB_PRECISION).toNumber();
|
29
|
+
});
|
30
|
+
}
|
31
|
+
exports.getSwitchboardOnDemandPrice = getSwitchboardOnDemandPrice;
|
32
|
+
//# sourceMappingURL=getSwitchboardOnDemandPrices.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getSwitchboardOnDemandPrices.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/switchboard/helpers/getSwitchboardOnDemandPrices.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAuB;AAEvB,mDAAgD;AAChD,wCAAuD;AACvD,iEAAwE;AAGxE,MAAM,gBAAgB,GAAG,IAAI,eAAE,CAAC,EAAE,CAAC,CAAC;AACpC,MAAM,YAAY,GAAG,IAAI,eAAE,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,+BAAmB,CAAC,CAAC,CAAC;AAE/E,SAAsB,2BAA2B,CAC/C,MAAoB,EACpB,cAAyB;;QAEzB,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAC5D,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAE/B,MAAM,CAAC,mBAAmB,CAAC,GAAG,mCAAyB,CAAC,WAAW,CACjE,OAAO,CAAC,IAAI,CACb,CAAC;QAEF,OAAO,IAAA,WAAI,EAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC7E,CAAC;CAAA;AAZD,kEAYC"}
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.fetchers = exports.jobs = void 0;
|
7
7
|
const pricingJob_1 = __importDefault(require("./pricingJob"));
|
8
|
-
|
8
|
+
const onDemandPricingJob_1 = __importDefault(require("./onDemandPricingJob"));
|
9
|
+
exports.jobs = [pricingJob_1.default, onDemandPricingJob_1.default];
|
9
10
|
exports.fetchers = [];
|
10
11
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/switchboard/index.ts"],"names":[],"mappings":";;;;;;AAEA,8DAAsC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/switchboard/index.ts"],"names":[],"mappings":";;;;;;AAEA,8DAAsC;AACtC,8EAAsD;AAEzC,QAAA,IAAI,GAAU,CAAC,oBAAU,EAAE,4BAAkB,CAAC,CAAC;AAC/C,QAAA,QAAQ,GAAc,EAAE,CAAC"}
|
@@ -0,0 +1,67 @@
|
|
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 constants_2 = require("../tokens/constants");
|
17
|
+
const getSwitchboardOnDemandPrice_1 = require("./helpers/getSwitchboardOnDemandPrice");
|
18
|
+
const getCachedDecimalsForToken_1 = require("../../utils/misc/getCachedDecimalsForToken");
|
19
|
+
const solana_1 = require("../../utils/solana");
|
20
|
+
const feedsToFetch = [
|
21
|
+
{
|
22
|
+
feedsAddresses: [
|
23
|
+
'Ceveqpim1FJZfx9DPeFDVDSz2HJavUqPPEJtZ2osNEmS',
|
24
|
+
'E8TLLh5jkYDvSXfAES7qe3s8Cfjj4hyvjksuvUHe8NEw',
|
25
|
+
'BSzfJs4d1tAkSDqkepnfzEVcx2WtDVnwwXa2giy9PLeP',
|
26
|
+
],
|
27
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
28
|
+
mintAddress: portfolio_core_1.solanaNativeWrappedAddress,
|
29
|
+
},
|
30
|
+
{
|
31
|
+
feedsAddresses: ['2Dv72h14k6ynrUvQ8mhu5ihwrk1Kte6Aj2tpKhXLsHrR'],
|
32
|
+
mintAddress: solana_1.usdcSolanaMint,
|
33
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
34
|
+
},
|
35
|
+
];
|
36
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
37
|
+
const connection = (0, clients_1.getClientSolana)();
|
38
|
+
const sources = [];
|
39
|
+
for (const tokenInfo of feedsToFetch) {
|
40
|
+
const values = yield (0, getSwitchboardOnDemandPrice_1.getSwitchboardOnDemandPrices)(connection, tokenInfo.feedsAddresses.map((t) => new web3_js_1.PublicKey(t)));
|
41
|
+
const decimals = yield (0, getCachedDecimalsForToken_1.getDecimalsForToken)(tokenInfo.mintAddress, portfolio_core_1.NetworkId.solana);
|
42
|
+
tokenInfo.feedsAddresses.forEach((feedToFetch, i) => {
|
43
|
+
const price = values.at(i);
|
44
|
+
if (!price || !decimals)
|
45
|
+
return;
|
46
|
+
const source = {
|
47
|
+
address: tokenInfo.mintAddress,
|
48
|
+
decimals,
|
49
|
+
id: `${constants_1.platformId}-feed-${feedToFetch.toString()}`,
|
50
|
+
networkId: tokenInfo.networkId,
|
51
|
+
platformId: constants_2.walletTokensPlatform.id,
|
52
|
+
weight: 0.8,
|
53
|
+
timestamp: Date.now(),
|
54
|
+
price,
|
55
|
+
};
|
56
|
+
sources.push(source);
|
57
|
+
});
|
58
|
+
}
|
59
|
+
yield cache.setTokenPriceSources(sources);
|
60
|
+
});
|
61
|
+
const job = {
|
62
|
+
id: `${constants_1.platformId}-ondemand-pricing`,
|
63
|
+
executor,
|
64
|
+
label: 'realtime',
|
65
|
+
};
|
66
|
+
exports.default = job;
|
67
|
+
//# sourceMappingURL=onDemandPricingJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"onDemandPricingJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/switchboard/onDemandPricingJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAIoC;AACpC,6CAA4C;AAG5C,2CAAyC;AACzC,iDAAsD;AACtD,mDAA2D;AAC3D,uFAAqF;AACrF,0FAAiF;AAEjF,+CAAoD;AAEpD,MAAM,YAAY,GAAkC;IAClD;QACE,cAAc,EAAE;YACd,8CAA8C;YAC9C,8CAA8C;YAC9C,8CAA8C;SAC/C;QACD,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,WAAW,EAAE,2CAA0B;KACxC;IACD;QACE,cAAc,EAAE,CAAC,8CAA8C,CAAC;QAChE,WAAW,EAAE,uBAAc;QAC3B,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B;CACF,CAAC;AAEF,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IACrC,MAAM,OAAO,GAAuB,EAAE,CAAC;IAEvC,KAAK,MAAM,SAAS,IAAI,YAAY,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,MAAM,IAAA,0DAA4B,EAC/C,UAAU,EACV,SAAS,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,mBAAS,CAAC,CAAC,CAAC,CAAC,CACtD,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAA,+CAAmB,EACxC,SAAS,CAAC,WAAW,EACrB,0BAAS,CAAC,MAAM,CACjB,CAAC;QAEF,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE;YAClD,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YAC3B,IAAI,CAAC,KAAK,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAEhC,MAAM,MAAM,GAAqB;gBAC/B,OAAO,EAAE,SAAS,CAAC,WAAW;gBAC9B,QAAQ;gBACR,EAAE,EAAE,GAAG,sBAAU,SAAS,WAAW,CAAC,QAAQ,EAAE,EAAE;gBAClD,SAAS,EAAE,SAAS,CAAC,SAAS;gBAC9B,UAAU,EAAE,gCAAoB,CAAC,EAAE;gBACnC,MAAM,EAAE,GAAG;gBACX,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,KAAK;aACN,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,mBAAmB;IACpC,QAAQ;IACR,KAAK,EAAE,UAAU;CAClB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/switchboard/types.ts"],"names":[],"mappings":""}
|