File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,13 @@ export function SwapConfirmationScreen(props: {
78
78
message : "Your wallet rejected the approval request." ,
79
79
} ;
80
80
}
81
+ if ( error . toLowerCase ( ) . includes ( "insufficient funds for gas" ) ) {
82
+ return {
83
+ title : "Insufficient Native Funds" ,
84
+ message :
85
+ "You do not have enough native funds to approve the transaction." ,
86
+ } ;
87
+ }
81
88
return {
82
89
title : "Failed to Approve" ,
83
90
message :
@@ -96,6 +103,13 @@ export function SwapConfirmationScreen(props: {
96
103
message : "Your wallet rejected the confirmation request." ,
97
104
} ;
98
105
}
106
+ if ( error . toLowerCase ( ) . includes ( "insufficient funds for gas" ) ) {
107
+ return {
108
+ title : "Insufficient Native Funds" ,
109
+ message :
110
+ "You do not have enough native funds to confirm the transaction." ,
111
+ } ;
112
+ }
99
113
return {
100
114
title : "Failed to Confirm" ,
101
115
message :
@@ -333,6 +347,7 @@ export function SwapConfirmationScreen(props: {
333
347
} catch ( e ) {
334
348
console . error ( e ) ;
335
349
setStatus ( "error" ) ;
350
+ setError ( ( e as Error ) . message ) ;
336
351
}
337
352
}
338
353
} }
Original file line number Diff line number Diff line change @@ -126,6 +126,13 @@ export function TransferConfirmationScreen(
126
126
message : "Your wallet rejected the approval request." ,
127
127
} ;
128
128
}
129
+ if ( status . error . toLowerCase ( ) . includes ( "insufficient funds for gas" ) ) {
130
+ return {
131
+ title : "Insufficient Native Funds" ,
132
+ message :
133
+ "You do not have enough native funds to approve the transaction." ,
134
+ } ;
135
+ }
129
136
return {
130
137
title : "Failed to Approve" ,
131
138
message :
@@ -138,12 +145,23 @@ export function TransferConfirmationScreen(
138
145
status . id === "error" &&
139
146
status . error
140
147
) {
141
- if ( status . error . toLowerCase ( ) . includes ( "user rejected" ) ) {
148
+ if (
149
+ status . error . toLowerCase ( ) . includes ( "user rejected" ) ||
150
+ status . error . toLowerCase ( ) . includes ( "user closed modal" ) ||
151
+ status . error . toLowerCase ( ) . includes ( "user denied" )
152
+ ) {
142
153
return {
143
154
title : "Failed to Confirm" ,
144
155
message : "Your wallet rejected the confirmation request." ,
145
156
} ;
146
157
}
158
+ if ( status . error . toLowerCase ( ) . includes ( "insufficient funds for gas" ) ) {
159
+ return {
160
+ title : "Insufficient Native Funds" ,
161
+ message :
162
+ "You do not have enough native funds to confirm the transaction." ,
163
+ } ;
164
+ }
147
165
return {
148
166
title : "Failed to Confirm" ,
149
167
message :
You can’t perform that action at this time.
0 commit comments