-
Notifications
You must be signed in to change notification settings - Fork 217
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(protocol-kit): Add Abitype for contract types and use EIP-1193 #604
Merged
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 6979367114
💛 - Coveralls |
Pull Request Test Coverage Report for Build 8452514007Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
DaniSomoza
changed the title
Add abitype
feat(protocol-kit): Add Abitype for Safe Contract v1.3.0 and Ethers
Nov 24, 2023
This was referenced Nov 27, 2023
This was referenced Nov 30, 2023
tmjssz
reviewed
Dec 5, 2023
packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts
Outdated
Show resolved
Hide resolved
* Create abstract class `SafeBaseContractWeb3` * Implement class `SafeContract_v1_3_0_Web3` * feat(protocol-kit): Add Abitype for Safe Contract 1.4.1 + Web3.js (#637) * Create Types for the v1.4.1 Safe contract * Implement class `SafeContract_v1_4_1_Web3`
…624) * Create Types for the v1.4.1 Safe contract * Create `SafeContract_v1_4_1_Ethers` Class * feat(protocol-kit): Add Abitype for Safe Contract v1.2.0 + ethers.js (#627) * Create Types for the v1.2.0 Safe contract * Create `SafeContract_v1_2_0_Ethers` Class * Add arg names to contract functions --------- Co-authored-by: Daniel Somoza <[email protected]>
This was referenced Dec 15, 2023
This was referenced Jan 8, 2024
* Rename old 1.1.1 Safe contract implementations (for Ethers.js + Web3.js) * Create Types for the v1.1.1 Safe contract * Implement `SafeContract_v1_1_1_Web3` class * Implement `SafeContract_v1_1_1_Ethers` class * Various fixes in Safe contract v1.1.1 implementations * Update `contractInstancesEthers.ts` to use the new class * Update `contractInstancesWeb3.ts` to use the new class * Remove contract 1.1.1 from typechain generation script * Remove old SafeContract v1.1.1 implementations * Fix `getModulesPaginated` function in 1.1.1 contract implementations * Fix binding issues in `mapToTypechainContract` function for contract v1.1.1 implementations
…pe + Fixes (#644) * Rename old Safe contract v1.2.0 Web3 implementation * Implement new `SafeContract_v1_2_0_Web3` class * Update `contractInstancesWeb3.ts` to use the new class * Remove contract 1.2.0 from typechain generation script * Remove old SafeContract v1.2.0 implementation * Move typechain mapper functions to individual Safe contract implementations for ethers.js * Call `getModules` contract method directly for Safe contract v1.2.0 * fix: Handle return value of Safe contract's `getModulesPaginated` method correctly * Fix `getMessageHash` return value in SafeContract_v1_2_0_Ethers * Refactor `getModules` method in SafeContract classes * Fix binding issues in typechain mapper functions for Safe contract v1.3.0 + v1.4.1
leonardotc
reviewed
May 13, 2024
* remove API reference from api-kit and protocol-kit * chore: update relay-kit information to refer ERC-4337 --------- Co-authored-by: Yago Pérez Vázquez <[email protected]>
…e-sdk into Abitype-1_3_0-safe-contract # Conflicts: # packages/account-abstraction-kit/package.json # packages/api-kit/package.json # packages/auth-kit/package.json # packages/onramp-kit/package.json # packages/protocol-kit/package.json # packages/relay-kit/package.json # packages/safe-core-sdk-types/package.json
…-global/safe-core-sdk into Abitype-1_3_0-safe-contract # Conflicts: # packages/safe-core-sdk-types/package.json
dasanra
approved these changes
May 16, 2024
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 #582
Contracts Implemented
v1.4.1
Ethers.js & Web3.jsv1.3.0
Ethers.js & Web3.jsv1.2.0
Ethers.js & Web3.jsv1.1.1
Ethers.js & Web3.jsv1.0.0
Ethers.js & Web3.jsHow this PR fixes it
Classes And Types Implemented
SafeBaseContract
: This Type usesabitype
utilities to extract The Functions and Types from a given Abi.SafeContract_v1_3_0_Contract
: This Type uses theSafeBaseContract
utility to extract The Functions and Types for a Safe contract version 1.3.0.SafeBaseContract
: Abstract class that serves as a base for creating a Safe contract for a specific adapter (Ethers.js, Web3.js, or viem.js). This class is designed to be extended by adapter-specific abstract classes, such asSafeBaseContractEthers
(Implemented),SafeBaseContractWeb3
(pending implementation), andSafeBaseContractViem
(pending implementation). It includes the core logic for selecting the appropriate ABI and the address from Safe deployments and determining the correct L1 or L2 contract version of the Safe.SafeBaseContractEthers
: This Abstract class extendsSafeBaseContract
to specifically integrate with theEthers.js v6
library. This abstract class sets up the Ethers v6 Contract object that interacts with a Safe contract version. Subclasses ofSafeBaseContractEthers
are expected to represent specific versions of the Safe contract. Example subclasses:SafeContract_v1_4_1_Ethers
(pending implementation),SafeContract_v1_3_0_Ethers
(Implemented),SafeContract_v1_2_0_Ethers
(pending implementation)...SafeContract_v1_3_0_Ethers
: This class specializes in handling interactions with the Safe contract version 1.3.0 using Ethers.js v6. Inherits fromSafeBaseContractEthers
and Implements theSafeContract_v1_3_0_Contract
Guides
Add a
v1.4.1
Safe Contract ForEthers.js
(Easy)v1.4.1
Safe contract: Create aSafeContract_v1_4_1.ts
file inpackages/protocol-kit/src/contracts/AbiType/Safe/v1.4.1/SafeContract_v1_4_1.ts
. Use the implementedSafeContract_v1_3_0.ts
as a model.SafeContract_v1_4_1_Ethers
Class: Create aSafeContract_v1_4_1_Ethers.ts
file inpackages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts
. Use the implementedSafeContract_v1_3_0_Ethers.ts
as a model.contractInstancesEthers.ts
file to use the new class.SafeContract_V1_4_1_Ethers.ts
generateTypechainFiles.ts
script to remove the generation of the Safe Contractv1.4.1
For Ethers.js.Add
Web3.js
forv1.3.0
Safe Contract (Medium)SafeBaseContractWeb3
: Create aSafeBaseContractWeb3.ts
file inpackages/protocol-kit/src/adapters/web3/contracts/Safe/SafeBaseContractWeb3.ts
. Use the implementedSafeBaseContractEthers.ts
as a model.SafeContract_v1_3_0_Web3
: Create aSafeContract_v1_3_0_Web3.ts file in
packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Web3.ts`.contractInstancesEthers.ts
file to use the new class.SafeContract_V1_3_0_Web3.ts
generateTypechainFiles.ts
script to remove the generation of the Safe Contractv1.3.0
For Web3.js.Add another contract like
safeProxyFactory
v1.3.0
contract for Ethers (Hard):safeProxyFactoryContract.ts
types file. In thepackages/protocol-kit/src/contracts/AbiType
create asafeProxyFactoryContract.ts
types using the Abi of the contract. See the implementedSafeBaseContract.ts
file.safeProxyFactoryBaseContract.ts
in 'src/adapters' seesrc/adapters/SafeBaseContract.ts
file as example.safeProxyFactoryBaseContractEthers.ts
seesrc/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts
as example.safeProxyFactory_v1_3_0_Ethers.ts
: see theSafeContract_v1_3_0_Ethers
file as example.contractInstancesEthers.ts
file to use the new class.safeProxyFactory_V1_3_0_Ethers.ts
generateTypechainFiles.ts
script to remove the generation of the safeProxyFactoryv1.3.0
For Ethers.js.