mirror of
https://github.com/status-im/safe-react.git
synced 2025-01-10 18:15:37 +00:00
Bug: incoming transactions do not load if it fails to fetch gas for a transaction (#1321)
* check if gas returned values are valid when loading token info for incoming tx * Fix generateBatchRequests Co-authored-by: Daniel Sanchez <daniel.sanchez@gnosis.pm>
This commit is contained in:
parent
bfed9679f7
commit
372d27f5a6
@ -10,8 +10,9 @@ import { web3ReadOnly as web3 } from 'src/logic/wallets/getWeb3'
|
||||
* @param {array<{ args: [any], method: string, type: 'eth'|undefined } | string>} args.methods - methods to be called
|
||||
* @returns {Promise<[*]>}
|
||||
*/
|
||||
const generateBatchRequests = ({ abi, address, batch = new web3.BatchRequest() , context, methods }: any): any => {
|
||||
const generateBatchRequests = ({ abi, address, batch, context, methods }: any): any => {
|
||||
const contractInstance: any = new web3.eth.Contract(abi, address)
|
||||
const localBatch = new web3.BatchRequest()
|
||||
|
||||
const values = methods.map((methodObject) => {
|
||||
let method, type, args = []
|
||||
@ -39,14 +40,14 @@ const generateBatchRequests = ({ abi, address, batch = new web3.BatchRequest() ,
|
||||
request = contractInstance.methods[method](...args).call.request(resolver)
|
||||
}
|
||||
|
||||
batch.add(request)
|
||||
batch ? batch.add(request) : localBatch.add(request)
|
||||
} catch (e) {
|
||||
resolve(null)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
batch.execute()
|
||||
!batch && localBatch.execute()
|
||||
|
||||
const returnValues = context ? [context, ...values] : values
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user