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

[14.x] fix: support ethermint's EIP712 implementation #333

Merged
merged 5 commits into from
Oct 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@
*
* @param address - The address to validate and normalize.
* @param req - The request object.
* @returns {string} - The normalized address, if valid. Otherwise, throws

Check warning on line 465 in src/wallet.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (20.x)

There must be no hyphen before @returns description

Check warning on line 465 in src/wallet.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (18.x)

There must be no hyphen before @returns description

Check warning on line 465 in src/wallet.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (22.x)

There must be no hyphen before @returns description
* an error
*/
async function validateAndNormalizeKeyholder(
Expand Down Expand Up @@ -500,7 +500,7 @@
*/
function validateVerifyingContract(data: string) {
const { domain: { verifyingContract } = {} } = parseTypedMessage(data);
if (verifyingContract && !isValidHexAddress(verifyingContract)) {
if (verifyingContract && !(isValidHexAddress(verifyingContract) || verifyingContract == 'cosmos')) {

Check failure on line 503 in src/wallet.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Build (20.x)

This condition will always return 'false' since the types '`0x${string}`' and '"cosmos"' have no overlap.

Check failure on line 503 in src/wallet.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (20.x)

Replace `verifyingContract·&&·!(isValidHexAddress(verifyingContract)·||·verifyingContract·==·'cosmos')` with `⏎····verifyingContract·&&⏎····!(isValidHexAddress(verifyingContract)·||·verifyingContract·==·'cosmos')⏎··`

Check failure on line 503 in src/wallet.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (20.x)

Expected '===' and instead saw '=='

Check failure on line 503 in src/wallet.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Build (18.x)

This condition will always return 'false' since the types '`0x${string}`' and '"cosmos"' have no overlap.

Check failure on line 503 in src/wallet.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (18.x)

Replace `verifyingContract·&&·!(isValidHexAddress(verifyingContract)·||·verifyingContract·==·'cosmos')` with `⏎····verifyingContract·&&⏎····!(isValidHexAddress(verifyingContract)·||·verifyingContract·==·'cosmos')⏎··`

Check failure on line 503 in src/wallet.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (18.x)

Expected '===' and instead saw '=='

Check failure on line 503 in src/wallet.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (22.x)

Replace `verifyingContract·&&·!(isValidHexAddress(verifyingContract)·||·verifyingContract·==·'cosmos')` with `⏎····verifyingContract·&&⏎····!(isValidHexAddress(verifyingContract)·||·verifyingContract·==·'cosmos')⏎··`

Check failure on line 503 in src/wallet.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (22.x)

Expected '===' and instead saw '=='
Copy link
Contributor

@legobeat legobeat Sep 10, 2024

Choose a reason for hiding this comment

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

Suggested change
if (verifyingContract && !(isValidHexAddress(verifyingContract) || verifyingContract == 'cosmos')) {
if (verifyingContract && !isValidHexAddress(verifyingContract) && verifyingContract !== 'cosmos') {

Needs adjusting of types as well.

(FWIW: The linting can also be run locally by yarn lint and yarn build, and tests by yarn test)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thx. fixed

throw rpcErrors.invalidInput();
}
}
Expand Down
Loading