@@ -61,6 +61,7 @@ import Cardano.Wallet.Kernel.Pending (newPending)
61
61
import Cardano.Wallet.Kernel.Read (getWalletSnapshot )
62
62
import Cardano.Wallet.Kernel.Types (AccountId (.. ),
63
63
RawResolvedTx (.. ), WalletId (.. ))
64
+ import Cardano.Wallet.Kernel.Util (shuffleNE )
64
65
import Cardano.Wallet.Kernel.Util.Core (paymentAmount , utxoBalance ,
65
66
utxoRestrictToInputs )
66
67
import Cardano.Wallet.WalletLayer.Kernel.Conv (exceptT )
@@ -198,7 +199,7 @@ newTransaction ActiveWallet{..} spendingPassword options accountId payees = runE
198
199
(WalletIdHdRnd $ accountId ^. hdAccountIdParent)
199
200
(walletPassive ^. walletKeystore)
200
201
let signAddress = mkSigner spendingPassword mbEsk snapshot
201
- mkTx = mkStdTx walletProtocolMagic signAddress
202
+ mkTx = mkStdTx walletProtocolMagic shuffleNE signAddress
202
203
203
204
txAux <- withExceptT NewTransactionErrorSignTxFailed $ ExceptT $
204
205
mkTx inputs outputs changeAddresses
@@ -208,43 +209,43 @@ newTransaction ActiveWallet{..} spendingPassword options accountId payees = runE
208
209
txMeta <- createNewMeta accountId txId inputs (toaOut <$> outputs)
209
210
return (txAux, txMeta, availableUtxo)
210
211
where
211
- -- Generate an initial seed for the random generator using the hash of
212
- -- the payees, which ensure that the coin selection (and the fee estimation)
213
- -- is \"pseudo deterministic\" and replicable.
214
- newEnvironment :: IO Env
215
- newEnvironment =
216
- let initialSeed = V. fromList . map fromIntegral
217
- . B. unpack
218
- . encodeUtf8 @ Text @ ByteString
219
- . sformat build
220
- $ hash payees
221
- in Env <$> initialize initialSeed
222
-
223
- toTxOut :: (Address , Coin ) -> TxOutAux
224
- toTxOut (a, c) = TxOutAux (TxOut a c)
225
-
226
- -- | Generates the list of change outputs from a list of change coins.
227
- genChangeOuts :: MonadIO m
228
- => [Coin ]
229
- -> ExceptT Kernel. CreateAddressError m [TxOutAux ]
230
- genChangeOuts css = forM css $ \ change -> do
231
- changeAddr <- genChangeAddr
232
- return TxOutAux {
233
- toaOut = TxOut {
234
- txOutAddress = changeAddr
235
- , txOutValue = change
236
- }
212
+ -- Generate an initial seed for the random generator using the hash of
213
+ -- the payees, which ensure that the coin selection (and the fee estimation)
214
+ -- is \"pseudo deterministic\" and replicable.
215
+ newEnvironment :: IO Env
216
+ newEnvironment =
217
+ let initialSeed = V. fromList . map fromIntegral
218
+ . B. unpack
219
+ . encodeUtf8 @ Text @ ByteString
220
+ . sformat build
221
+ $ hash payees
222
+ in Env <$> initialize initialSeed
223
+
224
+ toTxOut :: (Address , Coin ) -> TxOutAux
225
+ toTxOut (a, c) = TxOutAux (TxOut a c)
226
+
227
+ -- | Generates the list of change outputs from a list of change coins.
228
+ genChangeOuts :: MonadIO m
229
+ => [Coin ]
230
+ -> ExceptT Kernel. CreateAddressError m [TxOutAux ]
231
+ genChangeOuts css = forM css $ \ change -> do
232
+ changeAddr <- genChangeAddr
233
+ return TxOutAux {
234
+ toaOut = TxOut {
235
+ txOutAddress = changeAddr
236
+ , txOutValue = change
237
237
}
238
-
239
- -- | Monadic computation to generate a new change 'Address'. This will
240
- -- run after coin selection, when we create the final transaction as
241
- -- part of 'mkTx'.
242
- genChangeAddr :: MonadIO m
243
- => ExceptT Kernel. CreateAddressError m Address
244
- genChangeAddr = ExceptT $ liftIO $
245
- Kernel. createAddress spendingPassword
246
- (AccountIdHdRnd accountId)
247
- walletPassive
238
+ }
239
+
240
+ -- | Monadic computation to generate a new change 'Address'. This will
241
+ -- run after coin selection, when we create the final transaction as
242
+ -- part of 'mkTx'.
243
+ genChangeAddr :: MonadIO m
244
+ => ExceptT Kernel. CreateAddressError m Address
245
+ genChangeAddr = ExceptT $ liftIO $
246
+ Kernel. createAddress spendingPassword
247
+ (AccountIdHdRnd accountId)
248
+ walletPassive
248
249
249
250
createNewMeta :: HdAccountId -> TxId -> NonEmpty (TxIn , TxOutAux ) -> NonEmpty TxOut -> ExceptT NewTransactionError IO TxMeta
250
251
createNewMeta hdId txId inp out = do
0 commit comments