File tree 3 files changed +22
-4
lines changed
3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -377,7 +377,7 @@ describe('Error decoders work', () => {
377
377
expect ( decodedError . reason ) . toBe ( `Insufficient ${ base . nativeAssetSymbol } for transaction calls` )
378
378
const humanized = getHumanReadableEstimationError ( decodedError )
379
379
expect ( humanized . message ) . toBe (
380
- ` The transaction will fail because it will revert onchain. Error code: Insufficient ${ base . nativeAssetSymbol } for transaction calls\n`
380
+ " The transaction will fail because you don't have enough ETH to cover the gas costs for this transaction."
381
381
)
382
382
383
383
const sameErrorOnAvax = new InnerCallFailureError (
@@ -392,7 +392,7 @@ describe('Error decoders work', () => {
392
392
)
393
393
const humanizedAvax = getHumanReadableEstimationError ( decodedsameErrorOnAvax )
394
394
expect ( humanizedAvax . message ) . toBe (
395
- ` The transaction will fail because it will revert onchain. Error code: Insufficient ${ avalanche . nativeAssetSymbol } for transaction calls\n`
395
+ " The transaction will fail because you don't have enough AVAX to cover the gas costs for this transaction."
396
396
)
397
397
} )
398
398
it ( 'Should report transaction reverted with error unknown when error is 0x and the calls value is less or equal to the portfolio amount' , async ( ) => {
Original file line number Diff line number Diff line change @@ -56,6 +56,24 @@ const BROADCAST_OR_ESTIMATION_ERRORS: ErrorHumanizerError[] = [
56
56
reasons : [ 'Transaction underpriced' ] ,
57
57
message : 'it is underpriced. Please select a higher transaction speed and try again.'
58
58
} ,
59
+ // TODO: Figure out a more elegant way to handle errors with dynamic messages
60
+ {
61
+ reasons : [ 'Insufficient ETH for transaction calls' ] ,
62
+ message : "you don't have enough ETH to cover the gas costs for this transaction."
63
+ } ,
64
+ {
65
+ reasons : [ 'Insufficient AVAX for transaction calls' ] ,
66
+ message : "you don't have enough AVAX to cover the gas costs for this transaction."
67
+ } ,
68
+ {
69
+ reasons : [ 'Insufficient BNB for transaction calls' ] ,
70
+ message : "you don't have enough BNB to cover the gas costs for this transaction."
71
+ } ,
72
+ {
73
+ reasons : [ 'Insufficient POL for transaction calls' ] ,
74
+ message : "you don't have enough POL to cover the gas costs for this transaction."
75
+ } ,
76
+ // End of TODO
59
77
// Smart Accounts
60
78
{
61
79
reasons : [ 'Sponsorship failed.' ] ,
Original file line number Diff line number Diff line change @@ -932,7 +932,7 @@ describe('estimate', () => {
932
932
933
933
expect ( response instanceof Error ) . toBe ( true )
934
934
expect ( ( response as Error ) . message ) . toBe (
935
- ' The transaction will fail because it will revert onchain. Error code: Insufficient ETH for transaction calls\n'
935
+ " The transaction will fail because you don't have enough ETH to cover the gas costs for this transaction."
936
936
)
937
937
} )
938
938
@@ -1117,7 +1117,7 @@ describe('estimate', () => {
1117
1117
)
1118
1118
expect ( response instanceof Error ) . toBe ( true )
1119
1119
expect ( ( response as Error ) . message ) . toBe (
1120
- ' The transaction will fail because it will revert onchain. Error code: Insufficient POL for transaction calls\n'
1120
+ " The transaction will fail because you don't have enough POL to cover the gas costs for this transaction."
1121
1121
)
1122
1122
} )
1123
1123
You can’t perform that action at this time.
0 commit comments