@sonarwatch/portfolio-plugins 0.12.52 → 0.12.54
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 +1 -1
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/plugins/famousfoxfederation/constants.d.ts +13 -0
- package/src/plugins/famousfoxfederation/constants.js +32 -0
- package/src/plugins/famousfoxfederation/constants.js.map +1 -0
- package/src/plugins/famousfoxfederation/helpers.d.ts +2 -0
- package/src/plugins/famousfoxfederation/helpers.js +11 -0
- package/src/plugins/famousfoxfederation/helpers.js.map +1 -0
- package/src/plugins/famousfoxfederation/index.d.ts +6 -0
- package/src/plugins/famousfoxfederation/index.js +14 -0
- package/src/plugins/famousfoxfederation/index.js.map +1 -0
- package/src/plugins/famousfoxfederation/stakingFetcher.d.ts +3 -0
- package/src/plugins/famousfoxfederation/stakingFetcher.js +70 -0
- package/src/plugins/famousfoxfederation/stakingFetcher.js.map +1 -0
- package/src/plugins/famousfoxfederation/stakingIdl.d.ts +31 -0
- package/src/plugins/famousfoxfederation/stakingIdl.js +226 -0
- package/src/plugins/famousfoxfederation/stakingIdl.js.map +1 -0
- package/src/plugins/famousfoxfederation/stakingJob.d.ts +3 -0
- package/src/plugins/famousfoxfederation/stakingJob.js +30 -0
- package/src/plugins/famousfoxfederation/stakingJob.js.map +1 -0
- package/src/plugins/famousfoxfederation/tokenMarketFetcher.d.ts +3 -0
- package/src/plugins/famousfoxfederation/tokenMarketFetcher.js +59 -0
- package/src/plugins/famousfoxfederation/tokenMarketFetcher.js.map +1 -0
- package/src/plugins/famousfoxfederation/tokenMarketIdl.d.ts +45 -0
- package/src/plugins/famousfoxfederation/tokenMarketIdl.js +792 -0
- package/src/plugins/famousfoxfederation/tokenMarketIdl.js.map +1 -0
- package/src/plugins/famousfoxfederation/types.d.ts +25 -0
- package/src/plugins/famousfoxfederation/types.js +3 -0
- package/src/plugins/famousfoxfederation/types.js.map +1 -0
- package/src/plugins/nxfinance/constants.d.ts +1 -0
- package/src/plugins/nxfinance/constants.js +2 -1
- package/src/plugins/nxfinance/constants.js.map +1 -1
- package/src/plugins/nxfinance/helpers.d.ts +4 -0
- package/src/plugins/nxfinance/helpers.js +52 -0
- package/src/plugins/nxfinance/helpers.js.map +1 -0
- package/src/plugins/nxfinance/positionsFetcher.js +57 -12
- package/src/plugins/nxfinance/positionsFetcher.js.map +1 -1
- package/src/plugins/nxfinance/types.d.ts +17 -0
- package/src/utils/solana/das/heliusAssetToAssetCollectible.js +1 -1
- package/src/utils/solana/das/heliusAssetToAssetCollectible.js.map +1 -1
- package/src/utils/solana/das/heliusAssetToAssetToken.d.ts +6 -0
- package/src/utils/solana/das/heliusAssetToAssetToken.js +27 -0
- package/src/utils/solana/das/heliusAssetToAssetToken.js.map +1 -0
- package/src/utils/solana/mintsToAssets.d.ts +3 -0
- package/src/utils/solana/mintsToAssets.js +58 -0
- package/src/utils/solana/mintsToAssets.js.map +1 -0
- package/src/plugins/nxfinance/structs.d.ts +0 -19
- package/src/plugins/nxfinance/structs.js +0 -22
- package/src/plugins/nxfinance/structs.js.map +0 -1
@@ -0,0 +1,59 @@
|
|
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 solana_1 = require("../../utils/solana");
|
20
|
+
const getSolanaDasEndpoint_1 = __importDefault(require("../../utils/clients/getSolanaDasEndpoint"));
|
21
|
+
const mintsToAssets_1 = require("../../utils/solana/mintsToAssets");
|
22
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
|
+
const dasUrl = (0, getSolanaDasEndpoint_1.default)();
|
24
|
+
const connection = (0, clients_1.getClientSolana)();
|
25
|
+
const accounts = yield (0, solana_1.getAutoParsedProgramAccounts)(connection, constants_1.tokenMarketIdlItem, [
|
26
|
+
{
|
27
|
+
memcmp: {
|
28
|
+
bytes: owner,
|
29
|
+
offset: 41,
|
30
|
+
},
|
31
|
+
},
|
32
|
+
]);
|
33
|
+
if (accounts.length === 0)
|
34
|
+
return [];
|
35
|
+
const assetsByMint = yield (0, mintsToAssets_1.mintsToAssets)(dasUrl, cache, accounts.map((acc) => acc.mint), accounts.map((acc) => new bignumber_js_1.default(acc.count).toNumber()));
|
36
|
+
const elements = [];
|
37
|
+
const assets = [...assetsByMint.values()];
|
38
|
+
if (assets.length === 0)
|
39
|
+
return [];
|
40
|
+
elements.push({
|
41
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
42
|
+
label: 'Deposit',
|
43
|
+
platformId: constants_1.platformId,
|
44
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
45
|
+
value: (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value)),
|
46
|
+
name: 'Sell Orders',
|
47
|
+
data: {
|
48
|
+
assets,
|
49
|
+
},
|
50
|
+
});
|
51
|
+
return elements;
|
52
|
+
});
|
53
|
+
const fetcher = {
|
54
|
+
id: `${constants_1.platformId}-tokenmarket`,
|
55
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
56
|
+
executor,
|
57
|
+
};
|
58
|
+
exports.default = fetcher;
|
59
|
+
//# sourceMappingURL=tokenMarketFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"tokenMarketFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/famousfoxfederation/tokenMarketFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,gEAAqC;AAErC,2CAA6D;AAE7D,iDAAsD;AACtD,+CAAkE;AAElE,oGAA4E;AAC5E,oEAAiE;AAEjE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,8BAAoB,GAAE,CAAC;IACtC,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,QAAQ,GAAG,MAAM,IAAA,qCAA4B,EACjD,UAAU,EACV,8BAAkB,EAClB;QACE;YACE,MAAM,EAAE;gBACN,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,EAAE;aACX;SACF;KACF,CACF,CAAC;IAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,YAAY,GAAG,MAAM,IAAA,6BAAa,EACtC,MAAM,EACN,KAAK,EACL,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAC/B,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,sBAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAC3D,CAAC;IAEF,MAAM,QAAQ,GAAuB,EAAE,CAAC;IACxC,MAAM,MAAM,GAAqB,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;IAE5D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEnC,QAAQ,CAAC,IAAI,CAAC;QACZ,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,KAAK,EAAE,SAAS;QAChB,UAAU,EAAV,sBAAU;QACV,IAAI,EAAE,qCAAoB,CAAC,QAAQ;QACnC,KAAK,EAAE,IAAA,+BAAc,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE;YACJ,MAAM;SACP;KACF,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,cAAc;IAC/B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
export declare const tokenMarketIdl: {
|
2
|
+
version: string;
|
3
|
+
name: string;
|
4
|
+
instructions: {
|
5
|
+
name: string;
|
6
|
+
accounts: ({
|
7
|
+
name: string;
|
8
|
+
isMut: boolean;
|
9
|
+
isSigner: boolean;
|
10
|
+
isOptional?: undefined;
|
11
|
+
} | {
|
12
|
+
name: string;
|
13
|
+
isMut: boolean;
|
14
|
+
isSigner: boolean;
|
15
|
+
isOptional: boolean;
|
16
|
+
})[];
|
17
|
+
args: {
|
18
|
+
name: string;
|
19
|
+
type: string;
|
20
|
+
}[];
|
21
|
+
}[];
|
22
|
+
accounts: {
|
23
|
+
name: string;
|
24
|
+
type: {
|
25
|
+
kind: string;
|
26
|
+
fields: {
|
27
|
+
name: string;
|
28
|
+
type: string;
|
29
|
+
}[];
|
30
|
+
};
|
31
|
+
}[];
|
32
|
+
events: {
|
33
|
+
name: string;
|
34
|
+
fields: {
|
35
|
+
name: string;
|
36
|
+
type: string;
|
37
|
+
index: boolean;
|
38
|
+
}[];
|
39
|
+
}[];
|
40
|
+
errors: {
|
41
|
+
code: number;
|
42
|
+
name: string;
|
43
|
+
msg: string;
|
44
|
+
}[];
|
45
|
+
};
|