diff --git a/packages/eth-providers/src/__tests__/utils.test.ts b/packages/eth-providers/src/__tests__/utils.test.ts index 0aed45f57..b7b99ae88 100644 --- a/packages/eth-providers/src/__tests__/utils.test.ts +++ b/packages/eth-providers/src/__tests__/utils.test.ts @@ -447,14 +447,14 @@ describe('eth call error handling', () => { describe('checkEvmExecutionError', () => { const commonData = { - used_gas: '0x0', - used_storage: 0, + usedGas: '0x0', + usedStorage: 0, logs: [], }; it('when should throw - reverted', () => { const data = { - exit_reason: { revert: 'Reverted' as const }, + exitReason: { revert: 'Reverted' as const }, value: invalidCurrencyIdHex, ...commonData, }; @@ -464,7 +464,7 @@ describe('eth call error handling', () => { it('when should throw - outOfFund', () => { const data = { - exit_reason: { + exitReason: { error: { outOfFund: null }, }, value: invalidCurrencyIdHex, @@ -476,7 +476,7 @@ describe('eth call error handling', () => { it('when should throw - ExistentialDeposit', () => { const data = { - exit_reason: { + exitReason: { error: { other: 'ExistentialDeposit' }, }, value: invalidCurrencyIdHex, @@ -489,7 +489,7 @@ describe('eth call error handling', () => { it('when should not throw', () => { { const data = { - exit_reason: { succeed: 'Returned' as const }, + exitReason: { succeed: 'Returned' as const }, value: '0x123456789', ...commonData, }; @@ -498,7 +498,7 @@ describe('eth call error handling', () => { { const data = { - exit_reason: { succeed: 'Stopped' as const }, + exitReason: { succeed: 'Stopped' as const }, value: '0x', ...commonData, }; diff --git a/packages/eth-providers/src/base-provider.ts b/packages/eth-providers/src/base-provider.ts index ef4c41965..9f4096137 100644 --- a/packages/eth-providers/src/base-provider.ts +++ b/packages/eth-providers/src/base-provider.ts @@ -266,15 +266,15 @@ export interface PollFilters { } export interface CallReturnInfo { - exit_reason: { + exitReason: { succeed?: 'Stopped' | 'Returned' | 'Suicided'; error?: any; revert?: 'Reverted'; fatal?: any; }; value: string; - used_gas: string; - used_storage: number; + usedGas: string; + usedStorage: number; logs: Log[]; } @@ -839,7 +839,10 @@ export abstract class BaseProvider extends AbstractProvider { return res.value; }; - _ethCall = async (callRequest: SubstrateEvmCallRequest, at?: string) => { + _ethCall = async ( + callRequest: SubstrateEvmCallRequest, + at?: string, + ): Promise => { const api = at ? await this.api.at(at) : this.api; // call evm rpc when `state_call` is not supported yet @@ -847,10 +850,10 @@ export abstract class BaseProvider extends AbstractProvider { const data = await this.api.rpc.evm.call(callRequest); return { - exit_reason: { succeed: 'Returned' }, + exitReason: { succeed: 'Returned' }, value: data.toHex(), - used_gas: '0', - used_storage: 0, + usedGas: '0', + usedStorage: 0, logs: [], }; } @@ -1120,8 +1123,8 @@ export abstract class BaseProvider extends AbstractProvider { }; const gasInfo = await this._ethCall(txRequest, blockHash); - const usedGas = BigNumber.from(gasInfo.used_gas).toNumber(); - const usedStorage = gasInfo.used_storage; + const usedGas = BigNumber.from(gasInfo.usedGas).toNumber(); + const usedStorage = gasInfo.usedStorage; /* ---------- try using a gasLimit slightly more than actual used gas diff --git a/packages/eth-providers/src/utils/utils.ts b/packages/eth-providers/src/utils/utils.ts index 93764f30b..a26d43ff8 100644 --- a/packages/eth-providers/src/utils/utils.ts +++ b/packages/eth-providers/src/utils/utils.ts @@ -334,7 +334,7 @@ export const decodeRevertMsg = (hexMsg: string) => { export const checkEvmExecutionError = (data: CallReturnInfo): void => { if (!data) return; - const { exit_reason: exitReason, value: returnData } = data; + const { exitReason, value: returnData } = data; if (!exitReason.succeed) { let msg: string; let err: any;