@@ -89,20 +89,14 @@ export const getTotalFee = ({
89
89
} ) ;
90
90
} ;
91
91
92
- interface ICreateTransaction {
93
- selectedWallet ?: TWalletName ;
94
- selectedNetwork ?: EAvailableNetwork ;
95
- transactionData ?: ISendTransaction ;
96
- }
97
-
98
92
/**
99
93
* Creates complete signed transaction using the transaction data store
100
94
* @param {ISendTransaction } [transactionData]
101
95
* @returns {Promise<Result<{id: string, hex: string}>> }
102
96
*/
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 } > > => {
106
100
try {
107
101
const transaction = getOnChainWalletTransaction ( ) ;
108
102
const createTxRes = await transaction . createTransaction ( {
@@ -690,10 +684,8 @@ export const updateSendAmount = ({
690
684
}
691
685
692
686
updateSendTransaction ( {
693
- transaction : {
694
- outputs : [ { ...currentOutput , value : amount } ] ,
695
- max,
696
- } ,
687
+ outputs : [ { ...currentOutput , value : amount } ] ,
688
+ max,
697
689
} ) ;
698
690
699
691
return ok ( '' ) ;
@@ -747,15 +739,11 @@ export const updateMessage = async ({
747
739
if ( max ) {
748
740
_transaction . outputs = [ { address, value : inputTotal - newFee , index } ] ;
749
741
//Update the tx value with the new fee to continue sending the max amount.
750
- updateSendTransaction ( {
751
- transaction : _transaction ,
752
- } ) ;
742
+ updateSendTransaction ( _transaction ) ;
753
743
return ok ( 'Successfully updated the message.' ) ;
754
744
}
755
745
if ( totalNewAmount <= inputTotal ) {
756
- updateSendTransaction ( {
757
- transaction : _transaction ,
758
- } ) ;
746
+ updateSendTransaction ( _transaction ) ;
759
747
}
760
748
return ok ( 'Successfully updated the message.' ) ;
761
749
} ;
@@ -816,11 +804,7 @@ const runCoinSelect = async ({
816
804
fee: autoCoinSelectResponse.value.fee,
817
805
inputs: autoCoinSelectResponse.value.inputs,
818
806
};
819
- updateSendTransaction({
820
- selectedWallet,
821
- selectedNetwork,
822
- transaction: updatedTx,
823
- });
807
+ updateSendTransaction(updatedTx);
824
808
return ok('Successfully updated tx.');
825
809
}
826
810
return ok('No need to update transaction.');
@@ -913,7 +897,7 @@ export const broadcastBoost = async ({
913
897
}
914
898
const transaction = transactionDataResponse . value ;
915
899
916
- const rawTx = await createTransaction ( { } ) ;
900
+ const rawTx = await createTransaction ( ) ;
917
901
if ( rawTx . isErr ( ) ) {
918
902
return err ( rawTx . error . message ) ;
919
903
}
0 commit comments