Skip to content

Commit

Permalink
test: add one more test
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed Sep 24, 2023
1 parent 9ef6181 commit 8b0b2b3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/Client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,24 @@ describe('ClientOptions', () => {
expect(c.address).toEqual(account.address)
})

it('creates an identical client between viem and ethers', async () => {
const randomWallet = Wallet.createRandom()
const privateKey = randomWallet.privateKey
const account = privateKeyToAccount(privateKey as `0x${string}`)
const walletClient = createWalletClient({
account,
chain: mainnet,
transport: http(),
})

const viemClient = await Client.create(walletClient)
const ethersClient = await Client.create(randomWallet)
expect(viemClient.address).toEqual(ethersClient.address)
expect(
viemClient.publicKeyBundle.equals(ethersClient.publicKeyBundle)
).toBe(true)
})

it('fails if you use a viem WalletClient without an account', async () => {
const walletClient = createWalletClient({
chain: mainnet,
Expand Down

0 comments on commit 8b0b2b3

Please sign in to comment.