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

refactor:[SMR-2730] rewrite get tx data #1781

Merged
merged 6 commits into from
May 20, 2024
Merged

Conversation

Benjimmutable
Copy link
Contributor

Summary

Rewrite getTxData in bridge SDK

Detail and impact of the change

If you do not think this is a better way to write this function, please voice this opinion. I personally believe it is easier to read.

Changed

  • Rewrite a bit of getTxData so you just set the function name and parameters then generate the calldata based on those, since you already have the correct bridge contract to do it on as well.

@Benjimmutable Benjimmutable requested a review from a team as a code owner May 14, 2024 07:34
Base automatically changed from smr-2729-rename-getTxData to main May 16, 2024 04:31
currentBridgeMethods.native,
[amount],
), BridgeErrorType.INTERNAL_ERROR);
functionName = currentBridgeMethods.native;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the new way of doing it feels a lot easier to read to me

@@ -384,39 +384,40 @@ export class TokenBridge {
const currentBridgeMethods = await this.getBridgeMethods(direction);
const bridgeContract = await this.getBridgeContract(direction);

let functionName: string;
let parameters: any[];
/**
* Handle bridge transaction for native token
*/
if (token.toUpperCase() === NATIVE) {
if (sender === recipient) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we handle scenario where a checksummed version of an address might evaluate different from a non-checksummed version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. Ticket created

@Benjimmutable Benjimmutable added this pull request to the merge queue May 20, 2024
Merged via the queue into main with commit 6525581 May 20, 2024
11 checks passed
@Benjimmutable Benjimmutable deleted the smr-2730-rewrite-getTxData branch May 20, 2024 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants