diff --git a/src.ts/contract/contract.ts b/src.ts/contract/contract.ts index d07e68f1c..9e985b561 100644 --- a/src.ts/contract/contract.ts +++ b/src.ts/contract/contract.ts @@ -143,7 +143,7 @@ export async function copyOverrides(arg: any): Promise>overrides; } export async function resolveArgs(_runner: null | ContractRunner, inputs: ReadonlyArray, args: Array): Promise> { @@ -253,19 +253,19 @@ class WrappedMethod = Array, R = any, D extends R | Co }); } - const fragment = this.getFragment(...args); const tx = await this.populateTransaction(...args); let result = "0x"; try { result = await runner.call(tx); } catch (error: any) { - if (isCallException(error)) { - throw this._contract.interface.makeError(fragment, error.data, tx); + if (isCallException(error) && error.data) { + throw this._contract.interface.makeError(error.data, tx); } throw error; } + const fragment = this.getFragment(...args); return this._contract.interface.decodeFunctionResult(fragment, result); } } diff --git a/src.ts/contract/types.ts b/src.ts/contract/types.ts index f6b132a42..81a01e4a5 100644 --- a/src.ts/contract/types.ts +++ b/src.ts/contract/types.ts @@ -24,6 +24,9 @@ export interface ContractTransaction extends PreparedTransactionRequest { // These are populated by contract methods and cannot bu null to: string; data: string; + + // These are resolved + from?: string; } // Deployment Transactions have no `to`