File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -25,11 +25,13 @@ export enum LifiErrorCode {
25
25
TransactionRejected = 1012 ,
26
26
BalanceError = 1013 ,
27
27
AllowanceRequired = 1014 ,
28
+ InsufficientFunds = 1015 ,
28
29
}
29
30
30
31
export enum EthersErrorType {
31
- CallExecption = 'CALL_EXCEPTION' ,
32
32
ActionRejected = 'ACTION_REJECTED' ,
33
+ CallExecption = 'CALL_EXCEPTION' ,
34
+ InsufficientFunds = 'INSUFFICIENT_FUNDS' ,
33
35
}
34
36
35
37
export enum EthersErrorMessage {
Original file line number Diff line number Diff line change @@ -4,11 +4,12 @@ import {
4
4
getMessageFromCode ,
5
5
} from 'eth-rpc-errors'
6
6
7
+ import { fetchTxErrorDetails } from '../helpers'
7
8
import ChainsService from '../services/ChainsService'
8
9
import {
9
10
ErrorMessage ,
10
- EthersErrorType ,
11
11
EthersErrorMessage ,
12
+ EthersErrorType ,
12
13
LifiError ,
13
14
LifiErrorCode ,
14
15
MetaMaskProviderErrorCode ,
@@ -22,7 +23,6 @@ import {
22
23
ValidationError ,
23
24
} from './errors'
24
25
import { formatTokenAmountOnly } from './utils'
25
- import { fetchTxErrorDetails } from '../helpers'
26
26
27
27
/**
28
28
* Available MetaMask error codes:
@@ -203,7 +203,13 @@ export const parseError = async (
203
203
e . stack
204
204
)
205
205
}
206
-
206
+ case EthersErrorType . InsufficientFunds :
207
+ return new TransactionError (
208
+ LifiErrorCode . InsufficientFunds ,
209
+ e . message ,
210
+ await getTransactionNotSentMessage ( step , process ) ,
211
+ e . stack
212
+ )
207
213
case EthersErrorType . ActionRejected :
208
214
case MetaMaskProviderErrorCode . userRejectedRequest :
209
215
return new TransactionError (
You can’t perform that action at this time.
0 commit comments