@sonarwatch/portfolio-plugins 0.5.22 → 0.5.23
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 +5 -1
- package/package.json +2 -2
- package/src/plugins/drift/struct.d.ts +1 -1
- package/src/plugins/native-stake/structs.d.ts +1 -1
- package/src/plugins/tokens/fetchers/solana-nfts.d.ts +3 -0
- package/src/plugins/tokens/fetchers/solana-nfts.js +77 -0
- package/src/plugins/tokens/fetchers/solana-nfts.js.map +1 -0
- package/src/plugins/tokens/index.js +2 -0
- package/src/plugins/tokens/index.js.map +1 -1
package/CHANGELOG.md
CHANGED
@@ -2,10 +2,14 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
-
## [0.5.
|
5
|
+
## [0.5.23](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.22...plugins-0.5.23) (2023-08-10)
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
+
## [0.5.22](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.21...plugins-0.5.22) (2023-08-08)
|
10
|
+
|
11
|
+
|
12
|
+
|
9
13
|
## [0.5.21](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.20...plugins-0.5.21) (2023-08-07)
|
10
14
|
|
11
15
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sonarwatch/portfolio-plugins",
|
3
|
-
"version": "0.5.
|
3
|
+
"version": "0.5.23",
|
4
4
|
"type": "commonjs",
|
5
5
|
"generators": "./generators.json",
|
6
6
|
"dependencies": {
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"viem": "^1.2.9"
|
22
22
|
},
|
23
23
|
"peerDependencies": {
|
24
|
-
"@sonarwatch/portfolio-core": "0.5.
|
24
|
+
"@sonarwatch/portfolio-core": "0.5.23"
|
25
25
|
},
|
26
26
|
"main": "./src/index.js",
|
27
27
|
"types": "./src/index.d.ts"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
-
import { PublicKey } from '@
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
4
4
|
import BigNumber from 'bignumber.js';
|
5
5
|
export declare enum OrderTriggerCondition {
|
6
6
|
Above = 0,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { BeetStruct } from '@metaplex-foundation/beet';
|
3
|
-
import { PublicKey } from '@
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
4
4
|
import BigNumber from 'bignumber.js';
|
5
5
|
export type StakeAccount = {
|
6
6
|
state: number;
|
@@ -0,0 +1,77 @@
|
|
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 web3_js_1 = require("@solana/web3.js");
|
17
|
+
const js_1 = require("@metaplex-foundation/js");
|
18
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
19
|
+
const platforms_1 = require("../../../platforms");
|
20
|
+
const clients_1 = require("../../../utils/clients");
|
21
|
+
const executor = (owner) => __awaiter(void 0, void 0, void 0, function* () {
|
22
|
+
const client = (0, clients_1.getClientSolana)();
|
23
|
+
const ownerPubKey = new web3_js_1.PublicKey(owner);
|
24
|
+
const metaplex = new js_1.Metaplex(client);
|
25
|
+
if (!owner)
|
26
|
+
return [];
|
27
|
+
const outputs = yield metaplex.nfts().findAllByOwner({
|
28
|
+
owner: ownerPubKey,
|
29
|
+
});
|
30
|
+
const assets = outputs.map((output) => {
|
31
|
+
var _a;
|
32
|
+
const address = output.model === 'metadata'
|
33
|
+
? output.mintAddress.toString()
|
34
|
+
: output.mint.address.toString();
|
35
|
+
const token = (0, js_1.isNftWithToken)(output) || (0, js_1.isSftWithToken)(output) ? output.token : null;
|
36
|
+
const amount = (token === null || token === void 0 ? void 0 : token.amount)
|
37
|
+
? new bignumber_js_1.default(token.amount.basisPoints.toString())
|
38
|
+
.div(Math.pow(10, token.amount.currency.decimals))
|
39
|
+
.toNumber()
|
40
|
+
: 1;
|
41
|
+
return {
|
42
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
43
|
+
type: portfolio_core_1.PortfolioAssetType.collectible,
|
44
|
+
value: null,
|
45
|
+
data: {
|
46
|
+
address,
|
47
|
+
amount,
|
48
|
+
dataUri: output.uri,
|
49
|
+
price: null,
|
50
|
+
value: null,
|
51
|
+
floorPrice: null,
|
52
|
+
name: output.name,
|
53
|
+
collectionId: (_a = output.collection) === null || _a === void 0 ? void 0 : _a.address.toString(),
|
54
|
+
},
|
55
|
+
};
|
56
|
+
});
|
57
|
+
if (assets.length === 0)
|
58
|
+
return [];
|
59
|
+
const element = {
|
60
|
+
type: portfolio_core_1.PortfolioElementType.multiple,
|
61
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
62
|
+
platformId: platforms_1.walletNftsPlatform.id,
|
63
|
+
label: 'Wallet',
|
64
|
+
value: null,
|
65
|
+
data: {
|
66
|
+
assets,
|
67
|
+
},
|
68
|
+
};
|
69
|
+
return [element];
|
70
|
+
});
|
71
|
+
const fetcher = {
|
72
|
+
id: `${platforms_1.walletTokensPlatform.id}-solana-nfts`,
|
73
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
74
|
+
executor,
|
75
|
+
};
|
76
|
+
exports.default = fetcher;
|
77
|
+
//# sourceMappingURL=solana-nfts.js.map
|
@@ -0,0 +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,gDAKiC;AACjC,gEAAqC;AAErC,kDAA8E;AAC9E,oDAAyD;AAEzD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,EAAE;IACxD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,WAAW,GAAG,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,IAAI,aAAQ,CAAC,MAAM,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,cAAc,CAAC;QACnD,KAAK,EAAE,WAAW;KACnB,CAAC,CAAC;IACH,MAAM,MAAM,GAAgC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;;QACjE,MAAM,OAAO,GACX,MAAM,CAAC,KAAK,KAAK,UAAU;YACzB,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE;YAC/B,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QAErC,MAAM,KAAK,GACT,IAAA,mBAAc,EAAC,MAAM,CAAC,IAAI,IAAA,mBAAc,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI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C;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -11,6 +11,7 @@ const aptos_1 = __importDefault(require("./fetchers/aptos"));
|
|
11
11
|
const solana_1 = __importDefault(require("./fetchers/solana"));
|
12
12
|
const sui_1 = __importDefault(require("./fetchers/sui"));
|
13
13
|
const solana_native_1 = __importDefault(require("./fetchers/solana-native"));
|
14
|
+
const solana_nfts_1 = __importDefault(require("./fetchers/solana-nfts"));
|
14
15
|
const tokenListsJob_1 = __importDefault(require("./tokenListsJob"));
|
15
16
|
const evms_1 = require("./fetchers/evms");
|
16
17
|
exports.jobs = [
|
@@ -44,6 +45,7 @@ exports.fetchers = [
|
|
44
45
|
aptos_1.default,
|
45
46
|
solana_1.default,
|
46
47
|
solana_native_1.default,
|
48
|
+
solana_nfts_1.default,
|
47
49
|
sui_1.default,
|
48
50
|
...evms_1.fetchers,
|
49
51
|
];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tokens/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAuD;AACvD,+CAAuD;AACvD,kFAA0D;AAC1D,6DAA4C;AAC5C,+DAA8C;AAC9C,yDAAwC;AACxC,6EAA2D;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/tokens/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAuD;AACvD,+CAAuD;AACvD,kFAA0D;AAC1D,6DAA4C;AAC5C,+DAA8C;AAC9C,yDAAwC;AACxC,6EAA2D;AAC3D,yEAAuD;AAEvD,oEAA4C;AAE5C,0CAA0D;AAE7C,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,E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