@cityofzion/bs-neo3 1.1.0 → 1.1.2

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.
@@ -20,4 +20,5 @@ export declare class BSNeo3Helper {
20
20
  static getRpcList(network: Network<BSNeo3NetworkId>): string[];
21
21
  static isMainnet(network: Network<BSNeo3NetworkId>): boolean;
22
22
  static isCustomNet(network: Network<BSNeo3NetworkId>): boolean;
23
+ static normalizeHash(hash: string): string;
23
24
  }
@@ -28,6 +28,9 @@ class BSNeo3Helper {
28
28
  static isCustomNet(network) {
29
29
  return !this.ALL_NETWORK_IDS.includes(network.id);
30
30
  }
31
+ static normalizeHash(hash) {
32
+ return hash.startsWith('0x') ? hash.slice(2) : hash;
33
+ }
31
34
  }
32
35
  exports.BSNeo3Helper = BSNeo3Helper;
33
36
  _a = BSNeo3Helper;
@@ -43,7 +43,7 @@ class FlamingoEDSNeo3 extends blockchain_service_1.CryptoCompareEDS {
43
43
  const { data } = yield __classPrivateFieldGet(this, _FlamingoEDSNeo3_axiosInstance, "f").get('/token-info/prices');
44
44
  const prices = [];
45
45
  data.forEach(item => {
46
- const token = params.tokens.find(token => token.hash === item.hash);
46
+ const token = params.tokens.find(token => BSNeo3Helper_1.BSNeo3Helper.normalizeHash(token.hash) === BSNeo3Helper_1.BSNeo3Helper.normalizeHash(item.hash));
47
47
  if (!token)
48
48
  return;
49
49
  prices.push({
@@ -65,7 +65,8 @@ _GhostMarketNDSNeo3_network = new WeakMap(), _GhostMarketNDSNeo3_instances = new
65
65
  return;
66
66
  }
67
67
  if (srcImage.startsWith('ipfs://')) {
68
- const [, imageId] = srcImage.split('://');
68
+ const splitImage = srcImage.split('/');
69
+ const imageId = splitImage.slice(-2).join('/');
69
70
  return `https://ghostmarket.mypinata.cloud/ipfs/${imageId}`;
70
71
  }
71
72
  return srcImage;
@@ -75,7 +75,7 @@ class RPCBDSNeo3 {
75
75
  }
76
76
  getTokenInfo(tokenHash) {
77
77
  return __awaiter(this, void 0, void 0, function* () {
78
- const localToken = this._tokens.find(token => token.hash === tokenHash);
78
+ const localToken = this._tokens.find(token => BSNeo3Helper_1.BSNeo3Helper.normalizeHash(token.hash) === BSNeo3Helper_1.BSNeo3Helper.normalizeHash(tokenHash));
79
79
  if (localToken)
80
80
  return localToken;
81
81
  if (this._tokenCache.has(tokenHash)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/bs-neo3",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": "https://github.com/CityOfZion/blockchain-services",