fix: filtering in assets endpoint & update guides #1512
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
The endpoint
/accounts/{accountId}/asset-balances
no longer returns results for specific assets which means that the array query param format?assets[]=1&assets[]=2&assets[]=3
does not work as expected.The
assets[]
array query params are also used in:/accounts/{accountId}/pool-asset-balances
and other endpoints are using array query params and are probably affected but haven't tested them:
/pallets/{palletId}/storage/{storageItemId}
/contracts/ink/{address}/query
Suggested Solution
This issue is due to the upgrade from Express v4 to v5. In order to correctly handle
[]
in query params inv5
, we need to set the default parser toextended
(related resource).Testing
Test
/accounts/{accountId}/asset-balances
in Polkadot Asset HubYou can test that this change fixes the issue when connected to Polkadot Asset Hub and querying:
accounts/13Fet2MzBBUbJ2oREa7JJrswGeJPY4p7cY3Z2MC9oash8kzN/asset-balances?assets[]=1337
It returns
which is the expected output.
Test
/accounts/{accountId}/pool-asset-balances
in Westend Asset HubYou can test that this change fixes the issue when connected to Westend Asset Hub and querying:
/accounts/5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty/pool-asset-balances?assets[]=55
It returns
which is the expected output.