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

Conversation

@Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Jul 6, 2021

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
Copy link
Member Author

Gudahtt commented Jul 6, 2021

This depends upon #1

@Gudahtt Gudahtt force-pushed the add-hex-prefixed branch from ee5f13e to e4591e2 Compare July 6, 2021 19:00
@Gudahtt Gudahtt changed the base branch from add-initial-json-type to main July 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 owner July 6, 2021 19:01
@Gudahtt Gudahtt force-pushed the add-hex-prefixed branch from e4591e2 to b58b1a6 Compare July 6, 2021 19:02
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 force-pushed the add-hex-prefixed branch from b58b1a6 to e1e6054 Compare July 6, 2021 19:53
@rekmarks rekmarks self-assigned this Jul 12, 2021
@Gudahtt Gudahtt merged commit b8ab1bf into main Jul 12, 2021
@Gudahtt Gudahtt deleted the add-hex-prefixed branch July 12, 2021 18:16
Sign up for free to 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.

3 participants