Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft: adding handler to return all assets of an account #5290

Closed
wants to merge 3 commits into from

Conversation

barnjamin
Copy link
Contributor

@barnjamin barnjamin commented Apr 10, 2023

Summary

A half attempt at an endpoint to support

#5250

Mostly because I was curious about what it would take and to serve as a subject for discussion

If we were to pursue this approach we'd probably want to at least

  1. remove the /0 in the path so that the endpoint is just /v2/accounts/{address}/assets
  2. tweak the returned data to have a more appropriate wrapper type

If performance of this endpoint is a concern, we could add it to one of the flagged off set of handlers

Test Plan

copied the bin into my sandbox and ran a curl

curl localhost:4001/v2/accounts/AZRSDXCKQIUKIEEFF7FMF43ZNTFWCYONKAI3SXX5GRVPURLMTXI2OVSKUY/assets/0  -H "X-Algo-API-Token: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

returns

[
  {
    "asset-holding": {
      "amount": 10,
      "asset-id": 220,
      "is-frozen": false
    },
    "created-asset": {
      "clawback": "R2MEJY67MKV6JDO7L6HXXONDGQPQJLXL6PSWZONO67ZAC76QTHSIZ54NHI",
      "creator": "AZRSDXCKQIUKIEEFF7FMF43ZNTFWCYONKAI3SXX5GRVPURLMTXI2OVSKUY",
      "decimals": 0,
      "default-frozen": false,
      "freeze": "R2MEJY67MKV6JDO7L6HXXONDGQPQJLXL6PSWZONO67ZAC76QTHSIZ54NHI",
      "manager": "R2MEJY67MKV6JDO7L6HXXONDGQPQJLXL6PSWZONO67ZAC76QTHSIZ54NHI",
      "name": "lol",
      "name-b64": "bG9s",
      "reserve": "R2MEJY67MKV6JDO7L6HXXONDGQPQJLXL6PSWZONO67ZAC76QTHSIZ54NHI",
      "total": 10000
    },
    "round": 0
  },
  {
    "asset-holding": {
      "amount": 10,
      "asset-id": 223,
      "is-frozen": false
    },
    "created-asset": {
      "clawback": "R2MEJY67MKV6JDO7L6HXXONDGQPQJLXL6PSWZONO67ZAC76QTHSIZ54NHI",
      "creator": "AZRSDXCKQIUKIEEFF7FMF43ZNTFWCYONKAI3SXX5GRVPURLMTXI2OVSKUY",
      "decimals": 0,
      "default-frozen": false,
      "freeze": "R2MEJY67MKV6JDO7L6HXXONDGQPQJLXL6PSWZONO67ZAC76QTHSIZ54NHI",
      "manager": "R2MEJY67MKV6JDO7L6HXXONDGQPQJLXL6PSWZONO67ZAC76QTHSIZ54NHI",
      "name": "lmao",
      "name-b64": "bG1hbw==",
      "reserve": "R2MEJY67MKV6JDO7L6HXXONDGQPQJLXL6PSWZONO67ZAC76QTHSIZ54NHI",
      "total": 10000
    },
    "round": 0
  }
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant