-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: feat/v3
Are you sure you want to change the base?
Conversation
@@ -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}` { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
No description provided.