@cityofzion/bs-ethereum
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -153,3 +153,3 @@ "use strict"; | ||
let transactionParams; | ||
const isNative = this.feeToken.hash === param.intent.tokenHash; | ||
const isNative = BSEthereumHelper_1.BSEthereumHelper.normalizeHash(this.feeToken.hash) === BSEthereumHelper_1.BSEthereumHelper.normalizeHash(param.intent.tokenHash); | ||
if (isNative) { | ||
@@ -190,3 +190,3 @@ transactionParams = { | ||
let estimated; | ||
const isNative = this.feeToken.hash === param.intent.tokenHash; | ||
const isNative = BSEthereumHelper_1.BSEthereumHelper.normalizeHash(this.feeToken.hash) === BSEthereumHelper_1.BSEthereumHelper.normalizeHash(param.intent.tokenHash); | ||
const decimals = (_a = param.intent.tokenDecimals) !== null && _a !== void 0 ? _a : 18; | ||
@@ -193,0 +193,0 @@ const amount = ethersBigNumber.parseFixed(param.intent.amount, decimals); |
@@ -27,2 +27,3 @@ import { Network, NetworkId } from '@cityofzion/blockchain-service'; | ||
static isMainnet(network: Network<BSEthereumNetworkId>): boolean; | ||
static normalizeHash(hash: string): string; | ||
} |
@@ -12,3 +12,4 @@ "use strict"; | ||
static getNativeAsset(network) { | ||
return Object.assign(Object.assign({}, __classPrivateFieldGet(this, _a, "f", _BSEthereumHelper_NATIVE_ASSET)), { symbol: this.getNativeSymbol(network) }); | ||
const symbol = this.getNativeSymbol(network); | ||
return Object.assign(Object.assign({}, __classPrivateFieldGet(this, _a, "f", _BSEthereumHelper_NATIVE_ASSET)), { symbol, name: symbol }); | ||
} | ||
@@ -26,2 +27,5 @@ static getNativeSymbol(network) { | ||
} | ||
static normalizeHash(hash) { | ||
return hash.startsWith('0x') ? hash.slice(2) : hash; | ||
} | ||
} | ||
@@ -28,0 +32,0 @@ exports.BSEthereumHelper = BSEthereumHelper; |
@@ -49,3 +49,3 @@ "use strict"; | ||
{ | ||
amount: nativeBalance, | ||
amount: ethers_1.ethers.utils.formatUnits(nativeBalance, nativeToken.decimals), | ||
token: nativeToken, | ||
@@ -59,3 +59,3 @@ }, | ||
balances.push({ | ||
amount: balance.balance, | ||
amount: ethers_1.ethers.utils.formatUnits(balance.balance, balance.decimals), | ||
token: { | ||
@@ -81,3 +81,3 @@ decimals: balance.decimals, | ||
const nativeAsset = BSEthereumHelper_1.BSEthereumHelper.getNativeAsset(this._network); | ||
if (nativeAsset.hash === hash) | ||
if (BSEthereumHelper_1.BSEthereumHelper.normalizeHash(nativeAsset.hash) === BSEthereumHelper_1.BSEthereumHelper.normalizeHash(hash)) | ||
return nativeAsset; | ||
@@ -118,3 +118,3 @@ if (this._tokenCache.has(hash)) { | ||
transfers.push({ | ||
amount: data.value, | ||
amount: ethers_1.ethers.utils.formatUnits(data.value, nativeToken.decimals), | ||
from: data.from_address, | ||
@@ -121,0 +121,0 @@ to: data.to_address, |
@@ -65,4 +65,6 @@ "use strict"; | ||
return data.map(item => { | ||
var _a; | ||
let token; | ||
if (item.tokenAddress === (wrappedNativeToken === null || wrappedNativeToken === void 0 ? void 0 : wrappedNativeToken.hash)) { | ||
if (BSEthereumHelper_1.BSEthereumHelper.normalizeHash(item.tokenAddress) === | ||
BSEthereumHelper_1.BSEthereumHelper.normalizeHash((_a = wrappedNativeToken === null || wrappedNativeToken === void 0 ? void 0 : wrappedNativeToken.hash) !== null && _a !== void 0 ? _a : '')) { | ||
token = nativeToken; | ||
@@ -93,3 +95,3 @@ } | ||
let token; | ||
if (params.token.hash === nativeToken.hash) { | ||
if (BSEthereumHelper_1.BSEthereumHelper.normalizeHash(params.token.hash) === BSEthereumHelper_1.BSEthereumHelper.normalizeHash(nativeToken.hash)) { | ||
token = yield __classPrivateFieldGet(this, _MoralisEDSEthereum_instances, "m", _MoralisEDSEthereum_getWrappedNativeToken).call(this); | ||
@@ -96,0 +98,0 @@ } |
@@ -63,3 +63,3 @@ "use strict"; | ||
const nativeAsset = BSEthereumHelper_1.BSEthereumHelper.getNativeAsset(this._network); | ||
if (nativeAsset.hash === hash) | ||
if (BSEthereumHelper_1.BSEthereumHelper.normalizeHash(nativeAsset.hash) === BSEthereumHelper_1.BSEthereumHelper.normalizeHash(hash)) | ||
return nativeAsset; | ||
@@ -66,0 +66,0 @@ if (this._tokenCache.has(hash)) { |
{ | ||
"name": "@cityofzion/bs-ethereum", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
96200
2280