@cityofzion/bs-ethereum 2.5.0 → 2.6.1

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.
@@ -3,10 +3,8 @@ import { RpcNDSEthereum } from './RpcNDSEthereum';
3
3
  import { BSEthereumNetworkId } from '../../constants/BSEthereumConstants';
4
4
  export declare class GhostMarketNDSEthereum extends RpcNDSEthereum {
5
5
  #private;
6
- static CONFIG_BY_NETWORK_ID: Partial<Record<BSEthereumNetworkId, {
7
- url: string;
8
- chain: string;
9
- }>>;
6
+ static readonly BASE_URL = "https://api.ghostmarket.io/api/v2";
7
+ static CONFIG_BY_NETWORK_ID: Partial<Record<BSEthereumNetworkId, string>>;
10
8
  constructor(network: Network<BSEthereumNetworkId>);
11
9
  getNftsByAddress({ address, size, cursor }: GetNftsByAddressParams): Promise<NftsResponse>;
12
10
  getNft({ contractHash, tokenId }: GetNftParam): Promise<NftResponse>;
@@ -28,6 +28,7 @@ exports.GhostMarketNDSEthereum = void 0;
28
28
  const query_string_1 = __importDefault(require("query-string"));
29
29
  const axios_1 = __importDefault(require("axios"));
30
30
  const RpcNDSEthereum_1 = require("./RpcNDSEthereum");
31
+ const BSEthereumConstants_1 = require("../../constants/BSEthereumConstants");
31
32
  class GhostMarketNDSEthereum extends RpcNDSEthereum_1.RpcNDSEthereum {
32
33
  constructor(network) {
33
34
  super(network);
@@ -63,17 +64,17 @@ class GhostMarketNDSEthereum extends RpcNDSEthereum_1.RpcNDSEthereum {
63
64
  }
64
65
  if (srcImage.startsWith('ipfs://')) {
65
66
  const splitImage = srcImage.split('/');
66
- const imageId = splitImage.slice(-2).join('/');
67
+ const imageId = splitImage.slice(-2).filter(Boolean).join('/');
67
68
  return `https://ghostmarket.mypinata.cloud/ipfs/${imageId}`;
68
69
  }
69
70
  return srcImage;
70
71
  }
71
72
  getUrlWithParams(params) {
72
- const config = GhostMarketNDSEthereum.CONFIG_BY_NETWORK_ID[__classPrivateFieldGet(this, _GhostMarketNDSEthereum_network, "f").id];
73
- if (!config)
73
+ const chain = GhostMarketNDSEthereum.CONFIG_BY_NETWORK_ID[__classPrivateFieldGet(this, _GhostMarketNDSEthereum_network, "f").id];
74
+ if (!chain)
74
75
  throw new Error('Unsupported network');
75
- const parameters = query_string_1.default.stringify(Object.assign({ chain: config.chain }, params), { arrayFormat: 'bracket' });
76
- return `${config.url}/assets?${parameters}`;
76
+ const parameters = query_string_1.default.stringify(Object.assign({ chain }, params), { arrayFormat: 'bracket' });
77
+ return `${GhostMarketNDSEthereum.BASE_URL}/assets?${parameters}`;
77
78
  }
78
79
  parse(data) {
79
80
  var _a, _b;
@@ -96,9 +97,8 @@ class GhostMarketNDSEthereum extends RpcNDSEthereum_1.RpcNDSEthereum {
96
97
  }
97
98
  exports.GhostMarketNDSEthereum = GhostMarketNDSEthereum;
98
99
  _GhostMarketNDSEthereum_network = new WeakMap();
100
+ GhostMarketNDSEthereum.BASE_URL = 'https://api.ghostmarket.io/api/v2';
99
101
  GhostMarketNDSEthereum.CONFIG_BY_NETWORK_ID = {
100
- '1': {
101
- url: 'https://api.ghostmarket.io/api/v2',
102
- chain: 'eth',
103
- },
102
+ '1': 'eth',
103
+ [BSEthereumConstants_1.BSEthereumConstants.NEOX_MAINNET_NETWORK_ID]: 'neox',
104
104
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/bs-ethereum",
3
- "version": "2.5.0",
3
+ "version": "2.6.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": "https://github.com/CityOfZion/blockchain-services",