@cityofzion/bs-neo3 1.10.10 → 1.12.0

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/dist/BSNeo3.js CHANGED
@@ -65,10 +65,10 @@ class BSNeo3 {
65
65
  setNetwork(network) {
66
66
  __classPrivateFieldGet(this, _BSNeo3_instances, "m", _BSNeo3_setTokens).call(this, network);
67
67
  this.network = network;
68
- this.blockchainDataService = new DoraBDSNeo3_1.DoraBDSNeo3(network, this.feeToken, this.claimToken, this.tokens);
69
- this.exchangeDataService = new FlamingoForthewinEDSNeo3_1.FlamingoForthewinEDSNeo3(network);
70
68
  this.nftDataService = new GhostMarketNDSNeo3_1.GhostMarketNDSNeo3(network);
71
69
  this.explorerService = new DoraESNeo3_1.DoraESNeo3(network);
70
+ this.blockchainDataService = new DoraBDSNeo3_1.DoraBDSNeo3(network, this.feeToken, this.claimToken, this.tokens, this.nftDataService, this.explorerService);
71
+ this.exchangeDataService = new FlamingoForthewinEDSNeo3_1.FlamingoForthewinEDSNeo3(network);
72
72
  }
73
73
  validateAddress(address) {
74
74
  return neon_js_1.wallet.isAddress(address, 53);
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.BSNeo3Helper = void 0;
7
+ const blockchain_service_1 = require("@cityofzion/blockchain-service");
7
8
  const native_json_1 = __importDefault(require("../assets/tokens/native.json"));
8
9
  const BSNeo3Constants_1 = require("../constants/BSNeo3Constants");
9
10
  class BSNeo3Helper {
@@ -23,7 +24,7 @@ class BSNeo3Helper {
23
24
  return !BSNeo3Constants_1.BSNeo3Constants.ALL_NETWORK_IDS.includes(network.id);
24
25
  }
25
26
  static normalizeHash(hash) {
26
- return hash.startsWith('0x') ? hash.slice(2) : hash;
27
+ return (0, blockchain_service_1.normalizeHash)(hash, { lowercase: false });
27
28
  }
28
29
  }
29
30
  exports.BSNeo3Helper = BSNeo3Helper;
@@ -1,10 +1,12 @@
1
- import { BalanceResponse, ContractResponse, Network, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse } from '@cityofzion/blockchain-service';
1
+ import { BalanceResponse, ContractResponse, FullTransactionsByAddressParams, FullTransactionsByAddressResponse, Network, NftDataService, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse, ExplorerService } from '@cityofzion/blockchain-service';
2
2
  import { BSNeo3NetworkId } from '../../constants/BSNeo3Constants';
3
3
  import { RpcBDSNeo3 } from './RpcBDSNeo3';
4
4
  export declare class DoraBDSNeo3 extends RpcBDSNeo3 {
5
- constructor(network: Network<BSNeo3NetworkId>, feeToken: Token, claimToken: Token, tokens: Token[]);
5
+ #private;
6
+ constructor(network: Network<BSNeo3NetworkId>, feeToken: Token, claimToken: Token, tokens: Token[], nftDataService: NftDataService, explorerService: ExplorerService);
6
7
  getTransaction(hash: string): Promise<TransactionResponse>;
7
8
  getTransactionsByAddress({ address, nextPageParams, }: TransactionsByAddressParams): Promise<TransactionsByAddressResponse>;
9
+ getFullTransactionsByAddress(params: FullTransactionsByAddressParams): Promise<FullTransactionsByAddressResponse>;
8
10
  getContract(contractHash: string): Promise<ContractResponse>;
9
11
  getTokenInfo(tokenHash: string): Promise<Token>;
10
12
  getBalance(address: string): Promise<BalanceResponse[]>;
@@ -8,19 +8,49 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12
+ if (kind === "m") throw new TypeError("Private method is not writable");
13
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
14
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
15
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
16
+ };
17
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
19
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
20
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
21
+ };
22
+ var __rest = (this && this.__rest) || function (s, e) {
23
+ var t = {};
24
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
25
+ t[p] = s[p];
26
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
27
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
28
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
29
+ t[p[i]] = s[p[i]];
30
+ }
31
+ return t;
32
+ };
33
+ var _DoraBDSNeo3_instances, _DoraBDSNeo3_supportedNep11Standards, _DoraBDSNeo3_nftDataService, _DoraBDSNeo3_explorerService, _DoraBDSNeo3_validateFullTransactionsByAddressParams;
11
34
  Object.defineProperty(exports, "__esModule", { value: true });
12
35
  exports.DoraBDSNeo3 = void 0;
13
- const api_1 = require("@cityofzion/dora-ts/dist/api");
36
+ const blockchain_service_1 = require("@cityofzion/blockchain-service");
37
+ const dora_ts_1 = require("@cityofzion/dora-ts");
14
38
  const neon_js_1 = require("@cityofzion/neon-js");
15
39
  const BSNeo3Helper_1 = require("../../helpers/BSNeo3Helper");
16
40
  const RpcBDSNeo3_1 = require("./RpcBDSNeo3");
17
- const NeoRest = new api_1.NeoRESTApi({
18
- doraUrl: 'https://dora.coz.io',
41
+ const NeoRest = new dora_ts_1.api.NeoRESTApi({
42
+ doraUrl: blockchain_service_1.BSCommonConstants.DORA_URL,
19
43
  endpoint: '/api/v2/neo3',
20
44
  });
21
45
  class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
22
- constructor(network, feeToken, claimToken, tokens) {
46
+ constructor(network, feeToken, claimToken, tokens, nftDataService, explorerService) {
23
47
  super(network, feeToken, claimToken, tokens);
48
+ _DoraBDSNeo3_instances.add(this);
49
+ _DoraBDSNeo3_supportedNep11Standards.set(this, ['nep11', 'nep-11']);
50
+ _DoraBDSNeo3_nftDataService.set(this, void 0);
51
+ _DoraBDSNeo3_explorerService.set(this, void 0);
52
+ __classPrivateFieldSet(this, _DoraBDSNeo3_nftDataService, nftDataService, "f");
53
+ __classPrivateFieldSet(this, _DoraBDSNeo3_explorerService, explorerService, "f");
24
54
  }
25
55
  getTransaction(hash) {
26
56
  const _super = Object.create(null, {
@@ -62,11 +92,13 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
62
92
  var _a, _b;
63
93
  const transferPromises = [];
64
94
  item.notifications.forEach(({ contract: contractHash, state, event_name: eventName }) => {
65
- const properties = Array.isArray(state) ? state : state.value;
95
+ var _a;
96
+ // TODO: created issue to fix it (https://app.clickup.com/t/86a86n3yw), type from @cityofzion/dora-ts is wrong, it's necessary to do this force casting now
97
+ const properties = (_a = (Array.isArray(state) ? state : state === null || state === void 0 ? void 0 : state.value)) !== null && _a !== void 0 ? _a : [];
66
98
  if (eventName !== 'Transfer' || (properties.length !== 3 && properties.length !== 4))
67
99
  return;
68
100
  const promise = () => __awaiter(this, void 0, void 0, function* () {
69
- var _a;
101
+ var _b;
70
102
  const isAsset = properties.length === 3;
71
103
  const from = properties[0].value;
72
104
  const to = properties[1].value;
@@ -76,7 +108,7 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
76
108
  const token = yield this.getTokenInfo(contractHash);
77
109
  const [, , { value: amount }] = properties;
78
110
  return {
79
- amount: neon_js_1.u.BigInteger.fromNumber(amount).toDecimal((_a = token.decimals) !== null && _a !== void 0 ? _a : 0),
111
+ amount: (0, blockchain_service_1.formatNumber)(amount, token.decimals),
80
112
  from: convertedFrom,
81
113
  to: convertedTo,
82
114
  contractHash,
@@ -87,7 +119,7 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
87
119
  return {
88
120
  from: convertedFrom,
89
121
  to: convertedTo,
90
- tokenId: properties[3].value,
122
+ tokenId: (_b = properties[3].value) !== null && _b !== void 0 ? _b : '',
91
123
  contractHash,
92
124
  type: 'nft',
93
125
  };
@@ -119,6 +151,99 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
119
151
  };
120
152
  });
121
153
  }
154
+ getFullTransactionsByAddress(params) {
155
+ var _a;
156
+ return __awaiter(this, void 0, void 0, function* () {
157
+ __classPrivateFieldGet(this, _DoraBDSNeo3_instances, "m", _DoraBDSNeo3_validateFullTransactionsByAddressParams).call(this, params);
158
+ const data = [];
159
+ const _b = yield NeoRest.getFullTransactionsByAddress({
160
+ address: params.address,
161
+ timestampFrom: params.dateFrom,
162
+ timestampTo: params.dateTo,
163
+ network: this._network.id,
164
+ cursor: params.nextCursor,
165
+ }), { nextCursor } = _b, response = __rest(_b, ["nextCursor"]);
166
+ const items = (_a = response.data) !== null && _a !== void 0 ? _a : [];
167
+ const addressTemplateUrl = __classPrivateFieldGet(this, _DoraBDSNeo3_explorerService, "f").getAddressTemplateUrl();
168
+ const txTemplateUrl = __classPrivateFieldGet(this, _DoraBDSNeo3_explorerService, "f").getTxTemplateUrl();
169
+ const nftTemplateUrl = __classPrivateFieldGet(this, _DoraBDSNeo3_explorerService, "f").getNftTemplateUrl();
170
+ const contractTemplateUrl = __classPrivateFieldGet(this, _DoraBDSNeo3_explorerService, "f").getContractTemplateUrl();
171
+ const itemPromises = items.map((item) => __awaiter(this, void 0, void 0, function* () {
172
+ const txId = item.transactionID;
173
+ const newItem = {
174
+ txId,
175
+ txIdUrl: txId ? txTemplateUrl === null || txTemplateUrl === void 0 ? void 0 : txTemplateUrl.replace('{txId}', txId) : undefined,
176
+ block: item.block,
177
+ date: item.date,
178
+ invocationCount: item.invocationCount,
179
+ notificationCount: item.notificationCount,
180
+ networkFeeAmount: (0, blockchain_service_1.formatNumber)(item.networkFeeAmount, this._feeToken.decimals),
181
+ systemFeeAmount: (0, blockchain_service_1.formatNumber)(item.systemFeeAmount, this._feeToken.decimals),
182
+ events: [],
183
+ };
184
+ const eventPromises = item.events.map((event) => __awaiter(this, void 0, void 0, function* () {
185
+ var _c, _d, _e, _f;
186
+ let nftEvent;
187
+ let assetEvent;
188
+ let from = event.from;
189
+ let to = event.to;
190
+ const { methodName, tokenID: tokenId, contractHash: hash } = event;
191
+ const fromUrl = from ? addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', from) : undefined;
192
+ const toUrl = to ? addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', to) : undefined;
193
+ const hashUrl = hash ? contractTemplateUrl === null || contractTemplateUrl === void 0 ? void 0 : contractTemplateUrl.replace('{hash}', hash) : undefined;
194
+ if (!from)
195
+ from = 'Burn';
196
+ if (!to)
197
+ to = 'Mint';
198
+ const standard = (_e = (_d = (_c = event.supportedStandards) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.toLowerCase()) !== null && _e !== void 0 ? _e : '';
199
+ const isNft = __classPrivateFieldGet(this, _DoraBDSNeo3_supportedNep11Standards, "f").includes(standard) && !!tokenId;
200
+ if (isNft) {
201
+ const [nft] = yield blockchain_service_1.BSPromisesHelper.tryCatch(() => __classPrivateFieldGet(this, _DoraBDSNeo3_nftDataService, "f").getNft({ contractHash: hash, tokenId }));
202
+ const nftUrl = hash ? nftTemplateUrl === null || nftTemplateUrl === void 0 ? void 0 : nftTemplateUrl.replace('{hash}', hash).replace('{tokenId}', tokenId) : undefined;
203
+ nftEvent = {
204
+ eventType: 'nft',
205
+ amount: '0',
206
+ methodName,
207
+ from,
208
+ fromUrl,
209
+ to,
210
+ toUrl,
211
+ hash,
212
+ hashUrl,
213
+ tokenId,
214
+ tokenType: 'nep-11',
215
+ nftImageUrl: nft === null || nft === void 0 ? void 0 : nft.image,
216
+ nftUrl,
217
+ name: nft === null || nft === void 0 ? void 0 : nft.name,
218
+ collectionName: nft === null || nft === void 0 ? void 0 : nft.collectionName,
219
+ };
220
+ }
221
+ else {
222
+ const [token] = yield blockchain_service_1.BSPromisesHelper.tryCatch(() => this.getTokenInfo(hash));
223
+ const amount = (0, blockchain_service_1.formatNumber)(event.amount, (_f = token === null || token === void 0 ? void 0 : token.decimals) !== null && _f !== void 0 ? _f : event.tokenDecimals);
224
+ assetEvent = {
225
+ eventType: 'token',
226
+ amount,
227
+ methodName,
228
+ from,
229
+ fromUrl,
230
+ to,
231
+ toUrl,
232
+ hash,
233
+ hashUrl,
234
+ token: token !== null && token !== void 0 ? token : undefined,
235
+ tokenType: 'nep-17',
236
+ };
237
+ }
238
+ newItem.events.push(isNft ? nftEvent : assetEvent);
239
+ }));
240
+ yield Promise.allSettled(eventPromises);
241
+ data.push(newItem);
242
+ }));
243
+ yield Promise.allSettled(itemPromises);
244
+ return { nextCursor, data };
245
+ });
246
+ }
122
247
  getContract(contractHash) {
123
248
  const _super = Object.create(null, {
124
249
  getContract: { get: () => super.getContract }
@@ -193,8 +318,7 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
193
318
  }
194
319
  }));
195
320
  const balances = yield Promise.all(promises);
196
- const filteredBalances = balances.filter(balance => balance !== undefined);
197
- return filteredBalances;
321
+ return balances.filter(balance => balance !== undefined);
198
322
  });
199
323
  }
200
324
  convertByteStringToAddress(byteString) {
@@ -203,3 +327,10 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
203
327
  }
204
328
  }
205
329
  exports.DoraBDSNeo3 = DoraBDSNeo3;
330
+ _DoraBDSNeo3_supportedNep11Standards = new WeakMap(), _DoraBDSNeo3_nftDataService = new WeakMap(), _DoraBDSNeo3_explorerService = new WeakMap(), _DoraBDSNeo3_instances = new WeakSet(), _DoraBDSNeo3_validateFullTransactionsByAddressParams = function _DoraBDSNeo3_validateFullTransactionsByAddressParams(params) {
331
+ if (BSNeo3Helper_1.BSNeo3Helper.isCustomNet(this._network))
332
+ throw new Error('Only Mainnet and Testnet are supported');
333
+ blockchain_service_1.BSFullTransactionsByAddressHelper.validateFullTransactionsByAddressParams(params);
334
+ if (!neon_js_1.wallet.isAddress(params.address))
335
+ throw new Error('Invalid address param');
336
+ };
@@ -1,4 +1,4 @@
1
- import { BDSClaimable, BalanceResponse, BlockchainDataService, ContractResponse, Network, RpcResponse, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse } from '@cityofzion/blockchain-service';
1
+ import { BalanceResponse, BDSClaimable, BlockchainDataService, ContractResponse, FullTransactionsByAddressParams, FullTransactionsByAddressResponse, Network, RpcResponse, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse } from '@cityofzion/blockchain-service';
2
2
  import { BSNeo3NetworkId } from '../../constants/BSNeo3Constants';
3
3
  export declare class RpcBDSNeo3 implements BlockchainDataService, BDSClaimable {
4
4
  readonly _tokenCache: Map<string, Token>;
@@ -10,6 +10,7 @@ export declare class RpcBDSNeo3 implements BlockchainDataService, BDSClaimable {
10
10
  constructor(network: Network<BSNeo3NetworkId>, feeToken: Token, claimToken: Token, tokens: Token[]);
11
11
  getTransaction(hash: string): Promise<TransactionResponse>;
12
12
  getTransactionsByAddress(_params: TransactionsByAddressParams): Promise<TransactionsByAddressResponse>;
13
+ getFullTransactionsByAddress(_params: FullTransactionsByAddressParams): Promise<FullTransactionsByAddressResponse>;
13
14
  getContract(contractHash: string): Promise<ContractResponse>;
14
15
  getTokenInfo(tokenHash: string): Promise<Token>;
15
16
  getBalance(address: string): Promise<BalanceResponse[]>;
@@ -50,6 +50,11 @@ class RpcBDSNeo3 {
50
50
  throw new Error('Method not supported.');
51
51
  });
52
52
  }
53
+ getFullTransactionsByAddress(_params) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ throw new Error('Method not supported.');
56
+ });
57
+ }
53
58
  getContract(contractHash) {
54
59
  return __awaiter(this, void 0, void 0, function* () {
55
60
  try {
@@ -140,8 +145,7 @@ class RpcBDSNeo3 {
140
145
  token,
141
146
  };
142
147
  }));
143
- const balances = yield Promise.all(promises);
144
- return balances;
148
+ return yield Promise.all(promises);
145
149
  });
146
150
  }
147
151
  getBlockHeight() {
@@ -1,8 +1,8 @@
1
- import { CryptoCompareEDS, ExchangeDataService, GetTokenPriceHistoryParams, GetTokenPricesParams, Network, TokenPricesHistoryResponse, TokenPricesResponse } from '@cityofzion/blockchain-service';
1
+ import { ExchangeDataService, FlamingoForthewinEDS, GetTokenPriceHistoryParams, GetTokenPricesParams, Network, TokenPricesHistoryResponse, TokenPricesResponse } from '@cityofzion/blockchain-service';
2
2
  import { BSNeo3NetworkId } from '../../constants/BSNeo3Constants';
3
- export declare class FlamingoForthewinEDSNeo3 extends CryptoCompareEDS implements ExchangeDataService {
3
+ export declare class FlamingoForthewinEDSNeo3 extends FlamingoForthewinEDS implements ExchangeDataService {
4
4
  #private;
5
5
  constructor(network: Network<BSNeo3NetworkId>);
6
- getTokenPrices({ tokens }: GetTokenPricesParams): Promise<TokenPricesResponse[]>;
6
+ getTokenPrices(params: GetTokenPricesParams): Promise<TokenPricesResponse[]>;
7
7
  getTokenPriceHistory(params: GetTokenPriceHistoryParams): Promise<TokenPricesHistoryResponse[]>;
8
8
  }
@@ -19,60 +19,25 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
19
19
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
20
20
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
21
21
  };
22
- var __importDefault = (this && this.__importDefault) || function (mod) {
23
- return (mod && mod.__esModule) ? mod : { "default": mod };
24
- };
25
- var _FlamingoForthewinEDSNeo3_network, _FlamingoForthewinEDSNeo3_flamingoAxiosInstance, _FlamingoForthewinEDSNeo3_forthewinAxiosInstance;
22
+ var _FlamingoForthewinEDSNeo3_network;
26
23
  Object.defineProperty(exports, "__esModule", { value: true });
27
24
  exports.FlamingoForthewinEDSNeo3 = void 0;
28
25
  const blockchain_service_1 = require("@cityofzion/blockchain-service");
29
- const axios_1 = __importDefault(require("axios"));
30
26
  const BSNeo3Helper_1 = require("../../helpers/BSNeo3Helper");
31
- class FlamingoForthewinEDSNeo3 extends blockchain_service_1.CryptoCompareEDS {
27
+ class FlamingoForthewinEDSNeo3 extends blockchain_service_1.FlamingoForthewinEDS {
32
28
  constructor(network) {
33
29
  super();
34
30
  _FlamingoForthewinEDSNeo3_network.set(this, void 0);
35
- _FlamingoForthewinEDSNeo3_flamingoAxiosInstance.set(this, void 0);
36
- _FlamingoForthewinEDSNeo3_forthewinAxiosInstance.set(this, void 0);
37
31
  __classPrivateFieldSet(this, _FlamingoForthewinEDSNeo3_network, network, "f");
38
- __classPrivateFieldSet(this, _FlamingoForthewinEDSNeo3_flamingoAxiosInstance, axios_1.default.create({ baseURL: 'https://neo-api.b-cdn.net/flamingo' }), "f");
39
- __classPrivateFieldSet(this, _FlamingoForthewinEDSNeo3_forthewinAxiosInstance, axios_1.default.create({ baseURL: 'https://api.forthewin.network' }), "f");
40
32
  }
41
- getTokenPrices({ tokens }) {
42
- var _a, _b;
33
+ getTokenPrices(params) {
34
+ const _super = Object.create(null, {
35
+ getTokenPrices: { get: () => super.getTokenPrices }
36
+ });
43
37
  return __awaiter(this, void 0, void 0, function* () {
44
38
  if (!BSNeo3Helper_1.BSNeo3Helper.isMainnet(__classPrivateFieldGet(this, _FlamingoForthewinEDSNeo3_network, "f")))
45
39
  throw new Error('Exchange is only available on Mainnet');
46
- const { data: flamingoData } = yield __classPrivateFieldGet(this, _FlamingoForthewinEDSNeo3_flamingoAxiosInstance, "f").get('/live-data/prices/latest');
47
- const prices = [];
48
- const allTokens = BSNeo3Helper_1.BSNeo3Helper.getTokens(__classPrivateFieldGet(this, _FlamingoForthewinEDSNeo3_network, "f"));
49
- const neoToken = tokens.find(({ symbol }) => symbol === 'NEO');
50
- const bNeoTokenHash = BSNeo3Helper_1.BSNeo3Helper.normalizeHash((_b = (_a = allTokens.find(({ symbol }) => symbol === 'bNEO')) === null || _a === void 0 ? void 0 : _a.hash) !== null && _b !== void 0 ? _b : '');
51
- if (neoToken)
52
- flamingoData.forEach(item => {
53
- if (bNeoTokenHash === BSNeo3Helper_1.BSNeo3Helper.normalizeHash(item.hash))
54
- flamingoData.push(Object.assign(Object.assign({}, item), { symbol: neoToken.symbol, hash: neoToken.hash }));
55
- });
56
- flamingoData.forEach(item => {
57
- const token = tokens.find(({ hash }) => BSNeo3Helper_1.BSNeo3Helper.normalizeHash(hash) === BSNeo3Helper_1.BSNeo3Helper.normalizeHash(item.hash));
58
- if (!token)
59
- return;
60
- prices.push({ usdPrice: item.usd_price, token });
61
- });
62
- if (tokens.length > prices.length) {
63
- const { data: forthewinData } = yield __classPrivateFieldGet(this, _FlamingoForthewinEDSNeo3_forthewinAxiosInstance, "f").get('/mainnet/prices');
64
- Object.entries(forthewinData).forEach(([hash, usdPrice]) => {
65
- hash = BSNeo3Helper_1.BSNeo3Helper.normalizeHash(hash);
66
- const hasPrice = !!prices.find(({ token }) => BSNeo3Helper_1.BSNeo3Helper.normalizeHash(token.hash) === hash);
67
- if (hasPrice)
68
- return;
69
- const foundToken = tokens.find(token => BSNeo3Helper_1.BSNeo3Helper.normalizeHash(token.hash) === hash);
70
- if (!foundToken)
71
- return;
72
- prices.push({ usdPrice, token: foundToken });
73
- });
74
- }
75
- return prices;
40
+ return yield _super.getTokenPrices.call(this, params);
76
41
  });
77
42
  }
78
43
  getTokenPriceHistory(params) {
@@ -81,10 +46,10 @@ class FlamingoForthewinEDSNeo3 extends blockchain_service_1.CryptoCompareEDS {
81
46
  });
82
47
  return __awaiter(this, void 0, void 0, function* () {
83
48
  if (!BSNeo3Helper_1.BSNeo3Helper.isMainnet(__classPrivateFieldGet(this, _FlamingoForthewinEDSNeo3_network, "f")))
84
- throw new Error('Exchange is only available on mainnet');
49
+ throw new Error('Exchange is only available on Mainnet');
85
50
  return yield _super.getTokenPriceHistory.call(this, params);
86
51
  });
87
52
  }
88
53
  }
89
54
  exports.FlamingoForthewinEDSNeo3 = FlamingoForthewinEDSNeo3;
90
- _FlamingoForthewinEDSNeo3_network = new WeakMap(), _FlamingoForthewinEDSNeo3_flamingoAxiosInstance = new WeakMap(), _FlamingoForthewinEDSNeo3_forthewinAxiosInstance = new WeakMap();
55
+ _FlamingoForthewinEDSNeo3_network = new WeakMap();
@@ -8,4 +8,6 @@ export declare class DoraESNeo3 implements ExplorerService {
8
8
  buildNftUrl({ contractHash, tokenId }: BuildNftUrlParams): string;
9
9
  getAddressTemplateUrl(): string | undefined;
10
10
  getTxTemplateUrl(): string | undefined;
11
+ getNftTemplateUrl(): string | undefined;
12
+ getContractTemplateUrl(): string | undefined;
11
13
  }
@@ -13,10 +13,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  var _DoraESNeo3_BASE_URL, _DoraESNeo3_network;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.DoraESNeo3 = void 0;
16
+ const blockchain_service_1 = require("@cityofzion/blockchain-service");
16
17
  const BSNeo3Helper_1 = require("../../helpers/BSNeo3Helper");
17
18
  class DoraESNeo3 {
18
19
  constructor(network) {
19
- _DoraESNeo3_BASE_URL.set(this, 'https://dora.coz.io');
20
+ _DoraESNeo3_BASE_URL.set(this, blockchain_service_1.BSCommonConstants.DORA_URL);
20
21
  _DoraESNeo3_network.set(this, void 0);
21
22
  __classPrivateFieldSet(this, _DoraESNeo3_network, network, "f");
22
23
  }
@@ -45,6 +46,16 @@ class DoraESNeo3 {
45
46
  return undefined;
46
47
  return `${__classPrivateFieldGet(this, _DoraESNeo3_BASE_URL, "f")}/transaction/neo3/${__classPrivateFieldGet(this, _DoraESNeo3_network, "f").id}/{txId}`;
47
48
  }
49
+ getNftTemplateUrl() {
50
+ if (BSNeo3Helper_1.BSNeo3Helper.isCustomNet(__classPrivateFieldGet(this, _DoraESNeo3_network, "f")))
51
+ return undefined;
52
+ return `${__classPrivateFieldGet(this, _DoraESNeo3_BASE_URL, "f")}/nft/neo3/${__classPrivateFieldGet(this, _DoraESNeo3_network, "f").id}/{hash}/{tokenId}`;
53
+ }
54
+ getContractTemplateUrl() {
55
+ if (BSNeo3Helper_1.BSNeo3Helper.isCustomNet(__classPrivateFieldGet(this, _DoraESNeo3_network, "f")))
56
+ return undefined;
57
+ return `${__classPrivateFieldGet(this, _DoraESNeo3_BASE_URL, "f")}/contract/neo3/${__classPrivateFieldGet(this, _DoraESNeo3_network, "f").id}/{hash}`;
58
+ }
48
59
  }
49
60
  exports.DoraESNeo3 = DoraESNeo3;
50
61
  _DoraESNeo3_BASE_URL = new WeakMap(), _DoraESNeo3_network = new WeakMap();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/bs-neo3",
3
- "version": "1.10.10",
3
+ "version": "1.12.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": "https://github.com/CityOfZion/blockchain-services",
@@ -12,15 +12,16 @@
12
12
  "dependencies": {
13
13
  "@cityofzion/neon-js": "5.5.1",
14
14
  "@cityofzion/neon-core": "5.5.1",
15
- "@cityofzion/dora-ts": "0.0.11",
16
- "axios": "1.5.1",
15
+ "@cityofzion/dora-ts": "0.4.0",
16
+ "axios": "1.8.2",
17
17
  "query-string": "7.1.3",
18
18
  "@ledgerhq/hw-transport": "~6.30.5",
19
19
  "@cityofzion/neon-dappkit": "0.4.1",
20
20
  "bignumber.js": "^9.1.2",
21
21
  "isomorphic-ws": "^5.0.0",
22
22
  "lodash.clonedeep": "^4.5.0",
23
- "@cityofzion/blockchain-service": "1.16.3",
23
+ "date-fns": "~4.1.0",
24
+ "@cityofzion/blockchain-service": "1.17.1",
24
25
  "@cityofzion/bs-asteroid-sdk": "0.9.1"
25
26
  },
26
27
  "devDependencies": {