0

I managed to get this data:

  type: 3,
  amount: '100000000',
  nativeTokens: [
    {
      id: '0x083602db4cde74f1f3cf3945913bc7bc8e1a2fafd70c7e2895d034d68efe128d5f0200000000',
      amount: '0x13'
    }
  ],
  unlockConditions: [ { type: 0, address: [Object] } ]
{
  blockId: '0x9e43c212ca59b140a54fd4aaac5839a80fc6d3bb788336c344f16c908e425d52',
  transactionId: '0x8b736561d4f754a6ddba596622edaf10a9717ae93caac7346a1ea481eacf023e',
  outputIndex: 1,
  isSpent: false,
  milestoneIndexBooked: 8650978,
  milestoneTimestampBooked: 1709285153,
  ledgerIndex: 8651486
} 

using this code:

const addresses = ['smr1qrxvwfyh767huxrq2y3e4wqpfnr33ph92e6hclgyhytatj0y6dnmcy0cnn2']

        const outputIdsResponse = await client.basicOutputIds([
            { address: addresses[0] }
        ]
        );

        // Get outputs by their IDs
        const addressOutputs = await client.getOutputs(outputIdsResponse.items);

        for (const outputResponse of addressOutputs) {
            const output = outputResponse['output'];
            const metadata = outputResponse['metadata'];
            console.log(output)
            console.log(metadata)
        } 

How do I get transaction metadata?

1
  • It might be helpful to describe what data you are after. Do you want to have the token definition JSON of the native token you got 0x13 of (in which case you can convert the token id to the owning foundry id and query its foundry outputs)? Or do you want to have the metadata of the block that contains the transaction (i.e. the source and destination addresses that resulted in your output) in which case you can take the block ID and call getBlock and/or getBlockMetadata.
    – mihi
    Mar 1 at 22:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.