@stardust-collective/dag4-xchain-ethereum
Advanced tools
Comparing version 0.1.11 to 0.1.12
@@ -66,3 +66,3 @@ "use strict"; | ||
const ethBalance = await this.provider.getBalance(this.ethAddress); | ||
const ethBalanceNum = Number(ethers_1.ethers.utils.formatEther(ethBalance)) || 0; | ||
const ethBalanceNum = ethers_1.ethers.utils.formatEther(ethBalance) || '0'; | ||
const tokenAddresses = this.accounts.map(t => t.contractAddress); | ||
@@ -72,3 +72,3 @@ const rawTokenBalances = await token_contract_service_1.tokenContractService.getAddressBalances(this.provider, this.ethAddress, tokenAddresses, this.chainId); | ||
this.accounts.forEach(t => { | ||
tokenBalances[t.contractAddress] = Number(ethers_1.ethers.utils.formatUnits(rawTokenBalances[t.contractAddress], t.decimals)) || 0; | ||
tokenBalances[t.contractAddress] = ethers_1.ethers.utils.formatUnits(rawTokenBalances[t.contractAddress], t.decimals) || '0'; | ||
}); | ||
@@ -75,0 +75,0 @@ this.callback(ethBalanceNum, tokenBalances); |
@@ -10,3 +10,3 @@ "use strict"; | ||
const erc_20_abi_1 = __importDefault(require("erc-20-abi")); | ||
const TOKEN_BALANCE_CONTRACT = '0xb1f8e55c7f64d203c1400b9d8555d050f94adf39'; | ||
// const TOKEN_BALANCE_CONTRACT = '0xb1f8e55c7f64d203c1400b9d8555d050f94adf39'; | ||
const NETWORK_TO_CONTRACT_MAP = { | ||
@@ -24,3 +24,3 @@ 1: '0xb1f8e55c7f64d203c1400b9d8555d050f94adf39', | ||
const balance = values[addrIdx * tokens.length + tokenIdx]; | ||
balances[addr][tokenAddr] = balance.toString(); | ||
balances[addr][tokenAddr] = balance; | ||
}); | ||
@@ -27,0 +27,0 @@ }); |
@@ -63,3 +63,3 @@ import { ethers } from 'ethers'; | ||
const ethBalance = await this.provider.getBalance(this.ethAddress); | ||
const ethBalanceNum = Number(ethers.utils.formatEther(ethBalance)) || 0; | ||
const ethBalanceNum = ethers.utils.formatEther(ethBalance) || '0'; | ||
const tokenAddresses = this.accounts.map(t => t.contractAddress); | ||
@@ -69,3 +69,3 @@ const rawTokenBalances = await tokenContractService.getAddressBalances(this.provider, this.ethAddress, tokenAddresses, this.chainId); | ||
this.accounts.forEach(t => { | ||
tokenBalances[t.contractAddress] = Number(ethers.utils.formatUnits(rawTokenBalances[t.contractAddress], t.decimals)) || 0; | ||
tokenBalances[t.contractAddress] = ethers.utils.formatUnits(rawTokenBalances[t.contractAddress], t.decimals) || '0'; | ||
}); | ||
@@ -72,0 +72,0 @@ this.callback(ethBalanceNum, tokenBalances); |
import { Contract } from 'ethers'; | ||
import SINGLE_CALL_BALANCES_ABI from 'single-call-balance-checker-abi'; | ||
import ERC_20_ABI from 'erc-20-abi'; | ||
const TOKEN_BALANCE_CONTRACT = '0xb1f8e55c7f64d203c1400b9d8555d050f94adf39'; | ||
// const TOKEN_BALANCE_CONTRACT = '0xb1f8e55c7f64d203c1400b9d8555d050f94adf39'; | ||
const NETWORK_TO_CONTRACT_MAP = { | ||
@@ -17,3 +17,3 @@ 1: '0xb1f8e55c7f64d203c1400b9d8555d050f94adf39', | ||
const balance = values[addrIdx * tokens.length + tokenIdx]; | ||
balances[addr][tokenAddr] = balance.toString(); | ||
balances[addr][tokenAddr] = balance; | ||
}); | ||
@@ -20,0 +20,0 @@ }); |
{ | ||
"name": "@stardust-collective/dag4-xchain-ethereum", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"description": "Cross chain communication with Ethereum", | ||
@@ -5,0 +5,0 @@ "author": "Frank Fox", |
@@ -14,3 +14,3 @@ export declare class AccountTracker { | ||
}); | ||
config(ethAddress: string, accounts: TokenInfo[], chainId: number, callback: (e: number, t: TokenBalances) => void, debounceTimeSec?: number): void; | ||
config(ethAddress: string, accounts: TokenInfo[], chainId: number, callback: (e: string, t: TokenBalances) => void, debounceTimeSec?: number): void; | ||
private start; | ||
@@ -21,3 +21,3 @@ private stop; | ||
declare type TokenBalances = { | ||
[address: string]: number; | ||
[address: string]: string; | ||
}; | ||
@@ -24,0 +24,0 @@ declare type TokenInfo = { |
@@ -11,3 +11,3 @@ import { ethers } from 'ethers'; | ||
export declare class TokenContractService { | ||
formatAddressBalances<T>(values: T[], addresses: string[], tokens: string[]): AddressBalanceMap; | ||
formatAddressBalances(values: string[], addresses: string[], tokens: string[]): AddressBalanceMap; | ||
getAddressBalances(provider: Provider | Signer, ethAddress: string, tokenContractAddress: string[], chainId?: number): Promise<BalanceMap>; | ||
@@ -14,0 +14,0 @@ getTokenBalance(provider: Provider | Signer, ethAddress: string, tokenContractAddress: string, chainId?: number): Promise<BalanceMap>; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
36573