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: {
7878 message : "Your wallet rejected the approval request." ,
7979 } ;
8080 }
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+ }
8188 return {
8289 title : "Failed to Approve" ,
8390 message :
@@ -96,6 +103,13 @@ export function SwapConfirmationScreen(props: {
96103 message : "Your wallet rejected the confirmation request." ,
97104 } ;
98105 }
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+ }
99113 return {
100114 title : "Failed to Confirm" ,
101115 message :
@@ -333,6 +347,7 @@ export function SwapConfirmationScreen(props: {
333347 } catch ( e ) {
334348 console . error ( e ) ;
335349 setStatus ( "error" ) ;
350+ setError ( ( e as Error ) . message ) ;
336351 }
337352 }
338353 } }
Original file line number Diff line number Diff line change @@ -126,6 +126,13 @@ export function TransferConfirmationScreen(
126126 message : "Your wallet rejected the approval request." ,
127127 } ;
128128 }
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+ }
129136 return {
130137 title : "Failed to Approve" ,
131138 message :
@@ -138,12 +145,23 @@ export function TransferConfirmationScreen(
138145 status . id === "error" &&
139146 status . error
140147 ) {
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+ ) {
142153 return {
143154 title : "Failed to Confirm" ,
144155 message : "Your wallet rejected the confirmation request." ,
145156 } ;
146157 }
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+ }
147165 return {
148166 title : "Failed to Confirm" ,
149167 message :
You can’t perform that action at this time.
0 commit comments