Skip to content
Unverified Commit ef513cc7 authored by Dominique's avatar Dominique Committed by GitHub
Browse files

feat: Added the `network` and `accountId` to the response of `validate` endpoint (#926)

* Added networkName in the response of validate address endpoint

* Added the 'accountId' in the endpoint response
- If the address given is not a hex value then it returns the hex value of the related registry type
- If the address given is a hex value then it returns the same as the 'accountId'
- The tests were updated based on this logic

* Changes in `validateAddress` function, tests & docs
- Replaced `filter` with a `for..of` loop when retrieving the `network`.
- Replaced `new TypeRegistry` with `this.api.registry` when retrieving the `accountID`.
- Renamed `networkName` to `network` so it is aligned with the key naming in the SS58 registry.
- Updated the JSDocs of the function `validateAddress`.
- Added the default mock api into the service in the tests.
- Updated the docs.

* Code changes & built docs
- Changes in code based on Tarik's feedback.
- Run `yarn build:docs`.

* Removed unnecessary variable

* Fix for accountId & corresponding tests
- Fix for accountId when the input from user is an address in hex (from u8 array) format.
- Corrected the output of the corresponding tests also.

* Returns  in all other fields if isValid is false

* Code changes based on James feedback

* yarn lint
parent 0dd3f633
Pipeline #201390 passed with stages
in 18 minutes and 18 seconds