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

feat: improve fromEvmAddress developer experience #1309

Merged
merged 7 commits into from
Oct 6, 2023

Conversation

danielbate
Copy link
Member

Our current implementation of the fromEvmAddress method expects a wrapped and padded Evm Address to return an Address. As the EVM returns address unpadded, users would have to pad then wrap it to be compatible with the Sway/TS type.

To improve this experience, the fromEvmAddress method now accepts and unwrapped/unpadded string and will validate it to instantiate an Address. The toEvmAddress method has been renamed toWrappedEvmAddress to adhere to the above change.

Closes #1262

@danielbate danielbate self-assigned this Oct 3, 2023
@danielbate danielbate marked this pull request as ready for review October 3, 2023 05:41
@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2023

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
85.03% (+0.03% 🔼)
5250/6174
🟡 Branches
66.75% (+0.12% 🔼)
773/1158
🟡 Functions
75.04% (+0.04% 🔼)
857/1142
🟢 Lines
84.92% (+0.03% 🔼)
5030/5923
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / utils.ts
90.38% (+1.75% 🔼)
84.21% (-0.4% 🔻)
92.31% (+1.4% 🔼)
89.36% (+1.86% 🔼)

Test suite run success

1261 tests passing in 216 suites.

Report generated by 🧪jest coverage report action from 6820f79

packages/address/src/utils.ts Show resolved Hide resolved
packages/address/src/address.test.ts Show resolved Hide resolved
packages/address/src/address.ts Outdated Show resolved Hide resolved
camsjams
camsjams previously approved these changes Oct 4, 2023
Copy link
Contributor

@camsjams camsjams left a comment

Choose a reason for hiding this comment

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

LGTM, just nitpick on the function rename

packages/address/src/address.test.ts Show resolved Hide resolved
packages/address/src/address.ts Outdated Show resolved Hide resolved
packages/address/src/utils.ts Show resolved Hide resolved
Copy link
Member

@Dhaiwat10 Dhaiwat10 left a comment

Choose a reason for hiding this comment

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

🪄

@danielbate danielbate enabled auto-merge (squash) October 6, 2023 13:50
@danielbate danielbate merged commit d7562c2 into master Oct 6, 2023
@danielbate danielbate deleted the db/feat/improve-from-evm-address-dev-ex branch October 6, 2023 14:29
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.

Implement utility method for zero-padding EVM addresses in the Address class
5 participants