Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect chainIds in eip681 URIs #882

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

peachbits
Copy link
Contributor

@peachbits peachbits commented Jan 15, 2025

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

@@ -205,6 +206,21 @@ export class EthereumTools implements EdgeCurrencyTools {
}
address = contractAddress

// Split the address to get the chainId according to EIP-681
if (address.includes('@')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this allow using an Ethereum: uri with an L2 like optimism if and only if the chainId exists?

@peachbits peachbits force-pushed the matthew/eip681-chainId branch from 96cb5e2 to 8cb7297 Compare January 15, 2025 21:21
Copy link
Contributor

@swansontec swansontec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, but please remove the else

throw new Error(
'chainId must be present when using ethereum: prefix on a non-ethereum network'
)
} else if (address.includes('@')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This else isn't needed, since the previous if can only throw. Un-indenting this block would make it more obvious that it runs in every case, assuming we pass the error check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants