Skip to main content

Build a Basic Output

You can build a simple output using the Client.buildBasicOutput(options) function.

The following code example will:

  1. Create a Client which will connect to the Shimmer Testnet.
  2. Create a SecretManager from a mnemonic.
  3. Generate a public address.
  4. Build a simple output.

Code Example

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

Expected Output

[
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([]),
),
},
),
]