-
Notifications
You must be signed in to change notification settings - Fork 159
feat: add pool-assets endpoints #1338
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
Conversation
/** | ||
* @param keys Extract `assetId`s from an array of storage keys | ||
*/ | ||
extractPoolAssetIds(keys: StorageKey<[AssetId]>[]): AssetId[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for the sake of consistency lets make this a private
function as well.
): Promise<void> => { | ||
const hash = await this.getHashFromAt(at); | ||
|
||
const assetsSplit = (assets as string)?.split(',') || []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So my only concern with this is it's not following Express convention of dealing with query params as an array, and will add two different ways to within sidecar to add the query param. I think for this we should stick to the conventional method of using expresses built in format.
docs/src/openapi-v1.yaml
Outdated
format: unsignedInteger or $hex | ||
- name: assets | ||
in: query | ||
description: A list of comma separated AssetId's to be queried. If not supplied, defaults to providing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the comment about changing the query param structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, amazing job! I do think we should change the one format to fit within expresses supported structure for array query params.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome PR! LGTM
Description
Relates to: 1323
Adding the following endpoints :
/pallets/pool-assets/{assetId}/asset-info
/accounts/{accountId}/pool-asset-balances
/accounts/{accountId}/pool-asset-approvals
Query Parameters per Endpoint
For the endpoint
/pallets/pool-assets/assetId/asset-info
at
: Which block to query, it will default to the latest finalized block. Accepts a hash or blocknumber.For the endpoint
/accounts/{accountId}/pool-asset-balances
at
: same as above.assets
: it accepts anassetId
or an array ofassetId
's, e.g.?assets[]=1&assets[]=2&assets[]=3
.For the endpoint
/accounts/{accountId}/pool-asset-approvals
at
: same as above.delegate
: the delegate account associated with theApprovalKey
which is tied to aApproval
.assetId
: The assetId associated with theAssetApproval
e.g.assets=id1
Sample Response per Endpoint
Request
http://127.0.0.1:8080/pallets/pool-assets/32/asset-info
Response
Request
http://127.0.0.1:8080/accounts/5EiTAQ4cPoLTvwL6DE5BFSvKuwegjGwYGef1Mn6iwZTqBos9/pool-asset-balances
Response
Request
http://127.0.0.1:8080/accounts/5EiTAQ4cPoLTvwL6DE5BFSvKuwegjGwYGef1Mn6iwZTqBos9/pool-asset-balances?assets[]=4&assets[]=21
Response
Request
http://127.0.0.1:8080/accounts/5D8Rj3PcZaTDETw2tK67APJVXEubgo7du83kaFXvju3ASToj/pool-asset-approvals?assetId=123&delegate=5FgrRXw3KjHaUY1PogXXdtnnYvgVG7pEML7mAdvqa4EFmqex
Response
Additional Fixes
AccountsAssetsController
so it is aligned with the endpoint name..spec
file ofAsset-Conversion
so it is aligned with the naming in the two other mock api files.PalletsAssetsService
test since inAssetInfo
we receivestatus: 'Live'
instead ofisFrozen
rococoRegistry
with theKusamaAssetHubRegistry
AssetDetails
) forAssetInfo
in MockAssetData withPalletAssetsAssetDetails
(checked withtoRawType()
).isFrozen
withStatus
in theforeignAssetInfo***
(mockAssetHubKusamaData
file)Todos
balances
andapprovals
asset-info
assetHubWestendControllers