Skip to content

Instantly share code, notes, and snippets.

@cgcardona
Last active August 27, 2020 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgcardona/38a973710a2869df9c3129ac587a0ffd to your computer and use it in GitHub Desktop.
Save cgcardona/38a973710a2869df9c3129ac587a0ffd to your computer and use it in GitHub Desktop.

Here's an example of how to fetch atomic utxo.

curl --location --request POST 'http://localhost:9650/ext/P' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"platform.getUTXOs",
    "params" :{
        "addresses":["X-local18jma8ppw3nhx5r4ap8clazz0dps7rv5u00z96u"],
        "limit": 5
    }
}'

Note the path: /ext/P and also note the address prefix: X-

It returns the proper atomic utxo from the cross chain swap.

117yDurVWjehttDxhXS5c7pj94Qoet6Ufjas8MX66UZC2mVtQdDowKEb5XHrDiYp6jofnoLmgGEvpBapXmksNHvXsExzHt5PngFqKL1nTV1DDgeTUWvNqXGzXp7TLMweXDVWMDFKMASy36bwsPWtZ1ehWpPxWH85Eo8tKf

When decoded from CB58 to hex and decomposed you get

* codec_id: 00 00
* tx_id: 32 47 cf 95 af d9 76 32 34 7a 3c 0e c9 68 79 b6 77 3d 3f db 34 41 c9 8f ec 9b 8d d2 d5 52 ed 78
* output_index: 00 00 00 01
* asset_id: 39 c3 3a 49 9c e4 c3 3a 3b 09 cd d2 cf a0 1a e7 0d bf 2d 18 b2 d7 d1 68 52 44 40 e5 5d 55 00 88
* secp_xfer_output
* output_id: 00 00 00 07
* amount: 00 00 00 00 00 00 d4 31
* locktime: 00 00 00 00 00 00 00 00
* threshold: 00 00 00 01
* addresses[]
* num_addresses: 00 00 00 01
  * addresses[0]: 3c b7 d3 84 2e 8c ee 6a 0e bd 09 f1 fe 88 4f 68 61 e1 b2 9c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment