-
Notifications
You must be signed in to change notification settings - Fork 157
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
feat: assets endpoints #533
Conversation
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.
Looks good! I just have one suggestion for how to change the api for fetchAssetApproval
that I think will improve readability of the None
response. (And tiny recs in docs)
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.
lgtm, modulo nitpicks.
* Note: It borrows some variables used in the parachains constant section | ||
* | ||
* Used in `/assets` and `/accounts` endpoints | ||
*/ |
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.
I'm fine either way but I don't mind long test files generally. They are typically not read top to bottom anyway?
Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>
This PR is ready to merge. Just manually tested against Statemint today again. In return we found out the version of polkadot needed to be updated in order to resolve a few more types. I also changed all the |
Assets Endpoints
closes: #491
closes: #545
GET assets/{assetId}/asset-info
Associated Controller:
AssetsController
Associated Service:
AssetsService
Response:
AssetInfo(AssetDetails): substrate ref | polkadot-js ref
AssetMetaData: substrate ref | polkadot-js ref
GET accounts/{accountId}/asset-balances?assets=assetId
Notes:
Originally per the issue filed above, there were two different proposed responses depending on whether an
assetId
is provided as a parameter. I changed it slightly to always have one type of response. The only difference is when a assetId is provided theassets
array that is returned will only have the values provided in the query param. This choice was made to simplify return values for the end user. Happy to change this or discuss suggestions.assetId
query parameter is treated as an array. It is formatted as such:assetId=id1,id2,id3
Associated Controller:
AccountsAssetsController
Associated Service:
AccountsAssetsService
Response:
AssetBalance: substrate ref | polkadot-js ref
GET accounts/{accountId}/asset-approvals?assetId=assetId&delegate=accountId
Note: Both a
delegate
andassetId
are required for this endpoint. Theowner
=>accoundId
and thedelegate
can be referred to as theAssetApprovalKey
in polkadot-js orApprovalKey
in substrate.Associated Controller:
AccountsAssetsController
Associated Service:
AccountsAssetsService
Response:
AssetApproval: substrate ref | polkadot-js
AssetApprovalKey: substrate ref | polkadot-js
TODO's
assets/:assetId/asset-info
accounts/:address/asset-balances
accounts/:address/asset-balances?assets[]=10&assets[]=1
accounts/:address/asset-approvals
(Fails correctly, this is subject to change)(delegate
, andassetId
might be part of the path)accounts/:address/asset-approvals?assetId=assetId&delegate=delegateId
Other
assets
methods inside of testing.