-
-
Notifications
You must be signed in to change notification settings - Fork 906
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
69 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"viem": patch | ||
--- | ||
|
||
**Account Abstraction:** Exposed `data` on `ExecutionRevertedError`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import { accounts } from '~test/src/constants.js' | |
import { AbiDecodingZeroDataError } from '../../errors/abi.js' | ||
import { BaseError } from '../../errors/base.js' | ||
import { RawContractError } from '../../errors/contract.js' | ||
import { RpcRequestError } from '../../errors/request.js' | ||
|
||
import { getContractError } from './getContractError.js' | ||
|
||
|
@@ -179,6 +180,41 @@ describe('getContractError', () => { | |
`) | ||
}) | ||
|
||
test('rpc error', () => { | ||
const error = getContractError( | ||
new BaseError('An RPC error occurred', { | ||
cause: new RpcRequestError({ | ||
body: {}, | ||
error: { code: 3, message: 'ah no' }, | ||
url: '', | ||
}), | ||
}), | ||
{ | ||
abi: baycContractConfig.abi, | ||
functionName: 'mintApe', | ||
args: [1n], | ||
sender: accounts[0].address, | ||
}, | ||
) | ||
expect(error).toMatchInlineSnapshot(` | ||
[ContractFunctionExecutionError: The contract function "mintApe" reverted with the following reason: | ||
ah no | ||
Contract Call: | ||
function: mintApe(uint256 numberOfTokens) | ||
args: (1) | ||
sender: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 | ||
Version: [email protected]] | ||
`) | ||
expect(error.cause).toMatchInlineSnapshot(` | ||
[ContractFunctionRevertedError: The contract function "mintApe" reverted with the following reason: | ||
ah no | ||
Version: [email protected]] | ||
`) | ||
}) | ||
|
||
test('unknown function', () => { | ||
const error = getContractError( | ||
new BaseError('An RPC error occurred', { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters