@@ -173,6 +173,7 @@ export function Chats(props: {
173173 isMessagePending = { isMessagePending }
174174 client = { props . client }
175175 sendMessage = { props . sendMessage }
176+ nextMessage = { props . messages [ index + 1 ] }
176177 />
177178 </ ScrollShadow >
178179
@@ -207,8 +208,9 @@ function RenderMessage(props: {
207208 isMessagePending : boolean ;
208209 client : ThirdwebClient ;
209210 sendMessage : ( message : string ) => void ;
211+ nextMessage : ChatMessage | undefined ;
210212} ) {
211- const { message, isMessagePending, client, sendMessage } = props ;
213+ const { message, isMessagePending, client, sendMessage, nextMessage } = props ;
212214
213215 switch ( message . type ) {
214216 case "assistant" :
@@ -237,6 +239,11 @@ function RenderMessage(props: {
237239 txData = { message . data }
238240 client = { client }
239241 onTxSettled = { ( txHash ) => {
242+ // do not send automatic prompt if there is another transaction after this one
243+ if ( nextMessage ?. type === "action" ) {
244+ return ;
245+ }
246+
240247 sendMessage ( getTransactionSettledPrompt ( txHash ) ) ;
241248 } }
242249 />
@@ -254,8 +261,13 @@ function RenderMessage(props: {
254261 < SwapTransactionCard
255262 swapData = { message . data }
256263 client = { client }
257- onTxSettled = { ( ) => {
258- // no op
264+ onTxSettled = { ( txHash ) => {
265+ // do not send automatic prompt if there is another transaction after this one
266+ if ( nextMessage ?. type === "action" ) {
267+ return ;
268+ }
269+
270+ sendMessage ( getTransactionSettledPrompt ( txHash ) ) ;
259271 } }
260272 />
261273 ) ;
0 commit comments