@cityofzion/bs-ethereum 2.13.3 → 2.13.4
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,6 +3,6 @@ import { BSEthereumNetworkId } from '../../constants/BSEthereumConstants';
|
|
|
3
3
|
export declare class MoralisEDSEthereum extends CryptoCompareEDS implements ExchangeDataService {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(network: Network<BSEthereumNetworkId>, blockchainDataService: BlockchainDataService, tokenService: TokenService);
|
|
6
|
-
getTokenPrices(
|
|
6
|
+
getTokenPrices({ tokens }: GetTokenPricesParams): Promise<TokenPricesResponse[]>;
|
|
7
7
|
getTokenPriceHistory(params: GetTokenPriceHistoryParams): Promise<TokenPricesHistoryResponse[]>;
|
|
8
8
|
}
|
|
@@ -40,7 +40,7 @@ class MoralisEDSEthereum extends blockchain_service_1.CryptoCompareEDS {
|
|
|
40
40
|
__classPrivateFieldSet(this, _MoralisEDSEthereum_blockchainDataService, blockchainDataService, "f");
|
|
41
41
|
__classPrivateFieldSet(this, _MoralisEDSEthereum_tokenService, tokenService, "f");
|
|
42
42
|
}
|
|
43
|
-
getTokenPrices(
|
|
43
|
+
getTokenPrices({ tokens }) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
45
|
if (!BSEthereumHelper_1.BSEthereumHelper.isMainnet(__classPrivateFieldGet(this, _MoralisEDSEthereum_network, "f")))
|
|
46
46
|
throw new Error('Exchange is only available on mainnet');
|
|
@@ -50,20 +50,20 @@ class MoralisEDSEthereum extends blockchain_service_1.CryptoCompareEDS {
|
|
|
50
50
|
const nativeToken = BSEthereumHelper_1.BSEthereumHelper.getNativeAsset(__classPrivateFieldGet(this, _MoralisEDSEthereum_network, "f"));
|
|
51
51
|
const tokensBody = [];
|
|
52
52
|
let wrappedNativeToken;
|
|
53
|
-
if (
|
|
53
|
+
if (tokens.some(token => token.symbol === nativeToken.symbol)) {
|
|
54
54
|
try {
|
|
55
55
|
wrappedNativeToken = yield __classPrivateFieldGet(this, _MoralisEDSEthereum_instances, "m", _MoralisEDSEthereum_getWrappedNativeToken).call(this);
|
|
56
56
|
if (wrappedNativeToken) {
|
|
57
|
-
tokensBody.push({ token_address: wrappedNativeToken.hash });
|
|
57
|
+
tokensBody.push({ token_address: wrappedNativeToken.hash.toLowerCase() });
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
catch (_a) {
|
|
61
61
|
/* empty */
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
tokens.forEach(token => {
|
|
65
65
|
if (token.symbol !== nativeToken.symbol) {
|
|
66
|
-
tokensBody.push({ token_address: token.hash });
|
|
66
|
+
tokensBody.push({ token_address: token.hash.toLowerCase() });
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
if (tokensBody.length === 0)
|
|
@@ -85,7 +85,7 @@ class MoralisEDSEthereum extends blockchain_service_1.CryptoCompareEDS {
|
|
|
85
85
|
else {
|
|
86
86
|
token = {
|
|
87
87
|
decimals: Number(item.tokenDecimals),
|
|
88
|
-
hash: item.tokenAddress,
|
|
88
|
+
hash: __classPrivateFieldGet(this, _MoralisEDSEthereum_tokenService, "f").normalizeHash(item.tokenAddress),
|
|
89
89
|
name: item.tokenName,
|
|
90
90
|
symbol: item.tokenSymbol,
|
|
91
91
|
};
|