fix getting the innerData from injected provider

pull/3654/head^2
yann300 1 year ago committed by Aniket
parent d294e8d2d7
commit 625b3439c7
  1. 7
      apps/remix-ide/src/app/providers/injected-provider.tsx
  2. 35
      apps/remix-ide/src/blockchain/blockchain.tsx

@ -104,20 +104,19 @@ export abstract class InjectedProvider extends Plugin implements IProvider {
if (error.data && error.data.originalError && error.data.originalError.data) {
resolve({
jsonrpc: '2.0',
error: { message: error.data.originalError.message },
errorData: error.data.originalError.data,
error: error.data.originalError,
id: data.id
})
} else if (error.data && error.data.message) {
resolve({
jsonrpc: '2.0',
error: { message: error.data && error.data.message },
error: error.data && error.data,
id: data.id
})
} else {
resolve({
jsonrpc: '2.0',
error: { message: error.message },
error,
id: data.id
})
}

@ -853,16 +853,6 @@ export class Blockchain extends Plugin {
try {
this.txRunner.rawRun(tx, confirmationCb, continueCb, promptCb, async (error, result) => {
if (error) {
if (typeof error !== 'string') {
if (error.message) error = error.message
else {
try {
error = 'error: ' + JSON.stringify(error)
} catch (e) {
console.log(e)
}
}
}
return reject(error)
}
@ -880,18 +870,7 @@ export class Blockchain extends Plugin {
return resolve({result, tx})
})
} catch (err) {
let error = err
if (error && typeof error !== 'string') {
if (error.message) error = error.message
else {
try {
error = 'error: ' + JSON.stringify(error)
} catch (e) {
console.log(e)
}
}
}
return reject(error)
return reject(err)
}
})
}
@ -962,13 +941,11 @@ export class Blockchain extends Plugin {
cb(null, txResult, address, returnValue)
} catch (error) {
if (this.isInjectedWeb3()) {
const errorObj = error.replace('Returned error: ', '').replace('error: ', '')
if (errorObj) {
const compiledContracts = await this.call('compilerArtefacts', 'getAllContractDatas')
const injectedError = txExecution.checkError({ errorMessage: errorObj }, compiledContracts)
cb(injectedError.message)
} else
cb(error)
const errorMessage = error.innerError ? error.innerError.message : error.message
const errorData = error.innerError ? error.innerError.data : error.data
const compiledContracts = await this.call('compilerArtefacts', 'getAllContractDatas')
const injectedError = txExecution.checkError({ errorMessage, errorData }, compiledContracts)
cb(injectedError.message)
} else
cb(error)
}

Loading…
Cancel
Save