Unverified Commit 450c6ead authored by Dominique's avatar Dominique Committed by GitHub
Browse files

feat: add pallets/foreign-assets endpoint (#1314)



* feat: add pallets/foreign-assets endpoint
- add controller, service & reponse type for foreign assets
- update chain-config
- update docs

* fix: remove `asset-info` from endpoint & fix docs
- In /pallets/foreign-assets/ endpoint removed `asset-info` since it is not necessary.
- In the docs removed the array notation from the `200` response of multiple endpoints (including foreign assets) since there is no outer array in the result.

* add name & symbol in human readable format
- Added in the response the asset's name & symbol in human readable format.

* Refactored the code that retrieves the metadata of the foreign asset
- Retrieved metadata based on MultiLocation key obtained by asset info entries
- Changed types in IForeignAssetInfo

* test: added test & mock data
- Added a test (tinkernet) for foreign asset
- Added metadata & registry for Asset Hub Kusama

* Update src/services/pallets/PalletsForeignAssetsService.ts

Co-authored-by: default avatarTarik Gul <[email protected]>

* Update src/services/pallets/PalletsForeignAssetsService.ts

Co-authored-by: default avatarTarik Gul <[email protected]>

* Update src/services/pallets/PalletsForeignAssetsService.ts

Co-authored-by: default avatarTarik Gul <[email protected]>

* Update src/services/pallets/PalletsForeignAssetsService.ts

Co-authored-by: default avatarTarik Gul <[email protected]>

* Update src/services/pallets/PalletsForeignAssetsService.ts

Co-authored-by: default avatarTarik Gul <[email protected]>

* replaced type anyjson with codec

* changed types in assetInfo & assetMetadata & copyright
- Replaced types to avoid type casts based on Tarik's suggestion
- Added the copyright in some files that was missing
- Updated the copyright year in some of the files

* removed storageKeyMultilocation & changed storageKey
- Changed the copyright year in the files related to this PR

* fix: changes to support a list of multiple foreign assets

* Updated test to work with multiple foreign assets
- Added the DOT asset in the test file (.spec)
- Added the AssetInfo and AssetMetadata for the DOT asset in the mock data (metadata currently have empty & zero values because those are the values in Asset Hub right now - to be changed)
- Added again the storageKeyMultilocation in TypeFactory since indexType is not included in InterfaceTypes (as defined in storageKey)

* Changes types of foreignAssetInfo and foreignAssetMetadata
- Replaced PalletAssetsAssetMetadata with AssetMetadata
- Removed also Option from assetMetadata

* fix typing on queried values, and return values

* fix test

* removed an unnecessary console.log

---------

Co-authored-by: default avatarTarik Gul <[email protected]>
Co-authored-by: default avatartarikgul <[email protected]>
parent 899b26fb
Pipeline #388419 passed with stages
in 37 minutes and 54 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment