Skip to main content

Advanced Transaction

If you need more advanced features or unlock conditions in your transaction this guide will show you how to send custom outputs. You can use the related How-To guides to learn more about crating custom outputs with specific unlock conditions and features.

Online Faucet

You can request test funds from the Shimmer Testnet Faucet.

Example Code

The following example will:

  1. Instantiate a Wallet, get Alice's Account which was created in the first guide and sync it.
  2. Create a BasicOutput that is time-locked for one hour by calling the BasicOutputBuilder() function and passing the AddressUnlockCondition and the TimelockUnlockCondition in as unlockConditions to the BasicOutputBuilder() by chaining calls to the BasicOutputBuilder.add_unlock_condition()
sdk/examples/how_tos/advanced_transactions/advanced_transaction.rs
loading...
  1. Send the BasicOutput created in the previous step by calling the 'Account.send_outputs()' function.
sdk/examples/how_tos/advanced_transactions/advanced_transaction.rs
loading...
  1. Await for the Transaction to get confirmed by calling the 'Account.retryTransactionUntilIncluded' function.
sdk/examples/how_tos/advanced_transactions/advanced_transaction.rs
loading...

Full Example Code

sdk/examples/how_tos/advanced_transactions/advanced_transaction.rs
loading...

Expected Output

Transaction sent: 0x1f9bf3dd9e6c8cae9b23e3f2d4af4039518894b1dc4b605e41aea94fe93c995d
Block sent: https://explorer.shimmer.network/testnet/block/0x14fdeb191112e222e60cd18eecf803797013587b1e7c2f38f5075ba87b3a69b3