Build a Basic Output
You can build a simple output using the Client.buildBasicOutput(options)
function.
The following code example will:
- Create a
Client
which will connect to the Shimmer Testnet. - Create a
SecretManager
from a mnemonic. - Generate a public address.
- Build a simple output.
Code Example
- Rust
- Nodejs
- Python
- Java
Dotenv
This example uses dotenv, which is not safe to use in production environments.
client/examples/output/basic.rs
loading...
Run the Example
Run the example by running the following command:
cargo run --example basic --release
Dotenv
This example uses dotenv, which is not safe to use in production environments.
client/bindings/nodejs/examples/11_build_output.ts
loading...
You can run the example by running the following command from the bindings/node/examples/
folder:
node dist/11_build_output.js
client/bindings/python/examples/11_build_output.py
loading...
You can run the example by running the following command from the binding/python/examples
folder:
python3 11_build_output.py
client/bindings/java/examples/src/BuildBasicOutput.java
loading...
Expected Output
- Rust
- Nodejs
- Python
- Java
[
Basic(
BasicOutput {
amount: 1000000,
native_tokens: NativeTokens(
BoxedSlicePrefix([]),
),
unlock_conditions: UnlockConditions(
BoxedSlicePrefix([
Address(
AddressUnlockCondition(
Ed25519(
Ed25519Address(0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3),
),
),
),
]),
),
features: Features(
BoxedSlicePrefix([]),
),
},
),
Basic(
BasicOutput {
amount: 1000000,
native_tokens: NativeTokens(
BoxedSlicePrefix([]),
),
unlock_conditions: UnlockConditions(
BoxedSlicePrefix([
Address(
AddressUnlockCondition(
Ed25519(
Ed25519Address(0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3),
),
),
),
]),
),
features: Features(
BoxedSlicePrefix([
Metadata(
MetadataFeature(0x48656c6c6f2c20576f726c6421),
),
]),
),
},
),
Basic(
BasicOutput {
amount: 1000000,
native_tokens: NativeTokens(
BoxedSlicePrefix([]),
),
unlock_conditions: UnlockConditions(
BoxedSlicePrefix([
Address(
AddressUnlockCondition(
Ed25519(
Ed25519Address(0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3),
),
),
),
StorageDepositReturn(
StorageDepositReturnUnlockCondition {
return_address: Ed25519(
Ed25519Address(0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3),
),
amount: 1000000,
},
),
]),
),
features: Features(
BoxedSlicePrefix([]),
),
},
),
Basic(
BasicOutput {
amount: 1000000,
native_tokens: NativeTokens(
BoxedSlicePrefix([]),
),
unlock_conditions: UnlockConditions(
BoxedSlicePrefix([
Address(
AddressUnlockCondition(
Ed25519(
Ed25519Address(0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3),
),
),
),
Expiration(
ExpirationUnlockCondition {
return_address: Ed25519(
Ed25519Address(0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3),
),
timestamp: 1,
},
),
]),
),
features: Features(
BoxedSlicePrefix([]),
),
},
),
Basic(
BasicOutput {
amount: 1000000,
native_tokens: NativeTokens(
BoxedSlicePrefix([]),
),
unlock_conditions: UnlockConditions(
BoxedSlicePrefix([
Address(
AddressUnlockCondition(
Ed25519(
Ed25519Address(0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3),
),
),
),
Timelock(
TimelockUnlockCondition(
1,
),
),
]),
),
features: Features(
BoxedSlicePrefix([]),
),
},
),
]
{
"type": 3,
"amount": "1000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
}
]
}
{
"type": 3,
"amount": "1000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
}
],
"features": [
{
"type": 2,
"data": "0x48656c6c6f2c20576f726c6421"
}
]
}
{
"type": 3,
"amount": "1000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
},
{
"type": 1,
"returnAddress": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
},
"amount": "1000000"
}
]
}
{
"type": 3,
"amount": "1000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
},
{
"type": 3,
"returnAddress": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
},
"unixTime": 1
}
]
}
{
"type": 3,
"amount": "1000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
},
{
"type": 2,
"unixTime": 1
}
]
}
{
"type": 3,
"amount": "1000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
}
]
}
{
"type": 3,
"amount": "1000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
}
],
"features": [
{
"type": 2,
"data": "0x48656c6c6f2c20576f726c6421"
}
]
}
{
"type": 3,
"amount": "1000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
},
{
"type": 1,
"returnAddress": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
},
"amount": "1000000"
}
]
}
{
"type": 3,
"amount": "1000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
},
{
"type": 3,
"returnAddress": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
},
"unixTime": 1
}
]
}
{
"type": 3,
"amount": "1000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
},
{
"type": 2,
"unixTime": 1
}
]
}
{
"type": 3,
"amount": "1000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
}
]
}
{
"type": 3,
"amount": "1000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
}
],
"features": [
{
"type": 2,
"data": "0x48656c6c6f2c20576f726c6421"
}
]
}
{
"type": 3,
"amount": "1000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
},
{
"type": 1,
"returnAddress": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
},
"amount": "1000000"
}
]
}
{
"type": 3,
"amount": "1000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
},
{
"type": 3,
"returnAddress": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
},
"unixTime": 1
}
]
}
{
"type": 3,
"amount": "1000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3"
}
},
{
"type": 2,
"unixTime": 1
}
]
}