@@ -13,7 +13,7 @@ import { defineMessages, useIntl } from "react-intl";
13
13
14
14
import octopus from "@/images/octopus.svg" ;
15
15
import { WithExplanatorySidebar } from "@/layouts/WithExplanatorySidebar" ;
16
- import { trpcReact } from "@/providers/TRPCProvider" ;
16
+ import { trpcReact , TRPCRouterOutputs } from "@/providers/TRPCProvider" ;
17
17
import { Select } from "@/ui/Forms/Select/Select" ;
18
18
import { TextareaInput } from "@/ui/Forms/TextareaInput/TextareaInput" ;
19
19
import { PillButton } from "@/ui/PillButton/PillButton" ;
@@ -122,11 +122,33 @@ function InputUnsignedTransaction({
122
122
onSubmit : ( unsignedTransaction : string , selectedAccount : string ) => void ;
123
123
} ) {
124
124
const accounts = trpcReact . getMultisigLedgerAccounts . useQuery ( ) ;
125
- const accountsData = accounts . data ;
126
125
126
+ if ( accounts . isLoading ) {
127
+ return "Loading Accounts..." ;
128
+ }
129
+
130
+ if ( accounts . isError ) {
131
+ return `Error loading accounts ${ accounts . error . message } ` ;
132
+ }
133
+
134
+ return (
135
+ < InputUnsignedTransactionWithAccounts
136
+ onSubmit = { onSubmit }
137
+ accountsData = { accounts . data }
138
+ />
139
+ ) ;
140
+ }
141
+
142
+ function InputUnsignedTransactionWithAccounts ( {
143
+ onSubmit,
144
+ accountsData,
145
+ } : {
146
+ onSubmit : ( unsignedTransaction : string , selectedAccount : string ) => void ;
147
+ accountsData : TRPCRouterOutputs [ "getMultisigLedgerAccounts" ] ;
148
+ } ) {
127
149
const [ unsignedTransaction , setUnsignedTransaction ] = useState ( "" ) ;
128
150
const [ selectedAccount , setSelectedAccount ] = useState < string | null > (
129
- accounts . data ?. [ 0 ] ?. name ?? null ,
151
+ accountsData [ 0 ] ?. name ?? null ,
130
152
) ;
131
153
132
154
const accountOptions = useMemo ( ( ) => {
0 commit comments