Skip to content

feat: add asset-conversion endpoints #1324

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

Merged
merged 9 commits into from
Sep 1, 2023
Merged

Conversation

bee344
Copy link
Contributor

@bee344 bee344 commented Aug 25, 2023

Closes issue #1308

Description

Adds the endpoints /pallets/asset-conversion/liquidity-pools which returns an array of the existing liquidity pool tokens, and /pallets/asset-conversion/next-available-id which returns a string of the next available liquidity pool's id.

Query Params

at: Which block to query, defaults to latest finalized block if empty. Accepts a hash or a block number.

Sample Response

While connected to Westend Assst Hub and requesting /pallets/liquidity-pools, the return result is/should be simmilar to the following :

{
   "at":{
      "hash":"0xd712c01e62c4ec702c4b56e01cbbfd1b20e9008b18f4ebee6b1d854e26a8fd82",
      "height":"91"
   },
   "pools":[
      {
         "reserves":[
            {
               "parents":"1",
               "interior":{
                  "here":null
               }
            },
            {
               "parents":"0",
               "interior":{
                  "x2":[
                     {
                        "palletInstance":"50"
                     },
                     {
                        "generalIndex":"2"
                     }
                  ]
               }
            }
         ],
         "lpToken":{
            "lpToken":"1"
         }
      },
      {
         "reserves":[
            {
               "parents":"1",
               "interior":{
                  "here":null
               }
            },
            {
               "parents":"0",
               "interior":{
                  "x2":[
                     {
                        "palletInstance":"50"
                     },
                     {
                        "generalIndex":"1"
                     }
                  ]
               }
            }
         ],
         "lpToken":{
            "lpToken":"0"
         }
      }
   ]
}

While connected to Westend Asset Hub and requesting /pallets/next-available-id, the return result is/should be the following :

{
   "at":{
      "hash":"0xedb8792b4cd1ed8a8d5638e2fa5c7739cb4f4d93a68b20d5facc4888d2753131",
      "height":"736"
   },
   "id":"2"
}

TODO

  • Add tests

@bee344 bee344 changed the title WIP (feat) add asset-conversion endpoints (feat) add asset-conversion endpoints Aug 25, 2023
@TarikGul TarikGul changed the title (feat) add asset-conversion endpoints feat: add asset-conversion endpoints Aug 25, 2023
@bee344 bee344 marked this pull request as ready for review September 1, 2023 11:46
@bee344 bee344 requested a review from a team as a code owner September 1, 2023 11:46
Copy link
Member

@TarikGul TarikGul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, really great job, just a few nits to resolve!

Copy link
Contributor

@marshacb marshacb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome PR! A very small nit/question. Once any lingering merge conflicts are handled looks good to go :)

@TarikGul
Copy link
Member

TarikGul commented Sep 1, 2023

In terms of the failing docker check in gitlab, I think its not relevant to your PR but a version of buildah.

@bee344 bee344 merged commit 242aa09 into master Sep 1, 2023
@bee344 bee344 deleted the anp-asset-conversion-endpoint branch September 1, 2023 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants