@sonarwatch/portfolio-plugins 0.7.13 → 0.7.15
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 +13 -5
- package/package.json +3 -3
- package/src/index.js +7 -0
- package/src/index.js.map +1 -1
- package/src/plugins/aftermath/poolsJob.js +2 -2
- package/src/plugins/aftermath/poolsJob.js.map +1 -1
- package/src/plugins/bucket/collateralFetcher.d.ts +3 -0
- package/src/plugins/bucket/collateralFetcher.js +92 -0
- package/src/plugins/bucket/collateralFetcher.js.map +1 -0
- package/src/plugins/bucket/constants.d.ts +9 -0
- package/src/plugins/bucket/constants.js +30 -0
- package/src/plugins/bucket/constants.js.map +1 -0
- package/src/plugins/bucket/index.d.ts +6 -0
- package/src/plugins/bucket/index.js +12 -0
- package/src/plugins/bucket/index.js.map +1 -0
- package/src/plugins/bucket/types.d.ts +24 -0
- package/src/plugins/bucket/types.js +3 -0
- package/src/plugins/bucket/types.js.map +1 -0
- package/src/plugins/native-stake/index.js +7 -1
- package/src/plugins/native-stake/index.js.map +1 -1
- package/src/plugins/native-stake/seiFetcher.d.ts +3 -0
- package/src/plugins/native-stake/seiFetcher.js +78 -0
- package/src/plugins/native-stake/seiFetcher.js.map +1 -0
- package/src/plugins/native-stake/types.d.ts +11 -0
- package/src/plugins/navi/collateralFetcher.d.ts +3 -0
- package/src/plugins/navi/collateralFetcher.js +120 -0
- package/src/plugins/navi/collateralFetcher.js.map +1 -0
- package/src/plugins/navi/constants.d.ts +15 -0
- package/src/plugins/navi/constants.js +51 -0
- package/src/plugins/navi/constants.js.map +1 -0
- package/src/plugins/navi/index.d.ts +6 -0
- package/src/plugins/navi/index.js +13 -0
- package/src/plugins/navi/index.js.map +1 -0
- package/src/plugins/navi/reservesJob.d.ts +3 -0
- package/src/plugins/navi/reservesJob.js +40 -0
- package/src/plugins/navi/reservesJob.js.map +1 -0
- package/src/plugins/navi/types.d.ts +57 -0
- package/src/plugins/navi/types.js +3 -0
- package/src/plugins/navi/types.js.map +1 -0
- package/src/plugins/tokens/fetchers/solana-cnfts.d.ts +3 -0
- package/src/plugins/tokens/fetchers/solana-cnfts.js +56 -0
- package/src/plugins/tokens/fetchers/solana-cnfts.js.map +1 -0
- package/src/plugins/tokens/fetchers/solana-nfts.js +2 -6
- package/src/plugins/tokens/fetchers/solana-nfts.js.map +1 -1
- package/src/plugins/tokens/index.js +2 -2
- package/src/plugins/tokens/index.js.map +1 -1
- package/src/utils/solana/getAssetsByOwner.d.ts +95 -0
- package/src/utils/solana/getAssetsByOwner.js +44 -0
- package/src/utils/solana/getAssetsByOwner.js.map +1 -0
package/CHANGELOG.md
CHANGED
@@ -2,14 +2,22 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
-
## [0.7.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
## [0.7.12](https://github.com/sonarwatch/portfolio/compare/plugins-0.7.11...plugins-0.7.12) (2023-09-06)
|
5
|
+
## [0.7.15](https://github.com/sonarwatch/portfolio/compare/plugins-0.7.14...plugins-0.7.15) (2023-09-12)
|
10
6
|
|
11
7
|
|
12
8
|
|
9
|
+
## [0.7.14](https://github.com/sonarwatch/portfolio/compare/plugins-0.7.13...plugins-0.7.14) (2023-09-08)
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
## [0.7.13](https://github.com/sonarwatch/portfolio/compare/plugins-0.7.12...plugins-0.7.13) (2023-09-06)
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
## [0.7.12](https://github.com/sonarwatch/portfolio/compare/plugins-0.7.11...plugins-0.7.12) (2023-09-06)
|
18
|
+
|
19
|
+
|
20
|
+
|
13
21
|
## [0.7.11](https://github.com/sonarwatch/portfolio/compare/plugins-0.7.10...plugins-0.7.11) (2023-09-06)
|
14
22
|
|
15
23
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.7.
|
3
|
+
"version": "0.7.15",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -20,7 +20,7 @@
|
|
20
20
|
"@mysten/sui.js": "^0.37.1",
|
21
21
|
"@sei-js/core": "^3.0.1",
|
22
22
|
"@sei-js/proto": "^3.0.1",
|
23
|
-
"@solana/web3.js": "^1.78.
|
23
|
+
"@solana/web3.js": "^1.78.4",
|
24
24
|
"aptos": "^1.13.1",
|
25
25
|
"axios": "^1.4.0",
|
26
26
|
"bignumber.js": "^9.1.1",
|
@@ -36,7 +36,7 @@
|
|
36
36
|
"web3-v1": "npm:web3@^1.5.0"
|
37
37
|
},
|
38
38
|
"peerDependencies": {
|
39
|
-
"@sonarwatch/portfolio-core": "0.7.
|
39
|
+
"@sonarwatch/portfolio-core": "0.7.15"
|
40
40
|
},
|
41
41
|
"main": "./src/index.js",
|
42
42
|
"types": "./src/index.d.ts"
|
package/src/index.js
CHANGED
@@ -42,6 +42,8 @@ const liquidswap_1 = require("./plugins/liquidswap");
|
|
42
42
|
const auxexchange_1 = require("./plugins/auxexchange");
|
43
43
|
const maker_1 = require("./plugins/maker");
|
44
44
|
const kamino_1 = require("./plugins/kamino");
|
45
|
+
const bucket_1 = require("./plugins/bucket");
|
46
|
+
const navi_1 = require("./plugins/navi");
|
45
47
|
const getFetchersByAddressSystem_1 = require("./utils/misc/getFetchersByAddressSystem");
|
46
48
|
var constants_1 = require("./plugins/tokens/constants");
|
47
49
|
Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get: function () { return constants_1.walletTokensPlatform; } });
|
@@ -77,6 +79,8 @@ exports.platforms = [
|
|
77
79
|
...morpho_1.platforms,
|
78
80
|
...mango_1.platforms,
|
79
81
|
...kamino_1.platforms,
|
82
|
+
...bucket_1.platforms,
|
83
|
+
...navi_1.platforms,
|
80
84
|
];
|
81
85
|
// JOBS //
|
82
86
|
exports.jobs = [
|
@@ -104,6 +108,7 @@ exports.jobs = [
|
|
104
108
|
...aftermath_1.jobs,
|
105
109
|
...liquidswap_1.jobs,
|
106
110
|
...kamino_1.jobs,
|
111
|
+
...navi_1.jobs,
|
107
112
|
];
|
108
113
|
// FETCHERS //
|
109
114
|
exports.fetchers = [
|
@@ -125,6 +130,8 @@ exports.fetchers = [
|
|
125
130
|
...orders_1.fetchers,
|
126
131
|
...morpho_1.fetchers,
|
127
132
|
...liquiditypools_sei_1.fetchers,
|
133
|
+
...bucket_1.fetchers,
|
134
|
+
...navi_1.fetchers,
|
128
135
|
];
|
129
136
|
exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
|
130
137
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAGA,6CAI0B;AAC1B,yDAIgC;AAChC,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB,6CAI0B;AAC1B,+CAI2B;AAC3B,yCAIwB;AACxB,+CAG2B;AAC3B,2CAIyB;AACzB,6CAI0B;AAC1B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAI0B;AAC1B,yCAIwB;AACxB,2DAGiC;AACjC,6CAI0B;AAC1B,2CAIyB;AACzB,2CAIyB;AACzB,qDAA6D;AAC7D,qEAIsC;AACtC,uDAG+B;AAC/B,mDAG6B;AAC7B,qDAG8B;AAC9B,uDAG+B;AAC/B,2CAAoD;AACpD,6CAG0B;AAC1B,wFAAqF;AAErF,wDAGoC;AAFlC,iHAAA,oBAAoB,OAAA;AACpB,+GAAA,kBAAkB,OAAA;AAGpB,0CAAwB;AACxB,4CAA0B;AAC1B,wCAAsB;AACtB,uDAAqC;AAErC,eAAe;AACF,QAAA,SAAS,GAAe;IACnC,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,iBAAc;IACjB,GAAG,iBAAc;IACjB,GAAG,uBAAoB;IACvB,GAAG,8BAA0B;IAC7B,GAAG,sBAAmB;IACtB,GAAG,qBAAkB;IACrB,GAAG,uBAAoB;IACvB,GAAG,kBAAe;IAClB,GAAG,wBAAoB;IACvB,GAAG,oBAAiB;IACpB,GAAG,iBAAc;IACjB,GAAG,kBAAe;IAClB,GAAG,oBAAiB;IACpB,GAAG,mBAAgB;IACnB,GAAG,mBAAgB;IACnB,GAAG,kBAAe;IAClB,GAAG,iBAAc;IACjB,GAAG,kBAAe;IAClB,GAAG,kBAAe;IAClB,GAAG,yBAAqB;IACxB,GAAG,kBAAe;IAClB,GAAG,iBAAc;IACjB,GAAG,kBAAe;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAGA,6CAI0B;AAC1B,yDAIgC;AAChC,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB,6CAI0B;AAC1B,+CAI2B;AAC3B,yCAIwB;AACxB,+CAG2B;AAC3B,2CAIyB;AACzB,6CAI0B;AAC1B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAI0B;AAC1B,yCAIwB;AACxB,2DAGiC;AACjC,6CAI0B;AAC1B,2CAIyB;AACzB,2CAIyB;AACzB,qDAA6D;AAC7D,qEAIsC;AACtC,uDAG+B;AAC/B,mDAG6B;AAC7B,qDAG8B;AAC9B,uDAG+B;AAC/B,2CAAoD;AACpD,6CAG0B;AAC1B,6CAG0B;AAC1B,yCAIwB;AACxB,wFAAqF;AAErF,wDAGoC;AAFlC,iHAAA,oBAAoB,OAAA;AACpB,+GAAA,kBAAkB,OAAA;AAGpB,0CAAwB;AACxB,4CAA0B;AAC1B,wCAAsB;AACtB,uDAAqC;AAErC,eAAe;AACF,QAAA,SAAS,GAAe;IACnC,GAAG,gBAAa;IAChB,GAAG,gB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,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,iBAAc;IACjB,GAAG,wBAAoB;IACvB,GAAG,eAAY;IACf,GAAG,iBAAc;IACjB,GAAG,iBAAc;IACjB,GAAG,6BAAyB;IAC5B,GAAG,iBAAc;IACjB,GAAG,eAAY;CAChB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC"}
|
@@ -64,8 +64,8 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
64
|
decimalX: poolInfo.coin_decimals[0],
|
65
65
|
mintTokenY: `0x${poolInfo.type_names[1]}`,
|
66
66
|
decimalY: poolInfo.coin_decimals[1],
|
67
|
-
reserveTokenX: new bignumber_js_1.default(poolInfo.normalized_balances[0]),
|
68
|
-
reserveTokenY: new bignumber_js_1.default(poolInfo.normalized_balances[1]),
|
67
|
+
reserveTokenX: new bignumber_js_1.default(poolInfo.normalized_balances[0]).dividedBy(poolInfo.decimal_scalars[0]),
|
68
|
+
reserveTokenY: new bignumber_js_1.default(poolInfo.normalized_balances[1]).dividedBy(poolInfo.decimal_scalars[1]),
|
69
69
|
supply: new bignumber_js_1.default(poolInfo.lp_supply.fields.value),
|
70
70
|
};
|
71
71
|
yield (0, computeAndStoreLpPrice_1.default)(cache, poolData, portfolio_core_1.NetworkId.sui, constants_1.platformId);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"poolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/aftermath/poolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,2CAAgF;AAChF,gEAAqC;AACrC,+DAAuD;AAGvD,iDAAmD;AACnD,2CAAuD;AAEvD,qGAEiD;AAEjD,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,gBAAgB,GAAqB,MAAM,MA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AC;gBACnC,aAAa,EAAE,IAAI,sBAAS,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CACrE,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAC5B;gBACD,aAAa,EAAE,IAAI,sBAAS,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CACrE,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAC5B;gBACD,MAAM,EAAE,IAAI,sBAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;aACvD,CAAC;YACF,MAAM,IAAA,gCAAsB,EAAC,KAAK,EAAE,QAAQ,EAAE,0BAAS,CAAC,GAAG,EAAE,sBAAU,CAAC,CAAC;SAC1E;KACF;AACH,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,QAAQ;CACT,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,92 @@
|
|
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 sui_js_1 = require("@mysten/sui.js");
|
17
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
|
+
const constants_1 = require("./constants");
|
19
|
+
const clients_1 = require("../../utils/clients");
|
20
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
21
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
22
|
+
const client = (0, clients_1.getClientSui)();
|
23
|
+
const buckPrice = yield cache.getTokenPrice(constants_1.buckId, portfolio_core_1.NetworkId.sui);
|
24
|
+
if (!buckPrice)
|
25
|
+
return [];
|
26
|
+
const elements = [];
|
27
|
+
for (const collateral of constants_1.collaterals) {
|
28
|
+
const borrowedAssets = [];
|
29
|
+
const borrowedYields = [];
|
30
|
+
const suppliedAssets = [];
|
31
|
+
const suppliedYields = [];
|
32
|
+
const rewardAssets = [];
|
33
|
+
const input = {
|
34
|
+
parentId: collateral.parentId,
|
35
|
+
name: {
|
36
|
+
type: 'address',
|
37
|
+
value: owner,
|
38
|
+
},
|
39
|
+
};
|
40
|
+
const positionData = yield client.getDynamicFieldObject(input);
|
41
|
+
if (!positionData.data)
|
42
|
+
continue;
|
43
|
+
const tokenPrice = yield cache.getTokenPrice(collateral.tokenId, portfolio_core_1.NetworkId.sui);
|
44
|
+
if (!tokenPrice)
|
45
|
+
continue;
|
46
|
+
const collateralFields = (0, sui_js_1.getObjectFields)(positionData);
|
47
|
+
if (!collateralFields.value ||
|
48
|
+
!collateralFields.value.fields ||
|
49
|
+
!collateralFields.value.fields.value ||
|
50
|
+
!collateralFields.value.fields.value.fields)
|
51
|
+
continue;
|
52
|
+
const collateralInfo = collateralFields.value.fields.value.fields;
|
53
|
+
const suppliedQuantity = new bignumber_js_1.default(collateralInfo.collateral_amount)
|
54
|
+
.dividedBy(Math.pow(10, tokenPrice.decimals))
|
55
|
+
.toNumber();
|
56
|
+
if (suppliedQuantity === 0)
|
57
|
+
continue;
|
58
|
+
const borrowedQuantity = new bignumber_js_1.default(collateralInfo.buck_amount)
|
59
|
+
.dividedBy(Math.pow(10, buckPrice.decimals))
|
60
|
+
.toNumber();
|
61
|
+
borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(constants_1.buckId, borrowedQuantity, portfolio_core_1.NetworkId.sui, buckPrice));
|
62
|
+
suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(collateral.tokenId, suppliedQuantity, portfolio_core_1.NetworkId.sui, tokenPrice));
|
63
|
+
const { borrowedValue, collateralRatio, suppliedValue, value } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets);
|
64
|
+
const element = {
|
65
|
+
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
66
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
67
|
+
platformId: constants_1.platformId,
|
68
|
+
label: 'Lending',
|
69
|
+
value,
|
70
|
+
data: {
|
71
|
+
borrowedAssets,
|
72
|
+
borrowedValue,
|
73
|
+
borrowedYields,
|
74
|
+
suppliedAssets,
|
75
|
+
suppliedValue,
|
76
|
+
suppliedYields,
|
77
|
+
collateralRatio,
|
78
|
+
rewardAssets,
|
79
|
+
value,
|
80
|
+
},
|
81
|
+
};
|
82
|
+
elements.push(element);
|
83
|
+
}
|
84
|
+
return elements;
|
85
|
+
});
|
86
|
+
const fetcher = {
|
87
|
+
id: `${constants_1.platformId}-collateral`,
|
88
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
89
|
+
executor,
|
90
|
+
};
|
91
|
+
exports.default = fetcher;
|
92
|
+
//# sourceMappingURL=collateralFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"collateralFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bucket/collateralFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AACpC,2CAAiD;AACjD,gEAAqC;AAGrC,2CAA8D;AAC9D,iDAAmD;AAEnD,q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OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,aAAa;IAC9B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { Platform } from '@sonarwatch/portfolio-core';
|
2
|
+
export declare const platformId = "bucket";
|
3
|
+
export declare const bucketPlatform: Platform;
|
4
|
+
export declare const bottleType = "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::bottle::Bottle";
|
5
|
+
export declare const buckId = "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK";
|
6
|
+
export declare const collaterals: {
|
7
|
+
tokenId: string;
|
8
|
+
parentId: string;
|
9
|
+
}[];
|
@@ -0,0 +1,30 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.collaterals = exports.buckId = exports.bottleType = exports.bucketPlatform = exports.platformId = void 0;
|
4
|
+
exports.platformId = 'bucket';
|
5
|
+
exports.bucketPlatform = {
|
6
|
+
id: exports.platformId,
|
7
|
+
name: 'Cetus',
|
8
|
+
image: 'https://alpha.sonar.watch/img/platforms/bucket.png',
|
9
|
+
};
|
10
|
+
exports.bottleType = '0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::bottle::Bottle';
|
11
|
+
exports.buckId = '0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK';
|
12
|
+
exports.collaterals = [
|
13
|
+
{
|
14
|
+
tokenId: '0x2::sui::SUI',
|
15
|
+
parentId: '0x86050d85ebdafe3bda92c36c8489d46a233f57f103672647062f72f3fe37a46d',
|
16
|
+
},
|
17
|
+
{
|
18
|
+
tokenId: '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN',
|
19
|
+
parentId: '0x44529d74a43073c40963fe42c8d2e51d8a441d480ee105ea0c27f3847433ae21',
|
20
|
+
},
|
21
|
+
{
|
22
|
+
tokenId: '0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN',
|
23
|
+
parentId: '0x9cba3b4a99686c924ff3dc8940b70b35348bbe457767419be19feaec5594255c',
|
24
|
+
},
|
25
|
+
{
|
26
|
+
tokenId: '0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN',
|
27
|
+
parentId: '0xd21552e2b0df056f5f86206d758d4c87438d302e592575099726bd9d0ea16128',
|
28
|
+
},
|
29
|
+
];
|
30
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bucket/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,QAAQ,CAAC;AACtB,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,oDAAoD;CAC5D,CAAC;AAEW,QAAA,UAAU,GACrB,oFAAoF,CAAC;AAC1E,QAAA,MAAM,GACjB,gFAAgF,CAAC;AAEtE,QAAA,WAAW,GAAG;IACzB;QACE,OAAO,EAAE,eAAe;QACxB,QAAQ,EACN,oEAAoE;KACvE;IACD;QACE,OAAO,EACL,gFAAgF;QAClF,QAAQ,EACN,oEAAoE;KACvE;IACD;QACE,OAAO,EACL,gFAAgF;QAClF,QAAQ,EACN,oEAAoE;KACvE;IACD;QACE,OAAO,EACL,gFAAgF;QAClF,QAAQ,EACN,oEAAoE;KACvE;CACF,CAAC"}
|
@@ -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.platforms = exports.fetchers = exports.jobs = void 0;
|
7
|
+
const collateralFetcher_1 = __importDefault(require("./collateralFetcher"));
|
8
|
+
const constants_1 = require("./constants");
|
9
|
+
exports.jobs = [];
|
10
|
+
exports.fetchers = [collateralFetcher_1.default];
|
11
|
+
exports.platforms = [constants_1.bucketPlatform];
|
12
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bucket/index.ts"],"names":[],"mappings":";;;;;;AAGA,4EAAoD;AACpD,2CAA6C;AAEhC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,CAAC,2BAAiB,CAAC,CAAC;AAC1C,QAAA,SAAS,GAAe,CAAC,0BAAc,CAAC,CAAC"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
export type CollateralFields = {
|
2
|
+
id: string;
|
3
|
+
name: string;
|
4
|
+
value: {
|
5
|
+
type: string;
|
6
|
+
fields: {
|
7
|
+
next: string;
|
8
|
+
prev: string;
|
9
|
+
value: {
|
10
|
+
type: string;
|
11
|
+
fields: {
|
12
|
+
buck_amount: string;
|
13
|
+
collateral_amount: string;
|
14
|
+
id: {
|
15
|
+
id: string;
|
16
|
+
};
|
17
|
+
reward_coll_snapshot: string;
|
18
|
+
reward_debt_snapshot: string;
|
19
|
+
stake_amount: string;
|
20
|
+
};
|
21
|
+
};
|
22
|
+
};
|
23
|
+
};
|
24
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bucket/types.ts"],"names":[],"mappings":""}
|
@@ -7,9 +7,15 @@ exports.fetchers = exports.jobs = exports.platforms = void 0;
|
|
7
7
|
const suiFetcher_1 = __importDefault(require("./suiFetcher"));
|
8
8
|
const aptosFetcher_1 = __importDefault(require("./aptosFetcher"));
|
9
9
|
const solanaFetcher_1 = __importDefault(require("./solanaFetcher"));
|
10
|
+
const seiFetcher_1 = __importDefault(require("./seiFetcher"));
|
10
11
|
const activeValidatorsJob_1 = __importDefault(require("./activeValidatorsJob"));
|
11
12
|
const constants_1 = require("./constants");
|
12
13
|
exports.platforms = [constants_1.nativeStakePlatform];
|
13
14
|
exports.jobs = [activeValidatorsJob_1.default];
|
14
|
-
exports.fetchers = [
|
15
|
+
exports.fetchers = [
|
16
|
+
suiFetcher_1.default,
|
17
|
+
aptosFetcher_1.default,
|
18
|
+
solanaFetcher_1.default,
|
19
|
+
seiFetcher_1.default,
|
20
|
+
];
|
15
21
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/native-stake/index.ts"],"names":[],"mappings":";;;;;;AAGA,8DAAsC;AACtC,kEAA0C;AAC1C,oEAA4C;AAC5C,gFAAuD;AACvD,2CAAkD;AAErC,QAAA,SAAS,GAAe,CAAC,+BAAmB,CAAC,CAAC;AAC9C,QAAA,IAAI,GAAU,CAAC,6BAAkB,CAAC,CAAC;AACnC,QAAA,QAAQ,GAAc,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/native-stake/index.ts"],"names":[],"mappings":";;;;;;AAGA,8DAAsC;AACtC,kEAA0C;AAC1C,oEAA4C;AAC5C,8DAAsC;AACtC,gFAAuD;AACvD,2CAAkD;AAErC,QAAA,SAAS,GAAe,CAAC,+BAAmB,CAAC,CAAC;AAC9C,QAAA,IAAI,GAAU,CAAC,6BAAkB,CAAC,CAAC;AACnC,QAAA,QAAQ,GAAc;IACjC,oBAAU;IACV,sBAAY;IACZ,uBAAa;IACb,oBAAU;CACX,CAAC"}
|
@@ -0,0 +1,78 @@
|
|
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 long_1 = __importDefault(require("long"));
|
17
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
|
+
const constants_1 = require("./constants");
|
19
|
+
const clients_1 = require("../../utils/clients");
|
20
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
21
|
+
const maxBalances = 1500;
|
22
|
+
const limit = long_1.default.fromNumber(200);
|
23
|
+
const key = new Uint8Array(0);
|
24
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
25
|
+
const delegations = [];
|
26
|
+
let offset = long_1.default.ZERO;
|
27
|
+
let nextKey = new Uint8Array(0);
|
28
|
+
const client = yield (0, clients_1.getClientSei)();
|
29
|
+
do {
|
30
|
+
const res = yield client.cosmos.staking.v1beta1.delegatorDelegations({
|
31
|
+
delegatorAddr: owner,
|
32
|
+
pagination: {
|
33
|
+
countTotal: true,
|
34
|
+
key,
|
35
|
+
limit,
|
36
|
+
offset,
|
37
|
+
reverse: false,
|
38
|
+
},
|
39
|
+
});
|
40
|
+
delegations.push(...res.delegationResponses);
|
41
|
+
nextKey = res.pagination.nextKey;
|
42
|
+
offset = offset.add(limit);
|
43
|
+
if (offset.greaterThanOrEqual(res.pagination.total))
|
44
|
+
break;
|
45
|
+
} while (nextKey !== null && offset.lt(maxBalances));
|
46
|
+
if (delegations.length === 0)
|
47
|
+
return [];
|
48
|
+
const seiTokenPrice = yield cache.getTokenPrice(portfolio_core_1.seiNativeAddress, portfolio_core_1.NetworkId.sei);
|
49
|
+
if (!seiTokenPrice)
|
50
|
+
return [];
|
51
|
+
const nativeAssets = [];
|
52
|
+
for (const delegation of delegations) {
|
53
|
+
const amount = new bignumber_js_1.default(delegation.balance.amount)
|
54
|
+
.dividedBy(Math.pow(10, seiTokenPrice.decimals))
|
55
|
+
.toNumber();
|
56
|
+
const stakedAsset = (0, tokenPriceToAssetToken_1.default)(portfolio_core_1.seiNetwork.native.address, amount, portfolio_core_1.NetworkId.sei, seiTokenPrice);
|
57
|
+
nativeAssets.push(stakedAsset);
|
58
|
+
}
|
59
|
+
return [
|
60
|
+
{
|
61
|
+
networkId: portfolio_core_1.NetworkId.sei,
|
62
|
+
platformId: constants_1.platformId,
|
63
|
+
type: 'multiple',
|
64
|
+
label: 'Staked',
|
65
|
+
value: (0, portfolio_core_1.getUsdValueSum)(nativeAssets.map((a) => a.value)),
|
66
|
+
data: {
|
67
|
+
assets: nativeAssets,
|
68
|
+
},
|
69
|
+
},
|
70
|
+
];
|
71
|
+
});
|
72
|
+
const fetcher = {
|
73
|
+
id: `${constants_1.platformId}-sei`,
|
74
|
+
networkId: portfolio_core_1.NetworkId.sei,
|
75
|
+
executor,
|
76
|
+
};
|
77
|
+
exports.default = fetcher;
|
78
|
+
//# sourceMappingURL=seiFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"seiFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/native-stake/seiFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;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iCAAgB,EAChB,0BAAS,CAAC,GAAG,CACd,CAAC;IACF,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,CAAC;IAE9B,MAAM,YAAY,GAAqB,EAAE,CAAC;IAE1C,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;QACpC,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC;aACpD,SAAS,CAAC,SAAA,EAAE,EAAI,aAAa,CAAC,QAAQ,CAAA,CAAC;aACvC,QAAQ,EAAE,CAAC;QAEd,MAAM,WAAW,GAAG,IAAA,gCAAsB,EACxC,2BAAU,CAAC,MAAM,CAAC,OAAO,EACzB,MAAM,EACN,0BAAS,CAAC,GAAG,EACb,aAAa,CACd,CAAC;QACF,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;KAChC;IACD,OAAO;QACL;YACE,SAAS,EAAE,0BAAS,CAAC,GAAG;YACxB,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,QAAQ;YACf,KAAK,EAAE,IAAA,+BAAc,EAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACvD,IAAI,EAAE;gBACJ,MAAM,EAAE,YAAY;aACrB;SACF;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,MAAM;IACvB,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -19,3 +19,14 @@ export type ValidatorSet = {
|
|
19
19
|
total_voting_power: string;
|
20
20
|
};
|
21
21
|
};
|
22
|
+
export type DelegationResponse = {
|
23
|
+
delegation: {
|
24
|
+
delegatorAddress: string;
|
25
|
+
validatorAddress: string;
|
26
|
+
shares: string;
|
27
|
+
};
|
28
|
+
balance: {
|
29
|
+
denom: string;
|
30
|
+
amount: string;
|
31
|
+
};
|
32
|
+
};
|
@@ -0,0 +1,120 @@
|
|
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 sui_js_1 = require("@mysten/sui.js");
|
17
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
|
+
const constants_1 = require("./constants");
|
19
|
+
const clients_1 = require("../../utils/clients");
|
20
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
21
|
+
const indexFactor = 18;
|
22
|
+
const rateFactor = 27;
|
23
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
24
|
+
const client = (0, clients_1.getClientSui)();
|
25
|
+
const borrowedAssets = [];
|
26
|
+
const borrowedYields = [];
|
27
|
+
const suppliedAssets = [];
|
28
|
+
const suppliedYields = [];
|
29
|
+
const rewardAssets = [];
|
30
|
+
const reservesData = yield cache.getItem(constants_1.reservesKey, {
|
31
|
+
prefix: constants_1.reservesPrefix,
|
32
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
33
|
+
});
|
34
|
+
if (!reservesData)
|
35
|
+
return [];
|
36
|
+
const reserveById = new Map();
|
37
|
+
for (const reserve of reservesData) {
|
38
|
+
reserveById.set(reserve.id.id, reserve);
|
39
|
+
}
|
40
|
+
for (const pool of constants_1.poolsInfos) {
|
41
|
+
const reserve = reserveById.get(pool.reserveData);
|
42
|
+
if (!reserve)
|
43
|
+
continue;
|
44
|
+
const reserveData = reserve.value.fields;
|
45
|
+
const borrowBalance = yield client.getDynamicFieldObject({
|
46
|
+
parentId: pool.borrowBalanceParentId,
|
47
|
+
name: { type: 'address', value: owner },
|
48
|
+
});
|
49
|
+
const supplyBalance = yield client.getDynamicFieldObject({
|
50
|
+
parentId: pool.supplyBalanceParentId,
|
51
|
+
name: { type: 'address', value: owner },
|
52
|
+
});
|
53
|
+
const tokenPrice = yield cache.getTokenPrice(pool.type, portfolio_core_1.NetworkId.sui);
|
54
|
+
if (!tokenPrice)
|
55
|
+
continue;
|
56
|
+
if (!borrowBalance.error && borrowBalance.data) {
|
57
|
+
const borrowInfo = (0, sui_js_1.getObjectFields)(borrowBalance.data);
|
58
|
+
if (borrowInfo.value) {
|
59
|
+
borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPrice.address, new bignumber_js_1.default(borrowInfo.value)
|
60
|
+
.dividedBy(reserveData.current_borrow_index)
|
61
|
+
.multipliedBy(Math.pow(10, indexFactor))
|
62
|
+
.toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice));
|
63
|
+
const apy = new bignumber_js_1.default(reserveData.current_borrow_rate)
|
64
|
+
.dividedBy(Math.pow(10, rateFactor))
|
65
|
+
.toNumber();
|
66
|
+
borrowedYields.push([
|
67
|
+
{
|
68
|
+
apr: (0, portfolio_core_1.apyToApr)(apy),
|
69
|
+
apy,
|
70
|
+
},
|
71
|
+
]);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
if (!supplyBalance.error && supplyBalance.data) {
|
75
|
+
const supplyInfo = (0, sui_js_1.getObjectFields)(supplyBalance.data);
|
76
|
+
if (supplyInfo.value) {
|
77
|
+
suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPrice.address, new bignumber_js_1.default(supplyInfo.value)
|
78
|
+
.dividedBy(reserveData.current_supply_index)
|
79
|
+
.multipliedBy(Math.pow(10, indexFactor))
|
80
|
+
.toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice));
|
81
|
+
const apy = new bignumber_js_1.default(reserveData.current_supply_rate)
|
82
|
+
.dividedBy(Math.pow(10, rateFactor))
|
83
|
+
.toNumber();
|
84
|
+
suppliedYields.push([
|
85
|
+
{
|
86
|
+
apr: (0, portfolio_core_1.apyToApr)(apy),
|
87
|
+
apy,
|
88
|
+
},
|
89
|
+
]);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
const { borrowedValue, collateralRatio, suppliedValue, value } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets);
|
94
|
+
const element = {
|
95
|
+
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
96
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
97
|
+
platformId: constants_1.platformId,
|
98
|
+
label: 'Lending',
|
99
|
+
value,
|
100
|
+
data: {
|
101
|
+
borrowedAssets,
|
102
|
+
borrowedValue,
|
103
|
+
borrowedYields,
|
104
|
+
suppliedAssets,
|
105
|
+
suppliedValue,
|
106
|
+
suppliedYields,
|
107
|
+
collateralRatio,
|
108
|
+
rewardAssets,
|
109
|
+
value,
|
110
|
+
},
|
111
|
+
};
|
112
|
+
return [element];
|
113
|
+
});
|
114
|
+
const fetcher = {
|
115
|
+
id: `${constants_1.platformId}-collateral`,
|
116
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
117
|
+
executor,
|
118
|
+
};
|
119
|
+
exports.default = fetcher;
|
120
|
+
//# sourceMappingURL=collateralFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"collateralFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins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G,sBAAU,aAAa;IAC9B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { Platform } from '@sonarwatch/portfolio-core';
|
2
|
+
export declare const platformId = "navi";
|
3
|
+
export declare const naviPlatform: Platform;
|
4
|
+
export declare const reservesPrefix = "navi";
|
5
|
+
export declare const reservesKey = "reserves";
|
6
|
+
export declare const reserveParentId = "0xe6d4c6610b86ce7735ea754596d71d72d10c7980b5052fc3c8cdf8d09fea9b4b";
|
7
|
+
export declare const poolsInfos: {
|
8
|
+
id: number;
|
9
|
+
name: string;
|
10
|
+
type: string;
|
11
|
+
reserveData: string;
|
12
|
+
pool: string;
|
13
|
+
borrowBalanceParentId: string;
|
14
|
+
supplyBalanceParentId: string;
|
15
|
+
}[];
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.poolsInfos = exports.reserveParentId = exports.reservesKey = exports.reservesPrefix = exports.naviPlatform = exports.platformId = void 0;
|
4
|
+
exports.platformId = 'navi';
|
5
|
+
exports.naviPlatform = {
|
6
|
+
id: exports.platformId,
|
7
|
+
name: 'Navi',
|
8
|
+
image: `https://alpha.sonar.watch/img/platforms/${exports.platformId}.png`,
|
9
|
+
};
|
10
|
+
exports.reservesPrefix = exports.platformId;
|
11
|
+
exports.reservesKey = 'reserves';
|
12
|
+
exports.reserveParentId = '0xe6d4c6610b86ce7735ea754596d71d72d10c7980b5052fc3c8cdf8d09fea9b4b';
|
13
|
+
exports.poolsInfos = [
|
14
|
+
{
|
15
|
+
id: 0,
|
16
|
+
name: 'sui',
|
17
|
+
type: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',
|
18
|
+
reserveData: '0xab644b5fd11aa11e930d1c7bc903ef609a9feaf9ffe1b23532ad8441854fbfaf',
|
19
|
+
pool: '0x96df0fce3c471489f4debaaa762cf960b3d97820bd1f3f025ff8190730e958c5',
|
20
|
+
borrowBalanceParentId: '0xe7ff0daa9d090727210abe6a8b6c0c5cd483f3692a10610386e4dc9c57871ba7',
|
21
|
+
supplyBalanceParentId: '0x589c83af4b035a3bc64c40d9011397b539b97ea47edf7be8f33d643606bf96f8',
|
22
|
+
},
|
23
|
+
{
|
24
|
+
id: 1,
|
25
|
+
name: 'usdc',
|
26
|
+
type: '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN',
|
27
|
+
reserveData: '0xeb3903f7748ace73429bd52a70fff278aac1725d3b58afa781f25ce3450ac203',
|
28
|
+
pool: '0xa02a98f9c88db51c6f5efaaf2261c81f34dd56d86073387e0ef1805ca22e39c8',
|
29
|
+
borrowBalanceParentId: '0x8a3aaa817a811131c624658f6e77cba04ab5829293d2c49c1a9cce8ac9c8dec4',
|
30
|
+
supplyBalanceParentId: '0x8d0a4467806458052d577c8cd2be6031e972f2b8f5f77fce98aa12cd85330da9',
|
31
|
+
},
|
32
|
+
{
|
33
|
+
id: 2,
|
34
|
+
name: 'usdt',
|
35
|
+
type: '0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN',
|
36
|
+
reserveData: '0xb8c5eab02a0202f638958cc79a69a2d30055565caad1684b3c8bbca3bddcb322',
|
37
|
+
pool: '',
|
38
|
+
borrowBalanceParentId: '0xc14d8292a7d69ae31164bafab7ca8a5bfda11f998540fe976a674ed0673e448f',
|
39
|
+
supplyBalanceParentId: '0x7e2a49ff9d2edd875f82b76a9b21e2a5a098e7130abfd510a203b6ea08ab9257',
|
40
|
+
},
|
41
|
+
{
|
42
|
+
id: 3,
|
43
|
+
name: 'weth',
|
44
|
+
type: '0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN',
|
45
|
+
pool: '0x71b9f6e822c48ce827bceadce82201d6a7559f7b0350ed1daa1dc2ba3ac41b56',
|
46
|
+
reserveData: '0xafecf4b57899d377cc8c9de75854c68925d9f512d0c47150ca52a0d3a442b735',
|
47
|
+
borrowBalanceParentId: '0x7568d06a1b6ffc416a36c82791e3daf0e621cf19d4a2724fc6f74842661b6323',
|
48
|
+
supplyBalanceParentId: '0xa668905b1ad445a3159b4d29b1181c4a62d864861b463dd9106cc0d97ffe8f7f',
|
49
|
+
},
|
50
|
+
];
|
51
|
+
//# sourceMappingURL=constants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,YAAY,GAAa;IACpC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,2CAA2C,kBAAU,MAAM;CACnE,CAAC;AAEW,QAAA,cAAc,GAAG,kBAAU,CAAC;AAC5B,QAAA,WAAW,GAAG,UAAU,CAAC;AAEzB,QAAA,eAAe,GAC1B,oEAAoE,CAAC;AAE1D,QAAA,UAAU,GAAG;IACxB;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,8EAA8E;QACpF,WAAW,EACT,oEAAoE;QACtE,IAAI,EAAE,oEAAoE;QAC1E,qBAAqB,EACnB,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;KACvE;IACD;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,gFAAgF;QACtF,WAAW,EACT,oEAAoE;QACtE,IAAI,EAAE,oEAAoE;QAC1E,qBAAqB,EACnB,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;KACvE;IACD;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,gFAAgF;QACtF,WAAW,EACT,oEAAoE;QACtE,IAAI,EAAE,EAAE;QACR,qBAAqB,EACnB,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;KACvE;IACD;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,gFAAgF;QACtF,IAAI,EAAE,oEAAoE;QAC1E,WAAW,EACT,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;QACtE,qBAAqB,EACnB,oEAAoE;KACvE;CACF,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
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.platforms = exports.fetchers = exports.jobs = void 0;
|
7
|
+
const reservesJob_1 = __importDefault(require("./reservesJob"));
|
8
|
+
const collateralFetcher_1 = __importDefault(require("./collateralFetcher"));
|
9
|
+
const constants_1 = require("./constants");
|
10
|
+
exports.jobs = [reservesJob_1.default];
|
11
|
+
exports.fetchers = [collateralFetcher_1.default];
|
12
|
+
exports.platforms = [constants_1.naviPlatform];
|
13
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/index.ts"],"names":[],"mappings":";;;;;;AAGA,gEAAuC;AACvC,4EAAoD;AACpD,2CAA2C;AAE9B,QAAA,IAAI,GAAU,CAAC,qBAAU,CAAC,CAAC;AAC3B,QAAA,QAAQ,GAAc,CAAC,2BAAiB,CAAC,CAAC;AAC1C,QAAA,SAAS,GAAe,CAAC,wBAAY,CAAC,CAAC"}
|
@@ -0,0 +1,40 @@
|
|
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 sui_js_1 = require("@mysten/sui.js");
|
13
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
14
|
+
const clients_1 = require("../../utils/clients");
|
15
|
+
const constants_1 = require("./constants");
|
16
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
17
|
+
const client = (0, clients_1.getClientSui)();
|
18
|
+
const reservesDatas = [];
|
19
|
+
for (const pool of constants_1.poolsInfos) {
|
20
|
+
const reserves = yield client.getDynamicFieldObject({
|
21
|
+
parentId: constants_1.reserveParentId,
|
22
|
+
name: { type: 'u8', value: pool.id.toString() },
|
23
|
+
});
|
24
|
+
if (reserves.data) {
|
25
|
+
const fields = (0, sui_js_1.getObjectFields)(reserves.data);
|
26
|
+
if (fields.value)
|
27
|
+
reservesDatas.push(fields);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
yield cache.setItem(constants_1.reservesKey, reservesDatas, {
|
31
|
+
prefix: constants_1.reservesPrefix,
|
32
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
33
|
+
});
|
34
|
+
});
|
35
|
+
const job = {
|
36
|
+
id: `${constants_1.platformId}-reserves`,
|
37
|
+
executor,
|
38
|
+
};
|
39
|
+
exports.default = job;
|
40
|
+
//# sourceMappingURL=reservesJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"reservesJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/reservesJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2CAAiD;AACjD,+DAAuD;AAGvD,iDAAmD;AACnD,2CAMqB;AAGrB,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,aAAa,GAAkB,EAAE,CAAC;IACxC,KAAK,MAAM,IAAI,IAAI,sBAAU,EAAE;QAC7B,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC;YAClD,QAAQ,EAAE,2BAAe;YACzB,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE;SAChD,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,IAAI,EAAE;YACjB,MAAM,MAAM,GAAG,IAAA,wBAAe,EAAC,QAAQ,CAAC,IAAI,CAAgB,CAAC;YAC7D,IAAI,MAAM,CAAC,KAAK;gBAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC9C;KACF;IACD,MAAM,KAAK,CAAC,OAAO,CAAC,uBAAW,EAAE,aAAa,EAAE;QAC9C,MAAM,EAAE,0BAAc;QACtB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,QAAQ;CACT,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
export type Balance = {
|
2
|
+
id: {
|
3
|
+
id: string;
|
4
|
+
};
|
5
|
+
name: string;
|
6
|
+
value: string;
|
7
|
+
};
|
8
|
+
export type BorrowRateFactors = {
|
9
|
+
type: string;
|
10
|
+
fields: {
|
11
|
+
base_rate: string;
|
12
|
+
jump_rate_multiplier: string;
|
13
|
+
multiplier: string;
|
14
|
+
optimal_utilization: string;
|
15
|
+
reserve_factor: string;
|
16
|
+
};
|
17
|
+
};
|
18
|
+
export type LiquidationFactors = {
|
19
|
+
type: string;
|
20
|
+
fields: {
|
21
|
+
bonus: string;
|
22
|
+
ratio: string;
|
23
|
+
threshold: string;
|
24
|
+
};
|
25
|
+
};
|
26
|
+
export type ReserveData = {
|
27
|
+
id: {
|
28
|
+
id: string;
|
29
|
+
};
|
30
|
+
name: number;
|
31
|
+
value: {
|
32
|
+
type: string;
|
33
|
+
fields: {
|
34
|
+
borrow_balance: Balance;
|
35
|
+
borrow_cap_ceiling: string;
|
36
|
+
borrow_rate_factors: BorrowRateFactors;
|
37
|
+
coin_type: string;
|
38
|
+
current_borrow_index: string;
|
39
|
+
current_borrow_rate: string;
|
40
|
+
current_supply_index: string;
|
41
|
+
current_supply_rate: string;
|
42
|
+
id: number;
|
43
|
+
is_isolated: boolean;
|
44
|
+
last_update_timestamp: string;
|
45
|
+
liquidation_factors: LiquidationFactors;
|
46
|
+
ltv: string;
|
47
|
+
oracle_id: number;
|
48
|
+
reserve_field_a: string;
|
49
|
+
reserve_field_b: string;
|
50
|
+
reserve_field_c: string;
|
51
|
+
supply_balance: Balance;
|
52
|
+
supply_cap_ceiling: string;
|
53
|
+
treasury_balance: string;
|
54
|
+
treasury_factor: string;
|
55
|
+
};
|
56
|
+
};
|
57
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/types.ts"],"names":[],"mappings":""}
|
@@ -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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
13
|
+
const getAssetsByOwner_1 = require("../../../utils/solana/getAssetsByOwner");
|
14
|
+
const constants_1 = require("../constants");
|
15
|
+
const constants_2 = require("../../../utils/clients/constants");
|
16
|
+
const executor = (owner) => __awaiter(void 0, void 0, void 0, function* () {
|
17
|
+
const rpcEndpoint = (0, constants_2.getRpcEndpoint)(portfolio_core_1.NetworkId.solana);
|
18
|
+
const list = yield (0, getAssetsByOwner_1.getAssetsByOwner)(rpcEndpoint, owner);
|
19
|
+
const cNftsItems = list.items.filter((i) => i.compression.compressed);
|
20
|
+
const assets = cNftsItems.map((i) => {
|
21
|
+
var _a;
|
22
|
+
return ({
|
23
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
24
|
+
type: portfolio_core_1.PortfolioAssetType.collectible,
|
25
|
+
value: null,
|
26
|
+
data: {
|
27
|
+
address: i.id,
|
28
|
+
amount: 1,
|
29
|
+
price: null,
|
30
|
+
name: i.content.metadata.name,
|
31
|
+
imageUri: (_a = i.content.files.find((f) => { var _a; return (_a = f.mime) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase().startsWith('image'); })) === null || _a === void 0 ? void 0 : _a.uri,
|
32
|
+
dataUri: i.content.json_uri,
|
33
|
+
},
|
34
|
+
});
|
35
|
+
});
|
36
|
+
if (assets.length === 0)
|
37
|
+
return [];
|
38
|
+
const element = {
|
39
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
40
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
41
|
+
platformId: constants_1.walletNftsPlatform.id,
|
42
|
+
label: 'Wallet',
|
43
|
+
value: null,
|
44
|
+
data: {
|
45
|
+
assets,
|
46
|
+
},
|
47
|
+
};
|
48
|
+
return [element];
|
49
|
+
});
|
50
|
+
const fetcher = {
|
51
|
+
id: `${constants_1.walletTokensPlatform.id}-solana-cnfts`,
|
52
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
53
|
+
executor,
|
54
|
+
};
|
55
|
+
exports.default = fetcher;
|
56
|
+
//# sourceMappingURL=solana-cnfts.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"solana-cnfts.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana-cnfts.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAMoC;AAEpC,6EAA0E;AAC1E,4CAAwE;AACxE,gEAAkE;AAElE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,EAAE;IACxD,MAAM,WAAW,GAAG,IAAA,0BAAc,EAAC,0BAAS,CAAC,MAAM,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,MAAM,IAAA,mCAAgB,EAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAExD,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IACtE,MAAM,MAAM,GAAgC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;;QAAC,OAAA,CAAC;YACjE,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,IAAI,EAAE,mCAAkB,CAAC,WAAW;YACpC,KAAK,EAAE,IAAI;YACX,IAAI,EAAE;gBACJ,OAAO,EAAE,CAAC,CAAC,EAAE;gBACb,MAAM,EAAE,CAAC;gBACT,KAAK,EAAE,IAAI;gBACX,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAC7B,QAAQ,EAAE,MAAA,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,WACnC,OAAA,MAAA,CAAC,CAAC,IAAI,0CAAE,iBAAiB,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA,EAAA,CAChD,0CAAE,GAAG;gBACN,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ;aAC5B;SACF,CAAC,CAAA;KAAA,CAAC,CAAC;IACJ,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACnC,MAAM,OAAO,GAA6B;QACxC,IAAI,EAAE,qCAAoB,CAAC,QAAQ;QACnC,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,UAAU,EAAE,8BAAkB,CAAC,EAAE;QACjC,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,IAAI;QACX,IAAI,EAAE;YACJ,MAAM;SACP;KACF,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,eAAe;IAC7C,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -23,10 +23,9 @@ const prefix = 'nft-images';
|
|
23
23
|
const noImageValue = 'noimage';
|
24
24
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
25
25
|
const client = (0, clients_1.getClientSolana)();
|
26
|
-
const ownerPubKey = new web3_js_1.PublicKey(owner);
|
27
26
|
const metaplex = new js_1.Metaplex(client);
|
28
27
|
const outputs = yield metaplex.nfts().findAllByOwner({
|
29
|
-
owner:
|
28
|
+
owner: new web3_js_1.PublicKey(owner),
|
30
29
|
});
|
31
30
|
const cachedImages = yield cache.getItems(outputs.map((o) => o.model === 'metadata'
|
32
31
|
? o.mintAddress.toString()
|
@@ -48,7 +47,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
48
47
|
missings.push(o);
|
49
48
|
}
|
50
49
|
});
|
51
|
-
const res = yield (0, runInBatch_1.default)(missings.map((o) => () => metaplex.nfts().load({ metadata: o })),
|
50
|
+
const res = yield (0, runInBatch_1.default)(missings.map((o) => () => metaplex.nfts().load({ metadata: o })), 7);
|
52
51
|
const promises = res.map((r, i) => {
|
53
52
|
var _a;
|
54
53
|
const image = r.status !== 'rejected' ? (_a = r.value.json) === null || _a === void 0 ? void 0 : _a.image : undefined;
|
@@ -92,9 +91,6 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
92
91
|
amount,
|
93
92
|
dataUri: output.uri,
|
94
93
|
price: null,
|
95
|
-
value: null,
|
96
|
-
floorPrice: null,
|
97
|
-
image,
|
98
94
|
imageUri: image,
|
99
95
|
name: output.name,
|
100
96
|
collection,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solana-nfts.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana-nfts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,6CAA4C;AAC5C,gDAMiC;AACjC,gEAAqC;AAErC,4CAAwE;AACxE,oDAAyD;AAEzD,gFAAwD;AAExD,MAAM,MAAM,GAAG,YAAY,CAAC;AAC5B,MAAM,YAAY,GAAG,SAAS,CAAC;AAE/B,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,
|
1
|
+
{"version":3,"file":"solana-nfts.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/tokens/fetchers/solana-nfts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,6CAA4C;AAC5C,gDAMiC;AACjC,gEAAqC;AAErC,4CAAwE;AACxE,oDAAyD;AAEzD,gFAAwD;AAExD,MAAM,MAAM,GAAG,YAAY,CAAC;AAC5B,MAAM,YAAY,GAAG,SAAS,CAAC;AAE/B,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,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,CAAC;IACH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACnC,MAAM,OAAO,GAA6B;QACxC,IAAI,EAAE,qCAAoB,CAAC,QAAQ;QACnC,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,UAAU,EAAE,8BAAkB,CAAC,EAAE;QACjC,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,IAAI;QACX,IAAI,EAAE;YACJ,MAAM;SACP;KACF,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,cAAc;IAC5C,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -7,12 +7,12 @@ exports.fetchers = exports.jobs = exports.platforms = void 0;
|
|
7
7
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
8
8
|
const jobExecutorGenerator_1 = __importDefault(require("./jobExecutorGenerator"));
|
9
9
|
const aptos_1 = __importDefault(require("./fetchers/aptos"));
|
10
|
-
const aptos_nfts_1 = __importDefault(require("./fetchers/aptos-nfts"));
|
11
10
|
const solana_1 = __importDefault(require("./fetchers/solana"));
|
12
11
|
const sui_1 = __importDefault(require("./fetchers/sui"));
|
13
12
|
const sui_nfts_1 = __importDefault(require("./fetchers/sui-nfts"));
|
14
13
|
const sei_1 = __importDefault(require("./fetchers/sei"));
|
15
14
|
const solana_native_1 = __importDefault(require("./fetchers/solana-native"));
|
15
|
+
const solana_cnfts_1 = __importDefault(require("./fetchers/solana-cnfts"));
|
16
16
|
const solana_nfts_1 = __importDefault(require("./fetchers/solana-nfts"));
|
17
17
|
const solana_nfts_underlyings_1 = __importDefault(require("./fetchers/solana-nfts-underlyings"));
|
18
18
|
const tokenListsJob_1 = __importDefault(require("./tokenListsJob"));
|
@@ -52,10 +52,10 @@ exports.jobs = [
|
|
52
52
|
];
|
53
53
|
exports.fetchers = [
|
54
54
|
aptos_1.default,
|
55
|
-
aptos_nfts_1.default,
|
56
55
|
solana_1.default,
|
57
56
|
solana_native_1.default,
|
58
57
|
solana_nfts_1.default,
|
58
|
+
solana_cnfts_1.default,
|
59
59
|
solana_nfts_underlyings_1.default,
|
60
60
|
sui_1.default,
|
61
61
|
sui_nfts_1.default,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tokens/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAiE;AACjE,kFAA0D;AAC1D,6DAA4C;AAC5C
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tokens/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAiE;AACjE,kFAA0D;AAC1D,6DAA4C;AAC5C,+DAA8C;AAC9C,yDAAwC;AACxC,mEAAiD;AACjD,yDAAwC;AACxC,6EAA2D;AAC3D,2EAAyD;AACzD,yEAAuD;AACvD,iGAA8E;AAE9E,oEAA4C;AAE5C,0CAA0D;AAC1D,2CAAuE;AAE1D,QAAA,SAAS,GAAe,CAAC,gCAAoB,EAAE,8BAAkB,CAAC,CAAC;AACnE,QAAA,IAAI,GAAU;IACzB;QACE,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,IAAI,0BAAS,CAAC,KAAK,EAAE;QACnD,QAAQ,EAAE,IAAA,8BAAoB,EAAC,0BAAS,CAAC,KAAK,CAAC;KAChD;IACD;QACE,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,IAAI,0BAAS,CAAC,MAAM,EAAE;QACpD,QAAQ,EAAE,IAAA,8BAAoB,EAAC,0BAAS,CAAC,MAAM,CAAC;KACjD;IACD;QACE,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,IAAI,0BAAS,CAAC,QAAQ,EAAE;QACtD,QAAQ,EAAE,IAAA,8BAAoB,EAAC,0BAAS,CAAC,QAAQ,CAAC;KACnD;IACD;QACE,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,IAAI,0BAAS,CAAC,SAAS,EAAE;QACvD,QAAQ,EAAE,IAAA,8BAAoB,EAAC,0BAAS,CAAC,SAAS,CAAC;KACpD;IACD;QACE,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,IAAI,0BAAS,CAAC,OAAO,EAAE;QACrD,QAAQ,EAAE,IAAA,8BAAoB,EAAC,0BAAS,CAAC,OAAO,CAAC;KAClD;IACD;QACE,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,IAAI,0BAAS,CAAC,GAAG,EAAE;QACjD,QAAQ,EAAE,IAAA,8BAAoB,EAAC,0BAAS,CAAC,GAAG,CAAC;KAC9C;IACD;QACE,EAAE,EAAE,GAAG,gCAAoB,CAAC,EAAE,IAAI,0BAAS,CAAC,GAAG,EAAE;QACjD,QAAQ,EAAE,IAAA,8BAAoB,EAAC,0BAAS,CAAC,GAAG,CAAC;KAC9C;IACD,uBAAa;CACd,CAAC;AAEW,QAAA,QAAQ,GAAc;IACjC,eAAY;IACZ,gBAAa;IACb,uBAAmB;IACnB,qBAAiB;IACjB,sBAAkB;IAClB,iCAA4B;IAC5B,aAAU;IACV,kBAAc;IACd,aAAU;IACV,GAAG,eAAW;CACf,CAAC"}
|
@@ -0,0 +1,95 @@
|
|
1
|
+
import { RpcEndpoint } from '@sonarwatch/portfolio-core';
|
2
|
+
export declare function getAssetsByOwner(rpcEndpoint: RpcEndpoint, owner: string): Promise<HeliusAssetList>;
|
3
|
+
export type GetAssetsByOwnerOutput = {
|
4
|
+
jsonrpc: string;
|
5
|
+
result: HeliusAssetList;
|
6
|
+
id: string;
|
7
|
+
};
|
8
|
+
export type HeliusAssetList = {
|
9
|
+
total: number;
|
10
|
+
limit: number;
|
11
|
+
page: number;
|
12
|
+
items: HeliusAsset[];
|
13
|
+
};
|
14
|
+
export type HeliusAsset = {
|
15
|
+
interface: string;
|
16
|
+
id: string;
|
17
|
+
content: Content;
|
18
|
+
authorities: Authority[];
|
19
|
+
compression: Compression;
|
20
|
+
grouping: Grouping[];
|
21
|
+
royalty: Royalty;
|
22
|
+
creators: Creator[];
|
23
|
+
ownership: Ownership;
|
24
|
+
supply: Supply | null;
|
25
|
+
mutable: boolean;
|
26
|
+
burnt: boolean;
|
27
|
+
};
|
28
|
+
export type Authority = {
|
29
|
+
address: string;
|
30
|
+
scopes: string[];
|
31
|
+
};
|
32
|
+
export type Compression = {
|
33
|
+
eligible: boolean;
|
34
|
+
compressed: boolean;
|
35
|
+
data_hash: string;
|
36
|
+
creator_hash: string;
|
37
|
+
asset_hash: string;
|
38
|
+
tree: string;
|
39
|
+
seq: number;
|
40
|
+
leaf_id: number;
|
41
|
+
};
|
42
|
+
export type Content = {
|
43
|
+
$schema: string;
|
44
|
+
json_uri: string;
|
45
|
+
files: File[];
|
46
|
+
metadata: Metadata;
|
47
|
+
links?: Links;
|
48
|
+
};
|
49
|
+
export type File = {
|
50
|
+
uri: string;
|
51
|
+
cdn_uri?: string;
|
52
|
+
mime?: string;
|
53
|
+
};
|
54
|
+
export type Links = {
|
55
|
+
external_url: string;
|
56
|
+
};
|
57
|
+
export type Metadata = {
|
58
|
+
attributes?: Attribute[];
|
59
|
+
description?: string;
|
60
|
+
name: string;
|
61
|
+
symbol: string;
|
62
|
+
};
|
63
|
+
export type Attribute = {
|
64
|
+
value: string;
|
65
|
+
trait_type: string;
|
66
|
+
};
|
67
|
+
export type Creator = {
|
68
|
+
address: string;
|
69
|
+
share: number;
|
70
|
+
verified: boolean;
|
71
|
+
};
|
72
|
+
export type Grouping = {
|
73
|
+
group_key: string;
|
74
|
+
group_value: string;
|
75
|
+
};
|
76
|
+
export type Ownership = {
|
77
|
+
frozen: boolean;
|
78
|
+
delegated: boolean;
|
79
|
+
delegate: null | string;
|
80
|
+
ownership_model: string;
|
81
|
+
owner: string;
|
82
|
+
};
|
83
|
+
export type Royalty = {
|
84
|
+
royalty_model: string;
|
85
|
+
target: null;
|
86
|
+
percent: number;
|
87
|
+
basis_points: number;
|
88
|
+
primary_sale_happened: boolean;
|
89
|
+
locked: boolean;
|
90
|
+
};
|
91
|
+
export type Supply = {
|
92
|
+
print_max_supply: number;
|
93
|
+
print_current_supply: number;
|
94
|
+
edition_nonce: number | null;
|
95
|
+
};
|
@@ -0,0 +1,44 @@
|
|
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.getAssetsByOwner = void 0;
|
16
|
+
const axios_1 = __importDefault(require("axios"));
|
17
|
+
const getBasicAuthHeaders_1 = require("../misc/getBasicAuthHeaders");
|
18
|
+
function getAssetsByOwner(rpcEndpoint, owner) {
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
20
|
+
const httpHeaders = rpcEndpoint.basicAuth
|
21
|
+
? (0, getBasicAuthHeaders_1.getBasicAuthHeaders)(rpcEndpoint.basicAuth.username, rpcEndpoint.basicAuth.password)
|
22
|
+
: undefined;
|
23
|
+
return axios_1.default
|
24
|
+
.post(rpcEndpoint.url, {
|
25
|
+
jsonrpc: '2.0',
|
26
|
+
id: Math.random().toString(),
|
27
|
+
method: 'getAssetsByOwner',
|
28
|
+
params: {
|
29
|
+
ownerAddress: owner,
|
30
|
+
page: 1,
|
31
|
+
limit: 1000,
|
32
|
+
sortBy: {
|
33
|
+
sortBy: 'created',
|
34
|
+
sortDirection: 'asc',
|
35
|
+
},
|
36
|
+
},
|
37
|
+
}, {
|
38
|
+
headers: Object.assign({ 'Content-Type': 'application/json' }, httpHeaders),
|
39
|
+
})
|
40
|
+
.then((res) => res.data.result);
|
41
|
+
});
|
42
|
+
}
|
43
|
+
exports.getAssetsByOwner = getAssetsByOwner;
|
44
|
+
//# sourceMappingURL=getAssetsByOwner.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getAssetsByOwner.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/solana/getAssetsByOwner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kDAA6C;AAC7C,qEAAkE;AAElE,SAAsB,gBAAgB,CACpC,WAAwB,EACxB,KAAa;;QAEb,MAAM,WAAW,GAAG,WAAW,CAAC,SAAS;YACvC,CAAC,CAAC,IAAA,yCAAmB,EACjB,WAAW,CAAC,SAAS,CAAC,QAAQ,EAC9B,WAAW,CAAC,SAAS,CAAC,QAAQ,CAC/B;YACH,CAAC,CAAC,SAAS,CAAC;QAEd,OAAO,eAAK;aACT,IAAI,CACH,WAAW,CAAC,GAAG,EACf;YACE,OAAO,EAAE,KAAK;YACd,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAC5B,MAAM,EAAE,kBAAkB;YAC1B,MAAM,EAAE;gBACN,YAAY,EAAE,KAAK;gBACnB,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE;oBACN,MAAM,EAAE,SAAS;oBACjB,aAAa,EAAE,KAAK;iBACrB;aACF;SACF,EACD;YACE,OAAO,kBACL,cAAc,EAAE,kBAAkB,IAC/B,WAAW,CACf;SACF,CACF;aACA,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CAAA;AApCD,4CAoCC"}
|