diff --git a/__tests__/utils/ethSigner.test.ts b/__tests__/utils/ethSigner.test.ts index 30c62903d..21b420bcc 100644 --- a/__tests__/utils/ethSigner.test.ts +++ b/__tests__/utils/ethSigner.test.ts @@ -159,7 +159,12 @@ describe('Ethereum signer', () => { { maxFee: 1 * 10 ** 16 } ); const txR = await provider.waitForTransaction(respTransfer.transaction_hash); - expect(txR.execution_status).toBe('SUCCEEDED'); + + if (txR.isSuccess()) { + expect(txR.execution_status).toBe('SUCCEEDED'); + } else { + fail('txR not success'); + } }); test('ETH account declaration V2', async () => { @@ -279,7 +284,11 @@ describe('Ethereum signer', () => { }); const txR = await provider.waitForTransaction(respTransfer.transaction_hash); - expect(txR.execution_status).toBe('SUCCEEDED'); + if (txR.isSuccess()) { + expect(txR.execution_status).toBe('SUCCEEDED'); + } else { + fail('txR not success'); + } }); test('ETH account declaration V3', async () => { diff --git a/src/provider/errors.ts b/src/provider/errors.ts index 2824dec64..1e2a01b4b 100644 --- a/src/provider/errors.ts +++ b/src/provider/errors.ts @@ -37,13 +37,19 @@ export class CustomError extends Error { export class LibraryError extends CustomError {} export class GatewayError extends LibraryError { - constructor(message: string, public errorCode: string) { + constructor( + message: string, + public errorCode: string + ) { super(message); } } export class HttpError extends LibraryError { - constructor(message: string, public errorCode: number) { + constructor( + message: string, + public errorCode: number + ) { super(message); } } diff --git a/src/utils/transactionReceipt.ts b/src/utils/transactionReceipt.ts index ffc353985..9cbf09909 100644 --- a/src/utils/transactionReceipt.ts +++ b/src/utils/transactionReceipt.ts @@ -67,15 +67,15 @@ export class ReceiptTx implements TransactionReceiptUtilityInterface { return (callbacks as TransactionReceiptCallbacksDefault)._(); } - isSuccess() { + isSuccess(): this is SuccessfulTransactionReceiptResponse { return this.statusReceipt === 'success'; } - isReverted() { + isReverted(): this is RevertedTransactionReceiptResponse { return this.statusReceipt === 'reverted'; } - isRejected() { + isRejected(): this is RejectedTransactionReceiptResponse { return this.statusReceipt === 'rejected'; }