@sonarwatch/portfolio-plugins 0.11.164 → 0.11.166
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +8 -0
- package/package.json +2 -2
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/plugins/drift/constants.d.ts +1 -0
- package/src/plugins/drift/constants.js +2 -1
- package/src/plugins/drift/constants.js.map +1 -1
- package/src/plugins/drift/index.js +2 -1
- package/src/plugins/drift/index.js.map +1 -1
- package/src/plugins/drift/premarketJob.d.ts +3 -0
- package/src/plugins/drift/premarketJob.js +52 -0
- package/src/plugins/drift/premarketJob.js.map +1 -0
- package/src/plugins/drift/struct.d.ts +150 -0
- package/src/plugins/drift/struct.js +149 -1
- package/src/plugins/drift/struct.js.map +1 -1
- package/src/plugins/drift/types.d.ts +4 -0
- package/src/plugins/kamino/airdropFetcher.d.ts +3 -0
- package/src/plugins/kamino/airdropFetcher.js +76 -0
- package/src/plugins/kamino/airdropFetcher.js.map +1 -0
- package/src/plugins/kamino/constants.d.ts +2 -0
- package/src/plugins/kamino/constants.js +3 -1
- package/src/plugins/kamino/constants.js.map +1 -1
- package/src/plugins/kamino/helpers/common.d.ts +6 -0
- package/src/plugins/kamino/helpers/common.js +21 -1
- package/src/plugins/kamino/helpers/common.js.map +1 -1
- package/src/plugins/kamino/index.js +2 -1
- package/src/plugins/kamino/index.js.map +1 -1
- package/src/plugins/nosana/constants.d.ts +7 -0
- package/src/plugins/nosana/constants.js +17 -0
- package/src/plugins/nosana/constants.js.map +1 -0
- package/src/plugins/nosana/helpers.d.ts +2 -0
- package/src/plugins/nosana/helpers.js +14 -0
- package/src/plugins/nosana/helpers.js.map +1 -0
- package/src/plugins/nosana/index.d.ts +6 -0
- package/src/plugins/nosana/index.js +12 -0
- package/src/plugins/nosana/index.js.map +1 -0
- package/src/plugins/nosana/stakingFetcher.d.ts +3 -0
- package/src/plugins/nosana/stakingFetcher.js +56 -0
- package/src/plugins/nosana/stakingFetcher.js.map +1 -0
- package/src/plugins/nosana/structs.d.ts +15 -0
- package/src/plugins/nosana/structs.js +17 -0
- package/src/plugins/nosana/structs.js.map +1 -0
- package/src/plugins/raydium/constants.d.ts +3 -0
- package/src/plugins/raydium/constants.js +4 -1
- package/src/plugins/raydium/constants.js.map +1 -1
- package/src/plugins/raydium/filters.d.ts +1 -0
- package/src/plugins/raydium/filters.js +11 -1
- package/src/plugins/raydium/filters.js.map +1 -1
- package/src/plugins/raydium/helpers.d.ts +2 -0
- package/src/plugins/raydium/helpers.js +10 -1
- package/src/plugins/raydium/helpers.js.map +1 -1
- package/src/plugins/raydium/index.js +2 -1
- package/src/plugins/raydium/index.js.map +1 -1
- package/src/plugins/raydium/stakingFetcher.d.ts +3 -0
- package/src/plugins/raydium/stakingFetcher.js +50 -0
- package/src/plugins/raydium/stakingFetcher.js.map +1 -0
- package/src/plugins/raydium/structs/staking.d.ts +12 -0
- package/src/plugins/raydium/structs/staking.js +15 -0
- package/src/plugins/raydium/structs/staking.js.map +1 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const constants_2 = require("../drift/constants");
|
19
|
+
const common_1 = require("./helpers/common");
|
20
|
+
const oneDayInMs = 1 * 24 * 60 * 60 * 1000;
|
21
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
22
|
+
const premarketPrice = yield cache.getItem(`${constants_2.preMarketPriceKey}-KMNO`, { prefix: constants_2.driftPlatform.id, networkId: portfolio_core_1.NetworkId.solana });
|
23
|
+
if (!premarketPrice)
|
24
|
+
return [];
|
25
|
+
const cachedAllocation = yield cache.getItem(owner, {
|
26
|
+
prefix: constants_1.allocationPrefix,
|
27
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
28
|
+
});
|
29
|
+
let amount = new bignumber_js_1.default(0);
|
30
|
+
if (cachedAllocation) {
|
31
|
+
amount = amount.plus(cachedAllocation);
|
32
|
+
}
|
33
|
+
else {
|
34
|
+
const allocations = yield (0, common_1.getAllocationsBySeason)(owner, 1);
|
35
|
+
if (allocations) {
|
36
|
+
amount = allocations
|
37
|
+
.map((alloc) => new bignumber_js_1.default(alloc.quantity))
|
38
|
+
.reduce((alloc, sum) => sum.plus(alloc), new bignumber_js_1.default(0));
|
39
|
+
yield cache.setItem(owner, amount.toNumber(), {
|
40
|
+
prefix: constants_1.allocationPrefix,
|
41
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
42
|
+
ttl: oneDayInMs,
|
43
|
+
});
|
44
|
+
}
|
45
|
+
}
|
46
|
+
if (amount.isZero())
|
47
|
+
return [];
|
48
|
+
const asset = {
|
49
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
50
|
+
type: 'generic',
|
51
|
+
value: amount.times(premarketPrice).toNumber(),
|
52
|
+
data: {
|
53
|
+
name: 'KMNO',
|
54
|
+
amount: amount.toNumber(),
|
55
|
+
},
|
56
|
+
attributes: { isClaimable: false },
|
57
|
+
};
|
58
|
+
return [
|
59
|
+
{
|
60
|
+
value: asset.value,
|
61
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
62
|
+
platformId: constants_1.platformId,
|
63
|
+
name: 'Season 1 Allocation',
|
64
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
65
|
+
label: 'Rewards',
|
66
|
+
data: { assets: [asset] },
|
67
|
+
},
|
68
|
+
];
|
69
|
+
});
|
70
|
+
const fetcher = {
|
71
|
+
id: `${constants_1.platformId}-airdrop`,
|
72
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
73
|
+
executor,
|
74
|
+
};
|
75
|
+
exports.default = fetcher;
|
76
|
+
//# sourceMappingURL=airdropFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"airdropFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kamino/airdropFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,gEAAqC;AAGrC,2CAA2D;AAC3D,kDAAsE;AACtE,6CAA0D;AAE1D,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE3C,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,OAAO,CACxC,GAAG,6BAAiB,OAAO,EAC3B,EAAE,MAAM,EAAE,yBAAa,CAAC,EAAE,EAAE,SAAS,EAAE,0BAAS,CAAC,MAAM,EAAE,CAC1D,CAAC;IACF,IAAI,CAAC,cAAc;QAAE,OAAO,EAAE,CAAC;IAE/B,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAAC,OAAO,CAAS,KAAK,EAAE;QAC1D,MAAM,EAAE,4BAAgB;QACxB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IAEH,IAAI,MAAM,GAAG,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,gBAAgB,EAAE,CAAC;QACrB,M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C3B,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE;SAC1B;KACF,CAAC;AACJ,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"}
|
@@ -4,6 +4,8 @@ import { LendingMarketConfig } from './types';
|
|
4
4
|
export declare const platformId = "kamino";
|
5
5
|
export declare const kaminoPlatform: Platform;
|
6
6
|
export declare const programId: PublicKey;
|
7
|
+
export declare const allocationApiUrl = "https://api.hubbleprotocol.io/v2/airdrop/users/";
|
8
|
+
export declare const allocationPrefix = "kamino/allocation";
|
7
9
|
export declare const klendProgramId: PublicKey;
|
8
10
|
export declare const farmProgramId: PublicKey;
|
9
11
|
export declare const farmsKey = "farms";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.reservesKey = exports.marketsKey = exports.lendingConfigs = exports.mainMarket = exports.farmsKey = exports.farmProgramId = exports.klendProgramId = exports.programId = exports.kaminoPlatform = exports.platformId = void 0;
|
3
|
+
exports.reservesKey = exports.marketsKey = exports.lendingConfigs = exports.mainMarket = exports.farmsKey = exports.farmProgramId = exports.klendProgramId = exports.allocationPrefix = exports.allocationApiUrl = exports.programId = exports.kaminoPlatform = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
exports.platformId = 'kamino';
|
6
6
|
exports.kaminoPlatform = {
|
@@ -11,6 +11,8 @@ exports.kaminoPlatform = {
|
|
11
11
|
defiLlamaId: 'parent#kamino-finance',
|
12
12
|
};
|
13
13
|
exports.programId = new web3_js_1.PublicKey('6LtLpnUFNByNXLyCoK9wA2MykKAmQNZKBdY8s47dehDc');
|
14
|
+
exports.allocationApiUrl = 'https://api.hubbleprotocol.io/v2/airdrop/users/';
|
15
|
+
exports.allocationPrefix = `${exports.platformId}/allocation`;
|
14
16
|
exports.klendProgramId = new web3_js_1.PublicKey('KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD');
|
15
17
|
exports.farmProgramId = new web3_js_1.PublicKey('FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr');
|
16
18
|
exports.farmsKey = 'farms';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kamino/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAI/B,QAAA,UAAU,GAAG,QAAQ,CAAC;AACtB,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,qCAAqC,kBAAU,MAAM;IAC5D,OAAO,EAAE,yBAAyB;IAClC,WAAW,EAAE,uBAAuB;CACrC,CAAC;AACW,QAAA,SAAS,GAAG,IAAI,mBAAS,CACpC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,6CAA6C,CAC9C,CAAC;AACW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,8CAA8C,CAC/C,CAAC;AACW,QAAA,QAAQ,GAAG,OAAO,CAAC;AACnB,QAAA,UAAU,GAAG,8CAA8C,CAAC;AAE5D,QAAA,cAAc,GAAqC,IAAI,GAAG,CAAC;IACtE;QACE,8CAA8C;QAC9C;YACE,IAAI,EAAE,aAAa;YACnB,aAAa,EAAE;gBACb;oBACE,6CAA6C;oBAC7C,6CAA6C;iBAC9C;gBACD;oBACE,8CAA8C;oBAC9C,6CAA6C;iBAC9C;gBACD;oBACE,6CAA6C;oBAC7C,6CAA6C;iBAC9C;aACF;YACD,aAAa,EAAE;gBACb;oBACE,8CAA8C;oBAC9C,8CAA8C;iBAC/C;gBACD;oBACE,8CAA8C;oBAC9C,8CAA8C;iBAC/C;gBACD;oBACE,6CAA6C;oBAC7C,8CAA8C;iBAC/C;gBACD;oBACE,6CAA6C;oBAC7C,8CAA8C;iBAC/C;gBACD;oBACE,6CAA6C;oBAC7C,8CAA8C;iBAC/C;gBACD;oBACE,8CAA8C;oBAC9C,8CAA8C;iBAC/C;gBACD;oBACE,8CAA8C;oBAC9C,8CAA8C;iBAC/C;aACF;SACF;KACF;IACD,CAAC,8CAA8C,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;IACxE,CAAC,8CAA8C,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;CAC9E,CAAC,CAAC;AAEU,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,WAAW,GAAG,UAAU,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kamino/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAI/B,QAAA,UAAU,GAAG,QAAQ,CAAC;AACtB,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,qCAAqC,kBAAU,MAAM;IAC5D,OAAO,EAAE,yBAAyB;IAClC,WAAW,EAAE,uBAAuB;CACrC,CAAC;AACW,QAAA,SAAS,GAAG,IAAI,mBAAS,CACpC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,gBAAgB,GAC3B,iDAAiD,CAAC;AACvC,QAAA,gBAAgB,GAAG,GAAG,kBAAU,aAAa,CAAC;AAE9C,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,6CAA6C,CAC9C,CAAC;AACW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,8CAA8C,CAC/C,CAAC;AACW,QAAA,QAAQ,GAAG,OAAO,CAAC;AACnB,QAAA,UAAU,GAAG,8CAA8C,CAAC;AAE5D,QAAA,cAAc,GAAqC,IAAI,GAAG,CAAC;IACtE;QACE,8CAA8C;QAC9C;YACE,IAAI,EAAE,aAAa;YACnB,aAAa,EAAE;gBACb;oBACE,6CAA6C;oBAC7C,6CAA6C;iBAC9C;gBACD;oBACE,8CAA8C;oBAC9C,6CAA6C;iBAC9C;gBACD;oBACE,6CAA6C;oBAC7C,6CAA6C;iBAC9C;aACF;YACD,aAAa,EAAE;gBACb;oBACE,8CAA8C;oBAC9C,8CAA8C;iBAC/C;gBACD;oBACE,8CAA8C;oBAC9C,8CAA8C;iBAC/C;gBACD;oBACE,6CAA6C;oBAC7C,8CAA8C;iBAC/C;gBACD;oBACE,6CAA6C;oBAC7C,8CAA8C;iBAC/C;gBACD;oBACE,6CAA6C;oBAC7C,8CAA8C;iBAC/C;gBACD;oBACE,8CAA8C;oBAC9C,8CAA8C;iBAC/C;gBACD;oBACE,8CAA8C;oBAC9C,8CAA8C;iBAC/C;aACF;SACF;KACF;IACD,CAAC,8CAA8C,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;IACxE,CAAC,8CAA8C,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;CAC9E,CAAC,CAAC;AAEU,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,WAAW,GAAG,UAAU,CAAC"}
|
@@ -1,3 +1,9 @@
|
|
1
1
|
import { ParsedAccount } from '../../../utils/solana';
|
2
2
|
import { Reserve } from '../structs/klend';
|
3
3
|
export declare function getEchangeRate(reserve: ParsedAccount<Reserve>): number;
|
4
|
+
type Allocation = {
|
5
|
+
quantity: string;
|
6
|
+
name: string;
|
7
|
+
};
|
8
|
+
export declare function getAllocationsBySeason(owner: string, season: 1 | 2): Promise<Allocation[] | undefined>;
|
9
|
+
export {};
|
@@ -1,11 +1,22 @@
|
|
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
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
13
|
};
|
5
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.getEchangeRate = void 0;
|
15
|
+
exports.getAllocationsBySeason = exports.getEchangeRate = void 0;
|
7
16
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
|
+
const axios_1 = __importDefault(require("axios"));
|
8
18
|
const apr_1 = require("./apr");
|
19
|
+
const constants_1 = require("../constants");
|
9
20
|
const INITIAL_COLLATERAL_RATE = 1;
|
10
21
|
function getEchangeRate(reserve) {
|
11
22
|
const totalSupply = new bignumber_js_1.default((0, apr_1.getTotalSupply)(reserve.liquidity).toString());
|
@@ -18,4 +29,13 @@ function getEchangeRate(reserve) {
|
|
18
29
|
.toNumber();
|
19
30
|
}
|
20
31
|
exports.getEchangeRate = getEchangeRate;
|
32
|
+
function getAllocationsBySeason(owner, season) {
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
34
|
+
const res = yield axios_1.default
|
35
|
+
.get(`${constants_1.allocationApiUrl}${owner}/allocations?source=Season${season}`)
|
36
|
+
.catch(() => null);
|
37
|
+
return res ? res.data : undefined;
|
38
|
+
});
|
39
|
+
}
|
40
|
+
exports.getAllocationsBySeason = getAllocationsBySeason;
|
21
41
|
//# sourceMappingURL=common.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/kamino/helpers/common.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/kamino/helpers/common.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAAqC;AACrC,kDAA6C;AAG7C,+BAAuC;AACvC,4CAAgD;AAEhD,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAElC,SAAgB,cAAc,CAAC,OAA+B;IAC5D,MAAM,WAAW,GAAG,IAAI,sBAAS,CAC/B,IAAA,oBAAc,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAC7C,CAAC;IACF,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;IAC/C,IAAI,eAAe,CAAC,MAAM,EAAE,IAAI,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC;QACrD,OAAO,uBAAuB,CAAC;IACjC,CAAC;IACD,OAAO,IAAI,sBAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC;SAC7C,SAAS,CAAC,WAAW,CAAC;SACtB,QAAQ,EAAE,CAAC;AAChB,CAAC;AAXD,wCAWC;AAOD,SAAsB,sBAAsB,CAC1C,KAAa,EACb,MAAa;;QAEb,MAAM,GAAG,GAAuC,MAAM,eAAK;aACxD,GAAG,CAAC,GAAG,4BAAgB,GAAG,KAAK,6BAA6B,MAAM,EAAE,CAAC;aACrE,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QACrB,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IACpC,CAAC;CAAA;AARD,wDAQC"}
|
@@ -11,7 +11,8 @@ const reservesJob_1 = __importDefault(require("./reservesJob"));
|
|
11
11
|
const marketsJob_1 = __importDefault(require("./marketsJob"));
|
12
12
|
const lendsFetcher_1 = __importDefault(require("./lendsFetcher"));
|
13
13
|
const farmsFetcher_1 = __importDefault(require("./farmsFetcher"));
|
14
|
+
const airdropFetcher_1 = __importDefault(require("./airdropFetcher"));
|
14
15
|
exports.platforms = [constants_1.kaminoPlatform];
|
15
16
|
exports.jobs = [poolsJob_1.default, reservesJob_1.default, farmsJob_1.default, marketsJob_1.default];
|
16
|
-
exports.fetchers = [lendsFetcher_1.default, farmsFetcher_1.default];
|
17
|
+
exports.fetchers = [lendsFetcher_1.default, farmsFetcher_1.default, airdropFetcher_1.default];
|
17
18
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kamino/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAA6C;AAC7C,0DAAkC;AAClC,0DAAkC;AAClC,gEAAwC;AACxC,8DAAsC;AACtC,kEAA0C;AAC1C,kEAA0C;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kamino/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAA6C;AAC7C,0DAAkC;AAClC,0DAAkC;AAClC,gEAAwC;AACxC,8DAAsC;AACtC,kEAA0C;AAC1C,kEAA0C;AAC1C,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,0BAAc,CAAC,CAAC;AACzC,QAAA,IAAI,GAAU,CAAC,kBAAQ,EAAE,qBAAW,EAAE,kBAAQ,EAAE,oBAAU,CAAC,CAAC;AAC5D,QAAA,QAAQ,GAAc,CAAC,sBAAY,EAAE,sBAAY,EAAE,wBAAc,CAAC,CAAC"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
2
|
+
import { Platform } from '@sonarwatch/portfolio-core';
|
3
|
+
export declare const platformId = "nosana";
|
4
|
+
export declare const platform: Platform;
|
5
|
+
export declare const nosMint = "nosXBVoaCTtYdLvKY6Csb4AC8JCdQKKAaWYtx2ZMoo7";
|
6
|
+
export declare const nosDecimals = 6;
|
7
|
+
export declare const nosanaStakingPid: PublicKey;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.nosanaStakingPid = exports.nosDecimals = exports.nosMint = exports.platform = exports.platformId = void 0;
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
5
|
+
exports.platformId = 'nosana';
|
6
|
+
exports.platform = {
|
7
|
+
id: exports.platformId,
|
8
|
+
name: 'Nosana',
|
9
|
+
image: 'https://sonar.watch/img/platforms/nosana.png',
|
10
|
+
// defiLlamaId: 'foo-finance', // from https://defillama.com/docs/api
|
11
|
+
website: 'https://app.nosana.io/',
|
12
|
+
twitter: 'https://twitter.com/nosana_ci',
|
13
|
+
};
|
14
|
+
exports.nosMint = 'nosXBVoaCTtYdLvKY6Csb4AC8JCdQKKAaWYtx2ZMoo7';
|
15
|
+
exports.nosDecimals = 6;
|
16
|
+
exports.nosanaStakingPid = new web3_js_1.PublicKey('nosScmHY2uR24Zh751PmGj9ww9QRNHewh9H59AfrTJE');
|
17
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/nosana/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,QAAQ,CAAC;AACtB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,8CAA8C;IACrD,qEAAqE;IACrE,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,+BAA+B;CACzC,CAAC;AAEW,QAAA,OAAO,GAAG,6CAA6C,CAAC;AACxD,QAAA,WAAW,GAAG,CAAC,CAAC;AAChB,QAAA,gBAAgB,GAAG,IAAI,mBAAS,CAC3C,6CAA6C,CAC9C,CAAC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getStakePubKey = void 0;
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
5
|
+
const constants_1 = require("./constants");
|
6
|
+
function getStakePubKey(owner) {
|
7
|
+
return web3_js_1.PublicKey.findProgramAddressSync([
|
8
|
+
Buffer.from('stake', 'utf8'),
|
9
|
+
new web3_js_1.PublicKey(constants_1.nosMint).toBuffer(),
|
10
|
+
new web3_js_1.PublicKey(owner).toBuffer(),
|
11
|
+
], constants_1.nosanaStakingPid)[0];
|
12
|
+
}
|
13
|
+
exports.getStakePubKey = getStakePubKey;
|
14
|
+
//# sourceMappingURL=helpers.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/nosana/helpers.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,2CAAwD;AAExD,SAAgB,cAAc,CAAC,KAAa;IAC1C,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;QAC5B,IAAI,mBAAS,CAAC,mBAAO,CAAC,CAAC,QAAQ,EAAE;QACjC,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;KAChC,EACD,4BAAgB,CACjB,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AATD,wCASC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
|
+
const constants_1 = require("./constants");
|
8
|
+
const stakingFetcher_1 = __importDefault(require("./stakingFetcher"));
|
9
|
+
exports.platforms = [constants_1.platform];
|
10
|
+
exports.jobs = [];
|
11
|
+
exports.fetchers = [stakingFetcher_1.default];
|
12
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/nosana/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,56 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const clients_1 = require("../../utils/clients");
|
19
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
20
|
+
const structs_1 = require("./structs");
|
21
|
+
const helpers_1 = require("./helpers");
|
22
|
+
const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
|
23
|
+
const nosFactor = new bignumber_js_1.default(Math.pow(10, constants_1.nosDecimals));
|
24
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
25
|
+
const client = (0, clients_1.getClientSolana)();
|
26
|
+
const stakeAccount = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, structs_1.stakeStruct, (0, helpers_1.getStakePubKey)(owner));
|
27
|
+
if (!stakeAccount || stakeAccount.amount.isZero())
|
28
|
+
return [];
|
29
|
+
const lockedUntil = stakeAccount.timeUnstake.isZero()
|
30
|
+
? undefined
|
31
|
+
: stakeAccount.timeUnstake
|
32
|
+
.plus(stakeAccount.duration)
|
33
|
+
.times(1000)
|
34
|
+
.toNumber();
|
35
|
+
const tokenPrice = yield cache.getTokenPrice(constants_1.nosMint, portfolio_core_1.NetworkId.solana);
|
36
|
+
const asset = (0, tokenPriceToAssetToken_1.default)(constants_1.nosMint, stakeAccount.amount.dividedBy(nosFactor).toNumber(), portfolio_core_1.NetworkId.solana, tokenPrice, undefined, { lockedUntil });
|
37
|
+
return [
|
38
|
+
{
|
39
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
40
|
+
platformId: constants_1.platformId,
|
41
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
42
|
+
label: 'Staked',
|
43
|
+
value: asset.value,
|
44
|
+
data: {
|
45
|
+
assets: [asset],
|
46
|
+
},
|
47
|
+
},
|
48
|
+
];
|
49
|
+
});
|
50
|
+
const fetcher = {
|
51
|
+
id: `${constants_1.platformId}-staking`,
|
52
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
53
|
+
executor,
|
54
|
+
};
|
55
|
+
exports.default = fetcher;
|
56
|
+
//# sourceMappingURL=stakingFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"stakingFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/nosana/stakingFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAA6E;AAC7E,gEAAqC;AAGrC,2CAA+D;AAC/D,iDAAsD;AACtD,qGAA6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AAC;AACJ,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"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
4
|
+
import BigNumber from 'bignumber.js';
|
5
|
+
export type Stake = {
|
6
|
+
buffer: Buffer;
|
7
|
+
amount: BigNumber;
|
8
|
+
authorithy: PublicKey;
|
9
|
+
duration: BigNumber;
|
10
|
+
timeUnstake: BigNumber;
|
11
|
+
vault: PublicKey;
|
12
|
+
vaultBump: number;
|
13
|
+
xNos: BigNumber;
|
14
|
+
};
|
15
|
+
export declare const stakeStruct: BeetStruct<Stake, Partial<Stake>>;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.stakeStruct = void 0;
|
4
|
+
const beet_1 = require("@metaplex-foundation/beet");
|
5
|
+
const beet_solana_1 = require("@metaplex-foundation/beet-solana");
|
6
|
+
const solana_1 = require("../../utils/solana");
|
7
|
+
exports.stakeStruct = new beet_1.BeetStruct([
|
8
|
+
['buffer', (0, solana_1.blob)(8)],
|
9
|
+
['amount', solana_1.u64],
|
10
|
+
['authorithy', beet_solana_1.publicKey],
|
11
|
+
['duration', solana_1.u64],
|
12
|
+
['timeUnstake', solana_1.i64],
|
13
|
+
['vault', beet_solana_1.publicKey],
|
14
|
+
['vaultBump', beet_1.u8],
|
15
|
+
['xNos', solana_1.u128],
|
16
|
+
], (args) => args);
|
17
|
+
//# sourceMappingURL=structs.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/nosana/structs.ts"],"names":[],"mappings":";;;AAAA,oDAA2D;AAC3D,kEAA6D;AAG7D,+CAA0D;AAa7C,QAAA,WAAW,GAAG,IAAI,iBAAU,CACvC;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,QAAQ,EAAE,YAAG,CAAC;IACf,CAAC,YAAY,EAAE,uBAAS,CAAC;IACzB,CAAC,UAAU,EAAE,YAAG,CAAC;IACjB,CAAC,aAAa,EAAE,YAAG,CAAC;IACpB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,WAAW,EAAE,SAAE,CAAC;IACjB,CAAC,MAAM,EAAE,aAAI,CAAC;CACf,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAa,CACxB,CAAC"}
|
@@ -2,8 +2,11 @@ import { PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { Platform } from '@sonarwatch/portfolio-core';
|
3
3
|
export declare const platformId = "raydium";
|
4
4
|
export declare const raydiumPlatform: Platform;
|
5
|
+
export declare const AMM_PROGRAM_ID_V3: PublicKey;
|
5
6
|
export declare const AMM_PROGRAM_ID_V4: PublicKey;
|
6
7
|
export declare const AMM_PROGRAM_ID_V5: PublicKey;
|
7
8
|
export declare const raydiumProgram: PublicKey;
|
8
9
|
export declare const poolStatesPrefix = "raydium-poolSates";
|
9
10
|
export declare const positionsIdentifier = "Raydium Concentrated Liquidity";
|
11
|
+
export declare const rayMint = "4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R";
|
12
|
+
export declare const rayDecimals = 6;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.positionsIdentifier = exports.poolStatesPrefix = exports.raydiumProgram = exports.AMM_PROGRAM_ID_V5 = exports.AMM_PROGRAM_ID_V4 = exports.raydiumPlatform = exports.platformId = void 0;
|
3
|
+
exports.rayDecimals = exports.rayMint = exports.positionsIdentifier = exports.poolStatesPrefix = exports.raydiumProgram = exports.AMM_PROGRAM_ID_V5 = exports.AMM_PROGRAM_ID_V4 = exports.AMM_PROGRAM_ID_V3 = exports.raydiumPlatform = exports.platformId = void 0;
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
5
5
|
exports.platformId = 'raydium';
|
6
6
|
exports.raydiumPlatform = {
|
@@ -10,9 +10,12 @@ exports.raydiumPlatform = {
|
|
10
10
|
defiLlamaId: 'raydium',
|
11
11
|
website: 'https://raydium.io/',
|
12
12
|
};
|
13
|
+
exports.AMM_PROGRAM_ID_V3 = new web3_js_1.PublicKey('EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q');
|
13
14
|
exports.AMM_PROGRAM_ID_V4 = new web3_js_1.PublicKey('675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8');
|
14
15
|
exports.AMM_PROGRAM_ID_V5 = new web3_js_1.PublicKey('5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h');
|
15
16
|
exports.raydiumProgram = new web3_js_1.PublicKey('CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK');
|
16
17
|
exports.poolStatesPrefix = `${exports.platformId}-poolSates`;
|
17
18
|
exports.positionsIdentifier = 'Raydium Concentrated Liquidity';
|
19
|
+
exports.rayMint = '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R';
|
20
|
+
exports.rayDecimals = 6;
|
18
21
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,eAAe,GAAa;IACvC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,+CAA+C;IACtD,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,qBAAqB;CAC/B,CAAC;
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,eAAe,GAAa;IACvC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,+CAA+C;IACtD,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,qBAAqB;CAC/B,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAI,mBAAS,CAC5C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAI,mBAAS,CAC5C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAI,mBAAS,CAC5C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,gBAAgB,GAAG,GAAG,kBAAU,YAAY,CAAC;AAE7C,QAAA,mBAAmB,GAAG,gCAAgC,CAAC;AAEvD,QAAA,OAAO,GAAG,8CAA8C,CAAC;AACzD,QAAA,WAAW,GAAG,CAAC,CAAC"}
|
@@ -2,3 +2,4 @@ import { GetProgramAccountsFilter } from '@solana/web3.js';
|
|
2
2
|
export declare const ammV4Filter: GetProgramAccountsFilter[];
|
3
3
|
export declare const ammV5Filter: GetProgramAccountsFilter[];
|
4
4
|
export declare const poolsStateFilter: GetProgramAccountsFilter[];
|
5
|
+
export declare const stakingFilters: (owner: string) => GetProgramAccountsFilter[];
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.poolsStateFilter = exports.ammV5Filter = exports.ammV4Filter = void 0;
|
3
|
+
exports.stakingFilters = exports.poolsStateFilter = exports.ammV5Filter = exports.ammV4Filter = void 0;
|
4
4
|
const amms_1 = require("./structs/amms");
|
5
5
|
exports.ammV4Filter = [
|
6
6
|
{ dataSize: amms_1.ammInfoV4Struct.byteSize },
|
@@ -11,4 +11,14 @@ exports.ammV5Filter = [
|
|
11
11
|
exports.poolsStateFilter = [
|
12
12
|
{ dataSize: 1544 },
|
13
13
|
];
|
14
|
+
const stakingFilters = (owner) => [
|
15
|
+
{
|
16
|
+
memcmp: {
|
17
|
+
offset: 40,
|
18
|
+
bytes: owner,
|
19
|
+
},
|
20
|
+
},
|
21
|
+
{ dataSize: 232 },
|
22
|
+
];
|
23
|
+
exports.stakingFilters = stakingFilters;
|
14
24
|
//# sourceMappingURL=filters.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/filters.ts"],"names":[],"mappings":";;;AACA,yCAAkE;AAErD,QAAA,WAAW,GAA+B;IACrD,EAAE,QAAQ,EAAE,sBAAe,CAAC,QAAQ,EAAE;CACvC,CAAC;AAEW,QAAA,WAAW,GAA+B;IACrD,EAAE,QAAQ,EAAE,sBAAe,CAAC,QAAQ,EAAE;CACvC,CAAC;AAEW,QAAA,gBAAgB,GAA+B;IAC1D,EAAE,QAAQ,EAAE,IAAI,EAAE;CACnB,CAAC"}
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/filters.ts"],"names":[],"mappings":";;;AACA,yCAAkE;AAErD,QAAA,WAAW,GAA+B;IACrD,EAAE,QAAQ,EAAE,sBAAe,CAAC,QAAQ,EAAE;CACvC,CAAC;AAEW,QAAA,WAAW,GAA+B;IACrD,EAAE,QAAQ,EAAE,sBAAe,CAAC,QAAQ,EAAE;CACvC,CAAC;AAEW,QAAA,gBAAgB,GAA+B;IAC1D,EAAE,QAAQ,EAAE,IAAI,EAAE;CACnB,CAAC;AAEK,MAAM,cAAc,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC3E;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD,EAAE,QAAQ,EAAE,GAAG,EAAE;CAClB,CAAC;AARW,QAAA,cAAc,kBAQzB"}
|
@@ -1,9 +1,11 @@
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
2
2
|
import BN from 'bn.js';
|
3
3
|
import { PortfolioAssetCollectible } from '@sonarwatch/portfolio-core';
|
4
|
+
import { PublicKey } from '@solana/web3.js';
|
4
5
|
export declare function isARaydiumPosition(nft: PortfolioAssetCollectible): boolean;
|
5
6
|
export declare function raydiumTickToPriceX64(tick: number): BN;
|
6
7
|
export declare function getRaydiumTokenAmountsFromLiquidity(sqrtPriceCurrentX64: BigNumber, sqrtPriceX64A: BigNumber, sqrtPriceX64B: BigNumber, liquidity: BigNumber, roundUp: boolean): {
|
7
8
|
tokenAmountA: BigNumber;
|
8
9
|
tokenAmountB: BigNumber;
|
9
10
|
};
|
11
|
+
export declare function getStakePubKey(owner: string): PublicKey;
|
@@ -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.getRaydiumTokenAmountsFromLiquidity = exports.raydiumTickToPriceX64 = exports.isARaydiumPosition = void 0;
|
6
|
+
exports.getStakePubKey = exports.getRaydiumTokenAmountsFromLiquidity = exports.raydiumTickToPriceX64 = exports.isARaydiumPosition = void 0;
|
7
7
|
/* eslint-disable eqeqeq */
|
8
8
|
/* eslint-disable @typescript-eslint/naming-convention */
|
9
9
|
/* eslint-disable no-underscore-dangle */
|
@@ -11,6 +11,7 @@ exports.getRaydiumTokenAmountsFromLiquidity = exports.raydiumTickToPriceX64 = ex
|
|
11
11
|
/* eslint-disable no-bitwise */
|
12
12
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
13
13
|
const bn_js_1 = __importDefault(require("bn.js"));
|
14
|
+
const web3_js_1 = require("@solana/web3.js");
|
14
15
|
const constants_1 = require("./constants");
|
15
16
|
function isARaydiumPosition(nft) {
|
16
17
|
return nft.data.name === constants_1.positionsIdentifier;
|
@@ -168,4 +169,12 @@ function getRaydiumTokenAmountsFromLiquidity(sqrtPriceCurrentX64, sqrtPriceX64A,
|
|
168
169
|
};
|
169
170
|
}
|
170
171
|
exports.getRaydiumTokenAmountsFromLiquidity = getRaydiumTokenAmountsFromLiquidity;
|
172
|
+
function getStakePubKey(owner) {
|
173
|
+
return web3_js_1.PublicKey.findProgramAddressSync([
|
174
|
+
new web3_js_1.PublicKey('4EwbZo8BZXP5313z5A2H11MRBP15M5n6YxfmkjXESKAW').toBuffer(),
|
175
|
+
new web3_js_1.PublicKey(owner).toBuffer(),
|
176
|
+
Buffer.from('staker_info_v2_associated_seed', 'utf-8'),
|
177
|
+
], constants_1.AMM_PROGRAM_ID_V3)[0];
|
178
|
+
}
|
179
|
+
exports.getStakePubKey = getStakePubKey;
|
171
180
|
//# sourceMappingURL=helpers.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA2B;AAC3B,yDAAyD;AACzD,yCAAyC;AACzC,sCAAsC;AACtC,+BAA+B;AAC/B,gEAAqC;AACrC,kDAAuB;AAEvB,
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA2B;AAC3B,yDAAyD;AACzD,yCAAyC;AACzC,sCAAsC;AACtC,+BAA+B;AAC/B,gEAAqC;AACrC,kDAAuB;AAEvB,6CAA4C;AAC5C,2CAAqE;AAErE,SAAgB,kBAAkB,CAAC,GAA8B;IAC/D,OAAO,GAAG,CAAC,IAAI,C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AAC,QAAQ,EAAE,CAAC,EAC5B,OAAO,CACR,CAAC,QAAQ,EAAE,CACb;KACF,CAAC;AACJ,CAAC;AAtDD,kFAsDC;AAED,SAAgB,cAAc,CAAC,KAAa;IAC1C,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,IAAI,mBAAS,CAAC,8CAA8C,CAAC,CAAC,QAAQ,EAAE;QACxE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;QAC/B,MAAM,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC;KACvD,EACD,6BAAiB,CAClB,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AATD,wCASC"}
|
@@ -7,7 +7,8 @@ exports.fetchers = exports.jobs = exports.platforms = void 0;
|
|
7
7
|
const lpTokensJob_1 = __importDefault(require("./lpTokensJob"));
|
8
8
|
const clmmJob_1 = __importDefault(require("./clmmJob"));
|
9
9
|
const constants_1 = require("./constants");
|
10
|
+
const stakingFetcher_1 = __importDefault(require("./stakingFetcher"));
|
10
11
|
exports.platforms = [constants_1.raydiumPlatform];
|
11
12
|
exports.jobs = [lpTokensJob_1.default, clmmJob_1.default];
|
12
|
-
exports.fetchers = [];
|
13
|
+
exports.fetchers = [stakingFetcher_1.default];
|
13
14
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/index.ts"],"names":[],"mappings":";;;;;;AAGA,gEAAwC;AACxC,wDAAgC;AAChC,2CAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,2BAAe,CAAC,CAAC;AAC1C,QAAA,IAAI,GAAU,CAAC,qBAAW,EAAE,iBAAO,CAAC,CAAC;AACrC,QAAA,QAAQ,GAAc,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/index.ts"],"names":[],"mappings":";;;;;;AAGA,gEAAwC;AACxC,wDAAgC;AAChC,2CAA8C;AAC9C,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,2BAAe,CAAC,CAAC;AAC1C,QAAA,IAAI,GAAU,CAAC,qBAAW,EAAE,iBAAO,CAAC,CAAC;AACrC,QAAA,QAAQ,GAAc,CAAC,wBAAc,CAAC,CAAC"}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const clients_1 = require("../../utils/clients");
|
19
|
+
const staking_1 = require("./structs/staking");
|
20
|
+
const helpers_1 = require("./helpers");
|
21
|
+
const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
|
22
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
23
|
+
const rayFactor = new bignumber_js_1.default(Math.pow(10, constants_1.rayDecimals));
|
24
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
25
|
+
const client = (0, clients_1.getClientSolana)();
|
26
|
+
const stakeAccount = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, staking_1.stakeStruct, (0, helpers_1.getStakePubKey)(owner));
|
27
|
+
if (!stakeAccount || stakeAccount.depositBalance.isZero())
|
28
|
+
return [];
|
29
|
+
const tokenPrice = yield cache.getTokenPrice(constants_1.rayMint, portfolio_core_1.NetworkId.solana);
|
30
|
+
const asset = (0, tokenPriceToAssetToken_1.default)(constants_1.rayMint, stakeAccount.depositBalance.dividedBy(rayFactor).toNumber(), portfolio_core_1.NetworkId.solana, tokenPrice);
|
31
|
+
return [
|
32
|
+
{
|
33
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
34
|
+
platformId: constants_1.platformId,
|
35
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
36
|
+
label: 'Staked',
|
37
|
+
value: asset.value,
|
38
|
+
data: {
|
39
|
+
assets: [asset],
|
40
|
+
},
|
41
|
+
},
|
42
|
+
];
|
43
|
+
});
|
44
|
+
const fetcher = {
|
45
|
+
id: `${constants_1.platformId}-staking`,
|
46
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
47
|
+
executor,
|
48
|
+
};
|
49
|
+
exports.default = fetcher;
|
50
|
+
//# sourceMappingURL=stakingFetcher.js.map
|