Skip to main content

Get Outputs

You can use the indexer to query for specific outputs. You can query for any output type, just change the function to the output type you need

Client in Wallet

If you are using a wallet you can always get the client by calling the client()/getClient()/get_client() method

The following code example will:

  1. Create a Client which will connect to the Shimmer Testnet.
  2. Use the created client to query for outputs with the specified parameters.
  3. Print the first output found.

Code Example

sdk/examples/how_tos/client/get_outputs.rs
loading...

Expected Output

First output of query:
ID: OutputId(0x57a796e9b8c5fc96c330fa45c2658f37d04f631eedc85d8e1e23434ca599eb8c0000)
OutputWithMetadata {
output: BasicOutput {
amount: 12310426,
native_tokens: NativeTokens(
[],
),
unlock_conditions: UnlockConditions(
[
AddressUnlockCondition(
Ed25519Address(0x7ffec9e1233204d9c6dce6812b1539ee96af691ca2e4d9065daa85907d33e5d3),
),
],
),
features: Features(
[],
),
},
metadata: OutputMetadata {
block_id: BlockId(0x2a006e26f54f1221b4fa5738bf2b3501a0a2e7085ff8dcc03d0700f75bbcc43c),
output_id: OutputId(0x57a796e9b8c5fc96c330fa45c2658f37d04f631eedc85d8e1e23434ca599eb8c0000),
is_spent: false,
milestone_index_spent: None,
milestone_timestamp_spent: None,
transaction_id_spent: None,
milestone_index_booked: 5300818,
milestone_timestamp_booked: 1684939216,
ledger_index: 5794425,
},
}