@@ -31,116 +31,16 @@ import { MarkdownRenderer } from "@/components/ui/markdown-renderer";
3131import { Img } from "../../../components/ui/Img" ;
3232import { Spinner } from "../../../components/ui/Spinner" ;
3333import { THIRDWEB_CLIENT } from "../../../lib/client" ;
34- import { type NebulaContext , promptNebula } from "../api/chat" ;
35- import type { NebulaUserMessage } from "../api/types" ;
34+ import { promptNebula } from "../api/chat" ;
35+ import type {
36+ ChatMessage ,
37+ NebulaContext ,
38+ NebulaUserMessage ,
39+ WalletMeta ,
40+ } from "../api/types" ;
3641import { examplePrompts } from "../data/examplePrompts" ;
3742import { resolveSchemeWithErrorHandler } from "./resolveSchemeWithErrorHandler" ;
3843
39- // Simplified types for the playground version
40- type WalletMeta = {
41- walletId : string ;
42- address : string ;
43- } ;
44-
45- type NebulaUserMessageContentItem =
46- | {
47- type : "image" ;
48- image_url : string | null ;
49- b64 : string | null ;
50- }
51- | {
52- type : "text" ;
53- text : string ;
54- }
55- | {
56- type : "transaction" ;
57- transaction_hash : string ;
58- chain_id : number ;
59- } ;
60-
61- type NebulaUserMessageContent = NebulaUserMessageContentItem [ ] ;
62-
63- type ChatMessage =
64- | {
65- type : "user" ;
66- content : NebulaUserMessageContent ;
67- }
68- | {
69- text : string ;
70- type : "error" ;
71- }
72- | {
73- texts : string [ ] ;
74- type : "presence" ;
75- }
76- | {
77- // assistant type message loaded from history doesn't have request_id
78- request_id : string | undefined ;
79- text : string ;
80- type : "assistant" ;
81- }
82- | {
83- type : "action" ;
84- subtype : "sign_transaction" ;
85- request_id : string ;
86- data : NebulaTxData ;
87- }
88- | {
89- type : "action" ;
90- subtype : "sign_swap" ;
91- request_id : string ;
92- data : NebulaSwapData ;
93- }
94- | {
95- type : "image" ;
96- request_id : string ;
97- data : {
98- width : number ;
99- height : number ;
100- url : string ;
101- } ;
102- } ;
103-
104- type NebulaTxData = {
105- chain_id : number ;
106- data : `0x${string } `;
107- to : string ;
108- value ?: string ;
109- } ;
110-
111- type NebulaSwapData = {
112- action : string ;
113- transaction : {
114- chainId : number ;
115- to : `0x${string } `;
116- data : `0x${string } `;
117- value ?: string ;
118- } ;
119- to : {
120- address : `0x${string } `;
121- amount : string ;
122- chain_id : number ;
123- decimals : number ;
124- symbol : string ;
125- } ;
126- from : {
127- address : `0x${string } `;
128- amount : string ;
129- chain_id : number ;
130- decimals : number ;
131- symbol : string ;
132- } ;
133- intent : {
134- amount : string ;
135- destinationChainId : number ;
136- destinationTokenAddress : `0x${string } `;
137- originChainId : number ;
138- originTokenAddress : `0x${string } `;
139- receiver : `0x${string } `;
140- sender : `0x${string } `;
141- } ;
142- } ;
143-
14444export function ChatPageContent ( props : {
14545 client : ThirdwebClient ;
14646 type : "landing" | "new-chat" ;
@@ -752,7 +652,7 @@ function RenderMessage(props: {
752652 transaction = { ( ) =>
753653 prepareTransaction ( {
754654 client : THIRDWEB_CLIENT ,
755- chain : defineChain ( message . data . transaction . chainId ) ,
655+ chain : defineChain ( message . data . transaction . chain_id ) ,
756656 data : message . data . transaction . data ,
757657 to : message . data . transaction . to ,
758658 value : message . data . transaction . value
@@ -768,7 +668,7 @@ function RenderMessage(props: {
768668 props . sendMessage ( {
769669 content : [
770670 {
771- chain_id : message . data . transaction . chainId ,
671+ chain_id : message . data . transaction . chain_id ,
772672 transaction_hash : tx . transactionHash ,
773673 type : "transaction" ,
774674 } ,
@@ -785,7 +685,7 @@ function RenderMessage(props: {
785685 ) : (
786686 < ConnectButton
787687 client = { THIRDWEB_CLIENT }
788- chain = { defineChain ( message . data . transaction . chainId ) }
688+ chain = { defineChain ( message . data . transaction . chain_id ) }
789689 />
790690 ) }
791691 </ div >
0 commit comments