@@ -25,17 +25,19 @@ Fees are automatically calculated and sent to a change address in the example.
2525
2626``` javascript
2727// instantiate the tx builder with the Cardano protocol parameters - these may change later on
28- const txBuilder = CardanoWasm .TransactionBuilder .new (
29- // all of these are taken from the mainnet genesis settings
30- // linear fee parameters (a*size + b)
31- CardanoWasm .LinearFee .new (CardanoWasm .BigNum .from_str (' 44' ), CardanoWasm .BigNum .from_str (' 155381' )),
32- // minimum utxo value
33- CardanoWasm .BigNum .from_str (' 1000000' ),
34- // pool deposit
35- CardanoWasm .BigNum .from_str (' 500000000' ),
36- // key deposit
37- CardanoWasm .BigNum .from_str (' 2000000' )
28+ const linearFee = CardanoWasm .LinearFee .new (
29+ CardanoWasm .BigNum .from_str (' 44' ),
30+ CardanoWasm .BigNum .from_str (' 155381' )
3831);
32+ const txBuilderCfg = CardanoWasm .TransactionBuilderConfigBuilder .new ()
33+ .fee_algo (linearFee)
34+ .pool_deposit (CardanoWasm .BigNum .from_str (' 500000000' ))
35+ .key_deposit (CardanoWasm .BigNum .from_str (' 2000000' ))
36+ .max_value_size (4000 )
37+ .max_tx_size (8000 )
38+ .coins_per_utxo_word (CardanoWasm .BigNum .from_str (' 34482' ))
39+ .build ();
40+ const txBuilder = CardanoWasm .TransactionBuilder .new (txBuilderCfg);
3941
4042// add a keyhash input - for ADA held in a Shelley-era normal address (Base, Enterprise, Pointer)
4143const prvKey = CardanoWasm .PrivateKey .from_bech32 (" ed25519e_sk16rl5fqqf4mg27syjzjrq8h3vq44jnnv52mvyzdttldszjj7a64xtmjwgjtfy25lu0xmv40306lj9pcqpa6slry9eh3mtlqvfjz93vuq0grl80" );
@@ -80,22 +82,27 @@ txBuilder.add_output(
8082txBuilder .set_ttl (410021 );
8183
8284// calculate the min fee required and send any change to an address
83- txBuilder .add_change_if_needed (shelleyChangeAddress)
85+ txBuilder .add_change_if_needed (shelleyChangeAddress);
8486
8587// once the transaction is ready, we build it to get the tx body without witnesses
8688const txBody = txBuilder .build ();
8789const txHash = CardanoWasm .hash_transaction (txBody);
8890const witnesses = CardanoWasm .TransactionWitnessSet .new ();
8991
9092// add keyhash witnesses
91- const vkeyWitnesses = CardanoWasm .VkeyWitnesses .new ();
93+ const vkeyWitnesses = CardanoWasm .Vkeywitnesses .new ();
9294const vkeyWitness = CardanoWasm .make_vkey_witness (txHash, prvKey);
9395vkeyWitnesses .add (vkeyWitness);
9496witnesses .set_vkeys (vkeyWitnesses);
9597
9698// add bootstrap (Byron-era) witnesses
99+ const cip1852Account = CardanoWasm .Bip32PrivateKey .from_bech32 (' xprv1hretan5mml3tq2p0twkhq4tz4jvka7m2l94kfr6yghkyfar6m9wppc7h9unw6p65y23kakzct3695rs32z7vaw3r2lg9scmfj8ec5du3ufydu5yuquxcz24jlkjhsc9vsa4ufzge9s00fn398svhacse5su2awrw' );
97100const bootstrapWitnesses = CardanoWasm .BootstrapWitnesses .new ();
98- const bootstrapWitness = CardanoWasm .make_icarus_bootstrap_witness (txHash,byronAddress,getCip1852Account ());
101+ const bootstrapWitness = CardanoWasm .make_icarus_bootstrap_witness (
102+ txHash,
103+ byronAddress,
104+ cip1852Account,
105+ );
99106bootstrapWitnesses .add (bootstrapWitness);
100107witnesses .set_bootstraps (bootstrapWitnesses);
101108
0 commit comments