fix request

pull/5343/head
yann300 4 weeks ago committed by Aniket
parent 5c3c3950d5
commit fe6bc2fd27
  1. 2
      apps/remix-dapp/src/utils/txRunner.ts
  2. 20
      apps/remix-ide/src/app/udapp/run-tab.tsx
  3. 6
      libs/remix-lib/src/execution/txRunnerWeb3.ts
  4. 11
      libs/remix-ui/run-tab/src/lib/actions/deploy.ts

@ -267,7 +267,7 @@ export class TxRunner {
}; };
} catch (error: any) { } catch (error: any) {
console.log( console.log(
`Send transaction failed: ${error.message} . if you use an injected provider, please check it is properly unlocked. ` `Send transaction failed: ${error.message || error.error} . if you use an injected provider, please check it is properly unlocked. `
); );
return { error }; return { error };
} }

@ -198,16 +198,18 @@ export class RunTab extends ViewPlugin {
sendAsync (payload) { sendAsync (payload) {
return udapp.call(name, 'sendAsync', payload) return udapp.call(name, 'sendAsync', payload)
}, },
async request (payload) { request (payload) {
try { return new Promise<any>((resolve, reject) => {
const requestResult = await udapp.call(name, 'sendAsync', payload) udapp.call(name, 'sendAsync', payload).then((response) => {
if (requestResult.error) { if (response.error) {
throw new Error(requestResult.error.message) reject(response.error.message)
} } else {
return requestResult.result resolve(response)
} catch (err) {
throw new Error(err.message)
} }
}).catch((err) => {
reject(err)
})
})
} }
} }
}) })

@ -66,7 +66,7 @@ export class TxRunnerWeb3 {
const res = await (this.getWeb3() as any).eth.personal.sendTransaction({ ...tx, value }, { checkRevertBeforeSending: false, ignoreGasPricing: true }) const res = await (this.getWeb3() as any).eth.personal.sendTransaction({ ...tx, value }, { checkRevertBeforeSending: false, ignoreGasPricing: true })
cb(null, res.transactionHash) cb(null, res.transactionHash)
} catch (e) { } catch (e) {
console.log(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `) console.log(`Send transaction failed: ${e.message || e.error} . if you use an injected provider, please check it is properly unlocked. `)
// in case the receipt is available, we consider that only the execution failed but the transaction went through. // in case the receipt is available, we consider that only the execution failed but the transaction went through.
// So we don't consider this to be an error. // So we don't consider this to be an error.
if (e.receipt) cb(null, e.receipt.transactionHash) if (e.receipt) cb(null, e.receipt.transactionHash)
@ -82,6 +82,10 @@ export class TxRunnerWeb3 {
const res = await this.getWeb3().eth.sendTransaction(tx, null, { checkRevertBeforeSending: false, ignoreGasPricing: true }) const res = await this.getWeb3().eth.sendTransaction(tx, null, { checkRevertBeforeSending: false, ignoreGasPricing: true })
cb(null, res.transactionHash) cb(null, res.transactionHash)
} catch (e) { } catch (e) {
if (!e.message) e.message = ''
if (e.error) {
e.message = e.message + ' ' + e.error
}
console.log(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `) console.log(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `)
// in case the receipt is available, we consider that only the execution failed but the transaction went through. // in case the receipt is available, we consider that only the execution failed but the transaction went through.
// So we don't consider this to be an error. // So we don't consider this to be an error.

@ -119,10 +119,19 @@ const getConfirmationCb = (plugin: RunTab, dispatch: React.Dispatch<any>, confir
export const continueHandler = (dispatch: React.Dispatch<any>, gasEstimationPrompt: (msg: string) => JSX.Element, error, continueTxExecution, cancelCb) => { export const continueHandler = (dispatch: React.Dispatch<any>, gasEstimationPrompt: (msg: string) => JSX.Element, error, continueTxExecution, cancelCb) => {
if (error) { if (error) {
let msg = typeof error !== 'string' ? error.message : error let msg = ''
if (typeof error === 'string') {
msg = error
}
if (error && error.innerError) { if (error && error.innerError) {
msg += '\n' + error.innerError msg += '\n' + error.innerError
} }
if (error && error.message) {
msg += '\n' + error.message
}
if (error && error.error) {
msg += '\n' + error.error
}
if (msg.includes('invalid opcode')) msg += '\nThe EVM version used by the selected environment is not compatible with the compiler EVM version.' if (msg.includes('invalid opcode')) msg += '\nThe EVM version used by the selected environment is not compatible with the compiler EVM version.'

Loading…
Cancel
Save