Skip to content

Commit

Permalink
Only use first 32 bytes of returned data
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrtenz committed Apr 8, 2021
1 parent feb1f8b commit 0b10a29
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { batch } from './utils';
*/
export const toBalanceMap = (addresses: string[], results: Array<bigint | Result>): BalanceMap => {
return results.reduce<BalanceMap>((current, next, index) => {
const value = typeof next === 'bigint' ? next : toNumber(next[1]);
const value = typeof next === 'bigint' ? next : toNumber(next[1].slice(0, 32));

return {
...current,
Expand Down
2 changes: 1 addition & 1 deletion src/eth-scan.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { encode } from '@findeth/abi';
import { callSingle, retryCalls, toBalanceMap, toNestedBalanceMap } from './api';
import { callSingle, toBalanceMap, toNestedBalanceMap } from './api';
import {
BALANCE_OF_ID,
BALANCE_OF_TYPE,
Expand Down

0 comments on commit 0b10a29

Please sign in to comment.