Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(domains.service): remove addressOf from owner param
Previous `parseDid` function returned address if it was just an address. However, I think that was confusing behaviour It's better to validate that param is an address
- Loading branch information
Showing
15 changed files
with
186 additions
and
9 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...api/classes/errors_ENSOwnerNotValidAddressError.ENSOwnerNotValidAddressError.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Class: ENSOwnerNotValidAddressError | ||
|
||
[errors/ENSOwnerNotValidAddressError](../modules/errors_ENSOwnerNotValidAddressError.md).ENSOwnerNotValidAddressError | ||
|
||
## Hierarchy | ||
|
||
- `Error` | ||
|
||
↳ **`ENSOwnerNotValidAddressError`** | ||
|
||
## Table of contents | ||
|
||
### Constructors | ||
|
||
- [constructor](errors_ENSOwnerNotValidAddressError.ENSOwnerNotValidAddressError.md#constructor) | ||
|
||
## Constructors | ||
|
||
### constructor | ||
|
||
• **new ENSOwnerNotValidAddressError**(`providedOwner`) | ||
|
||
#### Parameters | ||
|
||
| Name | Type | | ||
| :------ | :------ | | ||
| `providedOwner` | `string` | | ||
|
||
#### Overrides | ||
|
||
Error.constructor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Module: errors/ENSOwnerNotValidAddressError | ||
|
||
## Table of contents | ||
|
||
### Classes | ||
|
||
- [ENSOwnerNotValidAddressError](../classes/errors_ENSOwnerNotValidAddressError.ENSOwnerNotValidAddressError.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Module: utils/address | ||
|
||
## Table of contents | ||
|
||
### Functions | ||
|
||
- [validateAddress](utils_address.md#validateaddress) | ||
|
||
## Functions | ||
|
||
### validateAddress | ||
|
||
▸ **validateAddress**(`address`): `void` | ||
|
||
Validate that address is valid ethereum address. | ||
Expect that error is thrown if not | ||
Uses ethers function but encapsulates to be able to swap in the future: | ||
https://docs.ethers.io/v5/api/utils/address/#utils-getAddress | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| :------ | :------ | :------ | | ||
| `address` | `string` | address to verify | | ||
|
||
#### Returns | ||
|
||
`void` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { ERROR_MESSAGES } from "./ErrorMessages"; | ||
|
||
export class ENSOwnerNotValidAddressError extends Error { | ||
constructor(providedOwner: string) { | ||
super(`Provided owner param: ${providedOwner}. ${ERROR_MESSAGES.ENS_OWNER_NOT_VALID_ADDRESS}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { utils } from "ethers"; | ||
|
||
/** | ||
* Validate that address is valid ethereum address. | ||
* Expect that error is thrown if not | ||
* Uses ethers function but encapsulates to be able to swap in the future: | ||
* https://docs.ethers.io/v5/api/utils/address/#utils-getAddress | ||
* @param address address to verify | ||
*/ | ||
export function validateAddress(address: string) { | ||
utils.getAddress(address); | ||
} |