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(viem): migrate to viem #11

Open
wants to merge 2 commits into
base: feat/v3
Choose a base branch
from
Open

feat(viem): migrate to viem #11

wants to merge 2 commits into from

Conversation

envin3
Copy link

@envin3 envin3 commented Sep 21, 2023

No description provided.

@@ -6,8 +6,8 @@ export function isHexPrefixed(_string: string) {
return _string.slice(0, 2).toLocaleLowerCase() === HEX_PREFIX
}

export function addHexPrefix(_string: string) {
return isHexPrefixed(_string) ? _string : HEX_PREFIX + _string
export function addHexPrefix(_string: string): `0x${string}` {

Choose a reason for hiding this comment

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

I don't understand this change. The function has already been tested and working.

Copy link
Author

Choose a reason for hiding this comment

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

viem requires 0x${string} instead of string where an hash is passed.

import { PayableTxOptions } from 'web3-eth-contract'
import { Abi, PublicClient, WalletClient, TransactionReceipt } from 'viem'
import events from './abi/events'
// import { privateKeyToAccount } from 'viem/accounts'

Choose a reason for hiding this comment

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

Clean all comments

return this
}
}
// class SendObject<T> {

Choose a reason for hiding this comment

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

Can't you re-enable this? There should be a way to set gas price/limit in viem as well.

const accounts = await _web3.eth.getAccounts()
return accounts[0]
}
// export async function getAccount(_web3: Web3): Promise<string> {

Choose a reason for hiding this comment

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

No way to get the address? If not, remove the function making sure it's not used elsewhere.

Copy link

@oliviera9 oliviera9 left a comment

Choose a reason for hiding this comment

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

What about tests? I suspect they are still checking web3 functions are called.
Remove comments.

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