File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed
Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ export const withdrawConfidentialBalance = async (
185185) => {
186186 const decryptionKey = new TwistedEd25519PrivateKey ( decryptionKeyHex ) ;
187187
188- return confidentialAssets . withdraw ( {
188+ return confidentialAssets . withdrawWithTotalBalance ( {
189189 signer : account ,
190190 recipient : receiver ,
191191 tokenAddress,
Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ export default function WithdrawForm({
172172 setIsSubmitting ( false ) ;
173173 return ;
174174 }
175- const [ txReceipt , withdrawErr ] = await tryCatch (
175+ const [ responses , withdrawErr ] = await tryCatch (
176176 withdrawTo (
177177 parseUnits ( String ( formData . amount ) , token . decimals ) . toString ( ) ,
178178 recipientAddress ,
@@ -187,9 +187,15 @@ export default function WithdrawForm({
187187 setIsSubmitting ( false ) ;
188188 return ;
189189 }
190+ if ( responses . length === 0 ) {
191+ ErrorHandler . process ( new Error ( 'No responses were returned' ) ) ;
192+ enableForm ( ) ;
193+ setIsSubmitting ( false ) ;
194+ return ;
195+ }
190196
191197 const [ , reloadError ] = await tryCatch (
192- reloadBalances ( BigInt ( txReceipt . version ) ) ,
198+ reloadBalances ( BigInt ( responses [ responses . length - 1 ] . version ) ) ,
193199 ) ;
194200 if ( reloadError ) {
195201 ErrorHandler . process ( reloadError ) ;
Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ type ConfidentialCoinContextType = {
154154 opts ?: {
155155 isSyncFirst ?: boolean ;
156156 } ,
157- ) => Promise < CommittedTransactionResponse > ;
157+ ) => Promise < CommittedTransactionResponse [ ] > ;
158158 depositTo : ( amount : bigint , to : string ) => Promise < CommittedTransactionResponse > ;
159159 depositCoinTo : ( amount : bigint , to : string ) => Promise < CommittedTransactionResponse > ;
160160 // TODO: rotate keys
@@ -212,7 +212,7 @@ const confidentialCoinContext = createContext<ConfidentialCoinContextType>({
212212 rolloverAccount : async ( ) => ( { } ) as CommittedTransactionResponse [ ] ,
213213 transfer : async ( ) => ( { } ) as CommittedTransactionResponse [ ] ,
214214 buildWithdrawToTx : async ( ) => ( { } ) as SimpleTransaction ,
215- withdrawTo : async ( ) => ( { } ) as CommittedTransactionResponse ,
215+ withdrawTo : async ( ) => ( { } ) as CommittedTransactionResponse [ ] ,
216216 depositTo : async ( ) => ( { } ) as CommittedTransactionResponse ,
217217 depositCoinTo : async ( ) => ( { } ) as CommittedTransactionResponse ,
218218
You can’t perform that action at this time.
0 commit comments