@sonarwatch/portfolio-plugins 0.11.33 → 0.11.35

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,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.11.35](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.34...plugins-0.11.35) (2024-01-05)
6
+
7
+
8
+
9
+ ## [0.11.34](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.33...plugins-0.11.34) (2024-01-04)
10
+
11
+
12
+
5
13
  ## [0.11.33](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.32...plugins-0.11.33) (2024-01-04)
6
14
 
7
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.11.33",
3
+ "version": "0.11.35",
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.33"
44
+ "@sonarwatch/portfolio-core": "0.11.35"
45
45
  },
46
46
  "main": "./src/index.js",
47
47
  "types": "./src/index.d.ts"
@@ -8,22 +8,44 @@ function heliusAssetToAssetCollectible(asset) {
8
8
  const tags = [];
9
9
  if (asset.compression.compressed)
10
10
  tags.push('compressed');
11
- if (asset.spl20)
12
- tags.push('spl20');
13
11
  if (asset.inscription)
14
12
  tags.push('inscription');
13
+ let amount = 1;
14
+ let collection;
15
15
  const decimals = (_a = asset.token_info) === null || _a === void 0 ? void 0 : _a.decimals;
16
16
  const balance = (_b = asset.token_info) === null || _b === void 0 ? void 0 : _b.balance;
17
17
  if (decimals !== undefined && decimals !== 0)
18
18
  return null;
19
19
  // Amount
20
- let amount = 1;
21
20
  if (balance && balance !== 0) {
22
21
  amount = balance;
23
22
  tags.push('sft');
24
23
  }
24
+ if (asset.spl20) {
25
+ const { amt, op, p, tick } = asset.spl20;
26
+ if (p !== 'spl-20')
27
+ return null;
28
+ if (op !== 'mint')
29
+ return null;
30
+ if (amt === undefined)
31
+ return null;
32
+ amount = parseInt(amt, 10);
33
+ collection = {
34
+ floorPrice: null,
35
+ id: `spl-20-${tick}`,
36
+ name: tick.toUpperCase(),
37
+ };
38
+ tags.push('spl20');
39
+ }
25
40
  // Collection
26
- const collection = asset.grouping.find((g) => g.group_key === 'collection');
41
+ const collectionGroup = asset.grouping.find((g) => g.group_key === 'collection');
42
+ if (collectionGroup) {
43
+ collection = {
44
+ floorPrice: null,
45
+ id: collectionGroup.group_value,
46
+ name: collectionGroup.collection_metadata.name,
47
+ };
48
+ }
27
49
  return {
28
50
  type: portfolio_core_1.PortfolioAssetType.collectible,
29
51
  attributes: {
@@ -37,13 +59,7 @@ function heliusAssetToAssetCollectible(asset) {
37
59
  dataUri: asset.content.json_uri,
38
60
  imageUri: (_c = asset.content.links) === null || _c === void 0 ? void 0 : _c.image,
39
61
  attributes: asset.content.metadata.attributes,
40
- collection: collection
41
- ? {
42
- id: collection === null || collection === void 0 ? void 0 : collection.group_value,
43
- name: collection === null || collection === void 0 ? void 0 : collection.collection_metadata.name,
44
- floorPrice: null,
45
- }
46
- : undefined,
62
+ collection,
47
63
  },
48
64
  networkId: portfolio_core_1.NetworkId.solana,
49
65
  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,OAAO;IACP,MAAM,IAAI,GAAyB,EAAE,CAAC;IACtC,IAAI,KAAK,CAAC,WAAW,CAAC,UAAU;QAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC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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;AAjDD,sEAiDC"}
1
+ {"version":3,"file":"heliusAssetToAssetCollectible.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/utils/solana/das/heliusAssetToAssetCollectible.ts"],"names":[],"mappings":";;;AAAA,+DAKoC;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,WAAW;QAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAEhD,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,UAA6C,CAAC;IAElD,MAAM,QAAQ,GAAG,MAAA,KAAK,CAAC,UAAU,0CAAE,QAAQ,CAAC;IAC5C,MAAM,OAAO,GAAG,MAAA,KAAK,CAAC,UAAU,0CAAE,OAAO,CAAC;IAC1C,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAE1D,SAAS;IACT,IAAI,OAAO,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,GAAG,OAAO,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,MAAM,EAAE,GAAG,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