Skip to content

Commit

Permalink
fix: use latest protocolParameters inside closure
Browse files Browse the repository at this point in the history
  • Loading branch information
renanvalentin committed Mar 4, 2024
1 parent 9f9ac1c commit a47000b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/ui/app/pages/send.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ const Send = () => {
const _value = data.value;
const _address = data.address;
const _message = data.message;
const protocolParameters = data.protocolParameters;
if (!_value.ada && _value.assets.length <= 0) {
setFee({ fee: '0' });
setTx(null);
Expand Down Expand Up @@ -256,11 +257,10 @@ const Send = () => {
),
await assetsToValue(output.amount)
);

const minAda = await minAdaRequired(
checkOutput,
Loader.Cardano.BigNum.from_str(
txInfo.protocolParameters.coinsPerUtxoWord
)
Loader.Cardano.BigNum.from_str(protocolParameters.coinsPerUtxoWord)
);

if (BigInt(minAda) <= BigInt(toUnit(_value.personalAda || '0'))) {
Expand Down Expand Up @@ -348,14 +348,13 @@ const Send = () => {
account.current,
utxos.current,
outputs,
txInfo.protocolParameters,
protocolParameters,
auxiliaryData.metadata() ? auxiliaryData : null
);
setFee({ fee: tx.body().fee().to_str() });
setTx(Buffer.from(tx.to_bytes()).toString('hex'));
} catch (e) {
setFee({ error: 'Transaction not possible' });
throw ERROR.txNotPossible;
}
};

Expand Down Expand Up @@ -433,7 +432,12 @@ const Send = () => {
if (txInfo.protocolParameters) {
setTx(null);
setFee({ fee: '' });
prepareTxDebounced(0, { value, address, message });
prepareTxDebounced(0, {
value,
address,
message,
protocolParameters: txInfo.protocolParameters,
});
}
}, [txUpdate]);

Expand Down

0 comments on commit a47000b

Please sign in to comment.