@@ -89,20 +89,14 @@ export const getTotalFee = ({
8989 } ) ;
9090} ;
9191
92- interface ICreateTransaction {
93- selectedWallet ?: TWalletName ;
94- selectedNetwork ?: EAvailableNetwork ;
95- transactionData ?: ISendTransaction ;
96- }
97-
9892/**
9993 * Creates complete signed transaction using the transaction data store
10094 * @param {ISendTransaction } [transactionData]
10195 * @returns {Promise<Result<{id: string, hex: string}>> }
10296 */
103- export const createTransaction = async ( {
104- transactionData,
105- } : ICreateTransaction = { } ) : Promise < Result < { id : string ; hex : string } > > => {
97+ export const createTransaction = async (
98+ transactionData ?: ISendTransaction ,
99+ ) : Promise < Result < { id : string ; hex : string } > > => {
106100 try {
107101 const transaction = getOnChainWalletTransaction ( ) ;
108102 const createTxRes = await transaction . createTransaction ( {
@@ -690,10 +684,8 @@ export const updateSendAmount = ({
690684 }
691685
692686 updateSendTransaction ( {
693- transaction : {
694- outputs : [ { ...currentOutput , value : amount } ] ,
695- max,
696- } ,
687+ outputs : [ { ...currentOutput , value : amount } ] ,
688+ max,
697689 } ) ;
698690
699691 return ok ( '' ) ;
@@ -747,15 +739,11 @@ export const updateMessage = async ({
747739 if ( max ) {
748740 _transaction . outputs = [ { address, value : inputTotal - newFee , index } ] ;
749741 //Update the tx value with the new fee to continue sending the max amount.
750- updateSendTransaction ( {
751- transaction : _transaction ,
752- } ) ;
742+ updateSendTransaction ( _transaction ) ;
753743 return ok ( 'Successfully updated the message.' ) ;
754744 }
755745 if ( totalNewAmount <= inputTotal ) {
756- updateSendTransaction ( {
757- transaction : _transaction ,
758- } ) ;
746+ updateSendTransaction ( _transaction ) ;
759747 }
760748 return ok ( 'Successfully updated the message.' ) ;
761749} ;
@@ -816,11 +804,7 @@ const runCoinSelect = async ({
816804 fee: autoCoinSelectResponse.value.fee,
817805 inputs: autoCoinSelectResponse.value.inputs,
818806 };
819- updateSendTransaction({
820- selectedWallet,
821- selectedNetwork,
822- transaction: updatedTx,
823- });
807+ updateSendTransaction(updatedTx);
824808 return ok('Successfully updated tx.');
825809 }
826810 return ok('No need to update transaction.');
@@ -913,7 +897,7 @@ export const broadcastBoost = async ({
913897 }
914898 const transaction = transactionDataResponse . value ;
915899
916- const rawTx = await createTransaction ( { } ) ;
900+ const rawTx = await createTransaction ( ) ;
917901 if ( rawTx . isErr ( ) ) {
918902 return err ( rawTx . error . message ) ;
919903 }
0 commit comments