-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(utils): add address and address payload validators
- Loading branch information
Showing
8 changed files
with
124 additions
and
13 deletions.
There are no files selected for viewing
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
5 changes: 0 additions & 5 deletions
5
packages/ckb-sdk-utils/src/exceptions/hexStringShouldStartWith0x.ts
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,11 +1,19 @@ | ||
import HexStringShouldStartWith0x from './hexStringShouldStartWith0x' | ||
import ArgumentRequired from './argumentRequired' | ||
import InvalidHexString from './invalidHexString' | ||
import { HexStringShouldStartWith0x, InvalidHexString } from './invalidHexString' | ||
import { InvalidSingleSignatureAddress, InvalidSingleSignatureAddressPayload } from './invalidAddress' | ||
|
||
export { HexStringShouldStartWith0x, ArgumentRequired, InvalidHexString } | ||
export { | ||
HexStringShouldStartWith0x, | ||
ArgumentRequired, | ||
InvalidHexString, | ||
InvalidSingleSignatureAddress, | ||
InvalidSingleSignatureAddressPayload, | ||
} | ||
|
||
export default { | ||
HexStringShouldStartWith0x, | ||
ArgumentRequired, | ||
InvalidHexString, | ||
InvalidSingleSignatureAddress, | ||
InvalidSingleSignatureAddressPayload, | ||
} |
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,16 @@ | ||
export class InvalidSingleSignatureAddressPayload extends Error { | ||
constructor(payload: string) { | ||
super(`${payload} is not a single signature address payload`) | ||
} | ||
} | ||
|
||
export class InvalidSingleSignatureAddress extends Error { | ||
constructor(addr: string) { | ||
super(`${addr} is not a single signature address`) | ||
} | ||
} | ||
|
||
export default { | ||
InvalidSingleSignatureAddressPayload, | ||
InvalidSingleSignatureAddress, | ||
} |
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 |
---|---|---|
@@ -1,5 +1,16 @@ | ||
export default class extends Error { | ||
export class InvalidHexString extends Error { | ||
constructor(hex: string) { | ||
super(`${hex} is an invalid hex string`) | ||
} | ||
} | ||
|
||
export class HexStringShouldStartWith0x extends Error { | ||
constructor(hex: string) { | ||
super(`Hex string ${hex} should start with 0x`) | ||
} | ||
} | ||
|
||
export default { | ||
InvalidHexString, | ||
HexStringShouldStartWith0x, | ||
} |
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