@sonarwatch/portfolio-plugins 0.11.31 → 0.11.32

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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.11.32](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.31...plugins-0.11.32) (2024-01-04)
6
+
7
+
8
+
5
9
  ## [0.11.31](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.30...plugins-0.11.31) (2024-01-04)
6
10
 
7
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.11.31",
3
+ "version": "0.11.32",
4
4
  "type": "commonjs",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
@@ -41,7 +41,7 @@
41
41
  "web3-v1": "npm:web3@^1.5.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@sonarwatch/portfolio-core": "0.11.31"
44
+ "@sonarwatch/portfolio-core": "0.11.32"
45
45
  },
46
46
  "main": "./src/index.js",
47
47
  "types": "./src/index.d.ts"
@@ -4,23 +4,26 @@ exports.heliusAssetToAssetCollectible = void 0;
4
4
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
5
5
  function heliusAssetToAssetCollectible(asset) {
6
6
  var _a;
7
- let amount = 1;
8
- if (asset.token_info && asset.token_info.decimals === 0) {
9
- amount = asset.token_info.balance;
10
- }
11
- let tags = [];
7
+ // Tags
8
+ const tags = [];
12
9
  if (asset.compression.compressed)
13
10
  tags.push('compressed');
14
11
  if (asset.spl20)
15
12
  tags.push('spl20');
16
13
  if (asset.inscription)
17
14
  tags.push('inscription');
18
- if (tags.length === 0)
19
- tags = undefined;
15
+ // Amount
16
+ let amount = 1;
17
+ if (asset.token_info && asset.token_info.decimals === 0) {
18
+ amount = asset.token_info.balance;
19
+ tags.push('sft');
20
+ }
21
+ // Collection
22
+ const collection = asset.grouping.find((g) => g.group_key === 'collection');
20
23
  return {
21
24
  type: portfolio_core_1.PortfolioAssetType.collectible,
22
25
  attributes: {
23
- tags,
26
+ tags: tags.length > 0 ? tags : undefined,
24
27
  },
25
28
  data: {
26
29
  address: asset.id,
@@ -29,6 +32,14 @@ function heliusAssetToAssetCollectible(asset) {
29
32
  name: asset.content.metadata.name,
30
33
  dataUri: asset.content.json_uri,
31
34
  imageUri: (_a = asset.content.links) === null || _a === void 0 ? void 0 : _a.image,
35
+ attributes: asset.content.metadata.attributes,
36
+ collection: collection
37
+ ? {
38
+ id: collection === null || collection === void 0 ? void 0 : collection.group_value,
39
+ name: collection === null || collection === void 0 ? void 0 : collection.collection_metadata.name,
40
+ floorPrice: null,
41
+ }
42
+ : undefined,
32
43
  },
33
44
  networkId: portfolio_core_1.NetworkId.solana,
34
45
  value: null,
@@ -1 +1 @@
1
- {"version":3,"file":"heliusAssetToAssetCollectible.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/solana/das/heliusAssetToAssetCollectible.ts"],"names":[],"mappings":";;;AAAA,+DAIoC;AAGpC,SAAgB,6BAA6B,CAC3C,KAAkB;;IAElB,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;QACxD,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;IACpC,CAAC;IAED,IAAI,IAAI,GAAyB,EAAE,CAAC;IACpC,IAAI,KAAK,CAAC,WAAW,CAAC,UAAU;QAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1D,IAAI,KAAK,CAAC,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,KAAK,CAAC,WAAW;QAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAChD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,IAAI,GAAG,SAAS,CAAC;IAExC,OAAO;QACL,IAAI,EAAE,mCAAkB,CAAC,WAAW;QACpC,UAAU,EAAE;YACV,IAAI;SACL;QACD,IAAI,EAAE;YACJ,OAAO,EAAE,KAAK,CAAC,EAAE;YACjB,MAAM;YACN,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI;YACjC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ;YAC/B,QAAQ,EAAE,MAAA,KAAK,CAAC,OAAO,CAAC,KAAK,0CAAE,KAAK;SACrC;QACD,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,KAAK,EAAE,IAAI;KACZ,CAAC;AACJ,CAAC;AA9BD,sEA8BC"}
1
+ {"version":3,"file":"heliusAssetToAssetCollectible.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/solana/das/heliusAssetToAssetCollectible.ts"],"names":[],"mappings":";;;AAAA,+DAIoC;AAGpC,SAAgB,6BAA6B,CAC3C,KAAkB;;IAElB,OAAO;IACP,MAAM,IAAI,GAAyB,EAAE,CAAC;IACtC,IAAI,KAAK,CAAC,WAAW,CAAC,UAAU;QAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1D,IAAI,KAAK,CAAC,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,KAAK,CAAC,WAAW;QAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAEhD,SAAS;IACT,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;QACxD,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,aAAa;IACb,MAAM,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CACpC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,YAAY,CACL,CAAC;IAEjC,OAAO;QACL,IAAI,EAAE,mCAAkB,CAAC,WAAW;QACpC,UAAU,EAAE;YACV,IAAI,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;SACzC;QACD,IAAI,EAAE;YACJ,OAAO,EAAE,KAAK,CAAC,EAAE;YACjB,MAAM;YACN,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI;YACjC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ;YAC/B,QAAQ,EAAE,MAAA,KAAK,CAAC,OAAO,CAAC,KAAK,0CAAE,KAAK;YACpC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU;YAC7C,UAAU,EAAE,UAAU;gBACpB,CAAC,CAAC;oBACE,EAAE,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,WAAW;oBAC3B,IAAI,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,mBAAmB,CAAC,IAAI;oBAC1C,UAAU,EAAE,IAAI;iBACjB;gBACH,CAAC,CAAC,SAAS;SACd;QACD,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,KAAK,EAAE,IAAI;KACZ,CAAC;AACJ,CAAC;AA7CD,sEA6CC"}
@@ -109,6 +109,19 @@ export type Grouping = {
109
109
  group_key: string;
110
110
  group_value: string;
111
111
  };
112
+ export type CollectionGroup = {
113
+ group_key: 'collection';
114
+ group_value: string;
115
+ verified: boolean;
116
+ collection_metadata: CollectionMetadata;
117
+ };
118
+ export interface CollectionMetadata {
119
+ name: string;
120
+ symbol: string;
121
+ image: string;
122
+ description: string;
123
+ external_url: string;
124
+ }
112
125
  export type Ownership = {
113
126
  frozen: boolean;
114
127
  delegated: boolean;