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: AccountApi #3

Open
wants to merge 14 commits into
base: WY_gg_extension
Choose a base branch
from
Open

Conversation

HansBhatia
Copy link
Contributor

@HansBhatia HansBhatia commented Apr 1, 2023

PR to add AccountApi object for signing utils.

@HansBhatia HansBhatia changed the title Branch PR feat: AccountApi Apr 9, 2023
@HansBhatia HansBhatia marked this pull request as draft April 9, 2023 06:02
@HansBhatia HansBhatia marked this pull request as ready for review April 9, 2023 06:15
@HansBhatia HansBhatia requested a review from ElasticBottle April 9, 2023 06:16
export const getDomainSeparator = (chainId: number): string => {
return ethers.utils.keccak256(
ethers.utils.defaultAbiCoder.encode(
["bytes32", "bytes32", "uint256"] as string[],
Copy link
Contributor

Choose a reason for hiding this comment

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

remove type cast

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

export const getTxnHash = (transaction: Transaction): string => {
return ethers.utils.keccak256(
ethers.utils.defaultAbiCoder.encode(
["uint256", "uint256", "address", "bool", "uint256", "bytes"] as string[],
Copy link
Contributor

Choose a reason for hiding this comment

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

here and everywhere else too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

};

// Get the hash of the given transaction
export const getTxnHash = (transaction: Transaction): string => {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe getKeccakHashForTransactionObject

};

// Get the hash of the signed message for the given transaction and chain ID
export function getTransactionHash(
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe getEip712HashForTransactionObject

const message = ethers.utils.solidityPack(
["bytes2", "bytes32", "bytes32"] as string[],
[
ethers.utils.toUtf8Bytes("\x19\x01"),
Copy link
Contributor

Choose a reason for hiding this comment

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

where is this coming from

Copy link
Contributor

Choose a reason for hiding this comment

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

put the magic var into a constant

ethers.utils.toUtf8Bytes("\x19\x01"),
domainSeparator,
getTxnHash(transaction),
] as string[],
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

chore(pullRequest): refactored tests so they work.
@HansBhatia HansBhatia changed the base branch from main to WY_gg_extension April 15, 2023 18:09
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.

2 participants