Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Add HexPrefixed type - #2

Merged
Gudahtt merged 2 commits into
mainfrom
add-hex-prefixed
Jul 12, 2021
Merged

Add HexPrefixed type#2
Gudahtt merged 2 commits into
mainfrom
add-hex-prefixed

Conversation

@Gudahtt

Copy link
Copy Markdown
Member

This type represents a string that is prefixed with 0x. It just verifies the prefix - it doesn't guarantee anything about the contents of the string after the prefix.

This is useful for Ethereum addresses, or any data that we expect to be represented by a prefixed hex string.

I considered adding type checking to verify that the rest of the string was valid hex, but currently this is not easy to do with TypeScript. The only method I know of us to build up the conditional logic and apply it to each character one-by-one, which is fairly slow. We can pursue this in a later PR if we decide it's worth the cost.

@Gudahtt

Gudahtt commented Jul 6, 2021

Copy link
Copy Markdown
MemberAuthor

This depends upon #1

@Gudahtt
Gudahtt changed the base branch from add-initial-json-type to mainJuly 6, 2021 19:01
@Gudahtt
Gudahtt marked this pull request as ready for review July 6, 2021 19:01
@Gudahtt
Gudahtt requested a review from a team as a code ownerJuly 6, 2021 19:01
This type represents a string that is prefixed with `0x`. It just
verifies the prefix - it doesn't guarantee anything about the contents
of the string after the prefix.
This is useful for Ethereum addresses, or any data that we expect to
be represented by a prefixed hex string.
I considered adding type checking to verify that the rest of the string
was valid hex, but currently this is not easy to do with TypeScript.
The only method I know of us to build up the conditional logic and
apply it to each character one-by-one, which is fairly slow. We can
pursue this in a later PR if we decide it's worth the cost.
@rekmarksrekmarks self-assigned this Jul 12, 2021
@Gudahtt
Gudahtt merged commit b8ab1bf into mainJul 12, 2021
@Gudahtt
Gudahtt deleted the add-hex-prefixed branch July 12, 2021 18:16
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Gudahtt@rekmarks