@sonarwatch/portfolio-plugins 0.7.14 → 0.7.16
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 +14 -6
- package/package.json +3 -3
- package/src/index.d.ts +1 -0
- package/src/index.js +5 -0
- package/src/index.js.map +1 -1
- package/src/plugins/navi/collateralFetcher.d.ts +3 -0
- package/src/plugins/navi/collateralFetcher.js +122 -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/blank/getBlankNetworkIds.d.ts +4 -0
- package/src/utils/blank/getBlankNetworkIds.js +60 -0
- package/src/utils/blank/getBlankNetworkIds.js.map +1 -0
- package/src/utils/blank/index.d.ts +1 -0
- package/src/utils/blank/index.js +18 -0
- package/src/utils/blank/index.js.map +1 -0
- package/src/utils/blank/isBlankAddressAptos.d.ts +1 -0
- package/src/utils/blank/isBlankAddressAptos.js +22 -0
- package/src/utils/blank/isBlankAddressAptos.js.map +1 -0
- package/src/utils/blank/isBlankAddressEvm.d.ts +2 -0
- package/src/utils/blank/isBlankAddressEvm.js +24 -0
- package/src/utils/blank/isBlankAddressEvm.js.map +1 -0
- package/src/utils/blank/isBlankAddressSui.d.ts +1 -0
- package/src/utils/blank/isBlankAddressSui.js +22 -0
- package/src/utils/blank/isBlankAddressSui.js.map +1 -0
- 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,18 +2,26 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
-
## [0.7.
|
5
|
+
## [0.7.16](https://github.com/sonarwatch/portfolio/compare/plugins-0.7.15...plugins-0.7.16) (2023-09-13)
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
-
## [0.7.
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
## [0.7.12](https://github.com/sonarwatch/portfolio/compare/plugins-0.7.11...plugins-0.7.12) (2023-09-06)
|
9
|
+
## [0.7.15](https://github.com/sonarwatch/portfolio/compare/plugins-0.7.14...plugins-0.7.15) (2023-09-12)
|
14
10
|
|
15
11
|
|
16
12
|
|
13
|
+
## [0.7.14](https://github.com/sonarwatch/portfolio/compare/plugins-0.7.13...plugins-0.7.14) (2023-09-08)
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
## [0.7.13](https://github.com/sonarwatch/portfolio/compare/plugins-0.7.12...plugins-0.7.13) (2023-09-06)
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
## [0.7.12](https://github.com/sonarwatch/portfolio/compare/plugins-0.7.11...plugins-0.7.12) (2023-09-06)
|
22
|
+
|
23
|
+
|
24
|
+
|
17
25
|
## [0.7.11](https://github.com/sonarwatch/portfolio/compare/plugins-0.7.10...plugins-0.7.11) (2023-09-06)
|
18
26
|
|
19
27
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.7.
|
3
|
+
"version": "0.7.16",
|
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.16"
|
40
40
|
},
|
41
41
|
"main": "./src/index.js",
|
42
42
|
"types": "./src/index.d.ts"
|
package/src/index.d.ts
CHANGED
@@ -6,6 +6,7 @@ export * from './Cache';
|
|
6
6
|
export * from './Fetcher';
|
7
7
|
export * from './Job';
|
8
8
|
export * from './utils/name-service';
|
9
|
+
export * from './utils/blank';
|
9
10
|
export declare const platforms: Platform[];
|
10
11
|
export declare const jobs: Job[];
|
11
12
|
export declare const fetchers: Fetcher[];
|
package/src/index.js
CHANGED
@@ -43,6 +43,7 @@ const auxexchange_1 = require("./plugins/auxexchange");
|
|
43
43
|
const maker_1 = require("./plugins/maker");
|
44
44
|
const kamino_1 = require("./plugins/kamino");
|
45
45
|
const bucket_1 = require("./plugins/bucket");
|
46
|
+
const navi_1 = require("./plugins/navi");
|
46
47
|
const getFetchersByAddressSystem_1 = require("./utils/misc/getFetchersByAddressSystem");
|
47
48
|
var constants_1 = require("./plugins/tokens/constants");
|
48
49
|
Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get: function () { return constants_1.walletTokensPlatform; } });
|
@@ -51,6 +52,7 @@ __exportStar(require("./Cache"), exports);
|
|
51
52
|
__exportStar(require("./Fetcher"), exports);
|
52
53
|
__exportStar(require("./Job"), exports);
|
53
54
|
__exportStar(require("./utils/name-service"), exports);
|
55
|
+
__exportStar(require("./utils/blank"), exports);
|
54
56
|
// PLATFORMS //
|
55
57
|
exports.platforms = [
|
56
58
|
...aave_1.platforms,
|
@@ -79,6 +81,7 @@ exports.platforms = [
|
|
79
81
|
...mango_1.platforms,
|
80
82
|
...kamino_1.platforms,
|
81
83
|
...bucket_1.platforms,
|
84
|
+
...navi_1.platforms,
|
82
85
|
];
|
83
86
|
// JOBS //
|
84
87
|
exports.jobs = [
|
@@ -106,6 +109,7 @@ exports.jobs = [
|
|
106
109
|
...aftermath_1.jobs,
|
107
110
|
...liquidswap_1.jobs,
|
108
111
|
...kamino_1.jobs,
|
112
|
+
...navi_1.jobs,
|
109
113
|
];
|
110
114
|
// FETCHERS //
|
111
115
|
exports.fetchers = [
|
@@ -128,6 +132,7 @@ exports.fetchers = [
|
|
128
132
|
...morpho_1.fetchers,
|
129
133
|
...liquiditypools_sei_1.fetchers,
|
130
134
|
...bucket_1.fetchers,
|
135
|
+
...navi_1.fetchers,
|
131
136
|
];
|
132
137
|
exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
|
133
138
|
//# 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,6CAG0B;AAC1B,wFAAqF;AAErF,wDAGoC;AAFlC,iHAAA,oBAAoB,OAAA;AACpB,+GAAA,kBAAkB,OAAA;AAGpB,0CAAwB;AACxB,4CAA0B;AAC1B,wCAAsB;AACtB,uDAAqC;
|
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;AACrC,gDAA8B;AAE9B,eAAe;AACF,QAAA,SAAS,GAAe;IACnC,GAAG,gBAAa;IAChB,GAAG,gBAAa;IAChB,GAAG,iBAAc;IACjB,GAAG,iBAAc;IACjB,GAAG,uBAAoB;IACvB,GAAG,8BAA0B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oB;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"}
|
@@ -0,0 +1,122 @@
|
|
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
|
+
if (suppliedAssets.length === 0 && borrowedAssets.length === 0)
|
94
|
+
return [];
|
95
|
+
const { borrowedValue, collateralRatio, suppliedValue, value } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets);
|
96
|
+
const element = {
|
97
|
+
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
98
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
99
|
+
platformId: constants_1.platformId,
|
100
|
+
label: 'Lending',
|
101
|
+
value,
|
102
|
+
data: {
|
103
|
+
borrowedAssets,
|
104
|
+
borrowedValue,
|
105
|
+
borrowedYields,
|
106
|
+
suppliedAssets,
|
107
|
+
suppliedValue,
|
108
|
+
suppliedYields,
|
109
|
+
collateralRatio,
|
110
|
+
rewardAssets,
|
111
|
+
value,
|
112
|
+
},
|
113
|
+
};
|
114
|
+
return [element];
|
115
|
+
});
|
116
|
+
const fetcher = {
|
117
|
+
id: `${constants_1.platformId}-collateral`,
|
118
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
119
|
+
executor,
|
120
|
+
};
|
121
|
+
exports.default = fetcher;
|
122
|
+
//# sourceMappingURL=collateralFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"collateralFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/navi/collateralFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAQoC;AACpC,2CAAiD;AACjD,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAmD;AACnD,qGAA6E;AAG7E,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,cAAc,GAAqB,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAc,EAAE,CAAC;IACrC,MAAM,cAAc,GAAqB,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAc,EAAE,CAAC;IACrC,MAAM,YAAY,GAAqB,EAAE,CAAC;IAE1C,MAAM,YAAY,GAAG,MAAM,KAAK,CAAC,OAAO,CAAgB,uBAAW,EAAE;QACnE,MAAM,EAAE,0BAAc;QACtB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;IACH,IAAI,CAAC,YAAY;QAAE,OAAO,EAAE,CAAC;IAE7B,MAAM,WAAW,GAA6B,IAAI,GAAG,EAAE,CAAC;IACxD,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE;QAClC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;KACzC;IAED,KAAK,MAAM,IAAI,IAAI,sBAAU,EAAE;QAC7B,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAClD,IAAI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C,GAAG;QACxB,UAAU,EAAV,sBAAU;QACV,KAAK,EAAE,SAAS;QAChB,KAAK;QACL,IAAI,EAAE;YACJ,cAAc;YACd,aAAa;YACb,cAAc;YACd,cAAc;YACd,aAAa;YACb,cAAc;YACd,eAAe;YACf,YAAY;YACZ,KAAK;SACN;KACF,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,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,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":["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SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,IAAI,EAAE,mCAAkB,CAAC,WAAW;YACpC,KAAK,EAAE,IAAI;YACX,IAAI,EAAE;gBACJ,OAAO;gBACP,MAAM;gBACN,OAAO,EAAE,MAAM,CAAC,GAAG;gBACnB,KAAK,EAAE,IAAI;gBACX,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,UAAU;aACX;SACF,CAAC;IACJ,CAAC,CAAC,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,I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dType } from '@sonarwatch/portfolio-core';
|
2
|
+
export declare function getBlankNetworkIds(address: string, addressSystem: AddressSystemType): Promise<NetworkIdType[]>;
|
3
|
+
export declare function getBlankNetworkIdsMove(address: string): Promise<MoveNetworkIdType[]>;
|
4
|
+
export declare function getBlankNetworkIdsEvm(address: string): Promise<EvmNetworkIdType[]>;
|
@@ -0,0 +1,60 @@
|
|
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
|
+
exports.getBlankNetworkIdsEvm = exports.getBlankNetworkIdsMove = exports.getBlankNetworkIds = void 0;
|
13
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
14
|
+
const isBlankAddressSui_1 = require("./isBlankAddressSui");
|
15
|
+
const isBlankAddressAptos_1 = require("./isBlankAddressAptos");
|
16
|
+
const isBlankAddressEvm_1 = require("./isBlankAddressEvm");
|
17
|
+
function getBlankNetworkIds(address, addressSystem) {
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
19
|
+
switch (addressSystem) {
|
20
|
+
case portfolio_core_1.AddressSystem.solana:
|
21
|
+
return [];
|
22
|
+
case portfolio_core_1.AddressSystem.bitcoin:
|
23
|
+
return [];
|
24
|
+
case portfolio_core_1.AddressSystem.evm:
|
25
|
+
return getBlankNetworkIdsEvm(address);
|
26
|
+
case portfolio_core_1.AddressSystem.move:
|
27
|
+
return getBlankNetworkIdsMove(address);
|
28
|
+
case portfolio_core_1.AddressSystem.sei:
|
29
|
+
return [];
|
30
|
+
default:
|
31
|
+
return [];
|
32
|
+
}
|
33
|
+
});
|
34
|
+
}
|
35
|
+
exports.getBlankNetworkIds = getBlankNetworkIds;
|
36
|
+
function getBlankNetworkIdsMove(address) {
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
38
|
+
const promises = [
|
39
|
+
(0, isBlankAddressSui_1.isBlankAddressSui)(address).then((isBlank) => isBlank ? portfolio_core_1.NetworkId.sui : null),
|
40
|
+
(0, isBlankAddressAptos_1.isBlankAddressAptos)(address).then((isBlank) => isBlank ? portfolio_core_1.NetworkId.aptos : null),
|
41
|
+
];
|
42
|
+
return (yield Promise.all(promises)).filter((v) => v !== null);
|
43
|
+
});
|
44
|
+
}
|
45
|
+
exports.getBlankNetworkIdsMove = getBlankNetworkIdsMove;
|
46
|
+
const evmNetworkIds = portfolio_core_1.evmNetworks.map((n) => n.id);
|
47
|
+
function getBlankNetworkIdsEvm(address) {
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
49
|
+
const promises = evmNetworkIds.map((n) => (0, isBlankAddressEvm_1.isBlankAddressEvm)(n, address));
|
50
|
+
const res = yield Promise.all(promises);
|
51
|
+
return res.reduce((acc, curr, i) => {
|
52
|
+
if (curr) {
|
53
|
+
acc.push(evmNetworkIds[i]);
|
54
|
+
}
|
55
|
+
return acc;
|
56
|
+
}, []);
|
57
|
+
});
|
58
|
+
}
|
59
|
+
exports.getBlankNetworkIdsEvm = getBlankNetworkIdsEvm;
|
60
|
+
//# sourceMappingURL=getBlankNetworkIds.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getBlankNetworkIds.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/blank/getBlankNetworkIds.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAQoC;AACpC,2DAAwD;AACxD,+DAA4D;AAC5D,2DAAwD;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CAAC,EAAE,EAAE,CAAC,IAAA,qCAAiB,EAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QACzE,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,GAAuB,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;YACrD,IAAI,IAAI,EAAE;gBACR,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;aAC5B;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC;CAAA;AAXD,sDAWC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './getBlankNetworkIds';
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./getBlankNetworkIds"), exports);
|
18
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/blank/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function isBlankAddressAptos(address: string): Promise<boolean>;
|
@@ -0,0 +1,22 @@
|
|
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
|
+
exports.isBlankAddressAptos = void 0;
|
13
|
+
const clients_1 = require("../clients");
|
14
|
+
function isBlankAddressAptos(address) {
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
16
|
+
const client = (0, clients_1.getClientAptos)();
|
17
|
+
const ressources = yield client.getAccountResources(address).catch(() => []);
|
18
|
+
return ressources.length === 0;
|
19
|
+
});
|
20
|
+
}
|
21
|
+
exports.isBlankAddressAptos = isBlankAddressAptos;
|
22
|
+
//# sourceMappingURL=isBlankAddressAptos.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"isBlankAddressAptos.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/blank/isBlankAddressAptos.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAA4C;AAE5C,SAAsB,mBAAmB,CAAC,OAAe;;QACvD,MAAM,MAAM,GAAG,IAAA,wBAAc,GAAE,CAAC;QAChC,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QAC7E,OAAO,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC;IACjC,CAAC;CAAA;AAJD,kDAIC"}
|
@@ -0,0 +1,24 @@
|
|
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
|
+
exports.isBlankAddressEvm = void 0;
|
13
|
+
const clients_1 = require("../clients");
|
14
|
+
function isBlankAddressEvm(networkId, address) {
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
16
|
+
const client = (0, clients_1.getEvmClient)(networkId);
|
17
|
+
const count = yield client.getTransactionCount({
|
18
|
+
address: address,
|
19
|
+
});
|
20
|
+
return count === 0;
|
21
|
+
});
|
22
|
+
}
|
23
|
+
exports.isBlankAddressEvm = isBlankAddressEvm;
|
24
|
+
//# sourceMappingURL=isBlankAddressEvm.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"isBlankAddressEvm.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/blank/isBlankAddressEvm.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,wCAA0C;AAE1C,SAAsB,iBAAiB,CACrC,SAA2B,EAC3B,OAAe;;QAEf,MAAM,MAAM,GAAG,IAAA,sBAAY,EAAC,SAAS,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC;YAC7C,OAAO,EAAE,OAAwB;SAClC,CAAC,CAAC;QACH,OAAO,KAAK,KAAK,CAAC,CAAC;IACrB,CAAC;CAAA;AATD,8CASC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function isBlankAddressSui(address: string): Promise<boolean>;
|
@@ -0,0 +1,22 @@
|
|
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
|
+
exports.isBlankAddressSui = void 0;
|
13
|
+
const clients_1 = require("../clients");
|
14
|
+
function isBlankAddressSui(address) {
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
16
|
+
const client = (0, clients_1.getClientSui)();
|
17
|
+
const coinsBalances = yield client.getAllBalances({ owner: address });
|
18
|
+
return coinsBalances.length === 0;
|
19
|
+
});
|
20
|
+
}
|
21
|
+
exports.isBlankAddressSui = isBlankAddressSui;
|
22
|
+
//# sourceMappingURL=isBlankAddressSui.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"isBlankAddressSui.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/blank/isBlankAddressSui.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAA0C;AAE1C,SAAsB,iBAAiB,CAAC,OAAe;;QACrD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;QAC9B,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QACtE,OAAO,aAAa,CAAC,MAAM,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AAJD,8CAIC"}
|
@@ -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"}
|