-
-
Notifications
You must be signed in to change notification settings - Fork 839
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ethers adapter signTransaction properties (#322)
* fix: ethers adapter * test: boost coverage
- Loading branch information
Showing
3 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"viem": patch | ||
--- | ||
|
||
Fixed properties passed to ethers adapter `signTransaction` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Wallet } from 'ethers' | ||
import { expect, test } from 'vitest' | ||
import { accounts, typedData } from '../_test' | ||
import { ethersWalletToAccount } from './ethers' | ||
const wallet = new Wallet(accounts[0].privateKey) | ||
|
||
test('ethersWalletToAccount', async () => { | ||
const account = ethersWalletToAccount(wallet) | ||
expect(account).toBeDefined() | ||
}) | ||
|
||
test('signMessage', async () => { | ||
const account = ethersWalletToAccount(wallet) | ||
await account.signMessage({ message: 'foo bar baz' }) | ||
}) | ||
|
||
test('signTransaction', async () => { | ||
const account = ethersWalletToAccount(wallet) | ||
// with types | ||
await account.signTransaction({ type: 'legacy' }) | ||
await account.signTransaction({ type: 'eip1559', chainId: 1 }) | ||
await account.signTransaction({ type: 'eip2930', chainId: 1 }) | ||
|
||
// with conditional properties | ||
await account.signTransaction({ type: 'eip1559', chainId: 1, accessList: [] }) | ||
await account.signTransaction({ | ||
type: 'eip1559', | ||
chainId: 1, | ||
maxPriorityFeePerGas: 100n, | ||
maxFeePerGas: 100n, | ||
}) | ||
}) | ||
|
||
test('signTypedData', async () => { | ||
const account = ethersWalletToAccount(wallet) | ||
await account.signTypedData({ | ||
...typedData.basic, | ||
primaryType: 'Mail', | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ea019d7
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.
Successfully deployed to the following URLs:
viem-playground – ./playgrounds/browser
viem-playground.vercel.app
viem-playground-wagmi-dev.vercel.app
viem-playground-git-main-wagmi-dev.vercel.app
ea019d7
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.
Successfully deployed to the following URLs:
viem – ./site
viem-git-main-wagmi-dev.vercel.app
viem.vercel.app
viem-wagmi-dev.vercel.app
viem-site.vercel.app
viem.sh
www.viem.sh