Hi,I am using cardano-serialization-lib-asmjs, but I am having trouble generating transactions。
I run the following code txHex is empty:
const txBuilder = CardanoWasm.TransactionBuilder.new(
// all of these are taken from the mainnet genesis settings
CardanoWasm.LinearFee.new(CardanoWasm.BigNum.from_str('44'), CardanoWasm.BigNum.from_str('155381')),
CardanoWasm.BigNum.from_str('1000000'),
CardanoWasm.BigNum.from_str('500000000'),
CardanoWasm.BigNum.from_str('2000000')
);
const address = CardanoWasm.ByronAddress.from_base58("Ae2tdPwUPEZLs4HtbuNey7tK4hTKrwNwYtGqp7bDfCy2WdR3P6735W5Yfpe");
txBuilder.add_bootstrap_input(
address,
CardanoWasm.TransactionInput.new(
CardanoWasm.TransactionHash.from_bytes(
Buffer.from("488afed67b342d41ec08561258e210352fba2ac030c98a8199bc22ec7a27ccf1", "hex"),
),
0, // index
),
CardanoWasm.BigNum.from_str('3000000')
);
txBuilder.add_output(
CardanoWasm.TransactionOutput.new(
address.to_address(),
// we can construct BigNum (Coin) from both a js BigInt (here) or from a string (below in fee)
CardanoWasm.BigNum.from_str("1000000"),
),
);
txBuilder.set_ttl(410021);
// calculate the min fee required and send any change to an address
txBuilder.add_change_if_needed(CardanoWasm.ByronAddress.from_base58("Ae2tdPwUPEYxiWbAt3hUCJsZ9knze88qNhuTQ1MGCKqsVFo5ddNyoTDBymr").to_address())
const txBody = txBuilder.build();
const txHash = CardanoWasm.hash_transaction(txBody);
const witnesses = CardanoWasm.TransactionWitnessSet.new();
const bootstrapWitnesses = CardanoWasm.BootstrapWitnesses.new();
const bootstrapWitness = CardanoWasm.make_icarus_bootstrap_witness(txHash,address,rootKey);
bootstrapWitnesses.add(bootstrapWitness);
witnesses.set_bootstraps(bootstrapWitnesses);
const transaction = CardanoWasm.Transaction.new(
txBody,
witnesses,
undefined, // transaction metadata
);
const txHex = Buffer.from(transaction.to_bytes()).toString("hex");
console.log(txHex);