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(abstract-eth): support txn bulding for v4 wallet on eth chain #4423

Merged

Conversation

mullapudipruthvik
Copy link
Contributor

Ticket: WIN:2755

TICKET: WIN-2755

@@ -94,12 +94,12 @@ export const SEND_TERC_DATA =
export const CONTRACT_TOKEN_CUSD_ADDRESS = '0xa561131a1C8aC25925FB848bCa45A74aF61e5A38';

export const SEND_TX_BROADCAST_LEGACY =
'0xf901ca02843b9aca0083b8a1a0948f977e912ef500548a0c3be6ddde9899f1199b8180b901643912521500000000000000000000000019645032c7f1533395d44a629462e751084d3e4c000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000005ec67e28000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000417e522e602252e010f97b81b1a83128cf283dcef2ea06c221a236c1c11883adfc222a46f4c9a6ab8cd1d5dd1e963ffa443de88c9cebf755c399702dc00b0b55d61b0000000000000000000000000000000000000000000000000000000000000078a065751b9ff267e551cdc3e304e4314ac395be24b9071b10d90067215414782cb5a0111e39c47d856150fdcf521417aa3c1eea64861f349009be969c835e2bbe0425';
'0xf901cc02843b9aca0083b8a1a0948f977e912ef500548a0c3be6ddde9899f1199b8180b901643912521500000000000000000000000019645032c7f1533395d44a629462e751084d3e4c000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000005ec67e28000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000417e522e602252e010f97b81b1a83128cf283dcef2ea06c221a236c1c11883adfc222a46f4c9a6ab8cd1d5dd1e963ffa443de88c9cebf755c399702dc00b0b55d61b000000000000000000000000000000000000000000000000000000000000008284f4a0375b0731252b8a4a6f54cd3ee8078e5ba8a89168c8b9b3a49a7a3fb60984b49fa029de0bb07d891c5ad4273016055e474b0c70fa288008eadfaa16ec73b6b78427';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated the txHex to use hteth

@@ -95,7 +101,7 @@ export class TransferBuilder {
throw new InvalidParameterValueError('Invalid expiration time');
}

signAndBuild(chainId?: string, coinUsesNonPackedEncodingForTxData?: boolean): string {
signAndBuild(chainId: string, coinUsesNonPackedEncodingForTxData?: boolean): string {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

made chainId mandatory

Copy link
Contributor

Choose a reason for hiding this comment

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

wondering if this should be considered as a breaking change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

don't we always pass chainId here

return this._transfer.signAndBuild(chainId, coinUsesNonPackedEncodingForTxData);

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, there we always pass chainId, so it won't affect wallet platform and WRW most likely. But if some of our user is directly using signAndBuild method, so I was thinking it as a breaking change from that perspective

Copy link
Contributor

Choose a reason for hiding this comment

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

If the API changes and is exposed publicly, it is a breaking change. Please mark the commit as such.

txBuilder.sign({ key: testData.PRIVATE_KEY });
await txBuilder.build();
const operationData = txBuilder.transfer().getOperationData();
should.equal(operationData[1][0], '17000');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this tests ensure the prefix is chainId for walletVersion 4

@mullapudipruthvik mullapudipruthvik marked this pull request as ready for review April 11, 2024 09:49
@mullapudipruthvik mullapudipruthvik requested review from a team as code owners April 11, 2024 09:49
Copy link
Contributor

@OttoAllmendinger OttoAllmendinger left a comment

Choose a reason for hiding this comment

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

@BitGo/coins level changes look OK

Copy link
Contributor

@zahin-mohammad zahin-mohammad left a comment

Choose a reason for hiding this comment

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

Please remove @BitGo/wallet-platform from the CODEOWNERS for eth/evm specific modules. This has been requested in past PR's as a non-blocking change, but never addressed.

gianchandania
gianchandania previously approved these changes Apr 15, 2024
dpkjnr
dpkjnr previously approved these changes Apr 15, 2024
Copy link

@the-smooth-operator the-smooth-operator left a comment

Choose a reason for hiding this comment

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

approved from gitadmins PoV

Ticket: WIN:2755

TICKET: WIN-2755

BREAKING CHANGE: Made ChainID mandatory for signAndBuild method
@mullapudipruthvik
Copy link
Contributor Author

rebased due to merge conflict

Copy link
Contributor

@sumanmukherjee03 sumanmukherjee03 left a comment

Choose a reason for hiding this comment

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

codeowners change approved

@@ -95,7 +101,7 @@ export class TransferBuilder {
throw new InvalidParameterValueError('Invalid expiration time');
}

signAndBuild(chainId?: string, coinUsesNonPackedEncodingForTxData?: boolean): string {
signAndBuild(chainId: string, coinUsesNonPackedEncodingForTxData?: boolean): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

If the API changes and is exposed publicly, it is a breaking change. Please mark the commit as such.

@@ -38,6 +39,11 @@ export abstract class BaseNFTTransferBuilder {
throw new InvalidParameterValueError('Invalid expiration time');
}

walletVersion(version: number): this {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: This function scheme sounds like a getter opposed to a setter. Maybe setWalletVersion?

Copy link
Contributor

@gianchandania gianchandania left a comment

Choose a reason for hiding this comment

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

lgtm

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.

7 participants