RevertError: Decode Parity revert errors
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
import * as chai from 'chai';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { AnyRevertError, RawRevertError, RevertError, StringRevertError } from '../src/revert_error';
|
||||
import {
|
||||
AnyRevertError,
|
||||
getThrownErrorRevertErrorBytes,
|
||||
RawRevertError,
|
||||
RevertError,
|
||||
StringRevertError,
|
||||
} from '../src/revert_error';
|
||||
|
||||
import { chaiSetup } from './utils/chai_setup';
|
||||
|
||||
@@ -154,6 +160,14 @@ describe('RevertError', () => {
|
||||
expect(decode).to.throw();
|
||||
});
|
||||
});
|
||||
describe('getThrownErrorRevertErrorBytes', () => {
|
||||
it('should decode Parity revert errors', () => {
|
||||
const revertAbi = '0x1234';
|
||||
const parityError = { code: 1234, message: 'VM execution error.', data: `Reverted ${revertAbi}`, name: '' };
|
||||
const revertError = getThrownErrorRevertErrorBytes(parityError);
|
||||
expect(revertError).to.be.eq(revertAbi);
|
||||
});
|
||||
});
|
||||
describe('encoding', () => {
|
||||
const message = 'foobar';
|
||||
it('should be able to encode', () => {
|
||||
|
Reference in New Issue
Block a user