Skip to content

Commit

Permalink
ALL-1506 - Fix EVM tatum.address.spec.ts tests (#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hathoriel committed Jun 20, 2023
1 parent d1c9da6 commit 54f0fd0
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.5.2] - 2023.06.20
### Changed
- Fixed EVM tatum.address.spec.ts tests

## [1.5.1] - 2023.06.20
### Changed
- Fixed docs links to make it working in the /docs folder
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tatumcom/js",
"version": "1.5.1",
"version": "1.5.2",
"description": "Tatum JS SDK",
"author": "Tatum",
"repository": "https://github.com/tatumio/tatum-js",
Expand Down
1 change: 0 additions & 1 deletion src/dto/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ export const EVM_LOAD_BALANCER_NETWORKS = [
Network.FLARE_SONGBIRD,
Network.HAQQ,
Network.HAQQ_TESTNET,
// TODO: uncomment once it will work
// Network.ETHEREUM,
// Network.ETHEREUM_SEPOLIA,
]
Expand Down
4 changes: 1 addition & 3 deletions src/e2e/e2e.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,8 @@ export const e2eUtil = {
url,
address,
})
console.log(data)
console.log(error)

if (error) {
console.log(error)
throw new Error(error.message.join(','))
}

Expand Down
13 changes: 7 additions & 6 deletions src/service/address/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export class Address {
addresses,
}: AddressBalanceDetails): Promise<ResponseDto<AddressBalance[]>> {
const chain = this.config.network
const address = await this.getNativeBalance(addresses)
console.log(address)
return ErrorUtils.tryFail(async () => {
const [nativeBalances, tokenBalances] = await Promise.all([
this.getNativeBalance(addresses),
Expand Down Expand Up @@ -232,15 +234,14 @@ export class Address {
})
}

private getNativeBalance(addresses: string[]): Promise<string[]> {
private async getNativeBalance(addresses: string[]): Promise<string[]> {
const network = this.config.network
if (isEvmBasedNetwork(network)) {
const rpc = Utils.getRpc<EvmBasedRpc>(this.id, network)
return rpc
.rawBatchRpcCall(addresses.map((a, i) => Utils.prepareRpcCall('eth_getBalance', [a, 'pending'], i)))
.then((r) =>
r.map((e) => new BigNumber(e.result).dividedBy(10 ** Constant.DECIMALS[network]).toString()),
)
const result = await Promise.all(addresses.map((a, i) => rpc.rawRpcCall(Utils.prepareRpcCall('eth_getBalance', [a, 'pending'], i))))
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return result.map((e) => new BigNumber(e.result).dividedBy(10 ** Constant.DECIMALS[network]).toString())
}
if ([Network.SOLANA, Network.SOLANA_DEVNET].includes(network)) {
const rpc = Utils.getRpc<GenericRpc>(this.id, network)
Expand Down
8 changes: 0 additions & 8 deletions src/service/notification/subscribe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ export class Subscribe {
): Promise<ResponseDto<AddressBasedNotification>> {
return ErrorUtils.tryFail(async () => {
const chain = Utils.mapNetworkToNotificationChain(this.config.network)
console.log({
type: type,
attr: {
chain,
address,
url,
},
})
const { id } = await this.connector.post<IdDto>({
path: 'subscription',
body: {
Expand Down

0 comments on commit 54f0fd0

Please sign in to comment.