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
- Rust
- Typescript (Node.js)
- Python
The following example will:
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Create a
BasicOutput
that is time-locked for one hour by calling theBasicOutputBuilder()
function and passing theAddressUnlockCondition
and theTimelockUnlockCondition
in asunlockConditions
to theBasicOutputBuilder()
by chaining calls to theBasicOutputBuilder.add_unlock_condition()
- Send the
BasicOutput
created in the previous step by calling the 'Account.send_outputs()' function.
- Await for the
Transaction
to get confirmed by calling the 'Account.retryTransactionUntilIncluded' function.
The following example will:
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Create a
BasicOutput
that is time-locked for one hour by calling theClient.buildBasicOutput()
function and passing theAddressUnlockCondition
and theTimelockUnlockCondition
in asunlockConditions
to theClient
.
- Send the
Output
created in the previous step by calling the 'Account.sendOutputs()' function.
- Await for the
Transaction
to get confirmed by calling the 'Account.retryTransactionUntilIncluded' function.
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Create a
BasicOutput
that is time-locked for one hour by calling theClient.build_basic_output()
function and passing theAddressUnlockCondition
and theTimelockUnlockCondition
in asUnlockConditions
to theClient
.
- Send the
Output
created in the previous step by calling the 'Account.send_outputs()' function.
- Await for the
Transaction
to get confirmed by calling the 'Account.retry_transaction_until_included' function.
Full Example Code
- Rust
- Typescript (Node.js)
- Python
sdk/examples/how_tos/advanced_transactions/advanced_transaction.rs
loading...
bindings/nodejs/examples/how_tos/advanced_transactions/advanced_transaction.ts
loading...
bindings/python/examples/how_tos/advanced_transactions/advanced_transaction.py
loading...
Expected Output
Transaction sent: 0x1f9bf3dd9e6c8cae9b23e3f2d4af4039518894b1dc4b605e41aea94fe93c995d
Block sent: https://explorer.shimmer.network/testnet/block/0x14fdeb191112e222e60cd18eecf803797013587b1e7c2f38f5075ba87b3a69b3