Check Unlock Conditions
Outputs may have multiple UnlockConditions, which may require returning some or all of the transferred amount. The outputs could also expire if not claimed in time, or may not be unlockable for a predefined period.
Code Example
The following example will:
- Create an account manager.
- Get Alice's account which was created in the first guide.
- Check if an output has only an address unlock condition and that the address is from the account.
- Rust
- Nodejs
- Python
- Java
Dotenv
This example uses dotenv, which is not safe for use in production environments.
wallet/examples/17_check_unlock_conditions.rs
loading...
Run the example by running the following command:
cargo run --example check_unlock_conditions --release
wallet/bindings/nodejs/examples/36-check-unlock-conditions.js
loading...
You can run the example by running the following command from the wallet/bindings/nodejs/examples/
folder:
node 36-check-unlock-conditions.js
wallet/bindings/python/examples/13-check-unlock-conditions.py
loading...
You can run the example by running the following command from the binding/python/examples
folder:
python3 13-check-unlock-conditions.py
wallet/bindings/java/examples/src/CheckUnlockConditions.java
loading...
You can run the example by running the following command from the wallet/bindings/java/
folder:
./gradlew run -Pexample=CheckUnlockConditions
Expected Output
- Rust
- Nodejs
- Python
- Java
The output has only an address unlock condition and the address is from the account: true
The output has only an address unlock condition and the address is from the account: true
The output has only an address unlock condition and the address is from the account: True
The output has only an address unlock condition and the address is from the account: true