-
Notifications
You must be signed in to change notification settings - Fork 225
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 migration #887
Closed
Closed
feat: Viem migration #887
Conversation
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
Pull Request Test Coverage Report for Build 9697300982Details
💛 - Coveralls |
…stead of re-implementing it
Use viem's `PublicClient` instead of ether's `JsonRpcProvider`
tmjssz
force-pushed
the
feat/viem-migration
branch
from
July 2, 2024 12:34
d69e1d4
to
7e0bd8e
Compare
Pull Request Test Coverage Report for Build 9761038587Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9761061066Details
💛 - Coveralls |
To avoid breaking changes we keep regular `string` types for now and do type casting whenever necessary for calling viem's functions.
Pull Request Test Coverage Report for Build 9762097670Details
💛 - Coveralls |
…function Fix tests for refactored signDelegate function
Pull Request Test Coverage Report for Build 9792499339Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9806031807Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9807577285Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9810052440Details
💛 - Coveralls |
dasanra
reviewed
Jul 9, 2024
dasanra
reviewed
Jul 9, 2024
…ccount!.address`
…e-sdk into feat/viem-migration
* Extend SafeProvider's external client type to `PublicClient | WalletClient` * Introduce `ExternalClient` type alias and use it as type for `#externalProvider` in SafeProvider * With the extended type we need to use viem methods individually from `viem/actions` instead of calling them directly on the client itself * Extend SafeProvider by a `readContract` method to fix TS error in Safe4337Pack Also fix unit test for Safe4337Pack * Fix custom chain support --------- Co-authored-by: leonardotc <[email protected]>
dasanra
reviewed
Jul 31, 2024
} from 'viem' | ||
import { asHex } from '../types' | ||
|
||
// This whole file was copied (and softly adapted) from viem in order to expose the function that provides just the encoding. |
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 saw this was done to avoid to break the types in the current iteration. This was not explicitly explained here, and that this piece of code should be removed as soon as possible. Please add some comment signaling this.
dasanra
force-pushed
the
feat/viem-migration
branch
from
August 8, 2024 15:03
1c7dfb4
to
4dc89f1
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What it solves
Resolves issues #870 and #871.
How this PR fixes it
This pull request migrates the entire repository to
viem
, removingethers
as a dependency.ethers
is retained only as a devDependency for the test-utils inapi-kit
andprotocol-kit
.protocol-kit
getExternalProvider
now returns a viemPublicClient
(previously an ethersProvider
).getExternalSigner
now returns a viemWalletClient
(previously an ethersAbstractSigner
).getTransaction
now returns a viemTransaction
(previously an ethersTransactionResponse
).encodeParameters
anddecodeParameters
now expect astring
as the first parameter, containing the Human-readable ABI parameters (previously astring[]
).Abi
(previouslyJsonFragment | JsonFragment[]
). This affects:defaultAbi
andcustomContractAbi
in all Contract classes.customContractAbi
parameter in allget...ContractInstance
functions and in theGetContractProps
type.getSafeProxyFactoryContractInstance
function'ssignerOrProvider
parameter is now a viemPublicClient
.api-kit
SafeApiKit
'saddSafeDelegate
andremoveSafeDelegate
functions now expect a viemWalletClient
as the signer prop (previously an ethersSigner
).relay-kit
Safe4337Options
now expects abundlerClient
prop of viem's typePublicClient
(previously ethersJsonRpcProvider
).auth-kit
AuthKitEthereumProvider
type is now a viemEIP1193Provider
(previously ethersEip1193Provider
). This new type restricts the RPC methods for EIP-1193, as opposed to the ethers type, which accepted any string as a method name.