From 113d9e0df75db5d8534a06bb98df5d5c2f17b629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 9 Apr 2024 18:34:32 +0200 Subject: [PATCH 001/112] Initial commit --- packages/protocol-kit/src/Safe.ts | 50 +++++++----- .../src/adapters/CreateCallBaseContract.ts | 1 - .../src/adapters/MultiSendBaseContract.ts | 1 - .../adapters/MultiSendCallOnlyBaseContract.ts | 3 +- .../src/adapters/SafeBaseContract.ts | 1 - .../adapters/SafeProxyFactoryBaseContract.ts | 1 - .../adapters/SignMessageLibBaseContract.ts | 1 - .../SimulateTxAccessorBaseContract.ts | 1 - .../src/adapters/ethers/EthersAdapter.ts | 78 +++++++++---------- .../CreateCallBaseContractEthers.ts | 15 +--- .../CreateCallContract_v1_3_0_Ethers.ts | 6 +- .../CreateCallContract_v1_4_1_Ethers.ts | 5 +- .../MultiSend/MultiSendBaseContractEthers.ts | 9 +-- .../MultiSendCallOnlyBaseContractEthers.ts | 9 +-- .../v1.1.1/MultiSendContract_V1_1_1_Ethers.ts | 5 +- ...MultiSendCallOnlyContract_V1_3_0_Ethers.ts | 5 +- .../v1.3.0/MultiSendContract_V1_3_0_Ethers.ts | 6 +- ...MultiSendCallOnlyContract_V1_4_1_Ethers.ts | 5 +- .../v1.4.1/MultiSendContract_V1_4_1_Ethers.ts | 5 +- .../contracts/Safe/SafeBaseContractEthers.ts | 8 +- .../Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts | 6 +- .../Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts | 5 +- .../Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts | 5 +- .../Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts | 5 +- .../Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts | 5 +- .../SafeProxyFactoryBaseContractEthers.ts | 12 +-- .../SafeProxyFactoryContract_v1_0_0_Ethers.ts | 6 +- .../SafeProxyFactoryContract_v1_1_1_Ethers.ts | 6 +- .../SafeProxyFactoryContract_v1_3_0_Ethers.ts | 6 +- .../SafeProxyFactoryContract_v1_4_1_Ethers.ts | 6 +- .../SignMessageLibBaseContractEthers.ts | 8 +- .../SignMessageLibContract_V1_3_0_Ethers.ts | 5 +- .../SignMessageLibContract_V1_4_1_Ethers.ts | 5 +- .../SimulateTxAccessorBaseContractEthers.ts | 12 +-- ...imulateTxAccessorContract_v1_3_0_Ethers.ts | 5 +- ...imulateTxAccessorContract_v1_4_1_Ethers.ts | 5 +- .../contracts/contractInstancesEthers.ts | 40 +++++----- .../src/managers/contractManager.ts | 9 ++- .../protocol-kit/src/safeFactory/index.ts | 22 +++--- packages/protocol-kit/src/types/index.ts | 22 ++++-- .../src/utils/transactions/gas.ts | 2 - .../src/utils/transactions/utils.ts | 5 +- .../tests/e2e/contractManager.test.ts | 22 +++--- .../tests/e2e/createTransaction.test.ts | 72 ++++++++--------- .../tests/e2e/utils/setupEthAdapter.ts | 38 +++------ 45 files changed, 266 insertions(+), 283 deletions(-) diff --git a/packages/protocol-kit/src/Safe.ts b/packages/protocol-kit/src/Safe.ts index 8d1c73c25..a761bb539 100644 --- a/packages/protocol-kit/src/Safe.ts +++ b/packages/protocol-kit/src/Safe.ts @@ -1,3 +1,4 @@ +import { ethers } from 'ethers' import { EthAdapter, OperationType, @@ -31,6 +32,7 @@ import { AddOwnerTxParams, ConnectSafeConfig, CreateTransactionProps, + Eip1193Provider, PredictedSafeProps, RemoveOwnerTxParams, SafeConfig, @@ -71,12 +73,14 @@ import { } from './contracts/safeDeploymentContracts' import SafeMessage from './utils/messages/SafeMessage' import semverSatisfies from 'semver/functions/satisfies' +import { EthersAdapter } from './adapters/ethers' const EQ_OR_GT_1_4_1 = '>=1.4.1' const EQ_OR_GT_1_3_0 = '>=1.3.0' class Safe { #predictedSafe?: PredictedSafeProps + #provider!: Eip1193Provider #ethAdapter!: EthAdapter #contractManager!: ContractManager #ownerManager!: OwnerManager @@ -111,25 +115,33 @@ class Safe { * @throws "MultiSendCallOnly contract is not deployed on the current network" */ private async init(config: SafeConfig): Promise { - const { ethAdapter, isL1SafeSingleton, contractNetworks } = config - - this.#ethAdapter = ethAdapter + const { provider, isL1SafeSingleton, contractNetworks } = config + this.#provider = provider + this.#ethAdapter = new EthersAdapter({ + provider + }) if (isSafeConfigWithPredictedSafe(config)) { this.#predictedSafe = config.predictedSafe - this.#contractManager = await ContractManager.create({ - ethAdapter: this.#ethAdapter, - predictedSafe: this.#predictedSafe, - isL1SafeSingleton, - contractNetworks - }) + this.#contractManager = await ContractManager.create( + { + provider: this.#provider, + predictedSafe: this.#predictedSafe, + isL1SafeSingleton, + contractNetworks + }, + this.#ethAdapter + ) } else { - this.#contractManager = await ContractManager.create({ - ethAdapter: this.#ethAdapter, - safeAddress: config.safeAddress, - isL1SafeSingleton, - contractNetworks - }) + this.#contractManager = await ContractManager.create( + { + provider: this.#provider, + safeAddress: config.safeAddress, + isL1SafeSingleton, + contractNetworks + }, + this.#ethAdapter + ) } this.#ownerManager = new OwnerManager(this.#ethAdapter, this.#contractManager.safeContract) @@ -150,9 +162,9 @@ class Safe { * @throws "MultiSendCallOnly contract is not deployed on the current network" */ async connect(config: ConnectSafeConfig): Promise { - const { ethAdapter, safeAddress, predictedSafe, isL1SafeSingleton, contractNetworks } = config + const { provider, safeAddress, predictedSafe, isL1SafeSingleton, contractNetworks } = config const configProps: SafeConfigProps = { - ethAdapter: ethAdapter || this.#ethAdapter, + provider: provider || this.#provider, isL1SafeSingleton: isL1SafeSingleton || this.#contractManager.isL1SafeSingleton, contractNetworks: contractNetworks || this.#contractManager.contractNetworks } @@ -442,7 +454,7 @@ class Safe { return new EthSafeTransaction( await standardizeSafeTransactionData({ predictedSafe: this.#predictedSafe, - ethAdapter: this.#ethAdapter, + provider: this.#provider, tx: newTransaction, contractNetworks: this.#contractManager.contractNetworks }) @@ -455,7 +467,7 @@ class Safe { return new EthSafeTransaction( await standardizeSafeTransactionData({ safeContract: this.#contractManager.safeContract, - ethAdapter: this.#ethAdapter, + provider: this.#provider, tx: newTransaction, contractNetworks: this.#contractManager.contractNetworks }) diff --git a/packages/protocol-kit/src/adapters/CreateCallBaseContract.ts b/packages/protocol-kit/src/adapters/CreateCallBaseContract.ts index 14e738769..d4187219f 100644 --- a/packages/protocol-kit/src/adapters/CreateCallBaseContract.ts +++ b/packages/protocol-kit/src/adapters/CreateCallBaseContract.ts @@ -21,7 +21,6 @@ abstract class CreateCallBaseContract { abstract safeVersion: SafeVersion abstract contract: unknown // This needs to be implemented for each adapter. - abstract adapter: unknown // This needs to be implemented for each adapter. /** * Constructs a new CreateCallBaseContract instance. diff --git a/packages/protocol-kit/src/adapters/MultiSendBaseContract.ts b/packages/protocol-kit/src/adapters/MultiSendBaseContract.ts index d2db07790..6b42db4e6 100644 --- a/packages/protocol-kit/src/adapters/MultiSendBaseContract.ts +++ b/packages/protocol-kit/src/adapters/MultiSendBaseContract.ts @@ -21,7 +21,6 @@ abstract class MultiSendBaseContract { abstract safeVersion: SafeVersion abstract contract: unknown // This needs to be implemented for each adapter. - abstract adapter: unknown // This needs to be implemented for each adapter. /** * Constructs a new MultiSendBaseContract instance. diff --git a/packages/protocol-kit/src/adapters/MultiSendCallOnlyBaseContract.ts b/packages/protocol-kit/src/adapters/MultiSendCallOnlyBaseContract.ts index f3c82952c..1ce72c42d 100644 --- a/packages/protocol-kit/src/adapters/MultiSendCallOnlyBaseContract.ts +++ b/packages/protocol-kit/src/adapters/MultiSendCallOnlyBaseContract.ts @@ -20,8 +20,7 @@ abstract class MultiSendCallOnlyBaseContract { contractName: contractName abstract safeVersion: SafeVersion - abstract contract: unknown // This needs to be implemented for each adapter. - abstract adapter: unknown // This needs to be implemented for each adapter. + abstract contract: unknown // This needs to be implemented for each adapter /** * Constructs a new MultiSendCallOnlyBaseContract instance. diff --git a/packages/protocol-kit/src/adapters/SafeBaseContract.ts b/packages/protocol-kit/src/adapters/SafeBaseContract.ts index 896b06f4b..36b0fd1dd 100644 --- a/packages/protocol-kit/src/adapters/SafeBaseContract.ts +++ b/packages/protocol-kit/src/adapters/SafeBaseContract.ts @@ -25,7 +25,6 @@ abstract class SafeBaseContract { abstract safeVersion: SafeVersion abstract contract: unknown // This needs to be implemented for each adapter. - abstract adapter: unknown // This needs to be implemented for each adapter. /** * Constructs a new SafeBaseContract instance. diff --git a/packages/protocol-kit/src/adapters/SafeProxyFactoryBaseContract.ts b/packages/protocol-kit/src/adapters/SafeProxyFactoryBaseContract.ts index 649eca305..0e441158c 100644 --- a/packages/protocol-kit/src/adapters/SafeProxyFactoryBaseContract.ts +++ b/packages/protocol-kit/src/adapters/SafeProxyFactoryBaseContract.ts @@ -20,7 +20,6 @@ abstract class SafeProxyFactoryBaseContract { abstract safeVersion: SafeVersion abstract contract: unknown // This needs to be implemented for each adapter. - abstract adapter: unknown // This needs to be implemented for each adapter. /** * Constructs a new SafeProxyFactoryBaseContract instance. diff --git a/packages/protocol-kit/src/adapters/SignMessageLibBaseContract.ts b/packages/protocol-kit/src/adapters/SignMessageLibBaseContract.ts index e8d0cd628..165a05331 100644 --- a/packages/protocol-kit/src/adapters/SignMessageLibBaseContract.ts +++ b/packages/protocol-kit/src/adapters/SignMessageLibBaseContract.ts @@ -21,7 +21,6 @@ abstract class SignMessageLibBaseContract { abstract safeVersion: SafeVersion abstract contract: unknown // This needs to be implemented for each adapter. - abstract adapter: unknown // This needs to be implemented for each adapter. /** * Constructs a new SignMessageLibBaseContract instance. diff --git a/packages/protocol-kit/src/adapters/SimulateTxAccessorBaseContract.ts b/packages/protocol-kit/src/adapters/SimulateTxAccessorBaseContract.ts index 023c2b659..c0d688aea 100644 --- a/packages/protocol-kit/src/adapters/SimulateTxAccessorBaseContract.ts +++ b/packages/protocol-kit/src/adapters/SimulateTxAccessorBaseContract.ts @@ -21,7 +21,6 @@ abstract class SimulateTxAccessorBaseContract abstract safeVersion: SafeVersion abstract contract: unknown // This needs to be implemented for each adapter. - abstract adapter: unknown // This needs to be implemented for each adapter. /** * Constructs a new SimulateTxAccessorBaseContract instance. diff --git a/packages/protocol-kit/src/adapters/ethers/EthersAdapter.ts b/packages/protocol-kit/src/adapters/ethers/EthersAdapter.ts index 755150307..1ea2bf6ec 100644 --- a/packages/protocol-kit/src/adapters/ethers/EthersAdapter.ts +++ b/packages/protocol-kit/src/adapters/ethers/EthersAdapter.ts @@ -11,7 +11,7 @@ import { SignMessageLibContract, SimulateTxAccessorContract } from '@safe-global/safe-core-sdk-types' -import { ethers, TransactionResponse, AbstractSigner, Provider } from 'ethers' +import { ethers, TransactionResponse, AbstractSigner, Provider, BrowserProvider } from 'ethers' import CompatibilityFallbackHandlerContractEthers from './contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerEthersContract' import SafeContractEthers from './contracts/Safe/SafeContractEthers' import { @@ -24,55 +24,42 @@ import { getSignMessageLibContractInstance, getSimulateTxAccessorContractInstance } from './contracts/contractInstancesEthers' -import { isTypedDataSigner, isSignerCompatible } from './utils' +import { isTypedDataSigner } from './utils' import MultiSendCallOnlyContract_v1_3_0_Ethers from './contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_V1_3_0_Ethers' import MultiSendCallOnlyContract_v1_4_1_Ethers from './contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Ethers' import MultiSendContract_v1_1_1_Ethers from './contracts/MultiSend/v1.1.1/MultiSendContract_V1_1_1_Ethers' import MultiSendContract_v1_3_0_Ethers from './contracts/MultiSend/v1.3.0/MultiSendContract_V1_3_0_Ethers' import MultiSendContract_v1_4_1_Ethers from './contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Ethers' - -type Ethers = typeof ethers +import { Eip1193Provider } from '@safe-global/protocol-kit/types' export interface EthersAdapterConfig { - /** ethers - Ethers v6 library */ - ethers: Ethers /** signerOrProvider - Ethers signer or provider */ - signerOrProvider: AbstractSigner | Provider + provider: Eip1193Provider } class EthersAdapter implements EthAdapter { - #ethers: Ethers - #signer?: AbstractSigner - #provider: Provider + get #signer(): Promise { + return this.#provider.getSigner() + } - constructor({ ethers, signerOrProvider }: EthersAdapterConfig) { - if (!ethers) { - throw new Error('ethers property missing from options') - } - this.#ethers = ethers - const isSigner = isSignerCompatible(signerOrProvider) - if (isSigner) { - const signer = signerOrProvider as AbstractSigner - if (!signer.provider) { - throw new Error('Signer must be connected to a provider') - } - this.#provider = signer.provider - this.#signer = signer - } else { - this.#provider = signerOrProvider as Provider - } + #provider: BrowserProvider + #eip1193Provider: Eip1193Provider + + constructor({ provider }: EthersAdapterConfig) { + this.#provider = new BrowserProvider(provider) + this.#eip1193Provider = provider } getProvider(): Provider { return this.#provider } - getSigner(): AbstractSigner | undefined { + getSigner(): Promise { return this.#signer } isAddress(address: string): boolean { - return this.#ethers.isAddress(address) + return ethers.isAddress(address) } async getEip3770Address(fullAddress: string): Promise { @@ -93,7 +80,7 @@ class EthersAdapter implements EthAdapter { } getChecksummedAddress(address: string): string { - return this.#ethers.getAddress(address) + return ethers.getAddress(address) } async getSafeContract({ @@ -130,7 +117,7 @@ class EthersAdapter implements EthAdapter { if (!contractAddress) { throw new Error('Invalid SafeProxyFactory contract address') } - const signerOrProvider = this.#signer || this.#provider + const signerOrProvider = (await this.#signer) || this.#provider return getSafeProxyFactoryContractInstance( safeVersion, contractAddress, @@ -151,6 +138,7 @@ class EthersAdapter implements EthAdapter { | MultiSendContract_v1_1_1_Ethers > { const chainId = await this.getChainId() + const contractAddress = customContractAddress ?? singletonDeployment?.networkAddresses[chainId.toString()] if (!contractAddress) { @@ -193,7 +181,7 @@ class EthersAdapter implements EthAdapter { if (!contractAddress) { throw new Error('Invalid CompatibilityFallbackHandler contract address') } - const signerOrProvider = this.#signer || this.#provider + const signerOrProvider = (await this.#signer) || this.#provider return getCompatibilityFallbackHandlerContractInstance( safeVersion, contractAddress, @@ -272,24 +260,32 @@ class EthersAdapter implements EthAdapter { } async getSignerAddress(): Promise { - return this.#signer?.getAddress() + const signer = await this.#signer + + return signer?.getAddress() } - signMessage(message: string): Promise { - if (!this.#signer) { + async signMessage(message: string): Promise { + const signer = await this.#signer + + if (!signer) { throw new Error('EthAdapter must be initialized with a signer to use this method') } - const messageArray = this.#ethers.getBytes(message) - return this.#signer.signMessage(messageArray) + const messageArray = ethers.getBytes(message) + + return signer.signMessage(messageArray) } async signTypedData(safeEIP712Args: SafeEIP712Args): Promise { - if (!this.#signer) { + const signer = await this.#signer + + if (!signer) { throw new Error('EthAdapter must be initialized with a signer to use this method') } - if (isTypedDataSigner(this.#signer)) { + + if (isTypedDataSigner(signer)) { const typedData = generateTypedData(safeEIP712Args) - const signature = await this.#signer.signTypedData( + const signature = await signer.signTypedData( typedData.domain, typedData.primaryType === 'SafeMessage' ? { SafeMessage: (typedData as EIP712TypedDataMessage).types.SafeMessage } @@ -311,11 +307,11 @@ class EthersAdapter implements EthAdapter { } encodeParameters(types: string[], values: any[]): string { - return new this.#ethers.AbiCoder().encode(types, values) + return new ethers.AbiCoder().encode(types, values) } decodeParameters(types: string[], values: string): { [key: string]: any } { - return new this.#ethers.AbiCoder().decode(types, values) + return new ethers.AbiCoder().decode(types, values) } } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts index 375eaf99e..b162df978 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts @@ -1,6 +1,4 @@ -import { Contract, ContractRunner, InterfaceAbi } from 'ethers' - -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import { AbstractSigner, Contract, ContractRunner, InterfaceAbi } from 'ethers' import CreateCallBaseContract from '@safe-global/protocol-kit/adapters/CreateCallBaseContract' import { SafeVersion } from '@safe-global/safe-core-sdk-types' @@ -23,8 +21,6 @@ abstract class CreateCallBaseContractEthers< CreateCallContractAbiType extends InterfaceAbi > extends CreateCallBaseContract { contract: Contract - adapter: EthersAdapter - /** * @constructor * Constructs an instance of CreateCallBaseContractEthers. @@ -38,7 +34,7 @@ abstract class CreateCallBaseContractEthers< */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, defaultAbi: CreateCallContractAbiType, safeVersion: SafeVersion, customContractAddress?: string, @@ -47,12 +43,7 @@ abstract class CreateCallBaseContractEthers< ) { super(chainId, defaultAbi, safeVersion, customContractAddress, customContractAbi) - this.adapter = ethersAdapter - this.contract = new Contract( - this.contractAddress, - this.contractAbi, - runner || this.adapter.getSigner() - ) + this.contract = new Contract(this.contractAddress, this.contractAbi, runner || signer) } } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts index a773b7490..7544d73c2 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts @@ -1,5 +1,4 @@ import CreateCallBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' import { EthersTransactionOptions, EthersTransactionResult @@ -15,6 +14,7 @@ import { GetAddressCreateCallFunction } from '@safe-global/protocol-kit/contracts/AbiType/CreateCall/CreateCallBaseContract' import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' +import { AbstractSigner } from 'ethers' /** * CreateCallContract_V1_3_0_Ethers is the implementation specific to the CreateCall contract version 1.3.0. @@ -40,14 +40,14 @@ class CreateCallContract_V1_3_0_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, customContractAddress?: string, customContractAbi?: CreateCallContract_v1_3_0_Abi ) { const safeVersion = '1.3.0' const defaultAbi = CreateCall_1_3_0_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, signer, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts index 591082b4b..a6aa750f4 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts @@ -15,6 +15,7 @@ import { GetAddressCreateCallFunction } from '@safe-global/protocol-kit/contracts/AbiType/CreateCall/CreateCallBaseContract' import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' +import { AbstractSigner } from 'ethers' /** * CreateCallContract_V1_4_1_Ethers is the implementation specific to the CreateCall contract version 1.4.1. @@ -40,14 +41,14 @@ class CreateCallContract_V1_4_1_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, customContractAddress?: string, customContractAbi?: CreateCallContract_v1_4_1_Abi ) { const safeVersion = '1.4.1' const defaultAbi = CreateCall_1_4_1_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, signer, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts index ddaecb927..e41cbc3d5 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts @@ -1,6 +1,5 @@ -import { Contract, InterfaceAbi } from 'ethers' +import { AbstractSigner, Contract, InterfaceAbi } from 'ethers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import MultiSendBaseContract from '@safe-global/protocol-kit/adapters/MultiSendBaseContract' @@ -23,7 +22,6 @@ abstract class MultiSendBaseContractEthers< MultiSendContractAbiType extends InterfaceAbi > extends MultiSendBaseContract { contract: Contract - adapter: EthersAdapter /** * @constructor @@ -38,7 +36,7 @@ abstract class MultiSendBaseContractEthers< */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, defaultAbi: MultiSendContractAbiType, safeVersion: SafeVersion, customContractAddress?: string, @@ -46,8 +44,7 @@ abstract class MultiSendBaseContractEthers< ) { super(chainId, defaultAbi, safeVersion, customContractAddress, customContractAbi) - this.adapter = ethersAdapter - this.contract = new Contract(this.contractAddress, this.contractAbi, this.adapter.getSigner()) + this.contract = new Contract(this.contractAddress, this.contractAbi, signer) } } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts index 539e8207f..81a85eab7 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts @@ -1,4 +1,4 @@ -import { Contract, InterfaceAbi } from 'ethers' +import { AbstractSigner, Contract, InterfaceAbi } from 'ethers' import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' import { SafeVersion } from '@safe-global/safe-core-sdk-types' @@ -23,8 +23,6 @@ abstract class MultiSendCallOnlyBaseContractEthers< MultiSendCallOnlyContractAbiType extends InterfaceAbi > extends MultiSendCallOnlyBaseContract { contract: Contract - adapter: EthersAdapter - /** * @constructor * Constructs an instance of MultiSendCallOnlyBaseContractEthers. @@ -38,7 +36,7 @@ abstract class MultiSendCallOnlyBaseContractEthers< */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, defaultAbi: MultiSendCallOnlyContractAbiType, safeVersion: SafeVersion, customContractAddress?: string, @@ -46,8 +44,7 @@ abstract class MultiSendCallOnlyBaseContractEthers< ) { super(chainId, defaultAbi, safeVersion, customContractAddress, customContractAbi) - this.adapter = ethersAdapter - this.contract = new Contract(this.contractAddress, this.contractAbi, this.adapter.getSigner()) + this.contract = new Contract(this.contractAddress, this.contractAbi, signer) } } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_V1_1_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_V1_1_1_Ethers.ts index a8fbae004..202f1d51f 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_V1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_V1_1_1_Ethers.ts @@ -9,6 +9,7 @@ import { EncodeMultiSendFunction, GetAddressMultiSendFunction } from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/MultiSendBaseContract' +import { AbstractSigner } from 'ethers' /** * MultiSendContract_v1_1_1_Ethers is the implementation specific to the MultiSend contract version 1.1.1. @@ -34,14 +35,14 @@ class MultiSendContract_v1_1_1_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, customContractAddress?: string, customContractAbi?: MultiSendContract_v1_1_1_Abi ) { const safeVersion = '1.1.1' const defaultAbi = multisend_1_1_1_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, signer, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_V1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_V1_3_0_Ethers.ts index 36fcbd227..b0269152a 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_V1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_V1_3_0_Ethers.ts @@ -9,6 +9,7 @@ import { EncodeMultiSendCallOnlyFunction, GetAddressMultiSendCallOnlyFunction } from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/MultiSendCallOnlyBaseContract' +import { AbstractSigner } from 'ethers' /** * MultiSendCallOnlyContract_v1_3_0_Ethers is the implementation specific to the MultiSendCallOnly contract version 1.3.0. @@ -34,14 +35,14 @@ class MultiSendCallOnlyContract_v1_3_0_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, customContractAddress?: string, customContractAbi?: MultiSendCallOnlyContract_v1_3_0_Abi ) { const safeVersion = '1.3.0' const defaultAbi = multiSendCallOnly_1_3_0_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, signer, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_V1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_V1_3_0_Ethers.ts index bd16e8e2c..e94ecf0ae 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_V1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_V1_3_0_Ethers.ts @@ -1,5 +1,4 @@ import MultiSendBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' import MultiSendContract_v1_3_0_Contract, { MultiSendContract_v1_3_0_Abi } from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/v1.3.0/MultiSendContract_v1_3_0' @@ -9,6 +8,7 @@ import { EncodeMultiSendFunction, GetAddressMultiSendFunction } from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/MultiSendBaseContract' +import { AbstractSigner } from 'ethers' /** * MultiSendContract_v1_3_0_Ethers is the implementation specific to the MultiSend contract version 1.3.0. @@ -34,14 +34,14 @@ class MultiSendContract_v1_3_0_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, customContractAddress?: string, customContractAbi?: MultiSendContract_v1_3_0_Abi ) { const safeVersion = '1.3.0' const defaultAbi = multisend_1_3_0_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, signer, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Ethers.ts index 133b6c905..9bdb12cd9 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Ethers.ts @@ -9,6 +9,7 @@ import { EncodeMultiSendCallOnlyFunction, GetAddressMultiSendCallOnlyFunction } from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/MultiSendCallOnlyBaseContract' +import { AbstractSigner } from 'ethers' /** * MultiSendCallOnlyContract_v1_4_1_Ethers is the implementation specific to the MultiSend contract version 1.4.1. @@ -34,14 +35,14 @@ class MultiSendCallOnlyContract_v1_4_1_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, customContractAddress?: string, customContractAbi?: MultiSendCallOnlyContract_v1_4_1_Abi ) { const safeVersion = '1.4.1' const defaultAbi = multiSendCallOnly_1_4_1_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, signer, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Ethers.ts index 19099b281..f2b5a6ea2 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Ethers.ts @@ -9,6 +9,7 @@ import { EncodeMultiSendFunction, GetAddressMultiSendFunction } from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/MultiSendBaseContract' +import { AbstractSigner } from 'ethers' /** * MultiSendContract_v1_4_1_Ethers is the implementation specific to the MultiSend contract version 1.4.1. @@ -34,14 +35,14 @@ class MultiSendContract_v1_4_1_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, customContractAddress?: string, customContractAbi?: MultiSendContract_v1_4_1_Abi ) { const safeVersion = '1.4.1' const defaultAbi = multisend_1_4_1_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, signer, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts index e06cff88a..56ee9d87d 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts @@ -1,4 +1,4 @@ -import { Contract, InterfaceAbi } from 'ethers' +import { AbstractSigner, Contract, InterfaceAbi } from 'ethers' import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' import { SafeVersion } from '@safe-global/safe-core-sdk-types' @@ -26,7 +26,6 @@ abstract class SafeBaseContractEthers< SafeContractAbiType extends InterfaceAbi > extends SafeBaseContract { contract: Contract - adapter: EthersAdapter /** * @constructor @@ -42,7 +41,7 @@ abstract class SafeBaseContractEthers< */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, defaultAbi: SafeContractAbiType, safeVersion: SafeVersion, isL1SafeSingleton = false, @@ -58,8 +57,7 @@ abstract class SafeBaseContractEthers< customContractAbi ) - this.adapter = ethersAdapter - this.contract = new Contract(this.contractAddress, this.contractAbi, this.adapter.getSigner()) + this.contract = new Contract(this.contractAddress, this.contractAbi, signer) } } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts index f3238e92d..766a83190 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts @@ -1,5 +1,4 @@ import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' import { EthersTransactionOptions, EthersTransactionResult @@ -15,6 +14,7 @@ import { } from '@safe-global/protocol-kit/contracts/AbiType/Safe/SafeBaseContract' import { sameString } from '@safe-global/protocol-kit/utils' import { SafeTransaction, SafeTransactionData, SafeVersion } from '@safe-global/safe-core-sdk-types' +import { AbstractSigner } from 'ethers' /** * SafeContract_v1_0_0_Ethers is the implementation specific to the Safe contract version 1.0.0. @@ -41,7 +41,7 @@ class SafeContract_v1_0_0_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, isL1SafeSingleton = false, customContractAddress?: string, customContractAbi?: SafeContract_v1_0_0_Abi @@ -51,7 +51,7 @@ class SafeContract_v1_0_0_Ethers super( chainId, - ethersAdapter, + signer, defaultAbi, safeVersion, isL1SafeSingleton, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts index 56f53ee64..b0bacb419 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts @@ -15,6 +15,7 @@ import { } from '@safe-global/protocol-kit/contracts/AbiType/Safe/SafeBaseContract' import { sameString } from '@safe-global/protocol-kit/utils' import { SafeTransaction, SafeTransactionData, SafeVersion } from '@safe-global/safe-core-sdk-types' +import { AbstractSigner } from 'ethers' /** * SafeContract_v1_1_1_Ethers is the implementation specific to the Safe contract version 1.1.1. @@ -41,7 +42,7 @@ class SafeContract_v1_1_1_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, isL1SafeSingleton = false, customContractAddress?: string, customContractAbi?: SafeContract_v1_1_1_Abi @@ -51,7 +52,7 @@ class SafeContract_v1_1_1_Ethers super( chainId, - ethersAdapter, + signer, defaultAbi, safeVersion, isL1SafeSingleton, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts index 1ea0c1f5c..71e2f8518 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts @@ -14,6 +14,7 @@ import { EncodeSafeFunction, EstimateGasSafeFunction } from '@safe-global/protocol-kit/contracts/AbiType/Safe/SafeBaseContract' +import { AbstractSigner } from 'ethers' /** * SafeContract_v1_2_0_Ethers is the implementation specific to the Safe contract version 1.2.0. @@ -40,7 +41,7 @@ class SafeContract_v1_2_0_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, isL1SafeSingleton = false, customContractAddress?: string, customContractAbi?: SafeContract_v1_2_0_Abi @@ -50,7 +51,7 @@ class SafeContract_v1_2_0_Ethers super( chainId, - ethersAdapter, + signer, defaultAbi, safeVersion, isL1SafeSingleton, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts index 0b4ff2975..fecda4949 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts @@ -15,6 +15,7 @@ import { EncodeSafeFunction, EstimateGasSafeFunction } from '@safe-global/protocol-kit/contracts/AbiType/Safe/SafeBaseContract' +import { AbstractSigner } from 'ethers' /** * SafeContract_v1_3_0_Ethers is the implementation specific to the Safe contract version 1.3.0. @@ -41,7 +42,7 @@ class SafeContract_v1_3_0_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, isL1SafeSingleton = false, customContractAddress?: string, customContractAbi?: SafeContract_v1_3_0_Abi @@ -51,7 +52,7 @@ class SafeContract_v1_3_0_Ethers super( chainId, - ethersAdapter, + signer, defaultAbi, safeVersion, isL1SafeSingleton, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts index a2e60a657..adadb98ed 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts @@ -15,6 +15,7 @@ import { EncodeSafeFunction, EstimateGasSafeFunction } from '@safe-global/protocol-kit/contracts/AbiType/Safe/SafeBaseContract' +import { AbstractSigner } from 'ethers' /** * SafeContract_v1_4_1_Ethers is the implementation specific to the Safe contract version 1.4.1. @@ -41,7 +42,7 @@ class SafeContract_v1_4_1_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, isL1SafeSingleton = false, customContractAddress?: string, customContractAbi?: SafeContract_v1_4_1_Abi @@ -51,7 +52,7 @@ class SafeContract_v1_4_1_Ethers super( chainId, - ethersAdapter, + signer, defaultAbi, safeVersion, isL1SafeSingleton, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts index 33bc1bb8e..63b2aca99 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts @@ -1,4 +1,4 @@ -import { Contract, ContractRunner, InterfaceAbi } from 'ethers' +import { AbstractSigner, Contract, ContractRunner, InterfaceAbi } from 'ethers' import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' import SafeProxyFactoryBaseContract from '@safe-global/protocol-kit/adapters/SafeProxyFactoryBaseContract' @@ -26,7 +26,6 @@ abstract class SafeProxyFactoryBaseContractEthers< SafeProxyFactoryContractAbiType extends InterfaceAbi > extends SafeProxyFactoryBaseContract { contract: Contract - adapter: EthersAdapter /** * @constructor @@ -41,7 +40,7 @@ abstract class SafeProxyFactoryBaseContractEthers< */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, defaultAbi: SafeProxyFactoryContractAbiType, safeVersion: SafeVersion, customContractAddress?: string, @@ -50,12 +49,7 @@ abstract class SafeProxyFactoryBaseContractEthers< ) { super(chainId, defaultAbi, safeVersion, customContractAddress, customContractAbi) - this.adapter = ethersAdapter - this.contract = new Contract( - this.contractAddress, - this.contractAbi, - runner || this.adapter.getSigner() - ) + this.contract = new Contract(this.contractAddress, this.contractAbi, runner || signer) } } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts index 5cbcefc1c..d637ed39c 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts @@ -1,4 +1,4 @@ -import { ContractRunner, EventLog } from 'ethers' +import { AbstractSigner, ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' import { EthersTransactionOptions } from '@safe-global/protocol-kit/adapters/ethers/types' @@ -36,7 +36,7 @@ class SafeProxyFactoryContract_v1_0_0_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, customContractAddress?: string, customContractAbi?: SafeProxyFactoryContract_v1_0_0_Abi, runner?: ContractRunner | null @@ -46,7 +46,7 @@ class SafeProxyFactoryContract_v1_0_0_Ethers super( chainId, - ethersAdapter, + signer, defaultAbi, safeVersion, customContractAddress, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts index fc5c70e02..f3e7089b6 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts @@ -1,4 +1,4 @@ -import { ContractRunner, EventLog } from 'ethers' +import { AbstractSigner, ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' import { EthersTransactionOptions } from '@safe-global/protocol-kit/adapters/ethers/types' @@ -36,7 +36,7 @@ class SafeProxyFactoryContract_v1_1_1_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, customContractAddress?: string, customContractAbi?: SafeProxyFactoryContract_v1_1_1_Abi, runner?: ContractRunner | null @@ -46,7 +46,7 @@ class SafeProxyFactoryContract_v1_1_1_Ethers super( chainId, - ethersAdapter, + signer, defaultAbi, safeVersion, customContractAddress, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts index b2d516176..4210637a7 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts @@ -1,4 +1,4 @@ -import { ContractRunner, EventLog } from 'ethers' +import { AbstractSigner, ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' import { EthersTransactionOptions } from '@safe-global/protocol-kit/adapters/ethers/types' @@ -36,7 +36,7 @@ class SafeProxyFactoryContract_v1_3_0_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, customContractAddress?: string, customContractAbi?: SafeProxyFactoryContract_v1_3_0_Abi, runner?: ContractRunner | null @@ -46,7 +46,7 @@ class SafeProxyFactoryContract_v1_3_0_Ethers super( chainId, - ethersAdapter, + signer, defaultAbi, safeVersion, customContractAddress, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts index bf9ff98fe..ca5fb481a 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts @@ -1,4 +1,4 @@ -import { ContractRunner, EventLog } from 'ethers' +import { AbstractSigner, ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' import { EthersTransactionOptions } from '@safe-global/protocol-kit/adapters/ethers/types' @@ -36,7 +36,7 @@ class SafeProxyFactoryContract_v1_4_1_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, customContractAddress?: string, customContractAbi?: SafeProxyFactoryContract_v1_4_1_Abi, runner?: ContractRunner | null @@ -46,7 +46,7 @@ class SafeProxyFactoryContract_v1_4_1_Ethers super( chainId, - ethersAdapter, + signer, defaultAbi, safeVersion, customContractAddress, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts index bb530db96..eb17acfe8 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts @@ -1,4 +1,4 @@ -import { Contract, InterfaceAbi } from 'ethers' +import { AbstractSigner, Contract, InterfaceAbi } from 'ethers' import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' import { SafeVersion } from '@safe-global/safe-core-sdk-types' @@ -23,7 +23,6 @@ abstract class SignMessageLibBaseContractEthers< SignMessageLibContractAbiType extends InterfaceAbi > extends SignMessageLibBaseContract { contract: Contract - adapter: EthersAdapter /** * @constructor @@ -38,7 +37,7 @@ abstract class SignMessageLibBaseContractEthers< */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, defaultAbi: SignMessageLibContractAbiType, safeVersion: SafeVersion, customContractAddress?: string, @@ -46,8 +45,7 @@ abstract class SignMessageLibBaseContractEthers< ) { super(chainId, defaultAbi, safeVersion, customContractAddress, customContractAbi) - this.adapter = ethersAdapter - this.contract = new Contract(this.contractAddress, this.contractAbi, this.adapter.getSigner()) + this.contract = new Contract(this.contractAddress, this.contractAbi, signer) } } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_V1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_V1_3_0_Ethers.ts index fb1c6e692..81d20b2a4 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_V1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_V1_3_0_Ethers.ts @@ -13,6 +13,7 @@ import { GetAddressSignMessageLibFunction, SignMessageFunction } from '@safe-global/protocol-kit/contracts/AbiType/SignMessageLib/SignMessageLibBaseContract' +import { AbstractSigner } from 'ethers' /** * SignMessageLibContract_v1_3_0_Ethers is the implementation specific to the SignMessageLib contract version 1.3.0. @@ -38,14 +39,14 @@ class SignMessageLibContract_v1_3_0_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, customContractAddress?: string, customContractAbi?: SignMessageLibContract_v1_3_0_Abi ) { const safeVersion = '1.3.0' const defaultAbi = multisend_1_3_0_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, signer, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Ethers.ts index 8ced10de5..43f453ec6 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Ethers.ts @@ -13,6 +13,7 @@ import { GetAddressSignMessageLibFunction, SignMessageFunction } from '@safe-global/protocol-kit/contracts/AbiType/SignMessageLib/SignMessageLibBaseContract' +import { AbstractSigner } from 'ethers' /** * SignMessageLibContract_v1_4_1_Ethers is the implementation specific to the SignMessageLib contract version 1.4.1. @@ -38,14 +39,14 @@ class SignMessageLibContract_v1_4_1_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, customContractAddress?: string, customContractAbi?: SignMessageLibContract_v1_4_1_Abi ) { const safeVersion = '1.4.1' const defaultAbi = multisend_1_4_1_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, signer, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts index 4257a8f19..96b9da8b0 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts @@ -1,4 +1,4 @@ -import { Contract, ContractRunner, InterfaceAbi } from 'ethers' +import { AbstractSigner, Contract, ContractRunner, InterfaceAbi } from 'ethers' import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' import SimulateTxAccessorBaseContract from '@safe-global/protocol-kit/adapters/SimulateTxAccessorBaseContract' @@ -23,7 +23,6 @@ abstract class SimulateTxAccessorBaseContractEthers< SimulateTxAccessorContractAbiType extends InterfaceAbi > extends SimulateTxAccessorBaseContract { contract: Contract - adapter: EthersAdapter /** * @constructor @@ -38,7 +37,7 @@ abstract class SimulateTxAccessorBaseContractEthers< */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, defaultAbi: SimulateTxAccessorContractAbiType, safeVersion: SafeVersion, customContractAddress?: string, @@ -47,12 +46,7 @@ abstract class SimulateTxAccessorBaseContractEthers< ) { super(chainId, defaultAbi, safeVersion, customContractAddress, customContractAbi) - this.adapter = ethersAdapter - this.contract = new Contract( - this.contractAddress, - this.contractAbi, - runner || this.adapter.getSigner() - ) + this.contract = new Contract(this.contractAddress, this.contractAbi, runner || signer) } } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts index 091e21f93..69cb31f90 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts @@ -9,6 +9,7 @@ import { EncodeSimulateTxAccessorFunction, GetAddressSimulateTxAccessorFunction } from '@safe-global/protocol-kit/contracts/AbiType/SimulateTxAccessor/SimulateTxAccessorBaseContract' +import { AbstractSigner } from 'ethers' /** * SimulateTxAccessorContract_v1_3_0_Ethers is the implementation specific to the SimulateTxAccessor contract version 1.3.0. @@ -34,14 +35,14 @@ class SimulateTxAccessorContract_v1_3_0_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, customContractAddress?: string, customContractAbi?: SimulateTxAccessorContract_v1_3_0_Abi ) { const safeVersion = '1.3.0' const defaultAbi = SimulateTxAccessor_1_3_0_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, signer, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts index 19d42e26a..893b1fe06 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts @@ -9,6 +9,7 @@ import { EncodeSimulateTxAccessorFunction, GetAddressSimulateTxAccessorFunction } from '@safe-global/protocol-kit/contracts/AbiType/SimulateTxAccessor/SimulateTxAccessorBaseContract' +import { AbstractSigner } from 'ethers' /** * SimulateTxAccessorContract_v1_4_1_Ethers is the implementation specific to the SimulateTxAccessor contract version 1.4.1. @@ -34,14 +35,14 @@ class SimulateTxAccessorContract_v1_4_1_Ethers */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + signer: AbstractSigner, customContractAddress?: string, customContractAbi?: SimulateTxAccessorContract_v1_4_1_Abi ) { const safeVersion = '1.4.1' const defaultAbi = SimulateTxAccessor_1_4_1_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, signer, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts index a89049087..12bae0271 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts @@ -66,7 +66,7 @@ export async function getSafeContractInstance( case '1.4.1': safeContract = new SafeContract_v1_4_1_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, isL1SafeSingleton, contractAddress, // TODO: Remove this unknown after remove Typechain @@ -77,7 +77,7 @@ export async function getSafeContractInstance( case '1.3.0': safeContract = new SafeContract_v1_3_0_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, isL1SafeSingleton, contractAddress, // TODO: Remove this unknown after remove Typechain @@ -88,7 +88,7 @@ export async function getSafeContractInstance( case '1.2.0': safeContract = new SafeContract_v1_2_0_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, isL1SafeSingleton, contractAddress, // TODO: Remove this unknown after remove Typechain @@ -99,7 +99,7 @@ export async function getSafeContractInstance( case '1.1.1': safeContract = new SafeContract_v1_1_1_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, isL1SafeSingleton, contractAddress, // TODO: Remove this unknown after remove Typechain @@ -110,7 +110,7 @@ export async function getSafeContractInstance( case '1.0.0': safeContract = new SafeContract_v1_0_0_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, isL1SafeSingleton, contractAddress, // TODO: Remove this unknown after remove Typechain @@ -164,14 +164,14 @@ export async function getMultiSendContractInstance( case '1.4.1': return new MultiSendContract_V1_4_1_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as MultiSendContract_v1_4_1_Abi ) case '1.3.0': return new MultiSendContract_V1_3_0_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as MultiSendContract_v1_3_0_Abi ) @@ -180,7 +180,7 @@ export async function getMultiSendContractInstance( case '1.0.0': return new MultiSendContract_V1_1_1_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as MultiSendContract_v1_1_1_Abi ) @@ -200,7 +200,7 @@ export async function getMultiSendCallOnlyContractInstance( case '1.4.1': return new MultiSendCallOnlyContract_V1_4_1_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as MultiSendCallOnlyContract_v1_4_1_Abi ) @@ -210,7 +210,7 @@ export async function getMultiSendCallOnlyContractInstance( case '1.0.0': return new MultiSendCallOnlyContract_V1_3_0_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as MultiSendCallOnlyContract_v1_3_0_Abi ) @@ -232,7 +232,7 @@ export async function getSafeProxyFactoryContractInstance( case '1.4.1': safeProxyFactoryContract = new SafeProxyFactoryContract_v1_4_1_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, contractAddress, // TODO: Remove this unknown after remove Typechain customContractAbi as unknown as SafeProxyFactoryContract_v1_4_1_Abi, @@ -243,7 +243,7 @@ export async function getSafeProxyFactoryContractInstance( case '1.3.0': safeProxyFactoryContract = new SafeProxyFactoryContract_v1_3_0_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, contractAddress, // TODO: Remove this unknown after remove Typechain customContractAbi as unknown as SafeProxyFactoryContract_v1_3_0_Abi, @@ -254,7 +254,7 @@ export async function getSafeProxyFactoryContractInstance( case '1.1.1': safeProxyFactoryContract = new SafeProxyFactoryContract_v1_1_1_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, contractAddress, // TODO: Remove this unknown after remove Typechain customContractAbi as unknown as SafeProxyFactoryContract_v1_1_1_Abi, @@ -264,7 +264,7 @@ export async function getSafeProxyFactoryContractInstance( case '1.0.0': safeProxyFactoryContract = new SafeProxyFactoryContract_v1_0_0_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, contractAddress, // TODO: Remove this unknown after remove Typechain customContractAbi as unknown as SafeProxyFactoryContract_v1_0_0_Abi, @@ -289,7 +289,7 @@ export async function getSignMessageLibContractInstance( case '1.4.1': signMessageLibContract = new SignMessageLibContract_V1_4_1_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as SignMessageLibContract_v1_4_1_Abi ) @@ -299,7 +299,7 @@ export async function getSignMessageLibContractInstance( case '1.3.0': signMessageLibContract = new SignMessageLibContract_V1_3_0_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as SignMessageLibContract_v1_3_0_Abi ) @@ -323,7 +323,7 @@ export async function getCreateCallContractInstance( case '1.4.1': createCallContract = new CreateCallContract_V1_4_1_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as CreateCallContract_v1_4_1_Abi ) @@ -336,7 +336,7 @@ export async function getCreateCallContractInstance( case '1.0.0': createCallContract = new CreateCallContract_V1_3_0_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as CreateCallContract_v1_3_0_Abi ) @@ -360,14 +360,14 @@ export async function getSimulateTxAccessorContractInstance( case '1.4.1': return new SimulateTxAccessorContract_V1_4_1_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as SimulateTxAccessorContract_v1_4_1_Abi ) case '1.3.0': return new SimulateTxAccessorContract_V1_3_0_Ethers( chainId, - ethersAdapter, + (await ethersAdapter.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as SimulateTxAccessorContract_v1_3_0_Abi ) diff --git a/packages/protocol-kit/src/managers/contractManager.ts b/packages/protocol-kit/src/managers/contractManager.ts index b56e54666..265fca698 100644 --- a/packages/protocol-kit/src/managers/contractManager.ts +++ b/packages/protocol-kit/src/managers/contractManager.ts @@ -6,6 +6,7 @@ import { } from '@safe-global/protocol-kit/contracts/safeDeploymentContracts' import { ContractNetworksConfig, SafeConfig } from '@safe-global/protocol-kit/types' import { + EthAdapter, MultiSendCallOnlyContract, MultiSendContract, SafeContract @@ -20,14 +21,14 @@ class ContractManager { #multiSendContract!: MultiSendContract #multiSendCallOnlyContract!: MultiSendCallOnlyContract - static async create(config: SafeConfig): Promise { + static async create(config: SafeConfig, ethAdapter: EthAdapter): Promise { const contractManager = new ContractManager() - await contractManager.init(config) + await contractManager.init(config, ethAdapter) return contractManager } - async init(config: SafeConfig): Promise { - const { ethAdapter, isL1SafeSingleton, contractNetworks, predictedSafe, safeAddress } = config + async init(config: SafeConfig, ethAdapter: EthAdapter): Promise { + const { isL1SafeSingleton, contractNetworks, predictedSafe, safeAddress } = config const chainId = await ethAdapter.getChainId() const customContracts = contractNetworks?.[chainId.toString()] diff --git a/packages/protocol-kit/src/safeFactory/index.ts b/packages/protocol-kit/src/safeFactory/index.ts index e81ccdcaa..a01ebc1de 100644 --- a/packages/protocol-kit/src/safeFactory/index.ts +++ b/packages/protocol-kit/src/safeFactory/index.ts @@ -13,6 +13,7 @@ import { } from '@safe-global/protocol-kit/contracts/utils' import { ContractNetworksConfig, + Eip1193Provider, SafeAccountConfig, SafeDeploymentConfig } from '@safe-global/protocol-kit/types' @@ -23,6 +24,7 @@ import { SafeVersion, TransactionOptions } from '@safe-global/safe-core-sdk-types' +import { EthersAdapter } from '../adapters/ethers' export interface DeploySafeProps { safeAccountConfig: SafeAccountConfig @@ -33,7 +35,7 @@ export interface DeploySafeProps { export interface SafeFactoryConfig { /** ethAdapter - Ethereum adapter */ - ethAdapter: EthAdapter + provider: Eip1193Provider /** safeVersion - Versions of the Safe deployed by this Factory contract */ safeVersion?: SafeVersion /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ @@ -44,7 +46,7 @@ export interface SafeFactoryConfig { interface SafeFactoryInitConfig { /** ethAdapter - Ethereum adapter */ - ethAdapter: EthAdapter + provider: Eip1193Provider /** safeVersion - Versions of the Safe deployed by this Factory contract */ safeVersion: SafeVersion /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ @@ -57,40 +59,42 @@ class SafeFactory { #contractNetworks?: ContractNetworksConfig #isL1SafeSingleton?: boolean #safeVersion!: SafeVersion + #provider!: Eip1193Provider #ethAdapter!: EthAdapter #safeProxyFactoryContract!: SafeProxyFactoryContract #safeContract!: SafeContract static async create({ - ethAdapter, + provider, safeVersion = DEFAULT_SAFE_VERSION, isL1SafeSingleton = false, contractNetworks }: SafeFactoryConfig): Promise { const safeFactorySdk = new SafeFactory() - await safeFactorySdk.init({ ethAdapter, safeVersion, isL1SafeSingleton, contractNetworks }) + await safeFactorySdk.init({ provider, safeVersion, isL1SafeSingleton, contractNetworks }) return safeFactorySdk } private async init({ - ethAdapter, + provider, safeVersion, isL1SafeSingleton, contractNetworks }: SafeFactoryInitConfig): Promise { - this.#ethAdapter = ethAdapter + this.#provider = provider + this.#ethAdapter = new EthersAdapter({ provider }) this.#safeVersion = safeVersion this.#isL1SafeSingleton = isL1SafeSingleton this.#contractNetworks = contractNetworks const chainId = await this.#ethAdapter.getChainId() const customContracts = contractNetworks?.[chainId.toString()] this.#safeProxyFactoryContract = await getProxyFactoryContract({ - ethAdapter, + ethAdapter: this.#ethAdapter, safeVersion, customContracts }) this.#safeContract = await getSafeContract({ - ethAdapter, + ethAdapter: this.#ethAdapter, safeVersion, isL1SafeSingleton, customContracts @@ -177,7 +181,7 @@ class SafeFactory { throw new Error('SafeProxy contract is not deployed on the current network') } const safe = await Safe.create({ - ethAdapter: this.#ethAdapter, + provider: this.#provider, safeAddress, isL1SafeSingleton: this.#isL1SafeSingleton, contractNetworks: this.#contractNetworks diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index 6c785cf19..14c3d8d85 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -1,6 +1,5 @@ import { SafeTransactionOptionalProps } from '@safe-global/protocol-kit/utils/transactions' import { - EthAdapter, MetaTransactionData, SafeContract, SafeTransactionDataPartial, @@ -83,9 +82,18 @@ type SafeConfigWithPredictedSafeProps = { predictedSafe: PredictedSafeProps } +interface RequestArguments { + readonly method: string + readonly params?: readonly unknown[] | object +} + +export interface Eip1193Provider { + request: (args: RequestArguments) => Promise +} + export type SafeConfigProps = { - /** ethAdapter - Ethereum adapter */ - ethAdapter: EthAdapter + /** provider - Compatible EIP-1193 provider */ + provider: Eip1193Provider /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ isL1SafeSingleton?: boolean /** contractNetworks - Contract network configuration */ @@ -111,8 +119,8 @@ type ConnectSafeConfigWithPredictedSafeProps = { } type ConnectSafeConfigProps = { - /** ethAdapter - Ethereum adapter */ - ethAdapter?: EthAdapter + /** provider - Compatible EIP-1193 provider */ + provider?: Eip1193Provider /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ isL1SafeSingleton?: boolean /** contractNetworks - Contract network configuration */ @@ -172,8 +180,8 @@ type StandardizeSafeTxDataWithPredictedSafeProps = { } interface StandardizeSafeTransactionData { - /** ethAdapter - Ethereum adapter */ - ethAdapter: EthAdapter + /** provider - Compatible EIP-1193 provider */ + provider: Eip1193Provider /** tx - Safe transaction */ tx: SafeTransactionDataPartial /** contractNetworks - Contract network configuration */ diff --git a/packages/protocol-kit/src/utils/transactions/gas.ts b/packages/protocol-kit/src/utils/transactions/gas.ts index cd515c588..922509a9e 100644 --- a/packages/protocol-kit/src/utils/transactions/gas.ts +++ b/packages/protocol-kit/src/utils/transactions/gas.ts @@ -490,8 +490,6 @@ async function estimateSafeTxGasWithSimulate( } catch (error: any) { return parseSafeTxGasErrorResponse(error) } - - return '0' } /** diff --git a/packages/protocol-kit/src/utils/transactions/utils.ts b/packages/protocol-kit/src/utils/transactions/utils.ts index cc75401a8..6e95aa3f8 100644 --- a/packages/protocol-kit/src/utils/transactions/utils.ts +++ b/packages/protocol-kit/src/utils/transactions/utils.ts @@ -15,6 +15,7 @@ import { import semverSatisfies from 'semver/functions/satisfies' import { hexToNumber, hexToNumberString, toChecksumAddress } from 'web3-utils' import { estimateGas, estimateTxGas } from './gas' +import { EthersAdapter } from '../..' export function standardizeMetaTransactionData( tx: SafeTransactionDataPartial @@ -29,7 +30,7 @@ export function standardizeMetaTransactionData( export async function standardizeSafeTransactionData({ safeContract, predictedSafe, - ethAdapter, + provider, tx, contractNetworks }: StandardizeSafeTransactionDataProps): Promise { @@ -78,6 +79,8 @@ export async function standardizeSafeTransactionData({ } let safeTxGas + + const ethAdapter = new EthersAdapter({ provider }) if (semverSatisfies(safeVersion, '>=1.3.0')) { safeTxGas = await estimateGas( safeVersion, diff --git a/packages/protocol-kit/tests/e2e/contractManager.test.ts b/packages/protocol-kit/tests/e2e/contractManager.test.ts index 6fc176693..38a962448 100644 --- a/packages/protocol-kit/tests/e2e/contractManager.test.ts +++ b/packages/protocol-kit/tests/e2e/contractManager.test.ts @@ -21,7 +21,7 @@ import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) -describe('Safe contracts manager', () => { +describe.only('Safe contracts manager', () => { const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { await deployments.fixture() const accounts = await getAccounts() @@ -39,7 +39,7 @@ describe('Safe contracts manager', () => { it('should initialize the SDK with a Safe that is not deployed', async () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const predictedSafe: PredictedSafeProps = { safeAccountConfig: { owners: [accounts[0].address], @@ -51,7 +51,7 @@ describe('Safe contracts manager', () => { } chai.expect( await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -61,12 +61,12 @@ describe('Safe contracts manager', () => { it('should fail if the current network is not a default network and no contractNetworks is provided', async () => { const { safe, accounts } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() await chai .expect( Safe.create({ - ethAdapter, + provider, safeAddress }) ) @@ -76,11 +76,11 @@ describe('Safe contracts manager', () => { it('should fail if SafeProxy contract is not deployed on the current network', async () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) await chai .expect( Safe.create({ - ethAdapter, + provider, safeAddress: ZERO_ADDRESS, contractNetworks }) @@ -111,12 +111,12 @@ describe('Safe contracts manager', () => { } } const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() await chai .expect( Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks: customContractNetworks }) @@ -127,10 +127,10 @@ describe('Safe contracts manager', () => { it('should set the MultiSend contract available on the current network', async () => { const { safe, accounts, chainId, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) diff --git a/packages/protocol-kit/tests/e2e/createTransaction.test.ts b/packages/protocol-kit/tests/e2e/createTransaction.test.ts index 4e5717862..91cb60a0f 100644 --- a/packages/protocol-kit/tests/e2e/createTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createTransaction.test.ts @@ -57,10 +57,10 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -71,7 +71,7 @@ describe('Transactions creation', () => { } const safeTxData = await standardizeSafeTransactionData({ safeContract: safeSdk.getContractManager().safeContract as SafeContract, - ethAdapter, + provider, tx: txDataPartial, contractNetworks }) @@ -85,10 +85,10 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -100,7 +100,7 @@ describe('Transactions creation', () => { } const safeTxData = await standardizeSafeTransactionData({ safeContract: safeSdk.getContractManager().safeContract as SafeContract, - ethAdapter, + provider, tx: txDataPartial, contractNetworks }) @@ -114,10 +114,10 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -130,7 +130,7 @@ describe('Transactions creation', () => { } const safeTxData = await standardizeSafeTransactionData({ safeContract: safeSdk.getContractManager().safeContract as SafeContract, - ethAdapter, + provider, tx: txDataPartial, contractNetworks }) @@ -144,10 +144,10 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -158,7 +158,7 @@ describe('Transactions creation', () => { } const safeTxData = await standardizeSafeTransactionData({ safeContract: safeSdk.getContractManager().safeContract as SafeContract, - ethAdapter, + provider, tx: txDataPartial, contractNetworks }) @@ -172,10 +172,10 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -188,7 +188,7 @@ describe('Transactions creation', () => { } const safeTxData = await standardizeSafeTransactionData({ safeContract: safeSdk.getContractManager().safeContract as SafeContract, - ethAdapter, + provider, tx: txDataPartial, contractNetworks }) @@ -202,10 +202,10 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -218,7 +218,7 @@ describe('Transactions creation', () => { } const safeTxData = await standardizeSafeTransactionData({ safeContract: safeSdk.getContractManager().safeContract as SafeContract, - ethAdapter, + provider, tx: txDataPartial, contractNetworks }) @@ -231,9 +231,9 @@ describe('Transactions creation', () => { it('should create a single transaction with gasPrice=0', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -254,10 +254,10 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -285,10 +285,10 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -316,10 +316,10 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -338,10 +338,10 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -367,10 +367,10 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -382,10 +382,10 @@ describe('Transactions creation', () => { const { accounts, contractNetworks, erc20Mintable, chainId } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -418,9 +418,9 @@ describe('Transactions creation', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -462,10 +462,10 @@ describe('Transactions creation', () => { async () => { const { safe, predictedSafe, accounts, contractNetworks } = await setupTests() const account = accounts[0] - const ethAdapter = await getEthAdapter(account.signer) + const provider = await getEthAdapter(account.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) diff --git a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts b/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts index ed4783583..b6a441b22 100644 --- a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts +++ b/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts @@ -1,4 +1,4 @@ -import { Provider, AbstractSigner } from 'ethers' +import { utils, Provider, AbstractSigner, BrowserProvider } from 'ethers' import { EthersAdapter, EthersAdapterConfig, @@ -7,38 +7,24 @@ import { } from '@safe-global/protocol-kit/index' import { EthAdapter } from '@safe-global/safe-core-sdk-types' import { ethers, web3 } from 'hardhat' +import * as hre from 'hardhat' import Web3 from 'web3' import { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers' +import { Eip1193Provider } from '@safe-global/protocol-kit/types' +import { isSignerCompatible } from '@safe-global/protocol-kit/adapters/ethers/utils' +import { HardhatEthersProvider } from '@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider' type Network = 'mainnet' | 'gnosis' | 'zksync' | 'goerli' | 'sepolia' -export async function getEthAdapter( - signerOrProvider: AbstractSigner | Provider | Web3 -): Promise { - let ethAdapter: EthAdapter - switch (process.env.ETH_LIB) { - case 'web3': - const signerAddress = - signerOrProvider instanceof HardhatEthersSigner - ? await signerOrProvider.getAddress() - : undefined +// EIP-1193 methods that require accounts +const accountMethods = ['eth_accounts', 'eth_sign'] - const web3Instance = signerOrProvider instanceof Web3 ? signerOrProvider : web3 - const web3AdapterConfig: Web3AdapterConfig = { web3: web3Instance, signerAddress } - ethAdapter = new Web3Adapter(web3AdapterConfig) - break - case 'ethers': - const ethersAdapterConfig: EthersAdapterConfig = { - ethers, - signerOrProvider: signerOrProvider as Provider - } - ethAdapter = new EthersAdapter(ethersAdapterConfig) - break - default: - throw new Error('Ethereum library not supported') +export async function getEthAdapter(signer: HardhatEthersSigner): Promise { + return { + request: async (request) => { + return signer.provider.send(request.method, request.params as any[]) + } } - - return ethAdapter } export function getNetworkProvider(network: Network): Provider | Web3 { From bdb702c6d078b4d0be2eeb27e8215aa9673b8862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 10 Apr 2024 13:16:08 +0200 Subject: [PATCH 002/112] Initial commit --- .../tests/e2e/contractManager.test.ts | 2 +- packages/protocol-kit/tests/e2e/core.test.ts | 74 ++++---- .../createSafeDeploymentTransaction.test.ts | 40 ++--- .../tests/e2e/createTransactionBatch.test.ts | 4 +- .../e2e/eip1271-contract-signatures.test.ts | 44 ++--- .../protocol-kit/tests/e2e/eip1271.test.ts | 14 +- .../protocol-kit/tests/e2e/erc-20.test.ts | 30 ++-- .../tests/e2e/ethAdapters.test.ts | 32 ++-- .../protocol-kit/tests/e2e/execution.test.ts | 146 ++++++++-------- .../tests/e2e/fallbackHandlerManager.test.ts | 68 ++++---- .../tests/e2e/getEncodedTransaction.test.ts | 12 +- .../tests/e2e/guardManager.test.ts | 64 +++---- .../tests/e2e/moduleManager.test.ts | 72 ++++---- .../tests/e2e/offChainSignatures.test.ts | 64 +++---- .../tests/e2e/onChainSignatures.test.ts | 22 +-- .../tests/e2e/ownerManager.test.ts | 158 +++++++++--------- .../tests/e2e/safeFactory.test.ts | 94 +++++------ .../protocol-kit/tests/e2e/threshold.test.ts | 28 ++-- .../tests/e2e/utilsContracts.test.ts | 90 +++++----- ...SafeTransactionIntoDeploymentBatch.test.ts | 18 +- 20 files changed, 538 insertions(+), 538 deletions(-) diff --git a/packages/protocol-kit/tests/e2e/contractManager.test.ts b/packages/protocol-kit/tests/e2e/contractManager.test.ts index 38a962448..880c78b7e 100644 --- a/packages/protocol-kit/tests/e2e/contractManager.test.ts +++ b/packages/protocol-kit/tests/e2e/contractManager.test.ts @@ -21,7 +21,7 @@ import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) -describe.only('Safe contracts manager', () => { +describe('Safe contracts manager', () => { const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { await deployments.fixture() const accounts = await getAccounts() diff --git a/packages/protocol-kit/tests/e2e/core.test.ts b/packages/protocol-kit/tests/e2e/core.test.ts index e097f7072..a06c3392f 100644 --- a/packages/protocol-kit/tests/e2e/core.test.ts +++ b/packages/protocol-kit/tests/e2e/core.test.ts @@ -43,10 +43,10 @@ describe('Safe Info', () => { async () => { const { predictedSafe, safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -64,10 +64,10 @@ describe('Safe Info', () => { async () => { const { predictedSafe, safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -81,10 +81,10 @@ describe('Safe Info', () => { it('should connect a deployed Safe', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -93,9 +93,9 @@ describe('Safe Info', () => { .expect(await safeSdk.getEthAdapter().getSignerAddress()) .to.be.eq(await account1.signer.getAddress()) - const ethAdapter2 = await getEthAdapter(account2.signer) + const provider2 = await getEthAdapter(account2.signer) const safeSdk2 = await safeSdk.connect({ - ethAdapter: ethAdapter2, + provider: provider2, contractNetworks }) chai.expect(await safeSdk2.getAddress()).to.be.eq(safeAddress) @@ -117,9 +117,9 @@ describe('Safe Info', () => { it('should return the contract version of a Safe that is not deployed with a custom version configuration', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -130,13 +130,13 @@ describe('Safe Info', () => { it('should return the contract version of a Safe that is not deployed with a default version configuration', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeConfig: PredictedSafeProps = { ...predictedSafe, safeDeploymentConfig: {} } const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe: safeConfig, contractNetworks }) @@ -147,10 +147,10 @@ describe('Safe Info', () => { it('should return the Safe contract version', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -165,9 +165,9 @@ describe('Safe Info', () => { async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -185,16 +185,16 @@ describe('Safe Info', () => { async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) const safeAddress = await safeSdk.getAddress() const safeFactory = await SafeFactory.create({ - ethAdapter, + provider, safeVersion: safeVersionDeployed, contractNetworks }) @@ -208,10 +208,10 @@ describe('Safe Info', () => { it('should return the address of a deployed Safe', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -223,10 +223,10 @@ describe('Safe Info', () => { it('should return the connected EthAdapter', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: safeAddress, contractNetworks }) @@ -240,9 +240,9 @@ describe('Safe Info', () => { it('should return the nonce of a Safe that is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -252,11 +252,11 @@ describe('Safe Info', () => { it('should return the Safe nonce', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: safeAddress, contractNetworks }) @@ -278,9 +278,9 @@ describe('Safe Info', () => { it('should return the chainId of a Safe that is not deployed', async () => { const { predictedSafe, accounts, chainId, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -290,10 +290,10 @@ describe('Safe Info', () => { it('should return the chainId of the current network', async () => { const { safe, accounts, chainId, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: safeAddress, contractNetworks }) @@ -307,9 +307,9 @@ describe('Safe Info', () => { async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -326,9 +326,9 @@ describe('Safe Info', () => { async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -344,10 +344,10 @@ describe('Safe Info', () => { it('should return the balance of a deployed Safe', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) diff --git a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts index 6e307d87c..6e82ead20 100644 --- a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts @@ -45,10 +45,10 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -69,10 +69,10 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -93,10 +93,10 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -117,10 +117,10 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -141,10 +141,10 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -165,10 +165,10 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe, chainId } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -199,10 +199,10 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe, chainId } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -224,10 +224,10 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -246,12 +246,12 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const customSaltNonce = '123456789' const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe: { ...predictedSafe, safeDeploymentConfig: { @@ -276,11 +276,11 @@ describe('createSafeDeploymentTransaction', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) diff --git a/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts b/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts index 7c6b4d8f2..eb7a2c191 100644 --- a/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts +++ b/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts @@ -44,11 +44,11 @@ describe('createTransactionBatch', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) diff --git a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts index c7aac7a0c..4b52b1e59 100644 --- a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts @@ -77,14 +77,14 @@ describe('The EIP1271 implementation', () => { // Create adapters and the protocol kit instance const [account1, account2, account3, account4, account5] = accounts - const ethAdapter1 = await getEthAdapter(account1.signer) - const ethAdapter2 = await getEthAdapter(account2.signer) - const ethAdapter3 = await getEthAdapter(account3.signer) - const ethAdapter4 = await getEthAdapter(account4.signer) - const ethAdapter5 = await getEthAdapter(account5.signer) + const provider1 = await getEthAdapter(account1.signer) + const provider2 = await getEthAdapter(account2.signer) + const provider3 = await getEthAdapter(account3.signer) + const provider4 = await getEthAdapter(account4.signer) + const provider5 = await getEthAdapter(account5.signer) let protocolKit = await Safe.create({ - ethAdapter: ethAdapter1, + provider: provider1, safeAddress, contractNetworks }) @@ -102,12 +102,12 @@ describe('The EIP1271 implementation', () => { // EOA signatures tx = await protocolKit.signTransaction(tx) // Owner 1 signature - protocolKit = await protocolKit.connect({ ethAdapter: ethAdapter2 }) // Connect another owner + protocolKit = await protocolKit.connect({ provider: provider2 }) // Connect another owner tx = await protocolKit.signTransaction(tx) // Owner 2 signature // 1/1 Signer Safe signature protocolKit = await protocolKit.connect({ - ethAdapter: ethAdapter3, + provider: provider3, safeAddress: signerSafeAddress1_1 }) let signerSafeTx1_1 = await protocolKit.createTransaction({ @@ -126,7 +126,7 @@ describe('The EIP1271 implementation', () => { // 2/3 Signer Safe signature protocolKit = await protocolKit.connect({ - ethAdapter: ethAdapter4, + provider: provider4, safeAddress: signerSafeAddress2_3 }) let signerSafeTx2_3 = await protocolKit.createTransaction({ @@ -137,7 +137,7 @@ describe('The EIP1271 implementation', () => { SigningMethod.SAFE_SIGNATURE, safeAddress ) - protocolKit = await protocolKit.connect({ ethAdapter: ethAdapter5 }) + protocolKit = await protocolKit.connect({ provider: provider5 }) signerSafeTx2_3 = await protocolKit.signTransaction( signerSafeTx2_3, SigningMethod.SAFE_SIGNATURE, @@ -154,7 +154,7 @@ describe('The EIP1271 implementation', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - protocolKit = await protocolKit.connect({ ethAdapter: ethAdapter1, safeAddress }) + protocolKit = await protocolKit.connect({ provider: provider1, safeAddress }) const execResponse = await protocolKit.executeTransaction(tx) await waitSafeTxReceipt(execResponse) @@ -226,14 +226,14 @@ describe('The EIP1271 implementation', () => { // Create adapters and the protocol kit instance const [account1, account2, account3, account4, account5] = accounts - const ethAdapter1 = await getEthAdapter(account1.signer) - const ethAdapter2 = await getEthAdapter(account2.signer) - const ethAdapter3 = await getEthAdapter(account3.signer) - const ethAdapter4 = await getEthAdapter(account4.signer) - const ethAdapter5 = await getEthAdapter(account5.signer) + const provider1 = await getEthAdapter(account1.signer) + const provider2 = await getEthAdapter(account2.signer) + const provider3 = await getEthAdapter(account3.signer) + const provider4 = await getEthAdapter(account4.signer) + const provider5 = await getEthAdapter(account5.signer) let protocolKit = await Safe.create({ - ethAdapter: ethAdapter1, + provider: provider1, safeAddress, contractNetworks }) @@ -242,12 +242,12 @@ describe('The EIP1271 implementation', () => { // EOA signatures message = await protocolKit.signMessage(message) // Owner 1 signature - protocolKit = await protocolKit.connect({ ethAdapter: ethAdapter2 }) // Connect another owner + protocolKit = await protocolKit.connect({ provider: provider2 }) // Connect another owner message = await protocolKit.signMessage(message) // Owner 2 signature // 1/1 Signer Safe signature protocolKit = await protocolKit.connect({ - ethAdapter: ethAdapter3, + provider: provider3, safeAddress: signerSafeAddress1_1 }) let signerSafeMessage1_1 = protocolKit.createMessage(MESSAGE) @@ -264,7 +264,7 @@ describe('The EIP1271 implementation', () => { // 2/3 Signer Safe signature protocolKit = await protocolKit.connect({ - ethAdapter: ethAdapter4, + provider: provider4, safeAddress: signerSafeAddress2_3 }) let signerSafeMessage2_3 = protocolKit.createMessage(MESSAGE) @@ -273,7 +273,7 @@ describe('The EIP1271 implementation', () => { SigningMethod.SAFE_SIGNATURE, safeAddress ) - protocolKit = await protocolKit.connect({ ethAdapter: ethAdapter5 }) + protocolKit = await protocolKit.connect({ provider: provider5 }) signerSafeMessage2_3 = await protocolKit.signMessage( signerSafeMessage2_3, SigningMethod.SAFE_SIGNATURE, @@ -286,7 +286,7 @@ describe('The EIP1271 implementation', () => { message.addSignature(signerSafeSig2_3) // Connect the original Safe - protocolKit = await protocolKit.connect({ ethAdapter: ethAdapter1, safeAddress }) + protocolKit = await protocolKit.connect({ provider: provider1, safeAddress }) chai.expect( await protocolKit.isValidSignature(hashSafeMessage(MESSAGE), message.encodedSignatures()) diff --git a/packages/protocol-kit/tests/e2e/eip1271.test.ts b/packages/protocol-kit/tests/e2e/eip1271.test.ts index 47f772272..dace09e9d 100644 --- a/packages/protocol-kit/tests/e2e/eip1271.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271.test.ts @@ -66,24 +66,24 @@ describe('The EIP1271 implementation', () => { const safeAddress = await safe.getAddress() // Adapter and Safe instance for owner 1 - const ethAdapter1 = await getEthAdapter(account1.signer) + const provider1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: provider1, safeAddress, contractNetworks }) // Adapter and Safe instance for owner 2 - const ethAdapter2 = await getEthAdapter(account2.signer) + const provider2 = await getEthAdapter(account2.signer) const safeSdk2 = await Safe.create({ - ethAdapter: ethAdapter2, + provider: provider2, safeAddress, contractNetworks }) // Adapter and Safe instance for owner 3 const safeSdk3 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: provider1, safeAddress: signerSafeAddress, contractNetworks }) @@ -96,8 +96,8 @@ describe('The EIP1271 implementation', () => { accounts, contractNetworks, chainId, - ethAdapter1, - ethAdapter2, + provider1, + provider2, safeSdk1, safeSdk2, safeSdk3, diff --git a/packages/protocol-kit/tests/e2e/erc-20.test.ts b/packages/protocol-kit/tests/e2e/erc-20.test.ts index d9018189b..d5a6ea285 100644 --- a/packages/protocol-kit/tests/e2e/erc-20.test.ts +++ b/packages/protocol-kit/tests/e2e/erc-20.test.ts @@ -46,13 +46,13 @@ describe('ERC-20 utils', () => { const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) // mock decimals() call - sinon.stub(ethAdapter, 'call').returns(Promise.resolve('0x12')) + sinon.stub(provider, 'call').returns(Promise.resolve('0x12')) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -71,13 +71,13 @@ describe('ERC-20 utils', () => { const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) // mock decimals() call - sinon.stub(ethAdapter, 'call').returns(Promise.resolve('0x06')) + sinon.stub(provider, 'call').returns(Promise.resolve('0x06')) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -96,13 +96,13 @@ describe('ERC-20 utils', () => { const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) // mock decimals() call sinon.stub(ethAdapter, 'call').returns(Promise.resolve('0x')) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -123,7 +123,7 @@ describe('ERC-20 utils', () => { const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ ethAdapter, @@ -148,13 +148,13 @@ describe('ERC-20 utils', () => { const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) // mock decimals() call - sinon.stub(ethAdapter, 'call').returns(Promise.resolve('0x12')) + sinon.stub(provider, 'call').returns(Promise.resolve('0x12')) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -176,13 +176,13 @@ describe('ERC-20 utils', () => { const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) // mock decimals() call - sinon.stub(ethAdapter, 'call').returns(Promise.resolve('0x06')) + sinon.stub(provider, 'call').returns(Promise.resolve('0x06')) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) diff --git a/packages/protocol-kit/tests/e2e/ethAdapters.test.ts b/packages/protocol-kit/tests/e2e/ethAdapters.test.ts index db74f44b6..f60f70313 100644 --- a/packages/protocol-kit/tests/e2e/ethAdapters.test.ts +++ b/packages/protocol-kit/tests/e2e/ethAdapters.test.ts @@ -41,7 +41,7 @@ describe('Safe contracts', () => { describe('getSafeContract', async () => { it('should return an L1 Safe contract from safe-deployments', async () => { - const ethAdapter = await getEthAdapter(getNetworkProvider('mainnet')) + const provider = await getEthAdapter(getNetworkProvider('mainnet')) const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getSafeContractDeployment(safeVersion, chainId) @@ -55,7 +55,7 @@ describe('Safe contracts', () => { }) it('should return an L2 Safe contract from safe-deployments', async () => { - const ethAdapter = await getEthAdapter(getNetworkProvider('gnosis')) + const provider = await getEthAdapter(getNetworkProvider('gnosis')) const safeVersion: SafeVersion = '1.3.0' const chainId = 100n const singletonDeployment = getSafeContractDeployment(safeVersion, chainId) @@ -69,7 +69,7 @@ describe('Safe contracts', () => { }) it('should return an L1 Safe contract from safe-deployments using the L1 flag', async () => { - const ethAdapter = await getEthAdapter(getNetworkProvider('gnosis')) + const provider = await getEthAdapter(getNetworkProvider('gnosis')) const safeVersion: SafeVersion = '1.3.0' const chainId = 100n const isL1SafeSingleton = true @@ -86,7 +86,7 @@ describe('Safe contracts', () => { it('should return a Safe contract from the custom addresses', async () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const safeContract = await ethAdapter.getSafeContract({ @@ -102,7 +102,7 @@ describe('Safe contracts', () => { describe('getMultiSendContract', async () => { it('should return a MultiSend contract from safe-deployments', async () => { - const ethAdapter = await getEthAdapter(getNetworkProvider('mainnet')) + const provider = await getEthAdapter(getNetworkProvider('mainnet')) const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getMultiSendContractDeployment(safeVersion, chainId) @@ -118,7 +118,7 @@ describe('Safe contracts', () => { it('should return a MultiSend contract from the custom addresses', async () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const multiSendContract = await ethAdapter.getMultiSendContract({ @@ -134,7 +134,7 @@ describe('Safe contracts', () => { describe('getMultiSendCallOnlyContract', async () => { it('should return a MultiSendCallOnly contract from safe-deployments', async () => { - const ethAdapter = await getEthAdapter(getNetworkProvider('mainnet')) + const provider = await getEthAdapter(getNetworkProvider('mainnet')) const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getMultiSendCallOnlyContractDeployment(safeVersion, chainId) @@ -150,7 +150,7 @@ describe('Safe contracts', () => { it('should return a MultiSendCallOnly contract from the custom addresses', async () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const multiSendCallOnlyContract = await ethAdapter.getMultiSendCallOnlyContract({ @@ -166,7 +166,7 @@ describe('Safe contracts', () => { describe('getCompatibilityFallbackHandlerContract', async () => { it('should return a CompatibilityFallbackHandler contract from safe-deployments', async () => { - const ethAdapter = await getEthAdapter(getNetworkProvider('mainnet')) + const provider = await getEthAdapter(getNetworkProvider('mainnet')) const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getCompatibilityFallbackHandlerContractDeployment( @@ -186,7 +186,7 @@ describe('Safe contracts', () => { it('should return a CompatibilityFallbackHandler contract from the custom addresses', async () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const compatibilityFallbackHandlerContract = @@ -203,7 +203,7 @@ describe('Safe contracts', () => { describe('getSafeProxyFactoryContract', async () => { it('should return a SafeProxyFactory contract from safe-deployments', async () => { - const ethAdapter = await getEthAdapter(getNetworkProvider('mainnet')) + const provider = await getEthAdapter(getNetworkProvider('mainnet')) const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getSafeProxyFactoryContractDeployment(safeVersion, chainId) @@ -219,7 +219,7 @@ describe('Safe contracts', () => { it('should return a SafeProxyFactory contract from the custom addresses', async () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const factoryContract = await ethAdapter.getSafeProxyFactoryContract({ @@ -235,7 +235,7 @@ describe('Safe contracts', () => { describe('getSignMessageLibContract', async () => { it('should return a SignMessageLib contract from safe-deployments', async () => { - const ethAdapter = await getEthAdapter(getNetworkProvider('mainnet')) + const provider = await getEthAdapter(getNetworkProvider('mainnet')) const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getSignMessageLibContractDeployment(safeVersion, chainId) @@ -251,7 +251,7 @@ describe('Safe contracts', () => { it('should return a SignMessageLib contract from the custom addresses', async () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const signMessageLibContract = await ethAdapter.getSignMessageLibContract({ @@ -267,7 +267,7 @@ describe('Safe contracts', () => { describe('getCreateCallContract', async () => { it('should return a CreateCall contract from safe-deployments', async () => { - const ethAdapter = await getEthAdapter(getNetworkProvider('mainnet')) + const provider = await getEthAdapter(getNetworkProvider('mainnet')) const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getCreateCallContractDeployment(safeVersion, chainId) @@ -283,7 +283,7 @@ describe('Safe contracts', () => { it('should return a SafeProxyFactory contract from the custom addresses', async () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const createCallContract = await ethAdapter.getCreateCallContract({ diff --git a/packages/protocol-kit/tests/e2e/execution.test.ts b/packages/protocol-kit/tests/e2e/execution.test.ts index 0baf12792..2275df644 100644 --- a/packages/protocol-kit/tests/e2e/execution.test.ts +++ b/packages/protocol-kit/tests/e2e/execution.test.ts @@ -37,15 +37,15 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter1 = await getEthAdapter(account1.signer) + const provider1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: provider1, safeAddress, contractNetworks }) - const ethAdapter2 = await getEthAdapter(account2.signer) + const provider2 = await getEthAdapter(account2.signer) const safeSdk2 = await safeSdk1.connect({ - ethAdapter: ethAdapter2, + provider: provider2, contractNetworks }) await account1.signer.sendTransaction({ @@ -75,9 +75,9 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -105,9 +105,9 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -129,14 +129,14 @@ describe('Transactions execution', () => { const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) - const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ ethAdapter: ethAdapter2 }) + const provider2 = await getEthAdapter(account2.signer) + const safeSdk2 = await safeSdk1.connect({ provider: provider2 }) const safeTransactionData = { to: safeAddress, value: '0', @@ -157,9 +157,9 @@ describe('Transactions execution', () => { const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -179,15 +179,15 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter1 = await getEthAdapter(account1.signer) + const provider1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: provider1, safeAddress, contractNetworks }) - const ethAdapter2 = await getEthAdapter(account2.signer) + const provider2 = await getEthAdapter(account2.signer) const safeSdk2 = await safeSdk1.connect({ - ethAdapter: ethAdapter2, + provider: provider2, contractNetworks }) await account1.signer.sendTransaction({ @@ -215,9 +215,9 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -242,9 +242,9 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -269,9 +269,9 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -310,12 +310,12 @@ describe('Transactions execution', () => { const ethAdapter2 = await getEthAdapter(account2.signer) const ethAdapter3 = await getEthAdapter(account3.signer) const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: ethAdapter1, safeAddress, contractNetworks }) - const safeSdk2 = await safeSdk1.connect({ ethAdapter: ethAdapter2 }) - const safeSdk3 = await safeSdk1.connect({ ethAdapter: ethAdapter3 }) + const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) + const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) const safeInitialBalance = await safeSdk1.getBalance() const safeTransactionData = { to: account2.address, @@ -363,13 +363,13 @@ describe('Transactions execution', () => { const ethAdapter3 = await getEthAdapter(account3.signer) const ethAdapter4 = await getEthAdapter(account4.signer) const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: ethAdapter1, safeAddress, contractNetworks }) - const safeSdk2 = await safeSdk1.connect({ ethAdapter: ethAdapter2 }) - const safeSdk3 = await safeSdk1.connect({ ethAdapter: ethAdapter3 }) - const safeSdk4 = await safeSdk1.connect({ ethAdapter: ethAdapter4 }) + const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) + const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) + const safeSdk4 = await safeSdk1.connect({ provider: ethAdapter4 }) const safeInitialBalance = await safeSdk1.getBalance() const safeTransactionData = { to: account2.address, @@ -422,14 +422,14 @@ describe('Transactions execution', () => { const ethAdapter4 = await getEthAdapter(account4.signer) const ethAdapter5 = await getEthAdapter(account5.signer) const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: ethAdapter1, safeAddress, contractNetworks }) - const safeSdk2 = await safeSdk1.connect({ ethAdapter: ethAdapter2 }) - const safeSdk3 = await safeSdk1.connect({ ethAdapter: ethAdapter3 }) - const safeSdk4 = await safeSdk1.connect({ ethAdapter: ethAdapter4 }) - const safeSdk5 = await safeSdk1.connect({ ethAdapter: ethAdapter5 }) + const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) + const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) + const safeSdk4 = await safeSdk1.connect({ provider: ethAdapter4 }) + const safeSdk5 = await safeSdk1.connect({ provider: ethAdapter5 }) const safeInitialBalance = await safeSdk1.getBalance() const safeTransactionData = { to: account2.address, @@ -487,15 +487,15 @@ describe('Transactions execution', () => { const ethAdapter5 = await getEthAdapter(account5.signer) const ethAdapter6 = await getEthAdapter(account6.signer) const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: ethAdapter1, safeAddress, contractNetworks }) - const safeSdk2 = await safeSdk1.connect({ ethAdapter: ethAdapter2 }) - const safeSdk3 = await safeSdk1.connect({ ethAdapter: ethAdapter3 }) - const safeSdk4 = await safeSdk1.connect({ ethAdapter: ethAdapter4 }) - const safeSdk5 = await safeSdk1.connect({ ethAdapter: ethAdapter5 }) - const safeSdk6 = await safeSdk1.connect({ ethAdapter: ethAdapter6 }) + const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) + const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) + const safeSdk4 = await safeSdk1.connect({ provider: ethAdapter4 }) + const safeSdk5 = await safeSdk1.connect({ provider: ethAdapter5 }) + const safeSdk6 = await safeSdk1.connect({ provider: ethAdapter6 }) const safeInitialBalance = await safeSdk1.getBalance() const safeTransactionData = { to: account2.address, @@ -537,14 +537,14 @@ describe('Transactions execution', () => { const ethAdapter1 = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: ethAdapter1, safeAddress, contractNetworks }) const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ ethAdapter: ethAdapter2 }) + const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) const ethAdapter3 = await getEthAdapter(account3.signer) - const safeSdk3 = await safeSdk1.connect({ ethAdapter: ethAdapter3 }) + const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) await account2.signer.sendTransaction({ to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH @@ -573,9 +573,9 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -592,7 +592,7 @@ describe('Transactions execution', () => { const execOptions: EthersTransactionOptions = { gasLimit: 123456 } const txResponse = await safeSdk1.executeTransaction(tx, execOptions) await waitSafeTxReceipt(txResponse) - const txConfirmed = await ethAdapter.getTransaction(txResponse.hash) + const txConfirmed = await provider.getTransaction(txResponse.hash) chai.expect(execOptions.gasLimit).to.be.eq(Number(txConfirmed.gasLimit)) } ) @@ -604,9 +604,9 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -626,7 +626,7 @@ describe('Transactions execution', () => { } const txResponse = await safeSdk1.executeTransaction(tx, execOptions) await waitSafeTxReceipt(txResponse) - const txConfirmed = await ethAdapter.getTransaction(txResponse.hash) + const txConfirmed = await provider.getTransaction(txResponse.hash) chai.expect(execOptions.gasPrice).to.be.eq(Number(txConfirmed.gasPrice)) chai.expect(execOptions.gasLimit).to.be.eq(Number(txConfirmed.gasLimit)) } @@ -639,9 +639,9 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -661,7 +661,7 @@ describe('Transactions execution', () => { } const txResponse = await safeSdk1.executeTransaction(tx, execOptions) await waitSafeTxReceipt(txResponse) - const txConfirmed = await ethAdapter.getTransaction(txResponse.hash) + const txConfirmed = await provider.getTransaction(txResponse.hash) chai.expect(BigInt(execOptions.maxFeePerGas)).to.be.eq(txConfirmed.maxFeePerGas) chai .expect(BigInt(execOptions.maxPriorityFeePerGas)) @@ -676,9 +676,9 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -695,7 +695,7 @@ describe('Transactions execution', () => { const execOptions: Web3TransactionOptions = { gas: 123456 } const txResponse = await safeSdk1.executeTransaction(tx, execOptions) await waitSafeTxReceipt(txResponse) - const txConfirmed = await ethAdapter.getTransaction(txResponse.hash) + const txConfirmed = await provider.getTransaction(txResponse.hash) chai.expect(execOptions.gas).to.be.eq(txConfirmed.gas) } ) @@ -707,9 +707,9 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -729,7 +729,7 @@ describe('Transactions execution', () => { } const txResponse = await safeSdk1.executeTransaction(tx, execOptions) await waitSafeTxReceipt(txResponse) - const txConfirmed = await ethAdapter.getTransaction(txResponse.hash) + const txConfirmed = await provider.getTransaction(txResponse.hash) chai.expect(execOptions.gasPrice).to.be.eq(Number(txConfirmed.gasPrice)) chai.expect(execOptions.gas).to.be.eq(txConfirmed.gas) } @@ -742,9 +742,9 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -764,7 +764,7 @@ describe('Transactions execution', () => { } const txResponse = await safeSdk1.executeTransaction(tx, execOptions) await waitSafeTxReceipt(txResponse) - const txConfirmed = await ethAdapter.getTransaction(txResponse.hash) + const txConfirmed = await provider.getTransaction(txResponse.hash) chai.expect(BigInt(execOptions.maxFeePerGas)).to.be.eq(BigInt(txConfirmed.maxFeePerGas)) chai .expect(BigInt(execOptions.maxPriorityFeePerGas)) @@ -777,9 +777,9 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -792,12 +792,12 @@ describe('Transactions execution', () => { value: '500000000000000000', // 0.5 ETH data: '0x' } - const currentNonce = await ethAdapter.getNonce(account1.address, 'pending') + const currentNonce = await provider.getNonce(account1.address, 'pending') const tx = await safeSdk1.createTransaction({ transactions: [safeTransactionData] }) const execOptions: EthersTransactionOptions = { nonce: currentNonce } const txResponse = await safeSdk1.executeTransaction(tx, execOptions) await waitSafeTxReceipt(txResponse) - const txConfirmed = await ethAdapter.getTransaction(txResponse.hash) + const txConfirmed = await provider.getTransaction(txResponse.hash) chai.expect(execOptions.nonce).to.be.eq(txConfirmed.nonce) }) }) @@ -810,14 +810,14 @@ describe('Transactions execution', () => { const safeAddress = await safe.getAddress() const ethAdapter1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: ethAdapter1, safeAddress, contractNetworks }) const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ ethAdapter: ethAdapter2 }) + const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) const ethAdapter3 = await getEthAdapter(account3.signer) - const safeSdk3 = await safeSdk1.connect({ ethAdapter: ethAdapter3 }) + const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) await account1.signer.sendTransaction({ to: safeAddress, value: 2_000_000_000_000_000_000n // 2 ETH @@ -855,14 +855,14 @@ describe('Transactions execution', () => { const safeAddress = await safe.getAddress() const ethAdapter1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: ethAdapter1, safeAddress, contractNetworks }) const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ ethAdapter: ethAdapter2 }) + const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) const ethAdapter3 = await getEthAdapter(account3.signer) - const safeSdk3 = await safeSdk1.connect({ ethAdapter: ethAdapter3 }) + const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) await erc20Mintable.mint(safeAddress, '1200000000000000000') // 1.2 ERC20 const safeInitialERC20Balance = await erc20Mintable.balanceOf(safeAddress) diff --git a/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts b/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts index 3adcc3159..caa0048f2 100644 --- a/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts @@ -51,9 +51,9 @@ describe('Fallback handler manager', () => { const { safe, accounts, contractNetworks } = await setupTests() const safeAddress = await safe.getAddress() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -69,9 +69,9 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -81,10 +81,10 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')('should return the enabled fallback handler', async () => { const { safe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -110,9 +110,9 @@ describe('Fallback handler manager', () => { const { predictedSafe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -131,9 +131,9 @@ describe('Fallback handler manager', () => { const { predictedSafe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -147,10 +147,10 @@ describe('Fallback handler manager', () => { async () => { const { safe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -166,10 +166,10 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')('should fail if address is invalid', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -182,10 +182,10 @@ describe('Fallback handler manager', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -197,10 +197,10 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')('should fail if address is already enabled', async () => { const { safe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -218,10 +218,10 @@ describe('Fallback handler manager', () => { async () => { const { safe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -249,10 +249,10 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')('should enable a fallback handler', async () => { const { safe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -277,9 +277,9 @@ describe('Fallback handler manager', () => { async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -298,9 +298,9 @@ describe('Fallback handler manager', () => { const { predictedSafe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -316,9 +316,9 @@ describe('Fallback handler manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -336,10 +336,10 @@ describe('Fallback handler manager', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -361,9 +361,9 @@ describe('Fallback handler manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -399,9 +399,9 @@ describe('Fallback handler manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) diff --git a/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts b/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts index 1f4056ec6..db85b2616 100644 --- a/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts @@ -26,10 +26,10 @@ describe('getEncodedTransaction', () => { const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -57,10 +57,10 @@ describe('getEncodedTransaction', () => { const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -88,10 +88,10 @@ describe('getEncodedTransaction', () => { const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) diff --git a/packages/protocol-kit/tests/e2e/guardManager.test.ts b/packages/protocol-kit/tests/e2e/guardManager.test.ts index 1d723acf5..070a4eee2 100644 --- a/packages/protocol-kit/tests/e2e/guardManager.test.ts +++ b/packages/protocol-kit/tests/e2e/guardManager.test.ts @@ -46,10 +46,10 @@ describe('Safe guard manager', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -65,9 +65,9 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -79,10 +79,10 @@ describe('Safe guard manager', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -93,10 +93,10 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')('should return the enabled Safe guard', async () => { const { safe, accounts, contractNetworks, debugTransactionGuard } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -114,10 +114,10 @@ describe('Safe guard manager', () => { async () => { const { safe, accounts, contractNetworks, debugTransactionGuard } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -134,9 +134,9 @@ describe('Safe guard manager', () => { const { predictedSafe, accounts, debugTransactionGuard, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -147,10 +147,10 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')('should fail if address is invalid', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -163,10 +163,10 @@ describe('Safe guard manager', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -178,10 +178,10 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')('should fail if address is already enabled', async () => { const { safe, accounts, contractNetworks, debugTransactionGuard } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -197,10 +197,10 @@ describe('Safe guard manager', () => { async () => { const { safe, accounts, contractNetworks, debugTransactionGuard } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -228,10 +228,10 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')('should enable a Safe guard', async () => { const { safe, accounts, contractNetworks, debugTransactionGuard } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -250,10 +250,10 @@ describe('Safe guard manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -269,9 +269,9 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')('should fail if the Safe is not deployed', async () => { const { accounts, predictedSafe, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -282,10 +282,10 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')('should fail if no Safe guard is enabled', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -300,9 +300,9 @@ describe('Safe guard manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -333,9 +333,9 @@ describe('Safe guard manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) diff --git a/packages/protocol-kit/tests/e2e/moduleManager.test.ts b/packages/protocol-kit/tests/e2e/moduleManager.test.ts index 2bfe5772f..bbba16a50 100644 --- a/packages/protocol-kit/tests/e2e/moduleManager.test.ts +++ b/packages/protocol-kit/tests/e2e/moduleManager.test.ts @@ -48,9 +48,9 @@ describe('Safe modules manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -60,10 +60,10 @@ describe('Safe modules manager', () => { it('should return all the enabled modules', async () => { const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -79,9 +79,9 @@ describe('Safe modules manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -92,10 +92,10 @@ describe('Safe modules manager', () => { it('should return true if a module is enabled', async () => { const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -111,9 +111,9 @@ describe('Safe modules manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -124,10 +124,10 @@ describe('Safe modules manager', () => { it('should fail if address is invalid', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -138,10 +138,10 @@ describe('Safe modules manager', () => { it('should fail if address is equal to sentinel', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -152,10 +152,10 @@ describe('Safe modules manager', () => { it('should fail if address is equal to 0x address', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -166,10 +166,10 @@ describe('Safe modules manager', () => { it('should fail if address is already enabled', async () => { const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -183,10 +183,10 @@ describe('Safe modules manager', () => { it('should build the transaction with the optional props', async () => { const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -210,10 +210,10 @@ describe('Safe modules manager', () => { it('should enable a Safe module', async () => { const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -231,9 +231,9 @@ describe('Safe modules manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -244,10 +244,10 @@ describe('Safe modules manager', () => { it('should fail if address is invalid', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -258,10 +258,10 @@ describe('Safe modules manager', () => { it('should fail if address is equal to sentinel', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -272,10 +272,10 @@ describe('Safe modules manager', () => { it('should fail if address is equal to 0x address', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -286,10 +286,10 @@ describe('Safe modules manager', () => { it('should fail if address is not enabled', async () => { const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -302,9 +302,9 @@ describe('Safe modules manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -338,9 +338,9 @@ describe('Safe modules manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) diff --git a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts index 5d463c998..6202b06b2 100644 --- a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts @@ -39,9 +39,9 @@ describe('Off-chain signatures', () => { it('should sign a transaction hash with the current signer if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -53,10 +53,10 @@ describe('Off-chain signatures', () => { it('should sign a transaction hash with the current signer', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -78,15 +78,15 @@ describe('Off-chain signatures', () => { async () => { const { safe, predictedSafe, accounts, contractNetworks } = await setupTests() const account = accounts[0] - const ethAdapter = await getEthAdapter(account.signer) + const provider = await getEthAdapter(account.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) const safeAddress = await safe.getAddress() const safeSdkExistingSafe = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -112,9 +112,9 @@ describe('Off-chain signatures', () => { async () => { const { safe, predictedSafe, accounts, contractNetworks } = await setupTests() const account = accounts[0] - const ethAdapter = await getEthAdapter(account.signer) + const provider = await getEthAdapter(account.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -135,10 +135,10 @@ describe('Off-chain signatures', () => { it('should fail if the signature is added by an account that is not an owner', async () => { const { safe, accounts, contractNetworks } = await setupTests() const account3 = accounts[2] - const ethAdapter = await getEthAdapter(account3.signer) + const provider = await getEthAdapter(account3.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -156,10 +156,10 @@ describe('Off-chain signatures', () => { it('should ignore duplicated signatures', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -182,10 +182,10 @@ describe('Off-chain signatures', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: safeAddress, contractNetworks }) @@ -206,10 +206,10 @@ describe('Off-chain signatures', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -231,10 +231,10 @@ describe('Off-chain signatures', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -256,10 +256,10 @@ describe('Off-chain signatures', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -280,10 +280,10 @@ describe('Off-chain signatures', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -305,10 +305,10 @@ describe('Off-chain signatures', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -327,10 +327,10 @@ describe('Off-chain signatures', () => { it('should add the signature of the current signer using eth_signTypedData_v4', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -349,10 +349,10 @@ describe('Off-chain signatures', () => { it('should add the signature of the current signer using eth_signTypedData_v4 by default', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -371,10 +371,10 @@ describe('Off-chain signatures', () => { it('should sign a transaction received from the Safe Transaction Service', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -429,7 +429,7 @@ describe('Off-chain signatures', () => { const signedTx = await safeSdk.signTransaction(safeServiceTransaction) chai.expect(safeServiceTransaction.confirmations?.length).to.be.eq(2) chai.expect(signedTx.signatures.size).to.be.eq(3) - const signerAddress = await ethAdapter.getSignerAddress() + const signerAddress = await provider.getSignerAddress() const signerSignature = signedTx.signatures.get(signerAddress!.toLowerCase())?.data chai .expect(signedTx.encodedSignatures()) diff --git a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts index dfbe38e61..9d2ee79cb 100644 --- a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts @@ -38,9 +38,9 @@ describe('On-chain signatures', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -53,10 +53,10 @@ describe('On-chain signatures', () => { it('should fail if a transaction hash is approved by an account that is not an owner', async () => { const { safe, accounts, contractNetworks } = await setupTests() const account3 = accounts[2] - const ethAdapter = await getEthAdapter(account3.signer) + const provider = await getEthAdapter(account3.signer) const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -75,10 +75,10 @@ describe('On-chain signatures', () => { it('should approve the transaction hash', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -97,10 +97,10 @@ describe('On-chain signatures', () => { it('should ignore a duplicated signatures', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -127,7 +127,7 @@ describe('On-chain signatures', () => { const [account1] = accounts const ethAdapter1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: ethAdapter1, predictedSafe, contractNetworks }) @@ -142,12 +142,12 @@ describe('On-chain signatures', () => { const ethAdapter1 = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: ethAdapter1, safeAddress: safeAddress, contractNetworks }) const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ ethAdapter: ethAdapter2 }) + const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) const safeTransactionData = { to: safeAddress, value: '0', diff --git a/packages/protocol-kit/tests/e2e/ownerManager.test.ts b/packages/protocol-kit/tests/e2e/ownerManager.test.ts index 801428580..e54405ff8 100644 --- a/packages/protocol-kit/tests/e2e/ownerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/ownerManager.test.ts @@ -46,9 +46,9 @@ describe('Safe owners manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -59,9 +59,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address, account2.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -76,9 +76,9 @@ describe('Safe owners manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -89,9 +89,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -103,9 +103,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -118,9 +118,9 @@ describe('Safe owners manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -132,9 +132,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -146,9 +146,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -160,9 +160,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -174,9 +174,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -188,9 +188,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -208,9 +208,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -222,9 +222,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -249,9 +249,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -274,9 +274,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -302,9 +302,9 @@ describe('Safe owners manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -315,9 +315,9 @@ describe('Safe owners manager', () => { it('should fail if address is invalid', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -328,9 +328,9 @@ describe('Safe owners manager', () => { it('should fail if address is equal to sentinel', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -341,9 +341,9 @@ describe('Safe owners manager', () => { it('should fail if address is equal to 0x address', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -354,9 +354,9 @@ describe('Safe owners manager', () => { it('should fail if address is not an owner', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, , , account4] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -367,9 +367,9 @@ describe('Safe owners manager', () => { it('should fail if the threshold is bigger than the number of owners', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -386,9 +386,9 @@ describe('Safe owners manager', () => { it('should fail if the threshold is not bigger than 0', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -401,7 +401,7 @@ describe('Safe owners manager', () => { const [account1] = accounts const ethAdapter1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: ethAdapter1, safeAddress: await safe.getAddress(), contractNetworks }) @@ -427,14 +427,14 @@ describe('Safe owners manager', () => { const [account1, account2, account3] = accounts const ethAdapter1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: ethAdapter1, safeAddress: await safe.getAddress(), contractNetworks }) const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ ethAdapter: ethAdapter2 }) + const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) const ethAdapter3 = await getEthAdapter(account3.signer) - const safeSdk3 = await safeSdk1.connect({ ethAdapter: ethAdapter3 }) + const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) const initialThreshold = await safeSdk1.getThreshold() const initialOwners = await safeSdk1.getOwners() chai.expect(initialOwners.length).to.be.eq(3) @@ -459,15 +459,15 @@ describe('Safe owners manager', () => { const [account1, account2, account3] = accounts const ethAdapter1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: ethAdapter1, safeAddress: await safe.getAddress(), contractNetworks }) const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ ethAdapter: ethAdapter2 }) + const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) const ethAdapter3 = await getEthAdapter(account3.signer) const safeSdk3 = await safeSdk1.connect({ - ethAdapter: ethAdapter3, + provider: ethAdapter3, contractNetworks }) const initialThreshold = await safeSdk1.getThreshold() @@ -494,14 +494,14 @@ describe('Safe owners manager', () => { const [account1, account2, account3] = accounts const ethAdapter1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: ethAdapter1, safeAddress: await safe.getAddress(), contractNetworks }) const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ ethAdapter: ethAdapter2 }) + const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) const ethAdapter3 = await getEthAdapter(account3.signer) - const safeSdk3 = await safeSdk1.connect({ ethAdapter: ethAdapter3 }) + const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) const newThreshold = 1 const initialOwners = await safeSdk1.getOwners() chai.expect(initialOwners.length).to.be.eq(3) @@ -528,9 +528,9 @@ describe('Safe owners manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -545,9 +545,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -562,9 +562,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -579,9 +579,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -596,9 +596,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -613,9 +613,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -630,9 +630,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -647,9 +647,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2, , account4] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -664,9 +664,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -681,9 +681,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -711,9 +711,9 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -736,14 +736,14 @@ describe('Safe owners manager', () => { const [account1, account2, account3, account4] = accounts const ethAdapter1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - ethAdapter: ethAdapter1, + provider: ethAdapter1, safeAddress: await safe.getAddress(), contractNetworks }) const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ ethAdapter: ethAdapter2 }) + const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) const ethAdapter3 = await getEthAdapter(account3.signer) - const safeSdk3 = await safeSdk1.connect({ ethAdapter: ethAdapter3 }) + const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) const initialOwners = await safeSdk1.getOwners() chai.expect(initialOwners.length).to.be.eq(3) chai.expect(initialOwners[0]).to.be.eq(account1.address) diff --git a/packages/protocol-kit/tests/e2e/safeFactory.test.ts b/packages/protocol-kit/tests/e2e/safeFactory.test.ts index 6d4d3c3bb..07d60029a 100644 --- a/packages/protocol-kit/tests/e2e/safeFactory.test.ts +++ b/packages/protocol-kit/tests/e2e/safeFactory.test.ts @@ -46,16 +46,16 @@ describe('SafeProxyFactory', () => { it('should fail if the current network is not a default network and no contractNetworks is provided', async () => { const { accounts } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) chai - .expect(SafeFactory.create({ ethAdapter })) + .expect(SafeFactory.create({ provider })) .rejectedWith('Invalid SafeProxyFactory contract') }) it('should fail if the contractNetworks provided are not deployed', async () => { const { accounts, chainId } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const contractNetworks: ContractNetworksConfig = { [chainId.toString()]: { safeSingletonAddress: ZERO_ADDRESS, @@ -77,16 +77,16 @@ describe('SafeProxyFactory', () => { } } chai - .expect(SafeFactory.create({ ethAdapter, contractNetworks })) + .expect(SafeFactory.create({ provider, contractNetworks })) .rejectedWith('SafeProxyFactory contract is not deployed on the current network') }) it('should instantiate the SafeProxyFactory', async () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) - const safeFactory = await SafeFactory.create({ ethAdapter, contractNetworks }) - const networkId = await ethAdapter.getChainId() + const provider = await getEthAdapter(account1.signer) + const safeFactory = await SafeFactory.create({ provider, contractNetworks }) + const networkId = await provider.getChainId() chai .expect(await safeFactory.getAddress()) .to.be.eq(contractNetworks[networkId].safeProxyFactoryAddress) @@ -97,8 +97,8 @@ describe('SafeProxyFactory', () => { it('should return the connected EthAdapter', async () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) - const safeFactory = await SafeFactory.create({ ethAdapter, contractNetworks }) + const provider = await getEthAdapter(account1.signer) + const safeFactory = await SafeFactory.create({ provider, contractNetworks }) chai .expect(await safeFactory.getEthAdapter().getSignerAddress()) .to.be.eq(await account1.signer.getAddress()) @@ -109,8 +109,8 @@ describe('SafeProxyFactory', () => { it('should return the chainId of the current network', async () => { const { accounts, chainId, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) - const safeFactory = await SafeFactory.create({ ethAdapter, contractNetworks }) + const provider = await getEthAdapter(account1.signer) + const safeFactory = await SafeFactory.create({ provider, contractNetworks }) chai.expect(await safeFactory.getChainId()).to.be.eq(chainId) }) }) @@ -119,8 +119,8 @@ describe('SafeProxyFactory', () => { it('should fail if there are no owners', async () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) - const safeFactory = await SafeFactory.create({ ethAdapter, contractNetworks }) + const provider = await getEthAdapter(account1.signer) + const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners: string[] = [] const threshold = 2 const safeAccountConfig: SafeAccountConfig = { owners, threshold } @@ -134,8 +134,8 @@ describe('SafeProxyFactory', () => { it('should fail if the threshold is lower than 0', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) - const safeFactory = await SafeFactory.create({ ethAdapter, contractNetworks }) + const provider = await getEthAdapter(account1.signer) + const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const invalidThreshold = 0 const safeAccountConfig: SafeAccountConfig = { owners, threshold: invalidThreshold } @@ -149,8 +149,8 @@ describe('SafeProxyFactory', () => { it('should fail if the threshold is higher than the threshold', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) - const safeFactory = await SafeFactory.create({ ethAdapter, contractNetworks }) + const provider = await getEthAdapter(account1.signer) + const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const invalidThreshold = 3 const safeAccountConfig: SafeAccountConfig = { owners, threshold: invalidThreshold } @@ -164,9 +164,9 @@ describe('SafeProxyFactory', () => { it('should fail if the saltNonce is lower than 0', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeFactory = await SafeFactory.create({ - ethAdapter, + provider, safeVersion: safeVersionDeployed, contractNetworks }) @@ -183,9 +183,9 @@ describe('SafeProxyFactory', () => { it('should predict a new Safe with saltNonce', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeFactory = await SafeFactory.create({ - ethAdapter, + provider, safeVersion: safeVersionDeployed, contractNetworks }) @@ -210,9 +210,9 @@ describe('SafeProxyFactory', () => { async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeFactory = await SafeFactory.create({ - ethAdapter, + provider, safeVersion: safeVersionDeployed, contractNetworks }) @@ -239,9 +239,9 @@ describe('SafeProxyFactory', () => { async () => { const { accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeFactory = await SafeFactory.create({ - ethAdapter, + provider, safeVersion: safeVersionDeployed, contractNetworks }) @@ -271,8 +271,8 @@ describe('SafeProxyFactory', () => { it('should fail if there are no owners', async () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) - const safeFactory = await SafeFactory.create({ ethAdapter, contractNetworks }) + const provider = await getEthAdapter(account1.signer) + const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners: string[] = [] const threshold = 2 const safeAccountConfig: SafeAccountConfig = { owners, threshold } @@ -285,8 +285,8 @@ describe('SafeProxyFactory', () => { it('should fail if the threshold is lower than 0', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) - const safeFactory = await SafeFactory.create({ ethAdapter, contractNetworks }) + const provider = await getEthAdapter(account1.signer) + const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const threshold = 0 const safeAccountConfig: SafeAccountConfig = { owners, threshold } @@ -299,8 +299,8 @@ describe('SafeProxyFactory', () => { it('should fail if the threshold is higher than the threshold', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) - const safeFactory = await SafeFactory.create({ ethAdapter, contractNetworks }) + const provider = await getEthAdapter(account1.signer) + const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const threshold = 3 const safeAccountConfig: SafeAccountConfig = { owners, threshold } @@ -313,9 +313,9 @@ describe('SafeProxyFactory', () => { it('should fail if the saltNonce is lower than 0', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeFactory = await SafeFactory.create({ - ethAdapter, + provider, safeVersion: safeVersionDeployed, contractNetworks }) @@ -334,9 +334,9 @@ describe('SafeProxyFactory', () => { async () => { const { accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeFactory = await SafeFactory.create({ - ethAdapter, + provider, safeVersion: safeVersionDeployed, contractNetworks }) @@ -363,9 +363,9 @@ describe('SafeProxyFactory', () => { async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeFactory = await SafeFactory.create({ - ethAdapter, + provider, safeVersion: safeVersionDeployed, contractNetworks }) @@ -385,9 +385,9 @@ describe('SafeProxyFactory', () => { it('should deploy a new Safe without saltNonce', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeFactory = await SafeFactory.create({ - ethAdapter, + provider, safeVersion: safeVersionDeployed, contractNetworks }) @@ -405,9 +405,9 @@ describe('SafeProxyFactory', () => { it('should deploy a new Safe with saltNonce', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeFactory = await SafeFactory.create({ - ethAdapter, + provider, safeVersion: safeVersionDeployed, contractNetworks }) @@ -430,9 +430,9 @@ describe('SafeProxyFactory', () => { const callback = (txHash: string) => { callbackResult = txHash } - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeFactory = await SafeFactory.create({ - ethAdapter, + provider, safeVersion: safeVersionDeployed, contractNetworks }) @@ -452,8 +452,8 @@ describe('SafeProxyFactory', () => { async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) - const safeFactory = await SafeFactory.create({ ethAdapter, contractNetworks }) + const provider = await getEthAdapter(account1.signer) + const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const threshold = 2 const safeAccountConfig: SafeAccountConfig = { owners, threshold } @@ -467,9 +467,9 @@ describe('SafeProxyFactory', () => { it('should deploy a specific Safe version', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeFactory = await SafeFactory.create({ - ethAdapter, + provider, safeVersion: safeVersionDeployed, contractNetworks }) diff --git a/packages/protocol-kit/tests/e2e/threshold.test.ts b/packages/protocol-kit/tests/e2e/threshold.test.ts index 7397ad20f..e88557575 100644 --- a/packages/protocol-kit/tests/e2e/threshold.test.ts +++ b/packages/protocol-kit/tests/e2e/threshold.test.ts @@ -41,9 +41,9 @@ describe('Safe Threshold', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -53,9 +53,9 @@ describe('Safe Threshold', () => { it('should return the Safe threshold', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -67,9 +67,9 @@ describe('Safe Threshold', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -82,9 +82,9 @@ describe('Safe Threshold', () => { it('should fail if the threshold is bigger than the number of owners', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -99,9 +99,9 @@ describe('Safe Threshold', () => { it('should fail if the threshold is not bigger than 0', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -115,9 +115,9 @@ describe('Safe Threshold', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address, account2.address], 1) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -144,9 +144,9 @@ describe('Safe Threshold', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address, account2.address], 1) - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress: await safe.getAddress(), contractNetworks }) diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index 74b01790a..273df6589 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -13,20 +13,20 @@ import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/de import { SafeDeploymentConfig, SafeAccountConfig, - ContractNetworksConfig + ContractNetworksConfig, + Eip1193Provider } from '@safe-global/protocol-kit/types' import Safe, { SafeFactory, DeploySafeProps } from '@safe-global/protocol-kit/index' -import { EthAdapter } from '@safe-global/safe-core-sdk-types' import { itif } from './utils/helpers' // test util funcion to deploy a safe (needed to check the expected Safe Address) async function deploySafe( deploySafeProps: DeploySafeProps, - ethAdapter: EthAdapter, + provider: Eip1193Provider, contractNetworks: ContractNetworksConfig ): Promise { const safeFactory = await SafeFactory.create({ - ethAdapter, + provider, safeVersion: safeVersionDeployed, contractNetworks }) @@ -57,7 +57,7 @@ describe('Contract utils', () => { const owners = [owner1.address] const threshold = 1 const safeVersion = safeVersionDeployed - const ethAdapter = await getEthAdapter(owner1.signer) + const provider = await getEthAdapter(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -71,7 +71,7 @@ describe('Contract utils', () => { } const predictedSafeAddress = await predictSafeAddress({ - ethAdapter, + provider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -81,7 +81,7 @@ describe('Contract utils', () => { // we deploy the Safe with the given configuration and the deployed Safe address should be equal to the predicted one const deployedSafe = await deploySafe( { safeAccountConfig, saltNonce: safeDeploymentConfig.saltNonce }, - ethAdapter, + provider, contractNetworks ) @@ -101,7 +101,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const threshold = 1 const safeVersion = safeVersionDeployed - const ethAdapter = await getEthAdapter(owner1.signer) + const provider = await getEthAdapter(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -115,7 +115,7 @@ describe('Contract utils', () => { } const predictedSafeAddress = await predictSafeAddress({ - ethAdapter, + provider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -125,7 +125,7 @@ describe('Contract utils', () => { // we deploy the Safe with the given configuration and the deployed Safe address should be equal to the predicted one const deployedSafe = await deploySafe( { safeAccountConfig, saltNonce: safeDeploymentConfig.saltNonce }, - ethAdapter, + provider, contractNetworks ) @@ -145,7 +145,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const threshold = 2 const safeVersion = safeVersionDeployed - const ethAdapter = await getEthAdapter(owner1.signer) + const provider = await getEthAdapter(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -159,7 +159,7 @@ describe('Contract utils', () => { } const predictedSafeAddress = await predictSafeAddress({ - ethAdapter, + provider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -169,7 +169,7 @@ describe('Contract utils', () => { // we deploy the Safe with the given configuration and the deployed Safe address should be equal to the predicted one const deployedSafe = await deploySafe( { safeAccountConfig, saltNonce: safeDeploymentConfig.saltNonce }, - ethAdapter, + provider, contractNetworks ) @@ -189,7 +189,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const invalidThreshold = 3 const safeVersion = safeVersionDeployed - const ethAdapter = await getEthAdapter(owner1.signer) + const provider = await getEthAdapter(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -203,7 +203,7 @@ describe('Contract utils', () => { } const predictSafeAddressWithInvalidThreshold = { - ethAdapter, + provider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -223,7 +223,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const invalidThreshold = 0 const safeVersion = safeVersionDeployed - const ethAdapter = await getEthAdapter(owner1.signer) + const provider = await getEthAdapter(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -237,7 +237,7 @@ describe('Contract utils', () => { } const predictSafeAddressWithInvalidThreshold = { - ethAdapter, + provider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -257,7 +257,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const invalidThreshold = -2 const safeVersion = safeVersionDeployed - const ethAdapter = await getEthAdapter(owner1.signer) + const provider = await getEthAdapter(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -271,7 +271,7 @@ describe('Contract utils', () => { } const predictSafeAddressWithInvalidThreshold = { - ethAdapter, + provider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -290,7 +290,7 @@ describe('Contract utils', () => { const invalidOwners: string[] = [] const threshold = 1 const safeVersion = safeVersionDeployed - const ethAdapter = await getEthAdapter(accounts[0].signer) + const provider = await getEthAdapter(accounts[0].signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -304,7 +304,7 @@ describe('Contract utils', () => { } const predictSafeAddressWithInvalidThreshold = { - ethAdapter, + provider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -324,7 +324,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const threshold = 1 const safeVersion = safeVersionDeployed - const ethAdapter = await getEthAdapter(owner1.signer) + const provider = await getEthAdapter(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -337,7 +337,7 @@ describe('Contract utils', () => { const thirdSaltNonce = '3' const predictedSafeAddress1 = await predictSafeAddress({ - ethAdapter, + provider, chainId, safeAccountConfig, safeDeploymentConfig: { @@ -350,7 +350,7 @@ describe('Contract utils', () => { // we deploy the Safe with the given configuration and the deployed Safe address should be equal to the predicted one const firstDeployedSafe = await deploySafe( { safeAccountConfig, saltNonce: firstSaltNonce }, - ethAdapter, + provider, contractNetworks ) @@ -360,7 +360,7 @@ describe('Contract utils', () => { chai.expect(predictedSafeAddress1).to.be.equal(await firstDeployedSafe.getAddress()) const predictedSafeAddress2 = await predictSafeAddress({ - ethAdapter, + provider, chainId, safeAccountConfig, safeDeploymentConfig: { @@ -373,7 +373,7 @@ describe('Contract utils', () => { // we deploy the Safe with the given configuration and the deployed Safe address should be equal to the predicted one const secondDeployedSafe = await deploySafe( { safeAccountConfig, saltNonce: secondSaltNonce }, - ethAdapter, + provider, contractNetworks ) @@ -383,7 +383,7 @@ describe('Contract utils', () => { chai.expect(predictedSafeAddress2).to.be.equal(await secondDeployedSafe.getAddress()) const predictedSafeAddress3 = await predictSafeAddress({ - ethAdapter, + provider, chainId, safeAccountConfig, safeDeploymentConfig: { @@ -396,7 +396,7 @@ describe('Contract utils', () => { // we deploy the Safe with the given configuration and the deployed Safe address should be equal to the predicted one const thirdDeployedSafe = await deploySafe( { safeAccountConfig, saltNonce: thirdSaltNonce }, - ethAdapter, + provider, contractNetworks ) @@ -414,7 +414,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const threshold = 2 const safeVersion = safeVersionDeployed - const ethAdapter = await getEthAdapter(owner1.signer) + const provider = await getEthAdapter(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -430,7 +430,7 @@ describe('Contract utils', () => { // we deploy the Safe with the given configuration and the deployed Safe address should be equal to the predicted one const deployedSafe = await deploySafe( { safeAccountConfig, saltNonce: safeDeploymentConfig.saltNonce }, - ethAdapter, + provider, contractNetworks ) // We ensure the Safe is deployed, as getAddress() function is able to return an address for a predictedSafe @@ -438,7 +438,7 @@ describe('Contract utils', () => { const expectedSafeAddress = await deployedSafe.getAddress() const firstPredictedSafeAddress = await predictSafeAddress({ - ethAdapter, + provider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -446,7 +446,7 @@ describe('Contract utils', () => { }) const secondPredictedSafeAddress = await predictSafeAddress({ - ethAdapter, + provider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -454,7 +454,7 @@ describe('Contract utils', () => { }) const thirdPredictedSafeAddress = await predictSafeAddress({ - ethAdapter, + provider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -477,7 +477,7 @@ describe('Contract utils', () => { const [owner1] = accounts const owners = [owner1.address] const threshold = 1 - const ethAdapter = await getEthAdapter(owner1.signer) + const provider = await getEthAdapter(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -486,14 +486,14 @@ describe('Contract utils', () => { } const predictedSafeAddress = await predictSafeAddress({ - ethAdapter, + provider, chainId, safeAccountConfig, customContracts }) // we deploy the Safe by providing only the safeAccountConfig (owners & threshold) - const deployedSafe = await deploySafe({ safeAccountConfig }, ethAdapter, contractNetworks) + const deployedSafe = await deploySafe({ safeAccountConfig }, provider, contractNetworks) // We ensure the Safe is deployed const isSafeDeployed = await deployedSafe.isSafeDeployed() @@ -512,8 +512,8 @@ describe('Contract utils', () => { const safeVersion = safeVersionDeployed // Create EthAdapter instance - const ethAdapter = await getEthAdapter(getNetworkProvider('zksync')) - const chainId = await ethAdapter.getChainId() + const provider = await getEthAdapter(getNetworkProvider('zksync')) + const chainId = await provider.getChainId() const customContracts = contractNetworks[chainId.toString()] // We check real deployments from zksync return the expected address. @@ -530,7 +530,7 @@ describe('Contract utils', () => { const expectedSafeAddress1 = '0x4e19dA81a54eFbaBeb9AD50646f7643076475D65' const firstPredictedSafeAddress = await predictSafeAddress({ - ethAdapter, + provider, chainId, safeAccountConfig: safeAccountConfig1, safeDeploymentConfig: safeDeploymentConfig1, @@ -552,7 +552,7 @@ describe('Contract utils', () => { const expectedSafeAddress2 = '0x60c7F13dE7C8Fb88b3845e58859658bdc44243F8' const secondPredictedSafeAddress = await predictSafeAddress({ - ethAdapter, + provider, chainId, safeAccountConfig: safeAccountConfig2, safeDeploymentConfig: safeDeploymentConfig2, @@ -575,7 +575,7 @@ describe('Contract utils', () => { const expectedSafeAddress3 = '0xD971FAA20db3ad4d51D453047ca03Ce4ec164CE2' const thirdPredictedSafeAddress = await predictSafeAddress({ - ethAdapter, + provider, chainId, safeAccountConfig: safeAccountConfig3, safeDeploymentConfig: safeDeploymentConfig3, @@ -613,28 +613,28 @@ describe('Contract utils', () => { } const gnosisPredictedSafeAddress = await predictSafeAddress({ - ethAdapter: gnosisEthAdapter, + provider: gnosisEthAdapter, chainId: await gnosisEthAdapter.getChainId(), safeAccountConfig: safeAccountConfig, safeDeploymentConfig: safeDeploymentConfig }) const zkSyncPredictedSafeAddress = await predictSafeAddress({ - ethAdapter: zkSyncEthAdapter, + provider: zkSyncEthAdapter, chainId: await zkSyncEthAdapter.getChainId(), safeAccountConfig: safeAccountConfig, safeDeploymentConfig: safeDeploymentConfig }) const sepoliaPredictedSafeAddress = await predictSafeAddress({ - ethAdapter: sepoliaEthAdapter, + provider: sepoliaEthAdapter, chainId: await sepoliaEthAdapter.getChainId(), safeAccountConfig: safeAccountConfig, safeDeploymentConfig: safeDeploymentConfig }) const mainnetPredictedSafeAddress = await predictSafeAddress({ - ethAdapter: mainnetEthAdapter, + provider: mainnetEthAdapter, chainId: await mainnetEthAdapter.getChainId(), safeAccountConfig: safeAccountConfig, safeDeploymentConfig: safeDeploymentConfig diff --git a/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts b/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts index ba6c14285..993be65ed 100644 --- a/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts +++ b/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts @@ -44,10 +44,10 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -73,10 +73,10 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -109,10 +109,10 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -145,10 +145,10 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1, account2] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const provider = await getEthAdapter(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -171,7 +171,7 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { customSaltNonce ) - const customSaltNonceEncoded = ethAdapter.encodeParameters(['uint256'], [customSaltNonce]) + const customSaltNonceEncoded = provider.encodeParameters(['uint256'], [customSaltNonce]) // custom salt nonce included in the deployment data chai.expect(batchTransaction.data).to.contains(customSaltNonceEncoded.replace('0x', '')) From 5ba6c40a3203db7008e3479f15985fdb4957a167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 11 Apr 2024 16:19:22 +0200 Subject: [PATCH 003/112] Initial commit --- packages/protocol-kit/src/Safe.ts | 16 +- .../src/adapters/ethers/EthersAdapter.ts | 7 +- .../protocol-kit/src/safeFactory/index.ts | 2 + packages/protocol-kit/src/types/index.ts | 3 + packages/protocol-kit/tests/e2e/core.test.ts | 1 + .../createSafeDeploymentTransaction.test.ts | 8 +- .../e2e/eip1271-contract-signatures.test.ts | 18 +- .../protocol-kit/tests/e2e/eip1271.test.ts | 6 +- .../tests/e2e/ethAdapters.test.ts | 32 ++-- .../protocol-kit/tests/e2e/execution.test.ts | 175 ++++++++++++------ .../tests/e2e/offChainSignatures.test.ts | 3 +- .../tests/e2e/onChainSignatures.test.ts | 16 +- .../tests/e2e/ownerManager.test.ts | 74 +++++--- .../tests/e2e/utils/setupEthAdapter.ts | 2 +- .../tests/e2e/utilsContracts.test.ts | 32 +++- 15 files changed, 267 insertions(+), 128 deletions(-) diff --git a/packages/protocol-kit/src/Safe.ts b/packages/protocol-kit/src/Safe.ts index a761bb539..0ca382821 100644 --- a/packages/protocol-kit/src/Safe.ts +++ b/packages/protocol-kit/src/Safe.ts @@ -115,11 +115,12 @@ class Safe { * @throws "MultiSendCallOnly contract is not deployed on the current network" */ private async init(config: SafeConfig): Promise { - const { provider, isL1SafeSingleton, contractNetworks } = config + const { provider, signerAddress, isL1SafeSingleton, contractNetworks } = config this.#provider = provider this.#ethAdapter = new EthersAdapter({ - provider + provider, + signerAddress }) if (isSafeConfigWithPredictedSafe(config)) { this.#predictedSafe = config.predictedSafe @@ -162,9 +163,17 @@ class Safe { * @throws "MultiSendCallOnly contract is not deployed on the current network" */ async connect(config: ConnectSafeConfig): Promise { - const { provider, safeAddress, predictedSafe, isL1SafeSingleton, contractNetworks } = config + const { + provider, + signerAddress, + safeAddress, + predictedSafe, + isL1SafeSingleton, + contractNetworks + } = config const configProps: SafeConfigProps = { provider: provider || this.#provider, + signerAddress, isL1SafeSingleton: isL1SafeSingleton || this.#contractManager.isL1SafeSingleton, contractNetworks: contractNetworks || this.#contractManager.contractNetworks } @@ -683,6 +692,7 @@ class Safe { const owners = await this.getOwners() const signerAddress = await this.#ethAdapter.getSignerAddress() + console.log('signerAddress', signerAddress) if (!signerAddress) { throw new Error('EthAdapter must be initialized with a signer to use this method') } diff --git a/packages/protocol-kit/src/adapters/ethers/EthersAdapter.ts b/packages/protocol-kit/src/adapters/ethers/EthersAdapter.ts index 1ea2bf6ec..65b12b872 100644 --- a/packages/protocol-kit/src/adapters/ethers/EthersAdapter.ts +++ b/packages/protocol-kit/src/adapters/ethers/EthersAdapter.ts @@ -35,19 +35,22 @@ import { Eip1193Provider } from '@safe-global/protocol-kit/types' export interface EthersAdapterConfig { /** signerOrProvider - Ethers signer or provider */ provider: Eip1193Provider + signerAddress?: string } class EthersAdapter implements EthAdapter { get #signer(): Promise { - return this.#provider.getSigner() + return this.#provider.getSigner(this.#signerAddress) } #provider: BrowserProvider #eip1193Provider: Eip1193Provider + #signerAddress?: string - constructor({ provider }: EthersAdapterConfig) { + constructor({ provider, signerAddress }: EthersAdapterConfig) { this.#provider = new BrowserProvider(provider) this.#eip1193Provider = provider + this.#signerAddress = signerAddress } getProvider(): Provider { diff --git a/packages/protocol-kit/src/safeFactory/index.ts b/packages/protocol-kit/src/safeFactory/index.ts index a01ebc1de..dc3b6fec2 100644 --- a/packages/protocol-kit/src/safeFactory/index.ts +++ b/packages/protocol-kit/src/safeFactory/index.ts @@ -36,6 +36,7 @@ export interface DeploySafeProps { export interface SafeFactoryConfig { /** ethAdapter - Ethereum adapter */ provider: Eip1193Provider + signerAddress?: string /** safeVersion - Versions of the Safe deployed by this Factory contract */ safeVersion?: SafeVersion /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ @@ -47,6 +48,7 @@ export interface SafeFactoryConfig { interface SafeFactoryInitConfig { /** ethAdapter - Ethereum adapter */ provider: Eip1193Provider + signerAddress?: string /** safeVersion - Versions of the Safe deployed by this Factory contract */ safeVersion: SafeVersion /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index 14c3d8d85..14fd0d4f1 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -94,6 +94,7 @@ export interface Eip1193Provider { export type SafeConfigProps = { /** provider - Compatible EIP-1193 provider */ provider: Eip1193Provider + signerAddress?: string /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ isL1SafeSingleton?: boolean /** contractNetworks - Contract network configuration */ @@ -121,6 +122,7 @@ type ConnectSafeConfigWithPredictedSafeProps = { type ConnectSafeConfigProps = { /** provider - Compatible EIP-1193 provider */ provider?: Eip1193Provider + signerAddress?: string /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ isL1SafeSingleton?: boolean /** contractNetworks - Contract network configuration */ @@ -182,6 +184,7 @@ type StandardizeSafeTxDataWithPredictedSafeProps = { interface StandardizeSafeTransactionData { /** provider - Compatible EIP-1193 provider */ provider: Eip1193Provider + signerAddress?: string /** tx - Safe transaction */ tx: SafeTransactionDataPartial /** contractNetworks - Contract network configuration */ diff --git a/packages/protocol-kit/tests/e2e/core.test.ts b/packages/protocol-kit/tests/e2e/core.test.ts index a06c3392f..bdd1d92dc 100644 --- a/packages/protocol-kit/tests/e2e/core.test.ts +++ b/packages/protocol-kit/tests/e2e/core.test.ts @@ -96,6 +96,7 @@ describe('Safe Info', () => { const provider2 = await getEthAdapter(account2.signer) const safeSdk2 = await safeSdk.connect({ provider: provider2, + signerAddress: account2.address, contractNetworks }) chai.expect(await safeSdk2.getAddress()).to.be.eq(safeAddress) diff --git a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts index 6e82ead20..a3e534b47 100644 --- a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts @@ -176,7 +176,7 @@ describe('createSafeDeploymentTransaction', () => { const deploymentTransaction = await safeSdk.createSafeDeploymentTransaction() const customContract = contractNetworks[chainId.toString()] - const safeContract = await ethAdapter.getSafeContract({ + const safeContract = await provider.getSafeContract({ safeVersion: safeVersionDeployed, customContractAddress: customContract?.safeSingletonAddress, customContractAbi: customContract?.safeSingletonAbi @@ -184,7 +184,7 @@ describe('createSafeDeploymentTransaction', () => { // this is the call to the setup method that sets the threshold & owners of the new Safe const initializer = await encodeSetupCallData({ - ethAdapter, + provider, safeContract, safeAccountConfig: predictedSafe.safeAccountConfig, customContracts: contractNetworks[chainId.toString()] @@ -207,7 +207,7 @@ describe('createSafeDeploymentTransaction', () => { contractNetworks }) - const predeterminedSaltNonceEncoded = ethAdapter.encodeParameters( + const predeterminedSaltNonceEncoded = provider.encodeParameters( ['uint256'], [`0x${Buffer.from(keccak_256(PREDETERMINED_SALT_NONCE + chainId)).toString('hex')}`] ) @@ -234,7 +234,7 @@ describe('createSafeDeploymentTransaction', () => { const customSaltNonce = '123456789' - const customSaltNonceEncoded = ethAdapter.encodeParameters(['uint256'], [customSaltNonce]) + const customSaltNonceEncoded = provider.encodeParameters(['uint256'], [customSaltNonce]) const deploymentTransaction = await safeSdk.createSafeDeploymentTransaction(customSaltNonce) diff --git a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts index 4b52b1e59..da194709c 100644 --- a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts @@ -102,12 +102,16 @@ describe('The EIP1271 implementation', () => { // EOA signatures tx = await protocolKit.signTransaction(tx) // Owner 1 signature - protocolKit = await protocolKit.connect({ provider: provider2 }) // Connect another owner + protocolKit = await protocolKit.connect({ + provider: provider2, + signerAddress: account2.address + }) // Connect another owner tx = await protocolKit.signTransaction(tx) // Owner 2 signature // 1/1 Signer Safe signature protocolKit = await protocolKit.connect({ provider: provider3, + signerAddress: account3.address, safeAddress: signerSafeAddress1_1 }) let signerSafeTx1_1 = await protocolKit.createTransaction({ @@ -127,6 +131,7 @@ describe('The EIP1271 implementation', () => { // 2/3 Signer Safe signature protocolKit = await protocolKit.connect({ provider: provider4, + signerAddress: account4.address, safeAddress: signerSafeAddress2_3 }) let signerSafeTx2_3 = await protocolKit.createTransaction({ @@ -137,7 +142,10 @@ describe('The EIP1271 implementation', () => { SigningMethod.SAFE_SIGNATURE, safeAddress ) - protocolKit = await protocolKit.connect({ provider: provider5 }) + protocolKit = await protocolKit.connect({ + provider: provider5, + signerAddress: account5.address + }) signerSafeTx2_3 = await protocolKit.signTransaction( signerSafeTx2_3, SigningMethod.SAFE_SIGNATURE, @@ -154,7 +162,11 @@ describe('The EIP1271 implementation', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - protocolKit = await protocolKit.connect({ provider: provider1, safeAddress }) + protocolKit = await protocolKit.connect({ + provider: provider1, + signerAddress: account1.address, + safeAddress + }) const execResponse = await protocolKit.executeTransaction(tx) await waitSafeTxReceipt(execResponse) diff --git a/packages/protocol-kit/tests/e2e/eip1271.test.ts b/packages/protocol-kit/tests/e2e/eip1271.test.ts index dace09e9d..e9a0f7875 100644 --- a/packages/protocol-kit/tests/e2e/eip1271.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271.test.ts @@ -77,6 +77,7 @@ describe('The EIP1271 implementation', () => { const provider2 = await getEthAdapter(account2.signer) const safeSdk2 = await Safe.create({ provider: provider2, + signerAddress: account2.address, safeAddress, contractNetworks }) @@ -84,6 +85,7 @@ describe('The EIP1271 implementation', () => { // Adapter and Safe instance for owner 3 const safeSdk3 = await Safe.create({ provider: provider1, + signerAddress: account1.address, safeAddress: signerSafeAddress, contractNetworks }) @@ -108,14 +110,14 @@ describe('The EIP1271 implementation', () => { itif(safeVersionDeployed >= '1.3.0')( 'should validate on-chain messages (Approved hashes)', async () => { - const { contractNetworks, safeSdk1, safeSdk2, ethAdapter1 } = await setupTests() + const { contractNetworks, safeSdk1, safeSdk2, provider1 } = await setupTests() const chainId = await safeSdk1.getChainId() const safeVersion = await safeSdk1.getContractVersion() const customContract = contractNetworks[chainId.toString()] - const signMessageLibContract = await ethAdapter1.getSignMessageLibContract({ + const signMessageLibContract = await provider1.getSignMessageLibContract({ safeVersion, customContractAddress: customContract.signMessageLibAddress, customContractAbi: customContract.signMessageLibAbi diff --git a/packages/protocol-kit/tests/e2e/ethAdapters.test.ts b/packages/protocol-kit/tests/e2e/ethAdapters.test.ts index f60f70313..6c752cf52 100644 --- a/packages/protocol-kit/tests/e2e/ethAdapters.test.ts +++ b/packages/protocol-kit/tests/e2e/ethAdapters.test.ts @@ -45,7 +45,7 @@ describe('Safe contracts', () => { const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getSafeContractDeployment(safeVersion, chainId) - const safeContract = await ethAdapter.getSafeContract({ + const safeContract = await provider.getSafeContract({ safeVersion, singletonDeployment }) @@ -59,7 +59,7 @@ describe('Safe contracts', () => { const safeVersion: SafeVersion = '1.3.0' const chainId = 100n const singletonDeployment = getSafeContractDeployment(safeVersion, chainId) - const safeContract = await ethAdapter.getSafeContract({ + const safeContract = await provider.getSafeContract({ safeVersion, singletonDeployment }) @@ -74,7 +74,7 @@ describe('Safe contracts', () => { const chainId = 100n const isL1SafeSingleton = true const singletonDeployment = getSafeContractDeployment(safeVersion, chainId, isL1SafeSingleton) - const safeContract = await ethAdapter.getSafeContract({ + const safeContract = await provider.getSafeContract({ safeVersion, singletonDeployment }) @@ -89,7 +89,7 @@ describe('Safe contracts', () => { const provider = await getEthAdapter(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] - const safeContract = await ethAdapter.getSafeContract({ + const safeContract = await provider.getSafeContract({ safeVersion, customContractAddress: customContract?.safeSingletonAddress, customContractAbi: customContract?.safeSingletonAbi @@ -106,7 +106,7 @@ describe('Safe contracts', () => { const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getMultiSendContractDeployment(safeVersion, chainId) - const multiSendContract = await ethAdapter.getMultiSendContract({ + const multiSendContract = await provider.getMultiSendContract({ safeVersion, singletonDeployment }) @@ -121,7 +121,7 @@ describe('Safe contracts', () => { const provider = await getEthAdapter(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] - const multiSendContract = await ethAdapter.getMultiSendContract({ + const multiSendContract = await provider.getMultiSendContract({ safeVersion, customContractAddress: customContract.multiSendAddress, customContractAbi: customContract.multiSendAbi @@ -138,7 +138,7 @@ describe('Safe contracts', () => { const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getMultiSendCallOnlyContractDeployment(safeVersion, chainId) - const multiSendCallOnlyContract = await ethAdapter.getMultiSendCallOnlyContract({ + const multiSendCallOnlyContract = await provider.getMultiSendCallOnlyContract({ safeVersion, singletonDeployment }) @@ -153,7 +153,7 @@ describe('Safe contracts', () => { const provider = await getEthAdapter(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] - const multiSendCallOnlyContract = await ethAdapter.getMultiSendCallOnlyContract({ + const multiSendCallOnlyContract = await provider.getMultiSendCallOnlyContract({ safeVersion, customContractAddress: customContract.multiSendCallOnlyAddress, customContractAbi: customContract.multiSendCallOnlyAbi @@ -174,7 +174,7 @@ describe('Safe contracts', () => { chainId ) const compatibilityFallbackHandlerContract = - await ethAdapter.getCompatibilityFallbackHandlerContract({ + await provider.getCompatibilityFallbackHandlerContract({ safeVersion, singletonDeployment }) @@ -190,7 +190,7 @@ describe('Safe contracts', () => { const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const compatibilityFallbackHandlerContract = - await ethAdapter.getCompatibilityFallbackHandlerContract({ + await provider.getCompatibilityFallbackHandlerContract({ safeVersion, customContractAddress: customContract.fallbackHandlerAddress, customContractAbi: customContract.fallbackHandlerAbi @@ -207,7 +207,7 @@ describe('Safe contracts', () => { const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getSafeProxyFactoryContractDeployment(safeVersion, chainId) - const factoryContract = await ethAdapter.getSafeProxyFactoryContract({ + const factoryContract = await provider.getSafeProxyFactoryContract({ safeVersion, singletonDeployment }) @@ -222,7 +222,7 @@ describe('Safe contracts', () => { const provider = await getEthAdapter(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] - const factoryContract = await ethAdapter.getSafeProxyFactoryContract({ + const factoryContract = await provider.getSafeProxyFactoryContract({ safeVersion, customContractAddress: customContract.safeProxyFactoryAddress, customContractAbi: customContract.safeProxyFactoryAbi @@ -239,7 +239,7 @@ describe('Safe contracts', () => { const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getSignMessageLibContractDeployment(safeVersion, chainId) - const signMessageLibContract = await ethAdapter.getSignMessageLibContract({ + const signMessageLibContract = await provider.getSignMessageLibContract({ safeVersion, singletonDeployment }) @@ -254,7 +254,7 @@ describe('Safe contracts', () => { const provider = await getEthAdapter(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] - const signMessageLibContract = await ethAdapter.getSignMessageLibContract({ + const signMessageLibContract = await provider.getSignMessageLibContract({ safeVersion, customContractAddress: customContract.signMessageLibAddress, customContractAbi: customContract.signMessageLibAbi @@ -271,7 +271,7 @@ describe('Safe contracts', () => { const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getCreateCallContractDeployment(safeVersion, chainId) - const createCallContract = await ethAdapter.getCreateCallContract({ + const createCallContract = await provider.getCreateCallContract({ safeVersion, singletonDeployment }) @@ -286,7 +286,7 @@ describe('Safe contracts', () => { const provider = await getEthAdapter(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] - const createCallContract = await ethAdapter.getCreateCallContract({ + const createCallContract = await provider.getCreateCallContract({ safeVersion, customContractAddress: customContract.createCallAddress, customContractAbi: customContract.createCallAbi diff --git a/packages/protocol-kit/tests/e2e/execution.test.ts b/packages/protocol-kit/tests/e2e/execution.test.ts index 2275df644..6770578cb 100644 --- a/packages/protocol-kit/tests/e2e/execution.test.ts +++ b/packages/protocol-kit/tests/e2e/execution.test.ts @@ -46,6 +46,7 @@ describe('Transactions execution', () => { const provider2 = await getEthAdapter(account2.signer) const safeSdk2 = await safeSdk1.connect({ provider: provider2, + signerAddress: account2.address, contractNetworks }) await account1.signer.sendTransaction({ @@ -136,7 +137,10 @@ describe('Transactions execution', () => { contractNetworks }) const provider2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ provider: provider2 }) + const safeSdk2 = await safeSdk1.connect({ + provider: provider2, + signerAddress: account2.address + }) const safeTransactionData = { to: safeAddress, value: '0', @@ -188,6 +192,7 @@ describe('Transactions execution', () => { const provider2 = await getEthAdapter(account2.signer) const safeSdk2 = await safeSdk1.connect({ provider: provider2, + signerAddress: account2.address, contractNetworks }) await account1.signer.sendTransaction({ @@ -306,16 +311,22 @@ describe('Transactions execution', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - const ethAdapter1 = await getEthAdapter(account1.signer) - const ethAdapter2 = await getEthAdapter(account2.signer) - const ethAdapter3 = await getEthAdapter(account3.signer) + const provider1 = await getEthAdapter(account1.signer) + const provider2 = await getEthAdapter(account2.signer) + const provider3 = await getEthAdapter(account3.signer) const safeSdk1 = await Safe.create({ - provider: ethAdapter1, + provider: provider1, safeAddress, contractNetworks }) - const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) - const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) + const safeSdk2 = await safeSdk1.connect({ + provider: provider2, + signerAddress: account2.address + }) + const safeSdk3 = await safeSdk1.connect({ + provider: provider3, + signerAddress: account3.address + }) const safeInitialBalance = await safeSdk1.getBalance() const safeTransactionData = { to: account2.address, @@ -358,18 +369,27 @@ describe('Transactions execution', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - const ethAdapter1 = await getEthAdapter(account1.signer) - const ethAdapter2 = await getEthAdapter(account2.signer) - const ethAdapter3 = await getEthAdapter(account3.signer) - const ethAdapter4 = await getEthAdapter(account4.signer) + const provider1 = await getEthAdapter(account1.signer) + const provider2 = await getEthAdapter(account2.signer) + const provider3 = await getEthAdapter(account3.signer) + const provider4 = await getEthAdapter(account4.signer) const safeSdk1 = await Safe.create({ - provider: ethAdapter1, + provider: provider1, safeAddress, contractNetworks }) - const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) - const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) - const safeSdk4 = await safeSdk1.connect({ provider: ethAdapter4 }) + const safeSdk2 = await safeSdk1.connect({ + provider: provider2, + signerAddress: account2.address + }) + const safeSdk3 = await safeSdk1.connect({ + provider: provider3, + signerAddress: account3.address + }) + const safeSdk4 = await safeSdk1.connect({ + provider: provider4, + signerAddress: account4.address + }) const safeInitialBalance = await safeSdk1.getBalance() const safeTransactionData = { to: account2.address, @@ -416,20 +436,32 @@ describe('Transactions execution', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - const ethAdapter1 = await getEthAdapter(account1.signer) - const ethAdapter2 = await getEthAdapter(account2.signer) - const ethAdapter3 = await getEthAdapter(account3.signer) - const ethAdapter4 = await getEthAdapter(account4.signer) - const ethAdapter5 = await getEthAdapter(account5.signer) + const provider1 = await getEthAdapter(account1.signer) + const provider2 = await getEthAdapter(account2.signer) + const provider3 = await getEthAdapter(account3.signer) + const provider4 = await getEthAdapter(account4.signer) + const provider5 = await getEthAdapter(account5.signer) const safeSdk1 = await Safe.create({ - provider: ethAdapter1, + provider: provider1, safeAddress, contractNetworks }) - const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) - const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) - const safeSdk4 = await safeSdk1.connect({ provider: ethAdapter4 }) - const safeSdk5 = await safeSdk1.connect({ provider: ethAdapter5 }) + const safeSdk2 = await safeSdk1.connect({ + provider: provider2, + signerAddress: account2.address + }) + const safeSdk3 = await safeSdk1.connect({ + provider: provider3, + signerAddress: account3.address + }) + const safeSdk4 = await safeSdk1.connect({ + provider: provider4, + signerAddress: account4.address + }) + const safeSdk5 = await safeSdk1.connect({ + provider: provider5, + signerAddress: account5.address + }) const safeInitialBalance = await safeSdk1.getBalance() const safeTransactionData = { to: account2.address, @@ -480,22 +512,37 @@ describe('Transactions execution', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - const ethAdapter1 = await getEthAdapter(account1.signer) - const ethAdapter2 = await getEthAdapter(account2.signer) - const ethAdapter3 = await getEthAdapter(account3.signer) - const ethAdapter4 = await getEthAdapter(account4.signer) - const ethAdapter5 = await getEthAdapter(account5.signer) - const ethAdapter6 = await getEthAdapter(account6.signer) + const provider1 = await getEthAdapter(account1.signer) + const provider2 = await getEthAdapter(account2.signer) + const provider3 = await getEthAdapter(account3.signer) + const provider4 = await getEthAdapter(account4.signer) + const provider5 = await getEthAdapter(account5.signer) + const provider6 = await getEthAdapter(account6.signer) const safeSdk1 = await Safe.create({ - provider: ethAdapter1, + provider: provider1, safeAddress, contractNetworks }) - const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) - const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) - const safeSdk4 = await safeSdk1.connect({ provider: ethAdapter4 }) - const safeSdk5 = await safeSdk1.connect({ provider: ethAdapter5 }) - const safeSdk6 = await safeSdk1.connect({ provider: ethAdapter6 }) + const safeSdk2 = await safeSdk1.connect({ + provider: provider2, + signerAddress: account2.address + }) + const safeSdk3 = await safeSdk1.connect({ + provider: provider3, + signerAddress: account3.address + }) + const safeSdk4 = await safeSdk1.connect({ + provider: provider4, + signerAddress: account4.address + }) + const safeSdk5 = await safeSdk1.connect({ + provider: provider5, + signerAddress: account5.address + }) + const safeSdk6 = await safeSdk1.connect({ + provider: provider6, + signerAddress: account6.address + }) const safeInitialBalance = await safeSdk1.getBalance() const safeTransactionData = { to: account2.address, @@ -534,17 +581,23 @@ describe('Transactions execution', () => { it('should execute a transaction when is not submitted by an owner', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3] = accounts - const ethAdapter1 = await getEthAdapter(account1.signer) + const provider1 = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ - provider: ethAdapter1, + provider: provider1, safeAddress, contractNetworks }) - const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) - const ethAdapter3 = await getEthAdapter(account3.signer) - const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) + const provider2 = await getEthAdapter(account2.signer) + const safeSdk2 = await safeSdk1.connect({ + provider: provider2, + signerAddress: account2.address + }) + const provider3 = await getEthAdapter(account3.signer) + const safeSdk3 = await safeSdk1.connect({ + provider: provider3, + signerAddress: account3.address + }) await account2.signer.sendTransaction({ to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH @@ -808,16 +861,22 @@ describe('Transactions execution', () => { const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() - const ethAdapter1 = await getEthAdapter(account1.signer) + const provider1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - provider: ethAdapter1, + provider: provider1, safeAddress, contractNetworks }) - const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) - const ethAdapter3 = await getEthAdapter(account3.signer) - const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) + const provider2 = await getEthAdapter(account2.signer) + const safeSdk2 = await safeSdk1.connect({ + provider: provider2, + signerAddress: account2.address + }) + const provider3 = await getEthAdapter(account3.signer) + const safeSdk3 = await safeSdk1.connect({ + provider: provider3, + signerAddress: account3.address + }) await account1.signer.sendTransaction({ to: safeAddress, value: 2_000_000_000_000_000_000n // 2 ETH @@ -853,16 +912,22 @@ describe('Transactions execution', () => { const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() - const ethAdapter1 = await getEthAdapter(account1.signer) + const provider1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - provider: ethAdapter1, + provider: provider1, safeAddress, contractNetworks }) - const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) - const ethAdapter3 = await getEthAdapter(account3.signer) - const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) + const provider2 = await getEthAdapter(account2.signer) + const safeSdk2 = await safeSdk1.connect({ + provider: provider2, + signerAddress: account2.address + }) + const provider3 = await getEthAdapter(account3.signer) + const safeSdk3 = await safeSdk1.connect({ + provider: provider3, + signerAddress: account3.address + }) await erc20Mintable.mint(safeAddress, '1200000000000000000') // 1.2 ERC20 const safeInitialERC20Balance = await erc20Mintable.balanceOf(safeAddress) diff --git a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts index 6202b06b2..9cd442a46 100644 --- a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts @@ -140,6 +140,7 @@ describe('Off-chain signatures', () => { const safeSdk = await Safe.create({ provider, safeAddress, + signerAddress: account3.address, contractNetworks }) const safeTransactionData = { @@ -429,7 +430,7 @@ describe('Off-chain signatures', () => { const signedTx = await safeSdk.signTransaction(safeServiceTransaction) chai.expect(safeServiceTransaction.confirmations?.length).to.be.eq(2) chai.expect(signedTx.signatures.size).to.be.eq(3) - const signerAddress = await provider.getSignerAddress() + const signerAddress = account1.address const signerSignature = signedTx.signatures.get(signerAddress!.toLowerCase())?.data chai .expect(signedTx.encodedSignatures()) diff --git a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts index 9d2ee79cb..8432a4606 100644 --- a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts @@ -57,6 +57,7 @@ describe('On-chain signatures', () => { const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ provider, + signerAddress: account3.address, safeAddress, contractNetworks }) @@ -125,9 +126,9 @@ describe('On-chain signatures', () => { it('should fail if Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter1 = await getEthAdapter(account1.signer) + const provider1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - provider: ethAdapter1, + provider: provider1, predictedSafe, contractNetworks }) @@ -139,15 +140,18 @@ describe('On-chain signatures', () => { it('should return the list of owners who approved a transaction hash', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const ethAdapter1 = await getEthAdapter(account1.signer) + const provider1 = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ - provider: ethAdapter1, + provider: provider1, safeAddress: safeAddress, contractNetworks }) - const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) + const provider2 = await getEthAdapter(account2.signer) + const safeSdk2 = await safeSdk1.connect({ + provider: provider2, + signerAddress: account2.address + }) const safeTransactionData = { to: safeAddress, value: '0', diff --git a/packages/protocol-kit/tests/e2e/ownerManager.test.ts b/packages/protocol-kit/tests/e2e/ownerManager.test.ts index e54405ff8..a01ab446e 100644 --- a/packages/protocol-kit/tests/e2e/ownerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/ownerManager.test.ts @@ -399,9 +399,9 @@ describe('Safe owners manager', () => { it('should build the transaction with the optional props', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const ethAdapter1 = await getEthAdapter(account1.signer) + const provider1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - provider: ethAdapter1, + provider: provider1, safeAddress: await safe.getAddress(), contractNetworks }) @@ -425,16 +425,22 @@ describe('Safe owners manager', () => { it('should remove the first owner of a Safe and decrease the threshold', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3] = accounts - const ethAdapter1 = await getEthAdapter(account1.signer) + const provider1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - provider: ethAdapter1, + provider: provider1, safeAddress: await safe.getAddress(), contractNetworks }) - const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) - const ethAdapter3 = await getEthAdapter(account3.signer) - const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) + const provider2 = await getEthAdapter(account2.signer) + const safeSdk2 = await safeSdk1.connect({ + provider: provider2, + signerAddress: account2.address + }) + const provider3 = await getEthAdapter(account3.signer) + const safeSdk3 = await safeSdk1.connect({ + provider: provider3, + signerAddress: account3.address + }) const initialThreshold = await safeSdk1.getThreshold() const initialOwners = await safeSdk1.getOwners() chai.expect(initialOwners.length).to.be.eq(3) @@ -457,17 +463,21 @@ describe('Safe owners manager', () => { it('should remove any owner of a Safe and decrease the threshold', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3] = accounts - const ethAdapter1 = await getEthAdapter(account1.signer) + const provider1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - provider: ethAdapter1, + provider: provider1, safeAddress: await safe.getAddress(), contractNetworks }) - const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) - const ethAdapter3 = await getEthAdapter(account3.signer) + const provider2 = await getEthAdapter(account2.signer) + const safeSdk2 = await safeSdk1.connect({ + provider: provider2, + signerAddress: account2.address + }) + const provider3 = await getEthAdapter(account3.signer) const safeSdk3 = await safeSdk1.connect({ - provider: ethAdapter3, + provider: provider3, + signerAddress: account3.address, contractNetworks }) const initialThreshold = await safeSdk1.getThreshold() @@ -492,16 +502,22 @@ describe('Safe owners manager', () => { it('should remove an owner and update the threshold', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3] = accounts - const ethAdapter1 = await getEthAdapter(account1.signer) + const provider1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - provider: ethAdapter1, + provider: provider1, safeAddress: await safe.getAddress(), contractNetworks }) - const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) - const ethAdapter3 = await getEthAdapter(account3.signer) - const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) + const provider2 = await getEthAdapter(account2.signer) + const safeSdk2 = await safeSdk1.connect({ + provider: provider2, + signerAddress: account2.address + }) + const provider3 = await getEthAdapter(account3.signer) + const safeSdk3 = await safeSdk1.connect({ + provider: provider3, + signerAddress: account3.address + }) const newThreshold = 1 const initialOwners = await safeSdk1.getOwners() chai.expect(initialOwners.length).to.be.eq(3) @@ -734,16 +750,22 @@ describe('Safe owners manager', () => { it('should replace any owner of a Safe', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3, account4] = accounts - const ethAdapter1 = await getEthAdapter(account1.signer) + const provider1 = await getEthAdapter(account1.signer) const safeSdk1 = await Safe.create({ - provider: ethAdapter1, + provider: provider1, safeAddress: await safe.getAddress(), contractNetworks }) - const ethAdapter2 = await getEthAdapter(account2.signer) - const safeSdk2 = await safeSdk1.connect({ provider: ethAdapter2 }) - const ethAdapter3 = await getEthAdapter(account3.signer) - const safeSdk3 = await safeSdk1.connect({ provider: ethAdapter3 }) + const provider2 = await getEthAdapter(account2.signer) + const safeSdk2 = await safeSdk1.connect({ + provider: provider2, + signerAddress: account2.address + }) + const provider3 = await getEthAdapter(account3.signer) + const safeSdk3 = await safeSdk1.connect({ + provider: provider3, + signerAddress: account3.address + }) const initialOwners = await safeSdk1.getOwners() chai.expect(initialOwners.length).to.be.eq(3) chai.expect(initialOwners[0]).to.be.eq(account1.address) diff --git a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts b/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts index b6a441b22..585a5a502 100644 --- a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts +++ b/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts @@ -22,7 +22,7 @@ const accountMethods = ['eth_accounts', 'eth_sign'] export async function getEthAdapter(signer: HardhatEthersSigner): Promise { return { request: async (request) => { - return signer.provider.send(request.method, request.params as any[]) + return signer.provider.send(request.method, [...((request.params as unknown[]) ?? [])]) } } } diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index 273df6589..db4805130 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -23,10 +23,12 @@ import { itif } from './utils/helpers' async function deploySafe( deploySafeProps: DeploySafeProps, provider: Eip1193Provider, - contractNetworks: ContractNetworksConfig + contractNetworks: ContractNetworksConfig, + signerAddress?: string ): Promise { const safeFactory = await SafeFactory.create({ provider, + signerAddress, safeVersion: safeVersionDeployed, contractNetworks }) @@ -82,7 +84,8 @@ describe('Contract utils', () => { const deployedSafe = await deploySafe( { safeAccountConfig, saltNonce: safeDeploymentConfig.saltNonce }, provider, - contractNetworks + contractNetworks, + owner1.address ) // We ensure the Safe is deployed, as getAddress() function is able to return an address for a predictedSafe @@ -126,7 +129,8 @@ describe('Contract utils', () => { const deployedSafe = await deploySafe( { safeAccountConfig, saltNonce: safeDeploymentConfig.saltNonce }, provider, - contractNetworks + contractNetworks, + owner1.address ) // We ensure the Safe is deployed, as getAddress() function is able to return an address for a predictedSafe @@ -170,7 +174,8 @@ describe('Contract utils', () => { const deployedSafe = await deploySafe( { safeAccountConfig, saltNonce: safeDeploymentConfig.saltNonce }, provider, - contractNetworks + contractNetworks, + owner1.address ) // We ensure the Safe is deployed, as getAddress() function is able to return an address for a predictedSafe @@ -351,7 +356,8 @@ describe('Contract utils', () => { const firstDeployedSafe = await deploySafe( { safeAccountConfig, saltNonce: firstSaltNonce }, provider, - contractNetworks + contractNetworks, + owner1.address ) // We ensure the Safe is deployed, as getAddress() function is able to return an address for a predictedSafe @@ -374,7 +380,8 @@ describe('Contract utils', () => { const secondDeployedSafe = await deploySafe( { safeAccountConfig, saltNonce: secondSaltNonce }, provider, - contractNetworks + contractNetworks, + owner1.address ) // We ensure the Safe is deployed, as getAddress() function is able to return an address for a predictedSafe @@ -397,7 +404,8 @@ describe('Contract utils', () => { const thirdDeployedSafe = await deploySafe( { safeAccountConfig, saltNonce: thirdSaltNonce }, provider, - contractNetworks + contractNetworks, + owner1.address ) // We ensure the Safe is deployed, as getAddress() function is able to return an address for a predictedSafe @@ -431,7 +439,8 @@ describe('Contract utils', () => { const deployedSafe = await deploySafe( { safeAccountConfig, saltNonce: safeDeploymentConfig.saltNonce }, provider, - contractNetworks + contractNetworks, + owner1.address ) // We ensure the Safe is deployed, as getAddress() function is able to return an address for a predictedSafe const isSafeDeployed = await deployedSafe.isSafeDeployed() @@ -493,7 +502,12 @@ describe('Contract utils', () => { }) // we deploy the Safe by providing only the safeAccountConfig (owners & threshold) - const deployedSafe = await deploySafe({ safeAccountConfig }, provider, contractNetworks) + const deployedSafe = await deploySafe( + { safeAccountConfig }, + provider, + contractNetworks, + owner1.address + ) // We ensure the Safe is deployed const isSafeDeployed = await deployedSafe.isSafeDeployed() From 53f54f2076c1557853b1dc2b8851e47c760d1cf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 11 Apr 2024 18:18:30 +0200 Subject: [PATCH 004/112] Initial commit --- packages/protocol-kit/src/Safe.ts | 87 +++++++++-------- .../{EthersAdapter.ts => SafeProvider.ts} | 20 ++-- .../CreateCallBaseContractEthers.ts | 2 +- .../CreateCallContract_v1_3_0_Ethers.ts | 2 +- .../CreateCallContract_v1_4_1_Ethers.ts | 4 +- .../MultiSend/MultiSendBaseContractEthers.ts | 2 +- .../MultiSendCallOnlyBaseContractEthers.ts | 4 +- .../v1.1.1/MultiSendContract_V1_1_1_Ethers.ts | 4 +- ...MultiSendCallOnlyContract_V1_3_0_Ethers.ts | 4 +- .../v1.3.0/MultiSendContract_V1_3_0_Ethers.ts | 2 +- ...MultiSendCallOnlyContract_V1_4_1_Ethers.ts | 4 +- .../v1.4.1/MultiSendContract_V1_4_1_Ethers.ts | 4 +- .../contracts/Safe/SafeBaseContractEthers.ts | 4 +- .../Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts | 2 +- .../Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts | 4 +- .../Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts | 4 +- .../Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts | 4 +- .../Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts | 4 +- .../SafeProxyFactoryBaseContractEthers.ts | 4 +- .../SafeProxyFactoryContract_v1_0_0_Ethers.ts | 4 +- .../SafeProxyFactoryContract_v1_1_1_Ethers.ts | 4 +- .../SafeProxyFactoryContract_v1_3_0_Ethers.ts | 4 +- .../SafeProxyFactoryContract_v1_4_1_Ethers.ts | 4 +- .../SignMessageLibBaseContractEthers.ts | 4 +- .../SignMessageLibContract_V1_3_0_Ethers.ts | 4 +- .../SignMessageLibContract_V1_4_1_Ethers.ts | 4 +- .../SimulateTxAccessorBaseContractEthers.ts | 4 +- ...imulateTxAccessorContract_v1_3_0_Ethers.ts | 4 +- ...imulateTxAccessorContract_v1_4_1_Ethers.ts | 4 +- .../contracts/contractInstancesEthers.ts | 70 +++++++------- .../protocol-kit/src/adapters/ethers/index.ts | 6 +- .../src/adapters/web3/Web3Adapter.ts | 12 +-- .../src/contracts/safeDeploymentContracts.ts | 68 +++++++------- packages/protocol-kit/src/contracts/utils.ts | 40 ++++---- packages/protocol-kit/src/index.ts | 8 +- .../src/managers/contractManager.ts | 18 ++-- .../src/managers/fallbackHandlerManager.ts | 12 +-- .../protocol-kit/src/managers/guardManager.ts | 12 +-- .../src/managers/moduleManager.ts | 10 +- .../protocol-kit/src/managers/ownerManager.ts | 10 +- .../protocol-kit/src/safeFactory/index.ts | 36 +++---- .../protocol-kit/src/utils/erc-20/index.ts | 4 +- .../src/utils/signatures/utils.ts | 18 ++-- .../src/utils/transactions/gas.ts | 44 ++++----- .../src/utils/transactions/utils.ts | 8 +- .../tests/e2e/contractManager.test.ts | 12 +-- packages/protocol-kit/tests/e2e/core.test.ts | 52 +++++----- .../createSafeDeploymentTransaction.test.ts | 24 ++--- .../tests/e2e/createTransaction.test.ts | 32 +++---- .../tests/e2e/createTransactionBatch.test.ts | 4 +- .../e2e/eip1271-contract-signatures.test.ts | 22 ++--- .../protocol-kit/tests/e2e/eip1271.test.ts | 10 +- .../protocol-kit/tests/e2e/erc-20.test.ts | 18 ++-- .../tests/e2e/ethAdapters.test.ts | 34 +++---- .../protocol-kit/tests/e2e/execution.test.ts | 94 +++++++++---------- .../tests/e2e/fallbackHandlerManager.test.ts | 36 +++---- .../tests/e2e/getEncodedTransaction.test.ts | 8 +- .../tests/e2e/guardManager.test.ts | 34 +++---- .../tests/e2e/moduleManager.test.ts | 38 ++++---- .../tests/e2e/offChainSignatures.test.ts | 32 +++---- .../tests/e2e/onChainSignatures.test.ts | 16 ++-- .../tests/e2e/ownerManager.test.ts | 94 +++++++++---------- .../tests/e2e/safeFactory.test.ts | 54 +++++------ .../protocol-kit/tests/e2e/threshold.test.ts | 16 ++-- .../tests/e2e/utils/setupEthAdapter.ts | 17 +--- .../tests/e2e/utils/transactions.ts | 6 +- .../tests/e2e/utilsContracts.test.ts | 34 +++---- ...SafeTransactionIntoDeploymentBatch.test.ts | 10 +- .../src/ethereumLibs/EthAdapter.ts | 8 +- 69 files changed, 636 insertions(+), 650 deletions(-) rename packages/protocol-kit/src/adapters/ethers/{EthersAdapter.ts => SafeProvider.ts} (94%) diff --git a/packages/protocol-kit/src/Safe.ts b/packages/protocol-kit/src/Safe.ts index 0ca382821..cf74f7f75 100644 --- a/packages/protocol-kit/src/Safe.ts +++ b/packages/protocol-kit/src/Safe.ts @@ -1,6 +1,5 @@ -import { ethers } from 'ethers' import { - EthAdapter, + ISafeProvider, OperationType, SafeMultisigTransactionResponse, SafeMultisigConfirmationResponse, @@ -73,7 +72,7 @@ import { } from './contracts/safeDeploymentContracts' import SafeMessage from './utils/messages/SafeMessage' import semverSatisfies from 'semver/functions/satisfies' -import { EthersAdapter } from './adapters/ethers' +import { SafeProvider } from './adapters/ethers' const EQ_OR_GT_1_4_1 = '>=1.4.1' const EQ_OR_GT_1_3_0 = '>=1.3.0' @@ -81,7 +80,7 @@ const EQ_OR_GT_1_3_0 = '>=1.3.0' class Safe { #predictedSafe?: PredictedSafeProps #provider!: Eip1193Provider - #ethAdapter!: EthAdapter + #safeProvider!: ISafeProvider #contractManager!: ContractManager #ownerManager!: OwnerManager #moduleManager!: ModuleManager @@ -118,7 +117,7 @@ class Safe { const { provider, signerAddress, isL1SafeSingleton, contractNetworks } = config this.#provider = provider - this.#ethAdapter = new EthersAdapter({ + this.#safeProvider = new SafeProvider({ provider, signerAddress }) @@ -131,7 +130,7 @@ class Safe { isL1SafeSingleton, contractNetworks }, - this.#ethAdapter + this.#safeProvider ) } else { this.#contractManager = await ContractManager.create( @@ -141,15 +140,15 @@ class Safe { isL1SafeSingleton, contractNetworks }, - this.#ethAdapter + this.#safeProvider ) } - this.#ownerManager = new OwnerManager(this.#ethAdapter, this.#contractManager.safeContract) - this.#moduleManager = new ModuleManager(this.#ethAdapter, this.#contractManager.safeContract) - this.#guardManager = new GuardManager(this.#ethAdapter, this.#contractManager.safeContract) + this.#ownerManager = new OwnerManager(this.#safeProvider, this.#contractManager.safeContract) + this.#moduleManager = new ModuleManager(this.#safeProvider, this.#contractManager.safeContract) + this.#guardManager = new GuardManager(this.#safeProvider, this.#contractManager.safeContract) this.#fallbackHandlerManager = new FallbackHandlerManager( - this.#ethAdapter, + this.#safeProvider, this.#contractManager.safeContract ) } @@ -223,9 +222,9 @@ class Safe { ) } - const chainId = await this.#ethAdapter.getChainId() + const chainId = await this.#safeProvider.getChainId() return predictSafeAddress({ - ethAdapter: this.#ethAdapter, + safeProvider: this.#safeProvider, chainId, customContracts: this.#contractManager.contractNetworks?.[chainId.toString()], ...this.#predictedSafe @@ -249,12 +248,12 @@ class Safe { } /** - * Returns the current EthAdapter. + * Returns the current SafeProvider. * - * @returns The current EthAdapter + * @returns The current SafeProvider */ - getEthAdapter(): EthAdapter { - return this.#ethAdapter + getSafeProvider(): ISafeProvider { + return this.#safeProvider } /** @@ -282,7 +281,7 @@ class Safe { */ async isSafeDeployed(): Promise { const safeAddress = await this.getAddress() - const isSafeDeployed = await this.#ethAdapter.isContractDeployed(safeAddress) + const isSafeDeployed = await this.#safeProvider.isContractDeployed(safeAddress) return isSafeDeployed } @@ -348,7 +347,7 @@ class Safe { * @returns The chainId of the connected network */ async getChainId(): Promise { - return this.#ethAdapter.getChainId() + return this.#safeProvider.getChainId() } /** @@ -357,7 +356,7 @@ class Safe { * @returns The ETH balance of the Safe */ async getBalance(): Promise { - return this.#ethAdapter.getBalance(await this.getAddress()) + return this.#safeProvider.getBalance(await this.getAddress()) } /** @@ -548,7 +547,7 @@ class Safe { * @returns The Safe signature */ async signHash(hash: string): Promise { - const signature = await generateSignature(this.#ethAdapter, hash) + const signature = await generateSignature(this.#safeProvider, hash) return signature } @@ -580,9 +579,9 @@ class Safe { preimageSafeAddress?: string ): Promise { const owners = await this.getOwners() - const signerAddress = await this.#ethAdapter.getSignerAddress() + const signerAddress = await this.#safeProvider.getSignerAddress() if (!signerAddress) { - throw new Error('EthAdapter must be initialized with a signer to use this method') + throw new Error('SafeProvider must be initialized with a signer to use this method') } const addressIsOwner = owners.some( @@ -662,11 +661,11 @@ class Safe { const safeEIP712Args: SafeEIP712Args = { safeAddress: await this.getAddress(), safeVersion: await this.getContractVersion(), - chainId: await this.getEthAdapter().getChainId(), + chainId: await this.getSafeProvider().getChainId(), data: eip712Data.data } - return generateEIP712Signature(this.#ethAdapter, safeEIP712Args, methodVersion) + return generateEIP712Signature(this.#safeProvider, safeEIP712Args, methodVersion) } /** @@ -691,10 +690,10 @@ class Safe { : safeTransaction const owners = await this.getOwners() - const signerAddress = await this.#ethAdapter.getSignerAddress() + const signerAddress = await this.#safeProvider.getSignerAddress() console.log('signerAddress', signerAddress) if (!signerAddress) { - throw new Error('EthAdapter must be initialized with a signer to use this method') + throw new Error('SafeProvider must be initialized with a signer to use this method') } const addressIsOwner = owners.some( @@ -776,9 +775,9 @@ class Safe { } const owners = await this.getOwners() - const signerAddress = await this.#ethAdapter.getSignerAddress() + const signerAddress = await this.#safeProvider.getSignerAddress() if (!signerAddress) { - throw new Error('EthAdapter must be initialized with a signer to use this method') + throw new Error('SafeProvider must be initialized with a signer to use this method') } const addressIsOwner = owners.some( (owner: string) => signerAddress && sameString(owner, signerAddress) @@ -1133,9 +1132,9 @@ class Safe { signedSafeTransaction.addSignature(generatePreValidatedSignature(owner)) } const owners = await this.getOwners() - const signerAddress = await this.#ethAdapter.getSignerAddress() + const signerAddress = await this.#safeProvider.getSignerAddress() if (!signerAddress) { - throw new Error('EthAdapter must be initialized with a signer to use this method') + throw new Error('SafeProvider must be initialized with a signer to use this method') } if (owners.includes(signerAddress)) { signedSafeTransaction.addSignature(generatePreValidatedSignature(signerAddress)) @@ -1181,7 +1180,7 @@ class Safe { } const owners = await this.getOwners() const threshold = await this.getThreshold() - const signerAddress = await this.#ethAdapter.getSignerAddress() + const signerAddress = await this.#safeProvider.getSignerAddress() if ( threshold > signedSafeTransaction.signatures.size && signerAddress && @@ -1235,7 +1234,7 @@ class Safe { const isL1SafeSingleton = this.#contractManager.isL1SafeSingleton const safeSingletonContract = await getSafeContract({ - ethAdapter: this.#ethAdapter, + safeProvider: this.#safeProvider, safeVersion: safeVersion, isL1SafeSingleton, customContracts @@ -1335,13 +1334,13 @@ class Safe { const { safeAccountConfig, safeDeploymentConfig } = this.#predictedSafe const safeVersion = await this.getContractVersion() - const ethAdapter = this.#ethAdapter - const chainId = await ethAdapter.getChainId() + const safeProvider = this.#safeProvider + const chainId = await safeProvider.getChainId() const isL1SafeSingleton = this.#contractManager.isL1SafeSingleton const customContracts = this.#contractManager.contractNetworks?.[chainId.toString()] const safeSingletonContract = await getSafeContract({ - ethAdapter: this.#ethAdapter, + safeProvider: this.#safeProvider, safeVersion, isL1SafeSingleton, customContracts @@ -1349,14 +1348,14 @@ class Safe { // we use the SafeProxyFactory.sol contract, see: https://github.com/safe-global/safe-contracts/blob/main/contracts/proxies/SafeProxyFactory.sol const safeProxyFactoryContract = await getProxyFactoryContract({ - ethAdapter, + safeProvider, safeVersion, customContracts }) // this is the call to the setup method that sets the threshold & owners of the new Safe, see: https://github.com/safe-global/safe-contracts/blob/main/contracts/Safe.sol#L95 const initializer = await encodeSetupCallData({ - ethAdapter, + safeProvider, safeContract: safeSingletonContract, safeAccountConfig: safeAccountConfig, customContracts @@ -1397,11 +1396,11 @@ class Safe { transactions: MetaTransactionData[], transactionOptions?: TransactionOptions ): Promise { - const chainId = await this.#ethAdapter.getChainId() + const chainId = await this.#safeProvider.getChainId() // we use the MultiSend contract to create the batch, see: https://github.com/safe-global/safe-contracts/blob/main/contracts/libraries/MultiSendCallOnly.sol const multiSendCallOnlyContract = await getMultiSendCallOnlyContract({ - ethAdapter: this.#ethAdapter, + safeProvider: this.#safeProvider, safeVersion: await this.getContractVersion(), customContracts: this.#contractManager.contractNetworks?.[chainId.toString()] }) @@ -1433,10 +1432,10 @@ class Safe { const safeVersion = (await this.#contractManager.safeContract.getVersion()) ?? DEFAULT_SAFE_VERSION - const chainId = await this.#ethAdapter.getChainId() + const chainId = await this.#safeProvider.getChainId() const compatibilityFallbackHandlerContract = await getCompatibilityFallbackHandlerContract({ - ethAdapter: this.#ethAdapter, + safeProvider: this.#safeProvider, safeVersion, customContracts: this.#contractManager.contractNetworks?.[chainId.toString()] }) @@ -1492,12 +1491,12 @@ class Safe { try { const isValidSignatureResponse = await Promise.all([ - this.#ethAdapter.call({ + this.#safeProvider.call({ from: safeAddress, to: safeAddress, data: data }), - this.#ethAdapter.call({ + this.#safeProvider.call({ from: safeAddress, to: safeAddress, data: bytesData diff --git a/packages/protocol-kit/src/adapters/ethers/EthersAdapter.ts b/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts similarity index 94% rename from packages/protocol-kit/src/adapters/ethers/EthersAdapter.ts rename to packages/protocol-kit/src/adapters/ethers/SafeProvider.ts index 65b12b872..22aa4c6c5 100644 --- a/packages/protocol-kit/src/adapters/ethers/EthersAdapter.ts +++ b/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts @@ -4,8 +4,8 @@ import { EIP712TypedDataMessage, EIP712TypedDataTx, Eip3770Address, - EthAdapter, - EthAdapterTransaction, + ISafeProvider, + SafeProviderTransaction, GetContractProps, SafeEIP712Args, SignMessageLibContract, @@ -32,13 +32,13 @@ import MultiSendContract_v1_3_0_Ethers from './contracts/MultiSend/v1.3.0/MultiS import MultiSendContract_v1_4_1_Ethers from './contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Ethers' import { Eip1193Provider } from '@safe-global/protocol-kit/types' -export interface EthersAdapterConfig { +export interface SafeProviderConfig { /** signerOrProvider - Ethers signer or provider */ provider: Eip1193Provider signerAddress?: string } -class EthersAdapter implements EthAdapter { +class SafeProvider implements ISafeProvider { get #signer(): Promise { return this.#provider.getSigner(this.#signerAddress) } @@ -47,7 +47,7 @@ class EthersAdapter implements EthAdapter { #eip1193Provider: Eip1193Provider #signerAddress?: string - constructor({ provider, signerAddress }: EthersAdapterConfig) { + constructor({ provider, signerAddress }: SafeProviderConfig) { this.#provider = new BrowserProvider(provider) this.#eip1193Provider = provider this.#signerAddress = signerAddress @@ -272,7 +272,7 @@ class EthersAdapter implements EthAdapter { const signer = await this.#signer if (!signer) { - throw new Error('EthAdapter must be initialized with a signer to use this method') + throw new Error('SafeProvider must be initialized with a signer to use this method') } const messageArray = ethers.getBytes(message) @@ -283,7 +283,7 @@ class EthersAdapter implements EthAdapter { const signer = await this.#signer if (!signer) { - throw new Error('EthAdapter must be initialized with a signer to use this method') + throw new Error('SafeProvider must be initialized with a signer to use this method') } if (isTypedDataSigner(signer)) { @@ -301,11 +301,11 @@ class EthersAdapter implements EthAdapter { throw new Error('The current signer does not implement EIP-712 to sign typed data') } - async estimateGas(transaction: EthAdapterTransaction): Promise { + async estimateGas(transaction: SafeProviderTransaction): Promise { return (await this.#provider.estimateGas(transaction)).toString() } - call(transaction: EthAdapterTransaction, blockTag?: string | number): Promise { + call(transaction: SafeProviderTransaction, blockTag?: string | number): Promise { return this.#provider.call({ ...transaction, blockTag }) } @@ -318,4 +318,4 @@ class EthersAdapter implements EthAdapter { } } -export default EthersAdapter +export default SafeProvider diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts index b162df978..dcb0140bb 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts @@ -26,7 +26,7 @@ abstract class CreateCallBaseContractEthers< * Constructs an instance of CreateCallBaseContractEthers. * * @param chainId - The chain ID of the contract. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param defaultAbi - The default ABI for the CreateCall contract. It should be compatible with the specific version of the contract. * @param safeVersion - The version of the Safe contract. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts index 7544d73c2..36340c273 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts @@ -34,7 +34,7 @@ class CreateCallContract_V1_3_0_Ethers * Constructs an instance of CreateCallContract_V1_3_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the CreateCall deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts index a6aa750f4..6f02d3397 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts @@ -1,5 +1,5 @@ import CreateCallBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { EthersTransactionOptions, EthersTransactionResult @@ -35,7 +35,7 @@ class CreateCallContract_V1_4_1_Ethers * Constructs an instance of CreateCallContract_V1_4_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the CreateCall deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts index e41cbc3d5..c6cb709f4 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts @@ -28,7 +28,7 @@ abstract class MultiSendBaseContractEthers< * Constructs an instance of MultiSendBaseContractEthers. * * @param chainId - The chain ID of the contract. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param defaultAbi - The default ABI for the MultiSend contract. It should be compatible with the specific version of the MultiSend contract. * @param safeVersion - The version of the MultiSend contract. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSend deployments based on the chainId and safeVersion. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts index 81a85eab7..7f2eebd35 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts @@ -1,6 +1,6 @@ import { AbstractSigner, Contract, InterfaceAbi } from 'ethers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import MultiSendCallOnlyBaseContract from '@safe-global/protocol-kit/adapters/MultiSendCallOnlyBaseContract' @@ -28,7 +28,7 @@ abstract class MultiSendCallOnlyBaseContractEthers< * Constructs an instance of MultiSendCallOnlyBaseContractEthers. * * @param chainId - The chain ID of the contract. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param defaultAbi - The default ABI for the MultiSendCallOnly contract. It should be compatible with the specific version of the MultiSendCallOnly contract. * @param safeVersion - The version of the MultiSendCallOnly contract. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSendCallOnly deployments based on the chainId and safeVersion. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_V1_1_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_V1_1_1_Ethers.ts index 202f1d51f..b94a45f10 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_V1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_V1_1_1_Ethers.ts @@ -1,5 +1,5 @@ import MultiSendBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import MultiSendContract_v1_1_1_Contract, { MultiSendContract_v1_1_1_Abi } from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/v1.1.1/MultiSendContract_v1_1_1' @@ -29,7 +29,7 @@ class MultiSendContract_v1_1_1_Ethers * Constructs an instance of MultiSendContract_v1_1_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSend deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.1.1 is used. */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_V1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_V1_3_0_Ethers.ts index b0269152a..0330815cb 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_V1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_V1_3_0_Ethers.ts @@ -1,5 +1,5 @@ import MultiSendCallOnlyBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import MultiSendCallOnlyContract_v1_3_0_Contract, { MultiSendCallOnlyContract_v1_3_0_Abi } from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0' @@ -29,7 +29,7 @@ class MultiSendCallOnlyContract_v1_3_0_Ethers * Constructs an instance of MultiSendCallOnlyContract_v1_3_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSendCallOnly deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_V1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_V1_3_0_Ethers.ts index e94ecf0ae..544ffb656 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_V1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_V1_3_0_Ethers.ts @@ -28,7 +28,7 @@ class MultiSendContract_v1_3_0_Ethers * Constructs an instance of MultiSendContract_v1_3_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSend deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Ethers.ts index 9bdb12cd9..cac69c982 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Ethers.ts @@ -1,5 +1,5 @@ import MultiSendCallOnlyBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import MultiSendCallOnlyContract_v1_4_1_Contract, { MultiSendCallOnlyContract_v1_4_1_Abi } from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1' @@ -29,7 +29,7 @@ class MultiSendCallOnlyContract_v1_4_1_Ethers * Constructs an instance of MultiSendCallOnlyContract_v1_4_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSendCallOnly deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Ethers.ts index f2b5a6ea2..1bf97a8b8 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Ethers.ts @@ -1,5 +1,5 @@ import MultiSendBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import MultiSendContract_v1_4_1_Contract, { MultiSendContract_v1_4_1_Abi } from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/v1.4.1/MultiSendContract_v1_4_1' @@ -29,7 +29,7 @@ class MultiSendContract_v1_4_1_Ethers * Constructs an instance of MultiSendContract_v1_4_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSend deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts index 56ee9d87d..96fb708e7 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts @@ -1,6 +1,6 @@ import { AbstractSigner, Contract, InterfaceAbi } from 'ethers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import SafeBaseContract from '@safe-global/protocol-kit/adapters/SafeBaseContract' @@ -32,7 +32,7 @@ abstract class SafeBaseContractEthers< * Constructs an instance of SafeBaseContractEthers. * * @param chainId - The chain ID of the contract. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param defaultAbi - The default ABI for the Safe contract. It should be compatible with the specific version of the Safe contract. * @param safeVersion - The version of the Safe contract. * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts index 766a83190..5c1ffa41f 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts @@ -34,7 +34,7 @@ class SafeContract_v1_0_0_Ethers * Constructs an instance of SafeContract_v1_0_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.0.0 is used. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts index b0bacb419..1d9c29fd8 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts @@ -1,5 +1,5 @@ import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { EthersTransactionOptions, EthersTransactionResult @@ -35,7 +35,7 @@ class SafeContract_v1_1_1_Ethers * Constructs an instance of SafeContract_v1_1_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.1.1 is used. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts index 71e2f8518..0de34971b 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts @@ -1,5 +1,5 @@ import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { EthersTransactionOptions, EthersTransactionResult @@ -34,7 +34,7 @@ class SafeContract_v1_2_0_Ethers * Constructs an instance of SafeContract_v1_2_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.2.0 is used. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts index fecda4949..1424ed6f3 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts @@ -1,5 +1,5 @@ import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { EthersTransactionOptions, EthersTransactionResult @@ -35,7 +35,7 @@ class SafeContract_v1_3_0_Ethers * Constructs an instance of SafeContract_v1_3_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts index adadb98ed..0ea031245 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts @@ -1,5 +1,5 @@ import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { EthersTransactionOptions, EthersTransactionResult @@ -35,7 +35,7 @@ class SafeContract_v1_4_1_Ethers * Constructs an instance of SafeContract_v1_4_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts index 63b2aca99..249cd2024 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts @@ -1,6 +1,6 @@ import { AbstractSigner, Contract, ContractRunner, InterfaceAbi } from 'ethers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import SafeProxyFactoryBaseContract from '@safe-global/protocol-kit/adapters/SafeProxyFactoryBaseContract' import { SafeVersion } from '@safe-global/safe-core-sdk-types' @@ -32,7 +32,7 @@ abstract class SafeProxyFactoryBaseContractEthers< * Constructs an instance of SafeProxyFactoryBaseContractEthers. * * @param chainId - The chain ID of the contract. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param defaultAbi - The default ABI for the Safe contract. It should be compatible with the specific version of the contract. * @param safeVersion - The version of the Safe contract. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts index d637ed39c..6e2b65595 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts @@ -1,6 +1,6 @@ import { AbstractSigner, ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { EthersTransactionOptions } from '@safe-global/protocol-kit/adapters/ethers/types' import safeProxyFactory_1_0_0_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/SafeProxyFactory/v1.0.0/proxy_factory' import { @@ -30,7 +30,7 @@ class SafeProxyFactoryContract_v1_0_0_Ethers * Constructs an instance of SafeProxyFactoryContract_v1_0_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.0.0 is used. */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts index f3e7089b6..8488ac65a 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts @@ -1,6 +1,6 @@ import { AbstractSigner, ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { EthersTransactionOptions } from '@safe-global/protocol-kit/adapters/ethers/types' import safeProxyFactory_1_1_1_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/SafeProxyFactory/v1.1.1/proxy_factory' import { @@ -30,7 +30,7 @@ class SafeProxyFactoryContract_v1_1_1_Ethers * Constructs an instance of SafeProxyFactoryContract_v1_1_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.1.1 is used. */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts index 4210637a7..e43902a53 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts @@ -1,6 +1,6 @@ import { AbstractSigner, ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { EthersTransactionOptions } from '@safe-global/protocol-kit/adapters/ethers/types' import safeProxyFactory_1_3_0_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/SafeProxyFactory/v1.3.0/proxy_factory' import { @@ -30,7 +30,7 @@ class SafeProxyFactoryContract_v1_3_0_Ethers * Constructs an instance of SafeProxyFactoryContract_v1_3_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts index ca5fb481a..7bf3c9760 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts @@ -1,6 +1,6 @@ import { AbstractSigner, ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { EthersTransactionOptions } from '@safe-global/protocol-kit/adapters/ethers/types' import safeProxyFactory_1_4_1_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/SafeProxyFactory/v1.4.1/safe_proxy_factory' import { @@ -30,7 +30,7 @@ class SafeProxyFactoryContract_v1_4_1_Ethers * Constructs an instance of SafeProxyFactoryContract_v1_4_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts index eb17acfe8..d0f7ceeba 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts @@ -1,6 +1,6 @@ import { AbstractSigner, Contract, InterfaceAbi } from 'ethers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import SignMessageLibBaseContract from '@safe-global/protocol-kit/adapters/SignMessageLibBaseContract' @@ -29,7 +29,7 @@ abstract class SignMessageLibBaseContractEthers< * Constructs an instance of SignMessageLibBaseContractEthers. * * @param chainId - The chain ID of the contract. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param defaultAbi - The default ABI for the SignMessageLib contract. It should be compatible with the specific version of the SignMessageLib contract. * @param safeVersion - The version of the SignMessageLib contract. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SignMessageLib deployments based on the chainId and safeVersion. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_V1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_V1_3_0_Ethers.ts index 81d20b2a4..d514c6f61 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_V1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_V1_3_0_Ethers.ts @@ -1,7 +1,7 @@ import { EthersTransactionOptions } from '@safe-global/protocol-kit/adapters/ethers/types' import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' import SignMessageLibBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import SignMessageLibContract_v1_3_0_Contract, { SignMessageLibContract_v1_3_0_Abi } from '@safe-global/protocol-kit/contracts/AbiType/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0' @@ -33,7 +33,7 @@ class SignMessageLibContract_v1_3_0_Ethers * Constructs an instance of SignMessageLibContract_v1_3_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SignMessageLib deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Ethers.ts index 43f453ec6..c3a543d78 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Ethers.ts @@ -1,7 +1,7 @@ import { EthersTransactionOptions } from '@safe-global/protocol-kit/adapters/ethers/types' import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' import SignMessageLibBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import SignMessageLibContract_v1_4_1_Contract, { SignMessageLibContract_v1_4_1_Abi } from '@safe-global/protocol-kit/contracts/AbiType/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1' @@ -33,7 +33,7 @@ class SignMessageLibContract_v1_4_1_Ethers * Constructs an instance of SignMessageLibContract_v1_4_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SignMessageLib deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts index 96b9da8b0..317599128 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts @@ -1,6 +1,6 @@ import { AbstractSigner, Contract, ContractRunner, InterfaceAbi } from 'ethers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import SimulateTxAccessorBaseContract from '@safe-global/protocol-kit/adapters/SimulateTxAccessorBaseContract' import { SafeVersion } from '@safe-global/safe-core-sdk-types' @@ -29,7 +29,7 @@ abstract class SimulateTxAccessorBaseContractEthers< * Constructs an instance of SimulateTxAccessorBaseContractEthers. * * @param chainId - The chain ID of the contract. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param defaultAbi - The default ABI for the SimulateTxAccessor contract. It should be compatible with the specific version of the contract. * @param safeVersion - The version of the Safe contract. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts index 69cb31f90..f06d26bd9 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts @@ -1,5 +1,5 @@ import SimulateTxAccessorBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import SimulateTxAccessorContract_v1_3_0_Contract, { SimulateTxAccessorContract_v1_3_0_Abi } from '@safe-global/protocol-kit/contracts/AbiType/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0' @@ -29,7 +29,7 @@ class SimulateTxAccessorContract_v1_3_0_Ethers * Constructs an instance of SimulateTxAccessorContract_v1_3_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SimulateTxAccessor deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts index 893b1fe06..3f4e4108d 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts @@ -1,5 +1,5 @@ import SimulateTxAccessorBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import SimulateTxAccessorContract_v1_4_1_Contract, { SimulateTxAccessorContract_v1_4_1_Abi } from '@safe-global/protocol-kit/contracts/AbiType/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1' @@ -29,7 +29,7 @@ class SimulateTxAccessorContract_v1_4_1_Ethers * Constructs an instance of SimulateTxAccessorContract_v1_4_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SimulateTxAccessor deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts index 12bae0271..396d45383 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts @@ -30,7 +30,7 @@ import SafeProxyFactoryContract_v1_3_0_Ethers from '@safe-global/protocol-kit/ad import SafeProxyFactoryContract_v1_4_1_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers' import SimulateTxAccessorContract_V1_3_0_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers' import SimulateTxAccessorContract_V1_4_1_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers' -import EthersAdapter from '../EthersAdapter' +import SafeProvider from '../SafeProvider' import { CreateCallContract_v1_4_1_Abi } from '@safe-global/protocol-kit/contracts/AbiType/CreateCall/v1.4.1/CreateCallContract_v1_4_1' import { CreateCallContract_v1_3_0_Abi } from '@safe-global/protocol-kit/contracts/AbiType/CreateCall/v1.3.0/CreateCallContract_v1_3_0' import { MultiSendContract_v1_4_1_Abi } from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/v1.4.1/MultiSendContract_v1_4_1' @@ -55,18 +55,18 @@ import { SimulateTxAccessorContract_v1_4_1_Abi } from '@safe-global/protocol-kit export async function getSafeContractInstance( safeVersion: SafeVersion, contractAddress: string, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAbi?: AbiItem | AbiItem[] | undefined, isL1SafeSingleton?: boolean // TODO return type used until Typechain is removed ): Promise { - const chainId = await ethersAdapter.getChainId() + const chainId = await safeProvider.getChainId() let safeContract switch (safeVersion) { case '1.4.1': safeContract = new SafeContract_v1_4_1_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, isL1SafeSingleton, contractAddress, // TODO: Remove this unknown after remove Typechain @@ -77,7 +77,7 @@ export async function getSafeContractInstance( case '1.3.0': safeContract = new SafeContract_v1_3_0_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, isL1SafeSingleton, contractAddress, // TODO: Remove this unknown after remove Typechain @@ -88,7 +88,7 @@ export async function getSafeContractInstance( case '1.2.0': safeContract = new SafeContract_v1_2_0_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, isL1SafeSingleton, contractAddress, // TODO: Remove this unknown after remove Typechain @@ -99,7 +99,7 @@ export async function getSafeContractInstance( case '1.1.1': safeContract = new SafeContract_v1_1_1_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, isL1SafeSingleton, contractAddress, // TODO: Remove this unknown after remove Typechain @@ -110,7 +110,7 @@ export async function getSafeContractInstance( case '1.0.0': safeContract = new SafeContract_v1_0_0_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, isL1SafeSingleton, contractAddress, // TODO: Remove this unknown after remove Typechain @@ -152,26 +152,26 @@ export function getCompatibilityFallbackHandlerContractInstance( export async function getMultiSendContractInstance( safeVersion: SafeVersion, contractAddress: string, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAbi?: AbiItem | AbiItem[] | undefined ): Promise< | MultiSendContract_V1_4_1_Ethers | MultiSendContract_V1_3_0_Ethers | MultiSendContract_V1_1_1_Ethers > { - const chainId = await ethersAdapter.getChainId() + const chainId = await safeProvider.getChainId() switch (safeVersion) { case '1.4.1': return new MultiSendContract_V1_4_1_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as MultiSendContract_v1_4_1_Abi ) case '1.3.0': return new MultiSendContract_V1_3_0_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as MultiSendContract_v1_3_0_Abi ) @@ -180,7 +180,7 @@ export async function getMultiSendContractInstance( case '1.0.0': return new MultiSendContract_V1_1_1_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as MultiSendContract_v1_1_1_Abi ) @@ -192,15 +192,15 @@ export async function getMultiSendContractInstance( export async function getMultiSendCallOnlyContractInstance( safeVersion: SafeVersion, contractAddress: string, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAbi?: AbiItem | AbiItem[] | undefined ): Promise { - const chainId = await ethersAdapter.getChainId() + const chainId = await safeProvider.getChainId() switch (safeVersion) { case '1.4.1': return new MultiSendCallOnlyContract_V1_4_1_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as MultiSendCallOnlyContract_v1_4_1_Abi ) @@ -210,7 +210,7 @@ export async function getMultiSendCallOnlyContractInstance( case '1.0.0': return new MultiSendCallOnlyContract_V1_3_0_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as MultiSendCallOnlyContract_v1_3_0_Abi ) @@ -223,16 +223,16 @@ export async function getSafeProxyFactoryContractInstance( safeVersion: SafeVersion, contractAddress: string, signerOrProvider: AbstractSigner | Provider, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAbi?: AbiItem | AbiItem[] | undefined ) { - const chainId = await ethersAdapter.getChainId() + const chainId = await safeProvider.getChainId() let safeProxyFactoryContract switch (safeVersion) { case '1.4.1': safeProxyFactoryContract = new SafeProxyFactoryContract_v1_4_1_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, contractAddress, // TODO: Remove this unknown after remove Typechain customContractAbi as unknown as SafeProxyFactoryContract_v1_4_1_Abi, @@ -243,7 +243,7 @@ export async function getSafeProxyFactoryContractInstance( case '1.3.0': safeProxyFactoryContract = new SafeProxyFactoryContract_v1_3_0_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, contractAddress, // TODO: Remove this unknown after remove Typechain customContractAbi as unknown as SafeProxyFactoryContract_v1_3_0_Abi, @@ -254,7 +254,7 @@ export async function getSafeProxyFactoryContractInstance( case '1.1.1': safeProxyFactoryContract = new SafeProxyFactoryContract_v1_1_1_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, contractAddress, // TODO: Remove this unknown after remove Typechain customContractAbi as unknown as SafeProxyFactoryContract_v1_1_1_Abi, @@ -264,7 +264,7 @@ export async function getSafeProxyFactoryContractInstance( case '1.0.0': safeProxyFactoryContract = new SafeProxyFactoryContract_v1_0_0_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, contractAddress, // TODO: Remove this unknown after remove Typechain customContractAbi as unknown as SafeProxyFactoryContract_v1_0_0_Abi, @@ -279,17 +279,17 @@ export async function getSafeProxyFactoryContractInstance( export async function getSignMessageLibContractInstance( safeVersion: SafeVersion, contractAddress: string, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAbi?: AbiItem | AbiItem[] | undefined ): Promise { - const chainId = await ethersAdapter.getChainId() + const chainId = await safeProvider.getChainId() let signMessageLibContract switch (safeVersion) { case '1.4.1': signMessageLibContract = new SignMessageLibContract_V1_4_1_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as SignMessageLibContract_v1_4_1_Abi ) @@ -299,7 +299,7 @@ export async function getSignMessageLibContractInstance( case '1.3.0': signMessageLibContract = new SignMessageLibContract_V1_3_0_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as SignMessageLibContract_v1_3_0_Abi ) @@ -314,16 +314,16 @@ export async function getSignMessageLibContractInstance( export async function getCreateCallContractInstance( safeVersion: SafeVersion, contractAddress: string, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAbi?: AbiItem | AbiItem[] | undefined ): Promise { - const chainId = await ethersAdapter.getChainId() + const chainId = await safeProvider.getChainId() let createCallContract switch (safeVersion) { case '1.4.1': createCallContract = new CreateCallContract_V1_4_1_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as CreateCallContract_v1_4_1_Abi ) @@ -336,7 +336,7 @@ export async function getCreateCallContractInstance( case '1.0.0': createCallContract = new CreateCallContract_V1_3_0_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as CreateCallContract_v1_3_0_Abi ) @@ -351,23 +351,23 @@ export async function getCreateCallContractInstance( export async function getSimulateTxAccessorContractInstance( safeVersion: SafeVersion, contractAddress: string, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAbi?: AbiItem | AbiItem[] | undefined ): Promise { - const chainId = await ethersAdapter.getChainId() + const chainId = await safeProvider.getChainId() switch (safeVersion) { case '1.4.1': return new SimulateTxAccessorContract_V1_4_1_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as SimulateTxAccessorContract_v1_4_1_Abi ) case '1.3.0': return new SimulateTxAccessorContract_V1_3_0_Ethers( chainId, - (await ethersAdapter.getSigner()) as AbstractSigner, + (await safeProvider.getSigner()) as AbstractSigner, contractAddress, customContractAbi as unknown as SimulateTxAccessorContract_v1_3_0_Abi ) diff --git a/packages/protocol-kit/src/adapters/ethers/index.ts b/packages/protocol-kit/src/adapters/ethers/index.ts index d660a0d91..c1c795ca4 100644 --- a/packages/protocol-kit/src/adapters/ethers/index.ts +++ b/packages/protocol-kit/src/adapters/ethers/index.ts @@ -1,4 +1,4 @@ -import EthersAdapter, { EthersAdapterConfig } from './EthersAdapter' +import SafeProvider, { SafeProviderConfig } from './SafeProvider' import CreateCallBaseContractEthers from './contracts/CreateCall/CreateCallBaseContractEthers' import MultiSendBaseContractEthers from './contracts/MultiSend/MultiSendBaseContractEthers' import MultiSendCallOnlyBaseContractEthers from './contracts/MultiSend/MultiSendCallOnlyBaseContractEthers' @@ -9,8 +9,8 @@ import { EthersTransactionOptions, EthersTransactionResult } from './types' export { CreateCallBaseContractEthers, - EthersAdapter, - EthersAdapterConfig, + SafeProvider, + SafeProviderConfig, EthersTransactionOptions, EthersTransactionResult, MultiSendCallOnlyBaseContractEthers, diff --git a/packages/protocol-kit/src/adapters/web3/Web3Adapter.ts b/packages/protocol-kit/src/adapters/web3/Web3Adapter.ts index fdb061187..07a3cf8f5 100644 --- a/packages/protocol-kit/src/adapters/web3/Web3Adapter.ts +++ b/packages/protocol-kit/src/adapters/web3/Web3Adapter.ts @@ -3,8 +3,8 @@ import { SigningMethod } from '@safe-global/protocol-kit/types' import { CreateCallContract, Eip3770Address, - EthAdapter, - EthAdapterTransaction, + ISafeProvider, + SafeProviderTransaction, GetContractProps, SafeEIP712Args, SignMessageLibContract, @@ -43,7 +43,7 @@ export interface Web3AdapterConfig { signerAddress?: string } -class Web3Adapter implements EthAdapter { +class Web3Adapter implements ISafeProvider { #web3: Web3 #signerAddress?: string @@ -270,7 +270,7 @@ class Web3Adapter implements EthAdapter { signMessage(message: string): Promise { if (!this.#signerAddress) { - throw new Error('EthAdapter must be initialized with a signer to use this method') + throw new Error('SafeProvider must be initialized with a signer to use this method') } return this.#web3.eth.sign(message, this.#signerAddress) } @@ -321,13 +321,13 @@ class Web3Adapter implements EthAdapter { } async estimateGas( - transaction: EthAdapterTransaction, + transaction: SafeProviderTransaction, callback?: (error: Error, gas: number) => void ): Promise { return (await this.#web3.eth.estimateGas(transaction, callback)).toString() } - call(transaction: EthAdapterTransaction, defaultBlock?: string | number): Promise { + call(transaction: SafeProviderTransaction, defaultBlock?: string | number): Promise { return this.#web3.eth.call(transaction, defaultBlock) } diff --git a/packages/protocol-kit/src/contracts/safeDeploymentContracts.ts b/packages/protocol-kit/src/contracts/safeDeploymentContracts.ts index 02e3faef9..d96dd0adb 100644 --- a/packages/protocol-kit/src/contracts/safeDeploymentContracts.ts +++ b/packages/protocol-kit/src/contracts/safeDeploymentContracts.ts @@ -2,7 +2,7 @@ import { ContractNetworkConfig } from '@safe-global/protocol-kit/types' import { CompatibilityFallbackHandlerContract, CreateCallContract, - EthAdapter, + ISafeProvider, MultiSendCallOnlyContract, MultiSendContract, SafeContract, @@ -27,7 +27,7 @@ import { import { safeDeploymentsL1ChainIds, safeDeploymentsVersions } from './config' export interface GetContractInstanceProps { - ethAdapter: EthAdapter + safeProvider: ISafeProvider safeVersion: SafeVersion customContracts?: ContractNetworkConfig } @@ -111,22 +111,22 @@ export function getSimulateTxAccessorContractDeployment( } export async function getSafeContract({ - ethAdapter, + safeProvider, safeVersion, customSafeAddress, isL1SafeSingleton, customContracts }: GetSafeContractInstanceProps): Promise { - const chainId = await ethAdapter.getChainId() + const chainId = await safeProvider.getChainId() const singletonDeployment = getSafeContractDeployment(safeVersion, chainId, isL1SafeSingleton) - const safeContract = await ethAdapter.getSafeContract({ + const safeContract = await safeProvider.getSafeContract({ safeVersion, singletonDeployment, customContractAddress: customSafeAddress ?? customContracts?.safeSingletonAddress, customContractAbi: customContracts?.safeSingletonAbi, isL1SafeSingleton }) - const isContractDeployed = await ethAdapter.isContractDeployed(await safeContract.getAddress()) + const isContractDeployed = await safeProvider.isContractDeployed(await safeContract.getAddress()) if (!isContractDeployed) { throw new Error('SafeProxy contract is not deployed on the current network') } @@ -134,19 +134,19 @@ export async function getSafeContract({ } export async function getProxyFactoryContract({ - ethAdapter, + safeProvider, safeVersion, customContracts }: GetContractInstanceProps): Promise { - const chainId = await ethAdapter.getChainId() + const chainId = await safeProvider.getChainId() const proxyFactoryDeployment = getSafeProxyFactoryContractDeployment(safeVersion, chainId) - const safeProxyFactoryContract = await ethAdapter.getSafeProxyFactoryContract({ + const safeProxyFactoryContract = await safeProvider.getSafeProxyFactoryContract({ safeVersion, singletonDeployment: proxyFactoryDeployment, customContractAddress: customContracts?.safeProxyFactoryAddress, customContractAbi: customContracts?.safeProxyFactoryAbi }) - const isContractDeployed = await ethAdapter.isContractDeployed( + const isContractDeployed = await safeProvider.isContractDeployed( await safeProxyFactoryContract.getAddress() ) if (!isContractDeployed) { @@ -156,22 +156,22 @@ export async function getProxyFactoryContract({ } export async function getCompatibilityFallbackHandlerContract({ - ethAdapter, + safeProvider, safeVersion, customContracts }: GetContractInstanceProps): Promise { - const chainId = await ethAdapter.getChainId() + const chainId = await safeProvider.getChainId() const fallbackHandlerDeployment = getCompatibilityFallbackHandlerContractDeployment( safeVersion, chainId ) - const fallbackHandlerContract = await ethAdapter.getCompatibilityFallbackHandlerContract({ + const fallbackHandlerContract = await safeProvider.getCompatibilityFallbackHandlerContract({ safeVersion, singletonDeployment: fallbackHandlerDeployment, customContractAddress: customContracts?.fallbackHandlerAddress, customContractAbi: customContracts?.fallbackHandlerAbi }) - const isContractDeployed = await ethAdapter.isContractDeployed( + const isContractDeployed = await safeProvider.isContractDeployed( await fallbackHandlerContract.getAddress() ) if (!isContractDeployed) { @@ -181,19 +181,19 @@ export async function getCompatibilityFallbackHandlerContract({ } export async function getMultiSendContract({ - ethAdapter, + safeProvider, safeVersion, customContracts }: GetContractInstanceProps): Promise { - const chainId = await ethAdapter.getChainId() + const chainId = await safeProvider.getChainId() const multiSendDeployment = getMultiSendContractDeployment(safeVersion, chainId) - const multiSendContract = await ethAdapter.getMultiSendContract({ + const multiSendContract = await safeProvider.getMultiSendContract({ safeVersion, singletonDeployment: multiSendDeployment, customContractAddress: customContracts?.multiSendAddress, customContractAbi: customContracts?.multiSendAbi }) - const isContractDeployed = await ethAdapter.isContractDeployed( + const isContractDeployed = await safeProvider.isContractDeployed( await multiSendContract.getAddress() ) if (!isContractDeployed) { @@ -203,19 +203,19 @@ export async function getMultiSendContract({ } export async function getMultiSendCallOnlyContract({ - ethAdapter, + safeProvider, safeVersion, customContracts }: GetContractInstanceProps): Promise { - const chainId = await ethAdapter.getChainId() + const chainId = await safeProvider.getChainId() const multiSendCallOnlyDeployment = getMultiSendCallOnlyContractDeployment(safeVersion, chainId) - const multiSendCallOnlyContract = await ethAdapter.getMultiSendCallOnlyContract({ + const multiSendCallOnlyContract = await safeProvider.getMultiSendCallOnlyContract({ safeVersion, singletonDeployment: multiSendCallOnlyDeployment, customContractAddress: customContracts?.multiSendCallOnlyAddress, customContractAbi: customContracts?.multiSendCallOnlyAbi }) - const isContractDeployed = await ethAdapter.isContractDeployed( + const isContractDeployed = await safeProvider.isContractDeployed( await multiSendCallOnlyContract.getAddress() ) if (!isContractDeployed) { @@ -225,19 +225,19 @@ export async function getMultiSendCallOnlyContract({ } export async function getSignMessageLibContract({ - ethAdapter, + safeProvider, safeVersion, customContracts }: GetContractInstanceProps): Promise { - const chainId = await ethAdapter.getChainId() + const chainId = await safeProvider.getChainId() const signMessageLibDeployment = getSignMessageLibContractDeployment(safeVersion, chainId) - const signMessageLibContract = await ethAdapter.getSignMessageLibContract({ + const signMessageLibContract = await safeProvider.getSignMessageLibContract({ safeVersion, singletonDeployment: signMessageLibDeployment, customContractAddress: customContracts?.signMessageLibAddress, customContractAbi: customContracts?.signMessageLibAbi }) - const isContractDeployed = await ethAdapter.isContractDeployed( + const isContractDeployed = await safeProvider.isContractDeployed( await signMessageLibContract.getAddress() ) if (!isContractDeployed) { @@ -247,19 +247,19 @@ export async function getSignMessageLibContract({ } export async function getCreateCallContract({ - ethAdapter, + safeProvider, safeVersion, customContracts }: GetContractInstanceProps): Promise { - const chainId = await ethAdapter.getChainId() + const chainId = await safeProvider.getChainId() const createCallDeployment = getCreateCallContractDeployment(safeVersion, chainId) - const createCallContract = await ethAdapter.getCreateCallContract({ + const createCallContract = await safeProvider.getCreateCallContract({ safeVersion, singletonDeployment: createCallDeployment, customContractAddress: customContracts?.createCallAddress, customContractAbi: customContracts?.createCallAbi }) - const isContractDeployed = await ethAdapter.isContractDeployed( + const isContractDeployed = await safeProvider.isContractDeployed( await createCallContract.getAddress() ) if (!isContractDeployed) { @@ -269,19 +269,19 @@ export async function getCreateCallContract({ } export async function getSimulateTxAccessorContract({ - ethAdapter, + safeProvider, safeVersion, customContracts }: GetContractInstanceProps): Promise { - const chainId = await ethAdapter.getChainId() + const chainId = await safeProvider.getChainId() const simulateTxAccessorDeployment = getSimulateTxAccessorContractDeployment(safeVersion, chainId) - const simulateTxAccessorContract = await ethAdapter.getSimulateTxAccessorContract({ + const simulateTxAccessorContract = await safeProvider.getSimulateTxAccessorContract({ safeVersion, singletonDeployment: simulateTxAccessorDeployment, customContractAddress: customContracts?.simulateTxAccessorAddress, customContractAbi: customContracts?.simulateTxAccessorAbi }) - const isContractDeployed = await ethAdapter.isContractDeployed( + const isContractDeployed = await safeProvider.isContractDeployed( await simulateTxAccessorContract.getAddress() ) if (!isContractDeployed) { diff --git a/packages/protocol-kit/src/contracts/utils.ts b/packages/protocol-kit/src/contracts/utils.ts index 6f9a2f41d..40b85be53 100644 --- a/packages/protocol-kit/src/contracts/utils.ts +++ b/packages/protocol-kit/src/contracts/utils.ts @@ -4,7 +4,7 @@ import { DEFAULT_SAFE_VERSION } from '@safe-global/protocol-kit/contracts/config import { EMPTY_DATA, ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' import { createMemoizedFunction } from '@safe-global/protocol-kit/utils/memoized' import { - EthAdapter, + ISafeProvider, SafeContract, SafeProxyFactoryContract, SafeVersion @@ -47,7 +47,7 @@ const ZKSYNC_SAFE_PROXY_DEPLOYED_BYTECODE: { const ZKSYNC_CREATE2_PREFIX = '0x2020dba91b30cc0006188af794c2fb30dd8520db7e2c088b7fc7c103c00ca494' export interface PredictSafeAddressProps { - ethAdapter: EthAdapter + safeProvider: ISafeProvider chainId: bigint // required for performance safeAccountConfig: SafeAccountConfig safeDeploymentConfig?: SafeDeploymentConfig @@ -56,7 +56,7 @@ export interface PredictSafeAddressProps { } export interface encodeSetupCallDataProps { - ethAdapter: EthAdapter + safeProvider: ISafeProvider safeAccountConfig: SafeAccountConfig safeContract: SafeContract customContracts?: ContractNetworkConfig @@ -80,7 +80,7 @@ const memoizedGetCompatibilityFallbackHandlerContract = createMemoizedFunction( ) export async function encodeSetupCallData({ - ethAdapter, + safeProvider, safeAccountConfig, safeContract, customContracts, @@ -115,7 +115,7 @@ export async function encodeSetupCallData({ const isValidAddress = fallbackHandlerAddress !== undefined && isAddress(fallbackHandlerAddress) if (!isValidAddress) { const fallbackHandlerContract = await memoizedGetCompatibilityFallbackHandlerContract({ - ethAdapter, + safeProvider, safeVersion, customContracts }) @@ -140,19 +140,19 @@ type MemoizedGetProxyFactoryContractProps = GetContractInstanceProps & { chainId type MemoizedGetSafeContractInstanceProps = GetSafeContractInstanceProps & { chainId: string } const memoizedGetProxyFactoryContract = createMemoizedFunction( - ({ ethAdapter, safeVersion, customContracts }: MemoizedGetProxyFactoryContractProps) => - getProxyFactoryContract({ ethAdapter, safeVersion, customContracts }) + ({ safeProvider, safeVersion, customContracts }: MemoizedGetProxyFactoryContractProps) => + getProxyFactoryContract({ safeProvider, safeVersion, customContracts }) ) const memoizedGetProxyCreationCode = createMemoizedFunction( async ({ - ethAdapter, + safeProvider, safeVersion, customContracts, chainId }: MemoizedGetProxyFactoryContractProps) => { const safeProxyFactoryContract = await memoizedGetProxyFactoryContract({ - ethAdapter, + safeProvider, safeVersion, customContracts, chainId @@ -164,12 +164,12 @@ const memoizedGetProxyCreationCode = createMemoizedFunction( const memoizedGetSafeContract = createMemoizedFunction( ({ - ethAdapter, + safeProvider, safeVersion, isL1SafeSingleton, customContracts }: MemoizedGetSafeContractInstanceProps) => - getSafeContract({ ethAdapter, safeVersion, isL1SafeSingleton, customContracts }) + getSafeContract({ safeProvider, safeVersion, isL1SafeSingleton, customContracts }) ) /** @@ -184,7 +184,7 @@ export function getChainSpecificDefaultSaltNonce(chainId: bigint): string { } export async function predictSafeAddress({ - ethAdapter, + safeProvider, chainId, safeAccountConfig, safeDeploymentConfig = {}, @@ -200,21 +200,21 @@ export async function predictSafeAddress({ } = safeDeploymentConfig const safeProxyFactoryContract = await memoizedGetProxyFactoryContract({ - ethAdapter, + safeProvider, safeVersion, customContracts, chainId: chainId.toString() }) const proxyCreationCode = await memoizedGetProxyCreationCode({ - ethAdapter, + safeProvider, safeVersion, customContracts, chainId: chainId.toString() }) const safeContract = await memoizedGetSafeContract({ - ethAdapter, + safeProvider, safeVersion, isL1SafeSingleton, customContracts, @@ -222,14 +222,14 @@ export async function predictSafeAddress({ }) const initializer = await encodeSetupCallData({ - ethAdapter, + safeProvider, safeAccountConfig, safeContract, customContracts, customSafeVersion: safeVersion // it is more efficient if we provide the safeVersion manually }) - const encodedNonce = toBuffer(ethAdapter.encodeParameters(['uint256'], [saltNonce])).toString( + const encodedNonce = toBuffer(safeProvider.encodeParameters(['uint256'], [saltNonce])).toString( 'hex' ) @@ -237,7 +237,7 @@ export async function predictSafeAddress({ toBuffer('0x' + keccak256(toBuffer(initializer)).toString('hex') + encodedNonce) ) - const input = ethAdapter.encodeParameters(['address'], [await safeContract.getAddress()]) + const input = safeProvider.encodeParameters(['address'], [await safeContract.getAddress()]) const from = await safeProxyFactoryContract.getAddress() @@ -246,7 +246,7 @@ export async function predictSafeAddress({ if (isZkSyncEraChain) { const proxyAddress = zkSyncEraCreate2Address(from, safeVersion, salt, input) - return ethAdapter.getChecksummedAddress(proxyAddress) + return safeProvider.getChecksummedAddress(proxyAddress) } const constructorData = toBuffer(input).toString('hex') @@ -256,7 +256,7 @@ export async function predictSafeAddress({ const proxyAddress = '0x' + generateAddress2(toBuffer(from), toBuffer(salt), toBuffer(initCode)).toString('hex') - return ethAdapter.getChecksummedAddress(proxyAddress) + return safeProvider.getChecksummedAddress(proxyAddress) } export const validateSafeAccountConfig = ({ owners, threshold }: SafeAccountConfig): void => { diff --git a/packages/protocol-kit/src/index.ts b/packages/protocol-kit/src/index.ts index ee900d9c7..b2d17473a 100644 --- a/packages/protocol-kit/src/index.ts +++ b/packages/protocol-kit/src/index.ts @@ -1,8 +1,8 @@ import Safe from './Safe' import { CreateCallBaseContractEthers, - EthersAdapter, - EthersAdapterConfig, + SafeProvider, + SafeProviderConfig, EthersTransactionOptions, EthersTransactionResult, MultiSendBaseContractEthers, @@ -110,8 +110,8 @@ export { DEFAULT_SAFE_VERSION, DeploySafeProps, EthSafeSignature, - EthersAdapter, - EthersAdapterConfig, + SafeProvider, + SafeProviderConfig, EthersTransactionOptions, EthersTransactionResult, MultiSendCallOnlyBaseContractEthers, diff --git a/packages/protocol-kit/src/managers/contractManager.ts b/packages/protocol-kit/src/managers/contractManager.ts index 265fca698..90fe7fdeb 100644 --- a/packages/protocol-kit/src/managers/contractManager.ts +++ b/packages/protocol-kit/src/managers/contractManager.ts @@ -6,7 +6,7 @@ import { } from '@safe-global/protocol-kit/contracts/safeDeploymentContracts' import { ContractNetworksConfig, SafeConfig } from '@safe-global/protocol-kit/types' import { - EthAdapter, + ISafeProvider, MultiSendCallOnlyContract, MultiSendContract, SafeContract @@ -21,16 +21,16 @@ class ContractManager { #multiSendContract!: MultiSendContract #multiSendCallOnlyContract!: MultiSendCallOnlyContract - static async create(config: SafeConfig, ethAdapter: EthAdapter): Promise { + static async create(config: SafeConfig, safeProvider: ISafeProvider): Promise { const contractManager = new ContractManager() - await contractManager.init(config, ethAdapter) + await contractManager.init(config, safeProvider) return contractManager } - async init(config: SafeConfig, ethAdapter: EthAdapter): Promise { + async init(config: SafeConfig, safeProvider: ISafeProvider): Promise { const { isL1SafeSingleton, contractNetworks, predictedSafe, safeAddress } = config - const chainId = await ethAdapter.getChainId() + const chainId = await safeProvider.getChainId() const customContracts = contractNetworks?.[chainId.toString()] this.#contractNetworks = contractNetworks this.#isL1SafeSingleton = isL1SafeSingleton @@ -42,7 +42,7 @@ class ContractManager { } else { // We use the default version of the Safe contract to get the correct version of this Safe const defaultSafeContractInstance = await getSafeContract({ - ethAdapter, + safeProvider, safeVersion: DEFAULT_SAFE_VERSION, isL1SafeSingleton, customSafeAddress: safeAddress, @@ -58,7 +58,7 @@ class ContractManager { this.#safeContract = isTheDefaultSafeVersion ? defaultSafeContractInstance : await getSafeContract({ - ethAdapter, + safeProvider, safeVersion, isL1SafeSingleton, customSafeAddress: safeAddress, @@ -67,13 +67,13 @@ class ContractManager { } this.#multiSendContract = await getMultiSendContract({ - ethAdapter, + safeProvider, safeVersion, customContracts }) this.#multiSendCallOnlyContract = await getMultiSendCallOnlyContract({ - ethAdapter, + safeProvider, safeVersion, customContracts }) diff --git a/packages/protocol-kit/src/managers/fallbackHandlerManager.ts b/packages/protocol-kit/src/managers/fallbackHandlerManager.ts index 6e0b8f39a..e578d75df 100644 --- a/packages/protocol-kit/src/managers/fallbackHandlerManager.ts +++ b/packages/protocol-kit/src/managers/fallbackHandlerManager.ts @@ -5,21 +5,21 @@ import { sameString } from '@safe-global/protocol-kit/utils' import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' -import { EthAdapter, SafeContract } from '@safe-global/safe-core-sdk-types' +import { ISafeProvider, SafeContract } from '@safe-global/safe-core-sdk-types' class FallbackHandlerManager { - #ethAdapter: EthAdapter + #safeProvider: ISafeProvider #safeContract?: SafeContract // keccak256("fallback_manager.handler.address") #slot = '0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d5' - constructor(ethAdapter: EthAdapter, safeContract?: SafeContract) { - this.#ethAdapter = ethAdapter + constructor(safeProvider: ISafeProvider, safeContract?: SafeContract) { + this.#safeProvider = safeProvider this.#safeContract = safeContract } private validateFallbackHandlerAddress(fallbackHandlerAddress: string): void { - const isValidAddress = this.#ethAdapter.isAddress(fallbackHandlerAddress) + const isValidAddress = this.#safeProvider.isAddress(fallbackHandlerAddress) if (!isValidAddress || isZeroAddress(fallbackHandlerAddress)) { throw new Error('Invalid fallback handler address provided') } @@ -46,7 +46,7 @@ class FallbackHandlerManager { } const safeVersion = await this.#safeContract.getVersion() if (hasSafeFeature(SAFE_FEATURES.SAFE_FALLBACK_HANDLER, safeVersion)) { - return this.#ethAdapter.getStorageAt(await this.#safeContract.getAddress(), this.#slot) + return this.#safeProvider.getStorageAt(await this.#safeContract.getAddress(), this.#slot) } else { throw new Error( 'Current version of the Safe does not support the fallback handler functionality' diff --git a/packages/protocol-kit/src/managers/guardManager.ts b/packages/protocol-kit/src/managers/guardManager.ts index 24ac4c07f..c9744b9c1 100644 --- a/packages/protocol-kit/src/managers/guardManager.ts +++ b/packages/protocol-kit/src/managers/guardManager.ts @@ -5,21 +5,21 @@ import { sameString } from '@safe-global/protocol-kit/utils' import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' -import { EthAdapter, SafeContract } from '@safe-global/safe-core-sdk-types' +import { ISafeProvider, SafeContract } from '@safe-global/safe-core-sdk-types' class GuardManager { - #ethAdapter: EthAdapter + #safeProvider: ISafeProvider #safeContract?: SafeContract // keccak256("guard_manager.guard.address") #slot = '0x4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8' - constructor(ethAdapter: EthAdapter, safeContract?: SafeContract) { - this.#ethAdapter = ethAdapter + constructor(safeProvider: ISafeProvider, safeContract?: SafeContract) { + this.#safeProvider = safeProvider this.#safeContract = safeContract } private validateGuardAddress(guardAddress: string): void { - const isValidAddress = this.#ethAdapter.isAddress(guardAddress) + const isValidAddress = this.#safeProvider.isAddress(guardAddress) if (!isValidAddress || isZeroAddress(guardAddress)) { throw new Error('Invalid guard address provided') } @@ -43,7 +43,7 @@ class GuardManager { } const safeVersion = await this.#safeContract.getVersion() if (hasSafeFeature(SAFE_FEATURES.SAFE_TX_GUARDS, safeVersion)) { - return this.#ethAdapter.getStorageAt(await this.#safeContract.getAddress(), this.#slot) + return this.#safeProvider.getStorageAt(await this.#safeContract.getAddress(), this.#slot) } else { throw new Error( 'Current version of the Safe does not support Safe transaction guards functionality' diff --git a/packages/protocol-kit/src/managers/moduleManager.ts b/packages/protocol-kit/src/managers/moduleManager.ts index 47b397d48..da8f2dfa6 100644 --- a/packages/protocol-kit/src/managers/moduleManager.ts +++ b/packages/protocol-kit/src/managers/moduleManager.ts @@ -1,18 +1,18 @@ import { isRestrictedAddress, sameString } from '@safe-global/protocol-kit/utils/address' import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/utils/constants' -import { EthAdapter, SafeContract } from '@safe-global/safe-core-sdk-types' +import { ISafeProvider, SafeContract } from '@safe-global/safe-core-sdk-types' class ModuleManager { - #ethAdapter: EthAdapter + #safeProvider: ISafeProvider #safeContract?: SafeContract - constructor(ethAdapter: EthAdapter, safeContract?: SafeContract) { - this.#ethAdapter = ethAdapter + constructor(safeProvider: ISafeProvider, safeContract?: SafeContract) { + this.#safeProvider = safeProvider this.#safeContract = safeContract } private validateModuleAddress(moduleAddress: string): void { - const isValidAddress = this.#ethAdapter.isAddress(moduleAddress) + const isValidAddress = this.#safeProvider.isAddress(moduleAddress) if (!isValidAddress || isRestrictedAddress(moduleAddress)) { throw new Error('Invalid module address provided') } diff --git a/packages/protocol-kit/src/managers/ownerManager.ts b/packages/protocol-kit/src/managers/ownerManager.ts index d3927cf6d..3405edc76 100644 --- a/packages/protocol-kit/src/managers/ownerManager.ts +++ b/packages/protocol-kit/src/managers/ownerManager.ts @@ -1,18 +1,18 @@ import { isRestrictedAddress, sameString } from '@safe-global/protocol-kit/utils/address' import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/utils/constants' -import { EthAdapter, SafeContract } from '@safe-global/safe-core-sdk-types' +import { ISafeProvider, SafeContract } from '@safe-global/safe-core-sdk-types' class OwnerManager { - #ethAdapter: EthAdapter + #safeProvider: ISafeProvider #safeContract?: SafeContract - constructor(ethAdapter: EthAdapter, safeContract?: SafeContract) { - this.#ethAdapter = ethAdapter + constructor(safeProvider: ISafeProvider, safeContract?: SafeContract) { + this.#safeProvider = safeProvider this.#safeContract = safeContract } private validateOwnerAddress(ownerAddress: string, errorMessage?: string): void { - const isValidAddress = this.#ethAdapter.isAddress(ownerAddress) + const isValidAddress = this.#safeProvider.isAddress(ownerAddress) if (!isValidAddress || isRestrictedAddress(ownerAddress)) { throw new Error(errorMessage || 'Invalid owner address provided') } diff --git a/packages/protocol-kit/src/safeFactory/index.ts b/packages/protocol-kit/src/safeFactory/index.ts index dc3b6fec2..9d3b6a94e 100644 --- a/packages/protocol-kit/src/safeFactory/index.ts +++ b/packages/protocol-kit/src/safeFactory/index.ts @@ -18,13 +18,13 @@ import { SafeDeploymentConfig } from '@safe-global/protocol-kit/types' import { - EthAdapter, + ISafeProvider, SafeContract, SafeProxyFactoryContract, SafeVersion, TransactionOptions } from '@safe-global/safe-core-sdk-types' -import { EthersAdapter } from '../adapters/ethers' +import { SafeProvider } from '../adapters/ethers' export interface DeploySafeProps { safeAccountConfig: SafeAccountConfig @@ -34,7 +34,7 @@ export interface DeploySafeProps { } export interface SafeFactoryConfig { - /** ethAdapter - Ethereum adapter */ + /** safeProvider - Ethereum adapter */ provider: Eip1193Provider signerAddress?: string /** safeVersion - Versions of the Safe deployed by this Factory contract */ @@ -46,7 +46,7 @@ export interface SafeFactoryConfig { } interface SafeFactoryInitConfig { - /** ethAdapter - Ethereum adapter */ + /** safeProvider - Ethereum adapter */ provider: Eip1193Provider signerAddress?: string /** safeVersion - Versions of the Safe deployed by this Factory contract */ @@ -62,7 +62,7 @@ class SafeFactory { #isL1SafeSingleton?: boolean #safeVersion!: SafeVersion #provider!: Eip1193Provider - #ethAdapter!: EthAdapter + #safeProvider!: ISafeProvider #safeProxyFactoryContract!: SafeProxyFactoryContract #safeContract!: SafeContract @@ -84,27 +84,27 @@ class SafeFactory { contractNetworks }: SafeFactoryInitConfig): Promise { this.#provider = provider - this.#ethAdapter = new EthersAdapter({ provider }) + this.#safeProvider = new SafeProvider({ provider }) this.#safeVersion = safeVersion this.#isL1SafeSingleton = isL1SafeSingleton this.#contractNetworks = contractNetworks - const chainId = await this.#ethAdapter.getChainId() + const chainId = await this.#safeProvider.getChainId() const customContracts = contractNetworks?.[chainId.toString()] this.#safeProxyFactoryContract = await getProxyFactoryContract({ - ethAdapter: this.#ethAdapter, + safeProvider: this.#safeProvider, safeVersion, customContracts }) this.#safeContract = await getSafeContract({ - ethAdapter: this.#ethAdapter, + safeProvider: this.#safeProvider, safeVersion, isL1SafeSingleton, customContracts }) } - getEthAdapter(): EthAdapter { - return this.#ethAdapter + getSafeProvider(): ISafeProvider { + return this.#safeProvider } getSafeVersion(): SafeVersion { @@ -116,14 +116,14 @@ class SafeFactory { } async getChainId(): Promise { - return this.#ethAdapter.getChainId() + return this.#safeProvider.getChainId() } async predictSafeAddress( safeAccountConfig: SafeAccountConfig, saltNonce?: string ): Promise { - const chainId = await this.#ethAdapter.getChainId() + const chainId = await this.#safeProvider.getChainId() const customContracts = this.#contractNetworks?.[chainId.toString()] const safeVersion = this.#safeVersion @@ -133,7 +133,7 @@ class SafeFactory { } return predictSafeAddress({ - ethAdapter: this.#ethAdapter, + safeProvider: this.#safeProvider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -151,15 +151,15 @@ class SafeFactory { validateSafeAccountConfig(safeAccountConfig) validateSafeDeploymentConfig({ saltNonce }) - const signerAddress = await this.#ethAdapter.getSignerAddress() + const signerAddress = await this.#safeProvider.getSignerAddress() if (!signerAddress) { - throw new Error('EthAdapter must be initialized with a signer to use this method') + throw new Error('ISafeProvider must be initialized with a signer to use this method') } const chainId = await this.getChainId() const customContracts = this.#contractNetworks?.[chainId.toString()] const initializer = await encodeSetupCallData({ - ethAdapter: this.#ethAdapter, + safeProvider: this.#safeProvider, safeAccountConfig, safeContract: this.#safeContract, customContracts @@ -178,7 +178,7 @@ class SafeFactory { }, callback }) - const isContractDeployed = await this.#ethAdapter.isContractDeployed(safeAddress) + const isContractDeployed = await this.#safeProvider.isContractDeployed(safeAddress) if (!isContractDeployed) { throw new Error('SafeProxy contract is not deployed on the current network') } diff --git a/packages/protocol-kit/src/utils/erc-20/index.ts b/packages/protocol-kit/src/utils/erc-20/index.ts index b1b1ea72c..57273e4c9 100644 --- a/packages/protocol-kit/src/utils/erc-20/index.ts +++ b/packages/protocol-kit/src/utils/erc-20/index.ts @@ -19,7 +19,7 @@ const ERC20_ABI = [ * @throws "Invalid ERC-20 decimals" */ export async function getERC20Decimals(tokenAddress: string, safe: Safe): Promise { - const ethAdapter = safe.getEthAdapter() + const safeProvider = safe.getSafeProvider() const erc20Interface = new Interface(ERC20_ABI) const getTokenDecimalsTransaction = { @@ -29,7 +29,7 @@ export async function getERC20Decimals(tokenAddress: string, safe: Safe): Promis data: erc20Interface.encodeFunctionData('decimals') } - const response = await ethAdapter.call(getTokenDecimalsTransaction) + const response = await safeProvider.call(getTokenDecimalsTransaction) const decimals = Number(response) diff --git a/packages/protocol-kit/src/utils/signatures/utils.ts b/packages/protocol-kit/src/utils/signatures/utils.ts index 7dfda1198..26fee7d0b 100644 --- a/packages/protocol-kit/src/utils/signatures/utils.ts +++ b/packages/protocol-kit/src/utils/signatures/utils.ts @@ -1,6 +1,6 @@ import { ethers } from 'ethers' import { - EthAdapter, + ISafeProvider, SafeSignature, SafeEIP712Args, SafeTransactionData @@ -106,31 +106,31 @@ export const adjustVInSignature: AdjustVOverload = ( } export async function generateSignature( - ethAdapter: EthAdapter, + safeProvider: ISafeProvider, hash: string ): Promise { - const signerAddress = await ethAdapter.getSignerAddress() + const signerAddress = await safeProvider.getSignerAddress() if (!signerAddress) { - throw new Error('EthAdapter must be initialized with a signer to use this method') + throw new Error('ISafeProvider must be initialized with a signer to use this method') } - let signature = await ethAdapter.signMessage(hash) + let signature = await safeProvider.signMessage(hash) signature = adjustVInSignature(SigningMethod.ETH_SIGN, signature, hash, signerAddress) return new EthSafeSignature(signerAddress, signature) } export async function generateEIP712Signature( - ethAdapter: EthAdapter, + safeProvider: ISafeProvider, safeEIP712Args: SafeEIP712Args, methodVersion?: 'v3' | 'v4' ): Promise { - const signerAddress = await ethAdapter.getSignerAddress() + const signerAddress = await safeProvider.getSignerAddress() if (!signerAddress) { - throw new Error('EthAdapter must be initialized with a signer to use this method') + throw new Error('ISafeProvider must be initialized with a signer to use this method') } - let signature = await ethAdapter.signTypedData(safeEIP712Args, methodVersion) + let signature = await safeProvider.signTypedData(safeEIP712Args, methodVersion) signature = adjustVInSignature(SigningMethod.ETH_SIGN_TYPED_DATA, signature) return new EthSafeSignature(signerAddress, signature) diff --git a/packages/protocol-kit/src/utils/transactions/gas.ts b/packages/protocol-kit/src/utils/transactions/gas.ts index 922509a9e..17153de33 100644 --- a/packages/protocol-kit/src/utils/transactions/gas.ts +++ b/packages/protocol-kit/src/utils/transactions/gas.ts @@ -1,5 +1,5 @@ import { - EthAdapter, + ISafeProvider, SafeContract, OperationType, SafeVersion, @@ -61,16 +61,16 @@ function estimateDataGasCosts(data: string): number { export async function estimateGas( safeVersion: SafeVersion, safeContract: SafeContract, - ethAdapter: EthAdapter, + safeProvider: ISafeProvider, to: string, valueInWei: string, data: string, operation: OperationType, customContracts?: ContractNetworksConfig ) { - const chainId = await ethAdapter.getChainId() + const chainId = await safeProvider.getChainId() const simulateTxAccessorContract = await getSimulateTxAccessorContract({ - ethAdapter, + safeProvider, safeVersion, customContracts: customContracts?.[chainId.toString()] }) @@ -95,7 +95,7 @@ export async function estimateGas( } try { - const encodedResponse = await ethAdapter.call(transactionToEstimateGas) + const encodedResponse = await safeProvider.call(transactionToEstimateGas) return decodeSafeTxGas(encodedResponse) } catch (error: any) { @@ -105,7 +105,7 @@ export async function estimateGas( export async function estimateTxGas( safeContract: SafeContract, - ethAdapter: EthAdapter, + safeProvider: ISafeProvider, to: string, valueInWei: string, data: string, @@ -121,7 +121,7 @@ export async function estimateTxGas( operation ]) try { - const estimateResponse = await ethAdapter.estimateGas({ + const estimateResponse = await safeProvider.estimateGas({ to: safeAddress, from: safeAddress, data: estimateData @@ -134,7 +134,7 @@ export async function estimateTxGas( let additionalGas = 10000 for (let i = 0; i < 10; i++) { try { - const estimateResponse = await ethAdapter.call({ + const estimateResponse = await safeProvider.call({ to: safeAddress, from: safeAddress, data: estimateData, @@ -152,7 +152,7 @@ export async function estimateTxGas( } try { - const estimateGas = await ethAdapter.estimateGas({ + const estimateGas = await safeProvider.estimateGas({ to, from: safeAddress, value: valueInWei, @@ -204,13 +204,13 @@ export async function estimateTxBaseGas( const signatures = '0x' const safeVersion = await safe.getContractVersion() - const ethAdapter = safe.getEthAdapter() + const safeProvider = safe.getSafeProvider() const isL1SafeSingleton = safe.getContractManager().isL1SafeSingleton const chainId = await safe.getChainId() const customContracts = safe.getContractManager().contractNetworks?.[chainId.toString()] const safeSingletonContract = await getSafeContract({ - ethAdapter, + safeProvider, safeVersion, isL1SafeSingleton, customContracts @@ -314,13 +314,13 @@ async function estimateSafeTxGasWithRequiredTxGas( const isSafeDeployed = await safe.isSafeDeployed() const safeAddress = await safe.getAddress() const safeVersion = await safe.getContractVersion() - const ethAdapter = safe.getEthAdapter() + const safeProvider = safe.getSafeProvider() const isL1SafeSingleton = safe.getContractManager().isL1SafeSingleton const chainId = await safe.getChainId() const customContracts = safe.getContractManager().contractNetworks?.[chainId.toString()] const safeSingletonContract = await getSafeContract({ - ethAdapter, + safeProvider, safeVersion, isL1SafeSingleton, customContracts @@ -342,7 +342,7 @@ async function estimateSafeTxGasWithRequiredTxGas( from: safeAddress } try { - const encodedResponse = await ethAdapter.call(transactionToEstimateGas) + const encodedResponse = await safeProvider.call(transactionToEstimateGas) const safeTxGas = '0x' + encodedResponse.slice(-32) @@ -368,11 +368,11 @@ async function estimateSafeTxGasWithRequiredTxGas( // TO-DO: Improve decoding /* - const simulateAndRevertResponse = ethAdapter.decodeParameters( + const simulateAndRevertResponse = safeProvider.decodeParameters( ['bool', 'bytes'], encodedResponse ) - const returnedData = ethAdapter.decodeParameters(['uint256', 'bool', 'bytes'], simulateAndRevertResponse[1]) + const returnedData = safeProvider.decodeParameters(['uint256', 'bool', 'bytes'], simulateAndRevertResponse[1]) */ function decodeSafeTxGas(encodedDataResponse: string): string { const [, encodedSafeTxGas] = encodedDataResponse.split('0x') @@ -438,13 +438,13 @@ async function estimateSafeTxGasWithSimulate( const isSafeDeployed = await safe.isSafeDeployed() const safeAddress = await safe.getAddress() const safeVersion = await safe.getContractVersion() - const ethAdapter = safe.getEthAdapter() + const safeProvider = safe.getSafeProvider() const chainId = await safe.getChainId() const customContracts = safe.getContractManager().contractNetworks?.[chainId.toString()] const isL1SafeSingleton = safe.getContractManager().isL1SafeSingleton const safeSingletonContract = await getSafeContract({ - ethAdapter, + safeProvider, safeVersion, isL1SafeSingleton, customContracts @@ -452,7 +452,7 @@ async function estimateSafeTxGasWithSimulate( // new version of the estimation const simulateTxAccessorContract = await getSimulateTxAccessorContract({ - ethAdapter, + safeProvider, safeVersion, customContracts }) @@ -480,7 +480,7 @@ async function estimateSafeTxGasWithSimulate( } try { - const encodedResponse = await ethAdapter.call(transactionToEstimateGas) + const encodedResponse = await safeProvider.call(transactionToEstimateGas) const safeTxGas = decodeSafeTxGas(encodedResponse) @@ -509,10 +509,10 @@ export async function estimateSafeDeploymentGas(safe: Safe): Promise { return '0' } - const ethAdapter = safe.getEthAdapter() + const safeProvider = safe.getSafeProvider() const safeDeploymentTransaction = await safe.createSafeDeploymentTransaction() - const estimation = await ethAdapter.estimateGas({ + const estimation = await safeProvider.estimateGas({ ...safeDeploymentTransaction, from: ZERO_ADDRESS // if we use the Safe address the estimation always fails due to CREATE2 }) diff --git a/packages/protocol-kit/src/utils/transactions/utils.ts b/packages/protocol-kit/src/utils/transactions/utils.ts index 6e95aa3f8..3c601d165 100644 --- a/packages/protocol-kit/src/utils/transactions/utils.ts +++ b/packages/protocol-kit/src/utils/transactions/utils.ts @@ -15,7 +15,7 @@ import { import semverSatisfies from 'semver/functions/satisfies' import { hexToNumber, hexToNumberString, toChecksumAddress } from 'web3-utils' import { estimateGas, estimateTxGas } from './gas' -import { EthersAdapter } from '../..' +import { SafeProvider } from '../..' export function standardizeMetaTransactionData( tx: SafeTransactionDataPartial @@ -80,12 +80,12 @@ export async function standardizeSafeTransactionData({ let safeTxGas - const ethAdapter = new EthersAdapter({ provider }) + const safeProvider = new SafeProvider({ provider }) if (semverSatisfies(safeVersion, '>=1.3.0')) { safeTxGas = await estimateGas( safeVersion, safeContract, - ethAdapter, + safeProvider, standardizedTxs.to, standardizedTxs.value, standardizedTxs.data, @@ -95,7 +95,7 @@ export async function standardizeSafeTransactionData({ } else { safeTxGas = await estimateTxGas( safeContract, - ethAdapter, + safeProvider, standardizedTxs.to, standardizedTxs.value, standardizedTxs.data, diff --git a/packages/protocol-kit/tests/e2e/contractManager.test.ts b/packages/protocol-kit/tests/e2e/contractManager.test.ts index 880c78b7e..7a906da13 100644 --- a/packages/protocol-kit/tests/e2e/contractManager.test.ts +++ b/packages/protocol-kit/tests/e2e/contractManager.test.ts @@ -16,7 +16,7 @@ import { getSignMessageLib, getSimulateTxAccessor } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) @@ -39,7 +39,7 @@ describe('Safe contracts manager', () => { it('should initialize the SDK with a Safe that is not deployed', async () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const predictedSafe: PredictedSafeProps = { safeAccountConfig: { owners: [accounts[0].address], @@ -61,7 +61,7 @@ describe('Safe contracts manager', () => { it('should fail if the current network is not a default network and no contractNetworks is provided', async () => { const { safe, accounts } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() await chai .expect( @@ -76,7 +76,7 @@ describe('Safe contracts manager', () => { it('should fail if SafeProxy contract is not deployed on the current network', async () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) await chai .expect( Safe.create({ @@ -111,7 +111,7 @@ describe('Safe contracts manager', () => { } } const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() await chai .expect( @@ -127,7 +127,7 @@ describe('Safe contracts manager', () => { it('should set the MultiSend contract available on the current network', async () => { const { safe, accounts, chainId, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, diff --git a/packages/protocol-kit/tests/e2e/core.test.ts b/packages/protocol-kit/tests/e2e/core.test.ts index bdd1d92dc..831e87e64 100644 --- a/packages/protocol-kit/tests/e2e/core.test.ts +++ b/packages/protocol-kit/tests/e2e/core.test.ts @@ -7,7 +7,7 @@ import { deployments } from 'hardhat' import { itif } from './utils/helpers' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' @@ -43,7 +43,7 @@ describe('Safe Info', () => { async () => { const { predictedSafe, safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -64,7 +64,7 @@ describe('Safe Info', () => { async () => { const { predictedSafe, safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -73,7 +73,7 @@ describe('Safe Info', () => { }) const safeSdk2 = await safeSdk.connect({ predictedSafe }) chai - .expect(await safeSdk2.getEthAdapter().getSignerAddress()) + .expect(await safeSdk2.getSafeProvider().getSignerAddress()) .to.be.eq(await account1.signer.getAddress()) } ) @@ -81,7 +81,7 @@ describe('Safe Info', () => { it('should connect a deployed Safe', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -90,10 +90,10 @@ describe('Safe Info', () => { }) chai.expect(await safeSdk.getAddress()).to.be.eq(safeAddress) chai - .expect(await safeSdk.getEthAdapter().getSignerAddress()) + .expect(await safeSdk.getSafeProvider().getSignerAddress()) .to.be.eq(await account1.signer.getAddress()) - const provider2 = await getEthAdapter(account2.signer) + const provider2 = await getEip1193Provider(account2.signer) const safeSdk2 = await safeSdk.connect({ provider: provider2, signerAddress: account2.address, @@ -101,7 +101,7 @@ describe('Safe Info', () => { }) chai.expect(await safeSdk2.getAddress()).to.be.eq(safeAddress) chai - .expect(await safeSdk2.getEthAdapter().getSignerAddress()) + .expect(await safeSdk2.getSafeProvider().getSignerAddress()) .to.be.eq(await account2.signer.getAddress()) const safe2 = await getSafeWithOwners([accounts[2].address]) @@ -109,7 +109,7 @@ describe('Safe Info', () => { const safeSdk3 = await safeSdk2.connect({ safeAddress: safe2Address }) chai.expect(await safeSdk3.getAddress()).to.be.eq(safe2Address) chai - .expect(await safeSdk3.getEthAdapter().getSignerAddress()) + .expect(await safeSdk3.getSafeProvider().getSignerAddress()) .to.be.eq(await account2.signer.getAddress()) }) }) @@ -118,7 +118,7 @@ describe('Safe Info', () => { it('should return the contract version of a Safe that is not deployed with a custom version configuration', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -131,7 +131,7 @@ describe('Safe Info', () => { it('should return the contract version of a Safe that is not deployed with a default version configuration', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeConfig: PredictedSafeProps = { ...predictedSafe, safeDeploymentConfig: {} @@ -148,7 +148,7 @@ describe('Safe Info', () => { it('should return the Safe contract version', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -166,7 +166,7 @@ describe('Safe Info', () => { async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -186,7 +186,7 @@ describe('Safe Info', () => { async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -209,7 +209,7 @@ describe('Safe Info', () => { it('should return the address of a deployed Safe', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -220,11 +220,11 @@ describe('Safe Info', () => { }) }) - describe('getEthAdapter', async () => { - it('should return the connected EthAdapter', async () => { + describe('getEip1193Provider', async () => { + it('should return the connected ISafeProvider', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -232,7 +232,7 @@ describe('Safe Info', () => { contractNetworks }) chai - .expect(await safeSdk.getEthAdapter().getSignerAddress()) + .expect(await safeSdk.getSafeProvider().getSignerAddress()) .to.be.eq(await account1.signer.getAddress()) }) }) @@ -241,7 +241,7 @@ describe('Safe Info', () => { it('should return the nonce of a Safe that is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -253,7 +253,7 @@ describe('Safe Info', () => { it('should return the Safe nonce', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ @@ -279,7 +279,7 @@ describe('Safe Info', () => { it('should return the chainId of a Safe that is not deployed', async () => { const { predictedSafe, accounts, chainId, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -291,7 +291,7 @@ describe('Safe Info', () => { it('should return the chainId of the current network', async () => { const { safe, accounts, chainId, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -308,7 +308,7 @@ describe('Safe Info', () => { async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -327,7 +327,7 @@ describe('Safe Info', () => { async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -345,7 +345,7 @@ describe('Safe Info', () => { it('should return the balance of a deployed Safe', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, diff --git a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts index a3e534b47..211cedb55 100644 --- a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts @@ -10,7 +10,7 @@ import Safe, { } from '@safe-global/protocol-kit/index' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners, getFactory } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' import { itif } from './utils/helpers' @@ -45,7 +45,7 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, @@ -69,7 +69,7 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, @@ -93,7 +93,7 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, @@ -117,7 +117,7 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, @@ -141,7 +141,7 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, @@ -165,7 +165,7 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe, chainId } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, @@ -199,7 +199,7 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe, chainId } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, @@ -224,7 +224,7 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, @@ -246,7 +246,7 @@ describe('createSafeDeploymentTransaction', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const customSaltNonce = '123456789' @@ -262,7 +262,7 @@ describe('createSafeDeploymentTransaction', () => { contractNetworks }) - const saltNonceEncoded = ethAdapter.encodeParameters(['uint256'], [customSaltNonce]) + const saltNonceEncoded = safeProvider.encodeParameters(['uint256'], [customSaltNonce]) const deploymentTransaction = await safeSdk.createSafeDeploymentTransaction(customSaltNonce) @@ -276,7 +276,7 @@ describe('createSafeDeploymentTransaction', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ diff --git a/packages/protocol-kit/tests/e2e/createTransaction.test.ts b/packages/protocol-kit/tests/e2e/createTransaction.test.ts index 91cb60a0f..8f2df9b20 100644 --- a/packages/protocol-kit/tests/e2e/createTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createTransaction.test.ts @@ -11,7 +11,7 @@ import { deployments } from 'hardhat' import { itif } from './utils/helpers' import { getContractNetworks } from './utils/setupContractNetworks' import { getERC20Mintable, getSafeWithOwners } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) @@ -57,7 +57,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -85,7 +85,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -114,7 +114,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -144,7 +144,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -172,7 +172,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -202,7 +202,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -231,7 +231,7 @@ describe('Transactions creation', () => { it('should create a single transaction with gasPrice=0', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -254,7 +254,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -285,7 +285,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -316,7 +316,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -338,7 +338,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -367,7 +367,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -382,7 +382,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks, erc20Mintable, chainId } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -418,7 +418,7 @@ describe('Transactions creation', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress, @@ -462,7 +462,7 @@ describe('Transactions creation', () => { async () => { const { safe, predictedSafe, accounts, contractNetworks } = await setupTests() const account = accounts[0] - const provider = await getEthAdapter(account.signer) + const provider = await getEip1193Provider(account.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, diff --git a/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts b/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts index eb7a2c191..af17d470e 100644 --- a/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts +++ b/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts @@ -5,7 +5,7 @@ import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/de import Safe, { PredictedSafeProps } from '@safe-global/protocol-kit/index' import { getContractNetworks } from './utils/setupContractNetworks' import { getERC20Mintable, getSafeWithOwners, getMultiSendCallOnly } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' import { OperationType } from '@safe-global/safe-core-sdk-types/dist/src' @@ -44,7 +44,7 @@ describe('createTransactionBatch', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ diff --git a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts index da194709c..0b5d1545f 100644 --- a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts @@ -7,7 +7,7 @@ import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' import { itif } from './utils/helpers' @@ -77,11 +77,11 @@ describe('The EIP1271 implementation', () => { // Create adapters and the protocol kit instance const [account1, account2, account3, account4, account5] = accounts - const provider1 = await getEthAdapter(account1.signer) - const provider2 = await getEthAdapter(account2.signer) - const provider3 = await getEthAdapter(account3.signer) - const provider4 = await getEthAdapter(account4.signer) - const provider5 = await getEthAdapter(account5.signer) + const provider1 = await getEip1193Provider(account1.signer) + const provider2 = await getEip1193Provider(account2.signer) + const provider3 = await getEip1193Provider(account3.signer) + const provider4 = await getEip1193Provider(account4.signer) + const provider5 = await getEip1193Provider(account5.signer) let protocolKit = await Safe.create({ provider: provider1, @@ -238,11 +238,11 @@ describe('The EIP1271 implementation', () => { // Create adapters and the protocol kit instance const [account1, account2, account3, account4, account5] = accounts - const provider1 = await getEthAdapter(account1.signer) - const provider2 = await getEthAdapter(account2.signer) - const provider3 = await getEthAdapter(account3.signer) - const provider4 = await getEthAdapter(account4.signer) - const provider5 = await getEthAdapter(account5.signer) + const provider1 = await getEip1193Provider(account1.signer) + const provider2 = await getEip1193Provider(account2.signer) + const provider3 = await getEip1193Provider(account3.signer) + const provider4 = await getEip1193Provider(account4.signer) + const provider5 = await getEip1193Provider(account5.signer) let protocolKit = await Safe.create({ provider: provider1, diff --git a/packages/protocol-kit/tests/e2e/eip1271.test.ts b/packages/protocol-kit/tests/e2e/eip1271.test.ts index e9a0f7875..70eac47e5 100644 --- a/packages/protocol-kit/tests/e2e/eip1271.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271.test.ts @@ -14,7 +14,7 @@ import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' import { itif } from './utils/helpers' @@ -66,7 +66,7 @@ describe('The EIP1271 implementation', () => { const safeAddress = await safe.getAddress() // Adapter and Safe instance for owner 1 - const provider1 = await getEthAdapter(account1.signer) + const provider1 = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, @@ -74,7 +74,7 @@ describe('The EIP1271 implementation', () => { }) // Adapter and Safe instance for owner 2 - const provider2 = await getEthAdapter(account2.signer) + const provider2 = await getEip1193Provider(account2.signer) const safeSdk2 = await Safe.create({ provider: provider2, signerAddress: account2.address, @@ -382,7 +382,7 @@ describe('The EIP1271 implementation', () => { // EOA sign const safeMessage1 = safeSdk1.createMessage(MESSAGE) const signedMessage1: SafeMessage = await safeSdk1.signMessage(safeMessage1) - const signerAddress1 = (await safeSdk1.getEthAdapter().getSignerAddress()) as string + const signerAddress1 = (await safeSdk1.getSafeProvider().getSignerAddress()) as string const ethSig = signedMessage1.getSignature(signerAddress1) as EthSafeSignature // Signer Safe sign @@ -392,7 +392,7 @@ describe('The EIP1271 implementation', () => { SigningMethod.SAFE_SIGNATURE, safeAddress ) - const signerAddress2 = (await safeSdk3.getEthAdapter().getSignerAddress()) as string + const signerAddress2 = (await safeSdk3.getSafeProvider().getSignerAddress()) as string const safeSignerSig = await buildContractSignature( [signedMessage2.getSignature(signerAddress2) as EthSafeSignature], signerSafeAddress diff --git a/packages/protocol-kit/tests/e2e/erc-20.test.ts b/packages/protocol-kit/tests/e2e/erc-20.test.ts index d5a6ea285..5bde9428b 100644 --- a/packages/protocol-kit/tests/e2e/erc-20.test.ts +++ b/packages/protocol-kit/tests/e2e/erc-20.test.ts @@ -11,7 +11,7 @@ import sinonChai from 'sinon-chai' import { deployments } from 'hardhat' import { itif } from './utils/helpers' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' import { getAccounts } from './utils/setupTestNetwork' @@ -46,7 +46,7 @@ describe('ERC-20 utils', () => { const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) // mock decimals() call sinon.stub(provider, 'call').returns(Promise.resolve('0x12')) @@ -71,7 +71,7 @@ describe('ERC-20 utils', () => { const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) // mock decimals() call sinon.stub(provider, 'call').returns(Promise.resolve('0x06')) @@ -96,10 +96,10 @@ describe('ERC-20 utils', () => { const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) // mock decimals() call - sinon.stub(ethAdapter, 'call').returns(Promise.resolve('0x')) + sinon.stub(safeProvider, 'call').returns(Promise.resolve('0x')) const safeSdk = await Safe.create({ provider, @@ -123,10 +123,10 @@ describe('ERC-20 utils', () => { const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ - ethAdapter, + safeProvider, safeAddress, contractNetworks }) @@ -148,7 +148,7 @@ describe('ERC-20 utils', () => { const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) // mock decimals() call sinon.stub(provider, 'call').returns(Promise.resolve('0x12')) @@ -176,7 +176,7 @@ describe('ERC-20 utils', () => { const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) // mock decimals() call sinon.stub(provider, 'call').returns(Promise.resolve('0x06')) diff --git a/packages/protocol-kit/tests/e2e/ethAdapters.test.ts b/packages/protocol-kit/tests/e2e/ethAdapters.test.ts index 6c752cf52..6d0bf0cde 100644 --- a/packages/protocol-kit/tests/e2e/ethAdapters.test.ts +++ b/packages/protocol-kit/tests/e2e/ethAdapters.test.ts @@ -21,7 +21,7 @@ import { getSafeSingleton, getSignMessageLib } from './utils/setupContracts' -import { getEthAdapter, getNetworkProvider } from './utils/setupEthAdapter' +import { getEip1193Provider, getNetworkProvider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) @@ -41,7 +41,7 @@ describe('Safe contracts', () => { describe('getSafeContract', async () => { it('should return an L1 Safe contract from safe-deployments', async () => { - const provider = await getEthAdapter(getNetworkProvider('mainnet')) + const provider = await getEip1193Provider(getNetworkProvider('mainnet')) const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getSafeContractDeployment(safeVersion, chainId) @@ -55,7 +55,7 @@ describe('Safe contracts', () => { }) it('should return an L2 Safe contract from safe-deployments', async () => { - const provider = await getEthAdapter(getNetworkProvider('gnosis')) + const provider = await getEip1193Provider(getNetworkProvider('gnosis')) const safeVersion: SafeVersion = '1.3.0' const chainId = 100n const singletonDeployment = getSafeContractDeployment(safeVersion, chainId) @@ -69,7 +69,7 @@ describe('Safe contracts', () => { }) it('should return an L1 Safe contract from safe-deployments using the L1 flag', async () => { - const provider = await getEthAdapter(getNetworkProvider('gnosis')) + const provider = await getEip1193Provider(getNetworkProvider('gnosis')) const safeVersion: SafeVersion = '1.3.0' const chainId = 100n const isL1SafeSingleton = true @@ -86,7 +86,7 @@ describe('Safe contracts', () => { it('should return a Safe contract from the custom addresses', async () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const safeContract = await provider.getSafeContract({ @@ -102,7 +102,7 @@ describe('Safe contracts', () => { describe('getMultiSendContract', async () => { it('should return a MultiSend contract from safe-deployments', async () => { - const provider = await getEthAdapter(getNetworkProvider('mainnet')) + const provider = await getEip1193Provider(getNetworkProvider('mainnet')) const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getMultiSendContractDeployment(safeVersion, chainId) @@ -118,7 +118,7 @@ describe('Safe contracts', () => { it('should return a MultiSend contract from the custom addresses', async () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const multiSendContract = await provider.getMultiSendContract({ @@ -134,7 +134,7 @@ describe('Safe contracts', () => { describe('getMultiSendCallOnlyContract', async () => { it('should return a MultiSendCallOnly contract from safe-deployments', async () => { - const provider = await getEthAdapter(getNetworkProvider('mainnet')) + const provider = await getEip1193Provider(getNetworkProvider('mainnet')) const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getMultiSendCallOnlyContractDeployment(safeVersion, chainId) @@ -150,7 +150,7 @@ describe('Safe contracts', () => { it('should return a MultiSendCallOnly contract from the custom addresses', async () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const multiSendCallOnlyContract = await provider.getMultiSendCallOnlyContract({ @@ -166,7 +166,7 @@ describe('Safe contracts', () => { describe('getCompatibilityFallbackHandlerContract', async () => { it('should return a CompatibilityFallbackHandler contract from safe-deployments', async () => { - const provider = await getEthAdapter(getNetworkProvider('mainnet')) + const provider = await getEip1193Provider(getNetworkProvider('mainnet')) const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getCompatibilityFallbackHandlerContractDeployment( @@ -186,7 +186,7 @@ describe('Safe contracts', () => { it('should return a CompatibilityFallbackHandler contract from the custom addresses', async () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const compatibilityFallbackHandlerContract = @@ -203,7 +203,7 @@ describe('Safe contracts', () => { describe('getSafeProxyFactoryContract', async () => { it('should return a SafeProxyFactory contract from safe-deployments', async () => { - const provider = await getEthAdapter(getNetworkProvider('mainnet')) + const provider = await getEip1193Provider(getNetworkProvider('mainnet')) const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getSafeProxyFactoryContractDeployment(safeVersion, chainId) @@ -219,7 +219,7 @@ describe('Safe contracts', () => { it('should return a SafeProxyFactory contract from the custom addresses', async () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const factoryContract = await provider.getSafeProxyFactoryContract({ @@ -235,7 +235,7 @@ describe('Safe contracts', () => { describe('getSignMessageLibContract', async () => { it('should return a SignMessageLib contract from safe-deployments', async () => { - const provider = await getEthAdapter(getNetworkProvider('mainnet')) + const provider = await getEip1193Provider(getNetworkProvider('mainnet')) const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getSignMessageLibContractDeployment(safeVersion, chainId) @@ -251,7 +251,7 @@ describe('Safe contracts', () => { it('should return a SignMessageLib contract from the custom addresses', async () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const signMessageLibContract = await provider.getSignMessageLibContract({ @@ -267,7 +267,7 @@ describe('Safe contracts', () => { describe('getCreateCallContract', async () => { it('should return a CreateCall contract from safe-deployments', async () => { - const provider = await getEthAdapter(getNetworkProvider('mainnet')) + const provider = await getEip1193Provider(getNetworkProvider('mainnet')) const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getCreateCallContractDeployment(safeVersion, chainId) @@ -283,7 +283,7 @@ describe('Safe contracts', () => { it('should return a SafeProxyFactory contract from the custom addresses', async () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const createCallContract = await provider.getCreateCallContract({ diff --git a/packages/protocol-kit/tests/e2e/execution.test.ts b/packages/protocol-kit/tests/e2e/execution.test.ts index 6770578cb..b4a4a25f7 100644 --- a/packages/protocol-kit/tests/e2e/execution.test.ts +++ b/packages/protocol-kit/tests/e2e/execution.test.ts @@ -11,7 +11,7 @@ import { deployments } from 'hardhat' import { itif } from './utils/helpers' import { getContractNetworks } from './utils/setupContractNetworks' import { getERC20Mintable, getSafeWithOwners } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' @@ -37,13 +37,13 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider1 = await getEthAdapter(account1.signer) + const provider1 = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, contractNetworks }) - const provider2 = await getEthAdapter(account2.signer) + const provider2 = await getEip1193Provider(account2.signer) const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address, @@ -76,7 +76,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -106,7 +106,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -130,13 +130,13 @@ describe('Transactions execution', () => { const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider, safeAddress, contractNetworks }) - const provider2 = await getEthAdapter(account2.signer) + const provider2 = await getEip1193Provider(account2.signer) const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address @@ -161,7 +161,7 @@ describe('Transactions execution', () => { const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -183,13 +183,13 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider1 = await getEthAdapter(account1.signer) + const provider1 = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, contractNetworks }) - const provider2 = await getEthAdapter(account2.signer) + const provider2 = await getEip1193Provider(account2.signer) const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address, @@ -220,7 +220,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -247,7 +247,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -274,7 +274,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -311,9 +311,9 @@ describe('Transactions execution', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - const provider1 = await getEthAdapter(account1.signer) - const provider2 = await getEthAdapter(account2.signer) - const provider3 = await getEthAdapter(account3.signer) + const provider1 = await getEip1193Provider(account1.signer) + const provider2 = await getEip1193Provider(account2.signer) + const provider3 = await getEip1193Provider(account3.signer) const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, @@ -369,10 +369,10 @@ describe('Transactions execution', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - const provider1 = await getEthAdapter(account1.signer) - const provider2 = await getEthAdapter(account2.signer) - const provider3 = await getEthAdapter(account3.signer) - const provider4 = await getEthAdapter(account4.signer) + const provider1 = await getEip1193Provider(account1.signer) + const provider2 = await getEip1193Provider(account2.signer) + const provider3 = await getEip1193Provider(account3.signer) + const provider4 = await getEip1193Provider(account4.signer) const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, @@ -436,11 +436,11 @@ describe('Transactions execution', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - const provider1 = await getEthAdapter(account1.signer) - const provider2 = await getEthAdapter(account2.signer) - const provider3 = await getEthAdapter(account3.signer) - const provider4 = await getEthAdapter(account4.signer) - const provider5 = await getEthAdapter(account5.signer) + const provider1 = await getEip1193Provider(account1.signer) + const provider2 = await getEip1193Provider(account2.signer) + const provider3 = await getEip1193Provider(account3.signer) + const provider4 = await getEip1193Provider(account4.signer) + const provider5 = await getEip1193Provider(account5.signer) const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, @@ -512,12 +512,12 @@ describe('Transactions execution', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - const provider1 = await getEthAdapter(account1.signer) - const provider2 = await getEthAdapter(account2.signer) - const provider3 = await getEthAdapter(account3.signer) - const provider4 = await getEthAdapter(account4.signer) - const provider5 = await getEthAdapter(account5.signer) - const provider6 = await getEthAdapter(account6.signer) + const provider1 = await getEip1193Provider(account1.signer) + const provider2 = await getEip1193Provider(account2.signer) + const provider3 = await getEip1193Provider(account3.signer) + const provider4 = await getEip1193Provider(account4.signer) + const provider5 = await getEip1193Provider(account5.signer) + const provider6 = await getEip1193Provider(account6.signer) const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, @@ -581,19 +581,19 @@ describe('Transactions execution', () => { it('should execute a transaction when is not submitted by an owner', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3] = accounts - const provider1 = await getEthAdapter(account1.signer) + const provider1 = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, contractNetworks }) - const provider2 = await getEthAdapter(account2.signer) + const provider2 = await getEip1193Provider(account2.signer) const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address }) - const provider3 = await getEthAdapter(account3.signer) + const provider3 = await getEip1193Provider(account3.signer) const safeSdk3 = await safeSdk1.connect({ provider: provider3, signerAddress: account3.address @@ -626,7 +626,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -657,7 +657,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -692,7 +692,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -729,7 +729,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -760,7 +760,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -795,7 +795,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -830,7 +830,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -861,18 +861,18 @@ describe('Transactions execution', () => { const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() - const provider1 = await getEthAdapter(account1.signer) + const provider1 = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, contractNetworks }) - const provider2 = await getEthAdapter(account2.signer) + const provider2 = await getEip1193Provider(account2.signer) const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address }) - const provider3 = await getEthAdapter(account3.signer) + const provider3 = await getEip1193Provider(account3.signer) const safeSdk3 = await safeSdk1.connect({ provider: provider3, signerAddress: account3.address @@ -912,18 +912,18 @@ describe('Transactions execution', () => { const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() - const provider1 = await getEthAdapter(account1.signer) + const provider1 = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, contractNetworks }) - const provider2 = await getEthAdapter(account2.signer) + const provider2 = await getEip1193Provider(account2.signer) const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address }) - const provider3 = await getEthAdapter(account3.signer) + const provider3 = await getEip1193Provider(account3.signer) const safeSdk3 = await safeSdk1.connect({ provider: provider3, signerAddress: account3.address diff --git a/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts b/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts index caa0048f2..2a45db668 100644 --- a/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts @@ -14,7 +14,7 @@ import { getDefaultCallbackHandler, getSafeWithOwners } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' @@ -51,7 +51,7 @@ describe('Fallback handler manager', () => { const { safe, accounts, contractNetworks } = await setupTests() const safeAddress = await safe.getAddress() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress, @@ -69,7 +69,7 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -81,7 +81,7 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')('should return the enabled fallback handler', async () => { const { safe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -110,7 +110,7 @@ describe('Fallback handler manager', () => { const { predictedSafe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -131,7 +131,7 @@ describe('Fallback handler manager', () => { const { predictedSafe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -147,7 +147,7 @@ describe('Fallback handler manager', () => { async () => { const { safe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -166,7 +166,7 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')('should fail if address is invalid', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -182,7 +182,7 @@ describe('Fallback handler manager', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -197,7 +197,7 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')('should fail if address is already enabled', async () => { const { safe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -218,7 +218,7 @@ describe('Fallback handler manager', () => { async () => { const { safe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -249,7 +249,7 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')('should enable a fallback handler', async () => { const { safe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -277,7 +277,7 @@ describe('Fallback handler manager', () => { async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -298,7 +298,7 @@ describe('Fallback handler manager', () => { const { predictedSafe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -316,7 +316,7 @@ describe('Fallback handler manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress, @@ -336,7 +336,7 @@ describe('Fallback handler manager', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -361,7 +361,7 @@ describe('Fallback handler manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress, @@ -399,7 +399,7 @@ describe('Fallback handler manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress, diff --git a/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts b/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts index db85b2616..ec833726e 100644 --- a/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts @@ -4,7 +4,7 @@ import chai from 'chai' import { deployments } from 'hardhat' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' import { itif } from './utils/helpers' @@ -26,7 +26,7 @@ describe('getEncodedTransaction', () => { const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, @@ -57,7 +57,7 @@ describe('getEncodedTransaction', () => { const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, @@ -88,7 +88,7 @@ describe('getEncodedTransaction', () => { const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, diff --git a/packages/protocol-kit/tests/e2e/guardManager.test.ts b/packages/protocol-kit/tests/e2e/guardManager.test.ts index 070a4eee2..8a9d86fb2 100644 --- a/packages/protocol-kit/tests/e2e/guardManager.test.ts +++ b/packages/protocol-kit/tests/e2e/guardManager.test.ts @@ -10,7 +10,7 @@ import { deployments } from 'hardhat' import { itif } from './utils/helpers' import { getContractNetworks } from './utils/setupContractNetworks' import { getDebugTransactionGuard, getSafeWithOwners } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' @@ -46,7 +46,7 @@ describe('Safe guard manager', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -65,7 +65,7 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -79,7 +79,7 @@ describe('Safe guard manager', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -93,7 +93,7 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')('should return the enabled Safe guard', async () => { const { safe, accounts, contractNetworks, debugTransactionGuard } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -114,7 +114,7 @@ describe('Safe guard manager', () => { async () => { const { safe, accounts, contractNetworks, debugTransactionGuard } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -134,7 +134,7 @@ describe('Safe guard manager', () => { const { predictedSafe, accounts, debugTransactionGuard, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -147,7 +147,7 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')('should fail if address is invalid', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -163,7 +163,7 @@ describe('Safe guard manager', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -178,7 +178,7 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')('should fail if address is already enabled', async () => { const { safe, accounts, contractNetworks, debugTransactionGuard } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -197,7 +197,7 @@ describe('Safe guard manager', () => { async () => { const { safe, accounts, contractNetworks, debugTransactionGuard } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -228,7 +228,7 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')('should enable a Safe guard', async () => { const { safe, accounts, contractNetworks, debugTransactionGuard } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -250,7 +250,7 @@ describe('Safe guard manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -269,7 +269,7 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')('should fail if the Safe is not deployed', async () => { const { accounts, predictedSafe, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -282,7 +282,7 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')('should fail if no Safe guard is enabled', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -300,7 +300,7 @@ describe('Safe guard manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress, @@ -333,7 +333,7 @@ describe('Safe guard manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress, diff --git a/packages/protocol-kit/tests/e2e/moduleManager.test.ts b/packages/protocol-kit/tests/e2e/moduleManager.test.ts index bbba16a50..37a919fda 100644 --- a/packages/protocol-kit/tests/e2e/moduleManager.test.ts +++ b/packages/protocol-kit/tests/e2e/moduleManager.test.ts @@ -13,7 +13,7 @@ import { getSafeWithOwners, getSocialRecoveryModule } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' @@ -48,7 +48,7 @@ describe('Safe modules manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -60,7 +60,7 @@ describe('Safe modules manager', () => { it('should return all the enabled modules', async () => { const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -79,7 +79,7 @@ describe('Safe modules manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -92,7 +92,7 @@ describe('Safe modules manager', () => { it('should return true if a module is enabled', async () => { const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -111,7 +111,7 @@ describe('Safe modules manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -124,7 +124,7 @@ describe('Safe modules manager', () => { it('should fail if address is invalid', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -138,7 +138,7 @@ describe('Safe modules manager', () => { it('should fail if address is equal to sentinel', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -152,7 +152,7 @@ describe('Safe modules manager', () => { it('should fail if address is equal to 0x address', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -166,7 +166,7 @@ describe('Safe modules manager', () => { it('should fail if address is already enabled', async () => { const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -183,7 +183,7 @@ describe('Safe modules manager', () => { it('should build the transaction with the optional props', async () => { const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -210,7 +210,7 @@ describe('Safe modules manager', () => { it('should enable a Safe module', async () => { const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -231,7 +231,7 @@ describe('Safe modules manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -244,7 +244,7 @@ describe('Safe modules manager', () => { it('should fail if address is invalid', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -258,7 +258,7 @@ describe('Safe modules manager', () => { it('should fail if address is equal to sentinel', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -272,7 +272,7 @@ describe('Safe modules manager', () => { it('should fail if address is equal to 0x address', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -286,7 +286,7 @@ describe('Safe modules manager', () => { it('should fail if address is not enabled', async () => { const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -302,7 +302,7 @@ describe('Safe modules manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress, @@ -338,7 +338,7 @@ describe('Safe modules manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress, diff --git a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts index 9cd442a46..64929d1b7 100644 --- a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts @@ -7,7 +7,7 @@ import { deployments } from 'hardhat' import { itif } from './utils/helpers' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) @@ -39,7 +39,7 @@ describe('Off-chain signatures', () => { it('should sign a transaction hash with the current signer if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -53,7 +53,7 @@ describe('Off-chain signatures', () => { it('should sign a transaction hash with the current signer', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -78,7 +78,7 @@ describe('Off-chain signatures', () => { async () => { const { safe, predictedSafe, accounts, contractNetworks } = await setupTests() const account = accounts[0] - const provider = await getEthAdapter(account.signer) + const provider = await getEip1193Provider(account.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -112,7 +112,7 @@ describe('Off-chain signatures', () => { async () => { const { safe, predictedSafe, accounts, contractNetworks } = await setupTests() const account = accounts[0] - const provider = await getEthAdapter(account.signer) + const provider = await getEip1193Provider(account.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -135,7 +135,7 @@ describe('Off-chain signatures', () => { it('should fail if the signature is added by an account that is not an owner', async () => { const { safe, accounts, contractNetworks } = await setupTests() const account3 = accounts[2] - const provider = await getEthAdapter(account3.signer) + const provider = await getEip1193Provider(account3.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -157,7 +157,7 @@ describe('Off-chain signatures', () => { it('should ignore duplicated signatures', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -183,7 +183,7 @@ describe('Off-chain signatures', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -207,7 +207,7 @@ describe('Off-chain signatures', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -232,7 +232,7 @@ describe('Off-chain signatures', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -257,7 +257,7 @@ describe('Off-chain signatures', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -281,7 +281,7 @@ describe('Off-chain signatures', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -306,7 +306,7 @@ describe('Off-chain signatures', () => { async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -328,7 +328,7 @@ describe('Off-chain signatures', () => { it('should add the signature of the current signer using eth_signTypedData_v4', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -350,7 +350,7 @@ describe('Off-chain signatures', () => { it('should add the signature of the current signer using eth_signTypedData_v4 by default', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -372,7 +372,7 @@ describe('Off-chain signatures', () => { it('should sign a transaction received from the Safe Transaction Service', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, diff --git a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts index 8432a4606..6957437e8 100644 --- a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts @@ -5,7 +5,7 @@ import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' @@ -38,7 +38,7 @@ describe('On-chain signatures', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider, predictedSafe, @@ -53,7 +53,7 @@ describe('On-chain signatures', () => { it('should fail if a transaction hash is approved by an account that is not an owner', async () => { const { safe, accounts, contractNetworks } = await setupTests() const account3 = accounts[2] - const provider = await getEthAdapter(account3.signer) + const provider = await getEip1193Provider(account3.signer) const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ provider, @@ -76,7 +76,7 @@ describe('On-chain signatures', () => { it('should approve the transaction hash', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ provider, @@ -98,7 +98,7 @@ describe('On-chain signatures', () => { it('should ignore a duplicated signatures', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ provider, @@ -126,7 +126,7 @@ describe('On-chain signatures', () => { it('should fail if Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider1 = await getEthAdapter(account1.signer) + const provider1 = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider: provider1, predictedSafe, @@ -140,14 +140,14 @@ describe('On-chain signatures', () => { it('should return the list of owners who approved a transaction hash', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider1 = await getEthAdapter(account1.signer) + const provider1 = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress: safeAddress, contractNetworks }) - const provider2 = await getEthAdapter(account2.signer) + const provider2 = await getEip1193Provider(account2.signer) const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address diff --git a/packages/protocol-kit/tests/e2e/ownerManager.test.ts b/packages/protocol-kit/tests/e2e/ownerManager.test.ts index a01ab446e..1bc526275 100644 --- a/packages/protocol-kit/tests/e2e/ownerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/ownerManager.test.ts @@ -9,7 +9,7 @@ import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' @@ -46,7 +46,7 @@ describe('Safe owners manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -59,7 +59,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address, account2.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -76,7 +76,7 @@ describe('Safe owners manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -89,7 +89,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -103,7 +103,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -118,7 +118,7 @@ describe('Safe owners manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -132,7 +132,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -146,7 +146,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -160,7 +160,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -174,7 +174,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -188,7 +188,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -208,7 +208,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -222,7 +222,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -249,7 +249,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -274,7 +274,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -302,7 +302,7 @@ describe('Safe owners manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -315,7 +315,7 @@ describe('Safe owners manager', () => { it('should fail if address is invalid', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -328,7 +328,7 @@ describe('Safe owners manager', () => { it('should fail if address is equal to sentinel', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -341,7 +341,7 @@ describe('Safe owners manager', () => { it('should fail if address is equal to 0x address', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -354,7 +354,7 @@ describe('Safe owners manager', () => { it('should fail if address is not an owner', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, , , account4] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -367,7 +367,7 @@ describe('Safe owners manager', () => { it('should fail if the threshold is bigger than the number of owners', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -386,7 +386,7 @@ describe('Safe owners manager', () => { it('should fail if the threshold is not bigger than 0', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -399,7 +399,7 @@ describe('Safe owners manager', () => { it('should build the transaction with the optional props', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider1 = await getEthAdapter(account1.signer) + const provider1 = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider: provider1, safeAddress: await safe.getAddress(), @@ -425,18 +425,18 @@ describe('Safe owners manager', () => { it('should remove the first owner of a Safe and decrease the threshold', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3] = accounts - const provider1 = await getEthAdapter(account1.signer) + const provider1 = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider: provider1, safeAddress: await safe.getAddress(), contractNetworks }) - const provider2 = await getEthAdapter(account2.signer) + const provider2 = await getEip1193Provider(account2.signer) const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address }) - const provider3 = await getEthAdapter(account3.signer) + const provider3 = await getEip1193Provider(account3.signer) const safeSdk3 = await safeSdk1.connect({ provider: provider3, signerAddress: account3.address @@ -463,18 +463,18 @@ describe('Safe owners manager', () => { it('should remove any owner of a Safe and decrease the threshold', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3] = accounts - const provider1 = await getEthAdapter(account1.signer) + const provider1 = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider: provider1, safeAddress: await safe.getAddress(), contractNetworks }) - const provider2 = await getEthAdapter(account2.signer) + const provider2 = await getEip1193Provider(account2.signer) const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address }) - const provider3 = await getEthAdapter(account3.signer) + const provider3 = await getEip1193Provider(account3.signer) const safeSdk3 = await safeSdk1.connect({ provider: provider3, signerAddress: account3.address, @@ -502,18 +502,18 @@ describe('Safe owners manager', () => { it('should remove an owner and update the threshold', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3] = accounts - const provider1 = await getEthAdapter(account1.signer) + const provider1 = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider: provider1, safeAddress: await safe.getAddress(), contractNetworks }) - const provider2 = await getEthAdapter(account2.signer) + const provider2 = await getEip1193Provider(account2.signer) const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address }) - const provider3 = await getEthAdapter(account3.signer) + const provider3 = await getEip1193Provider(account3.signer) const safeSdk3 = await safeSdk1.connect({ provider: provider3, signerAddress: account3.address @@ -544,7 +544,7 @@ describe('Safe owners manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -561,7 +561,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -578,7 +578,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -595,7 +595,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -612,7 +612,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -629,7 +629,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -646,7 +646,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -663,7 +663,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2, , account4] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -680,7 +680,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -697,7 +697,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -727,7 +727,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -750,18 +750,18 @@ describe('Safe owners manager', () => { it('should replace any owner of a Safe', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3, account4] = accounts - const provider1 = await getEthAdapter(account1.signer) + const provider1 = await getEip1193Provider(account1.signer) const safeSdk1 = await Safe.create({ provider: provider1, safeAddress: await safe.getAddress(), contractNetworks }) - const provider2 = await getEthAdapter(account2.signer) + const provider2 = await getEip1193Provider(account2.signer) const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address }) - const provider3 = await getEthAdapter(account3.signer) + const provider3 = await getEip1193Provider(account3.signer) const safeSdk3 = await safeSdk1.connect({ provider: provider3, signerAddress: account3.address diff --git a/packages/protocol-kit/tests/e2e/safeFactory.test.ts b/packages/protocol-kit/tests/e2e/safeFactory.test.ts index 07d60029a..673b56dea 100644 --- a/packages/protocol-kit/tests/e2e/safeFactory.test.ts +++ b/packages/protocol-kit/tests/e2e/safeFactory.test.ts @@ -23,7 +23,7 @@ import { getSignMessageLib, getSimulateTxAccessor } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) @@ -46,7 +46,7 @@ describe('SafeProxyFactory', () => { it('should fail if the current network is not a default network and no contractNetworks is provided', async () => { const { accounts } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) chai .expect(SafeFactory.create({ provider })) .rejectedWith('Invalid SafeProxyFactory contract') @@ -55,7 +55,7 @@ describe('SafeProxyFactory', () => { it('should fail if the contractNetworks provided are not deployed', async () => { const { accounts, chainId } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const contractNetworks: ContractNetworksConfig = { [chainId.toString()]: { safeSingletonAddress: ZERO_ADDRESS, @@ -84,7 +84,7 @@ describe('SafeProxyFactory', () => { it('should instantiate the SafeProxyFactory', async () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const networkId = await provider.getChainId() chai @@ -93,14 +93,14 @@ describe('SafeProxyFactory', () => { }) }) - describe('getEthAdapter', async () => { - it('should return the connected EthAdapter', async () => { + describe('getEip1193Provider', async () => { + it('should return the connected ISafeProvider', async () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, contractNetworks }) chai - .expect(await safeFactory.getEthAdapter().getSignerAddress()) + .expect(await safeFactory.getSafeProvider().getSignerAddress()) .to.be.eq(await account1.signer.getAddress()) }) }) @@ -109,7 +109,7 @@ describe('SafeProxyFactory', () => { it('should return the chainId of the current network', async () => { const { accounts, chainId, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, contractNetworks }) chai.expect(await safeFactory.getChainId()).to.be.eq(chainId) }) @@ -119,7 +119,7 @@ describe('SafeProxyFactory', () => { it('should fail if there are no owners', async () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners: string[] = [] const threshold = 2 @@ -134,7 +134,7 @@ describe('SafeProxyFactory', () => { it('should fail if the threshold is lower than 0', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const invalidThreshold = 0 @@ -149,7 +149,7 @@ describe('SafeProxyFactory', () => { it('should fail if the threshold is higher than the threshold', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const invalidThreshold = 3 @@ -164,7 +164,7 @@ describe('SafeProxyFactory', () => { it('should fail if the saltNonce is lower than 0', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -183,7 +183,7 @@ describe('SafeProxyFactory', () => { it('should predict a new Safe with saltNonce', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -210,7 +210,7 @@ describe('SafeProxyFactory', () => { async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -239,7 +239,7 @@ describe('SafeProxyFactory', () => { async () => { const { accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -271,7 +271,7 @@ describe('SafeProxyFactory', () => { it('should fail if there are no owners', async () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners: string[] = [] const threshold = 2 @@ -285,7 +285,7 @@ describe('SafeProxyFactory', () => { it('should fail if the threshold is lower than 0', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const threshold = 0 @@ -299,7 +299,7 @@ describe('SafeProxyFactory', () => { it('should fail if the threshold is higher than the threshold', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const threshold = 3 @@ -313,7 +313,7 @@ describe('SafeProxyFactory', () => { it('should fail if the saltNonce is lower than 0', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -334,7 +334,7 @@ describe('SafeProxyFactory', () => { async () => { const { accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -363,7 +363,7 @@ describe('SafeProxyFactory', () => { async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -385,7 +385,7 @@ describe('SafeProxyFactory', () => { it('should deploy a new Safe without saltNonce', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -405,7 +405,7 @@ describe('SafeProxyFactory', () => { it('should deploy a new Safe with saltNonce', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -430,7 +430,7 @@ describe('SafeProxyFactory', () => { const callback = (txHash: string) => { callbackResult = txHash } - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -452,7 +452,7 @@ describe('SafeProxyFactory', () => { async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const threshold = 2 @@ -467,7 +467,7 @@ describe('SafeProxyFactory', () => { it('should deploy a specific Safe version', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, diff --git a/packages/protocol-kit/tests/e2e/threshold.test.ts b/packages/protocol-kit/tests/e2e/threshold.test.ts index e88557575..19bd588c7 100644 --- a/packages/protocol-kit/tests/e2e/threshold.test.ts +++ b/packages/protocol-kit/tests/e2e/threshold.test.ts @@ -8,7 +8,7 @@ import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' @@ -41,7 +41,7 @@ describe('Safe Threshold', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -53,7 +53,7 @@ describe('Safe Threshold', () => { it('should return the Safe threshold', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -67,7 +67,7 @@ describe('Safe Threshold', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -82,7 +82,7 @@ describe('Safe Threshold', () => { it('should fail if the threshold is bigger than the number of owners', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -99,7 +99,7 @@ describe('Safe Threshold', () => { it('should fail if the threshold is not bigger than 0', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -115,7 +115,7 @@ describe('Safe Threshold', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address, account2.address], 1) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -144,7 +144,7 @@ describe('Safe Threshold', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address, account2.address], 1) - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), diff --git a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts b/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts index 585a5a502..cba2e4aeb 100644 --- a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts +++ b/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts @@ -1,25 +1,12 @@ -import { utils, Provider, AbstractSigner, BrowserProvider } from 'ethers' -import { - EthersAdapter, - EthersAdapterConfig, - Web3Adapter, - Web3AdapterConfig -} from '@safe-global/protocol-kit/index' -import { EthAdapter } from '@safe-global/safe-core-sdk-types' +import { Provider } from 'ethers' import { ethers, web3 } from 'hardhat' -import * as hre from 'hardhat' import Web3 from 'web3' import { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers' import { Eip1193Provider } from '@safe-global/protocol-kit/types' -import { isSignerCompatible } from '@safe-global/protocol-kit/adapters/ethers/utils' -import { HardhatEthersProvider } from '@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider' type Network = 'mainnet' | 'gnosis' | 'zksync' | 'goerli' | 'sepolia' -// EIP-1193 methods that require accounts -const accountMethods = ['eth_accounts', 'eth_sign'] - -export async function getEthAdapter(signer: HardhatEthersSigner): Promise { +export async function getEip1193Provider(signer: HardhatEthersSigner): Promise { return { request: async (request) => { return signer.provider.send(request.method, [...((request.params as unknown[]) ?? [])]) diff --git a/packages/protocol-kit/tests/e2e/utils/transactions.ts b/packages/protocol-kit/tests/e2e/utils/transactions.ts index 5cb7f6d7d..d0b1f9049 100644 --- a/packages/protocol-kit/tests/e2e/utils/transactions.ts +++ b/packages/protocol-kit/tests/e2e/utils/transactions.ts @@ -1,5 +1,5 @@ import { ContractTransactionReceipt } from 'ethers' -import { EthAdapter, TransactionResult } from '@safe-global/safe-core-sdk-types' +import { ISafeProvider, TransactionResult } from '@safe-global/safe-core-sdk-types' import { TransactionReceipt } from 'web3-core/types' export async function waitSafeTxReceipt( @@ -20,8 +20,8 @@ export async function waitSafeTxReceipt( } export async function getTransaction( - ethAdapter: EthAdapter, + safeProvider: ISafeProvider, transactionHash: string ): Promise { - return ethAdapter.getTransaction(transactionHash) + return safeProvider.getTransaction(transactionHash) } diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index db4805130..27f178439 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -4,7 +4,7 @@ import { deployments } from 'hardhat' import { getAccounts } from './utils/setupTestNetwork' import { getContractNetworks } from './utils/setupContractNetworks' import { getDefaultCallbackHandler } from './utils/setupContracts' -import { getEthAdapter, getNetworkProvider } from './utils/setupEthAdapter' +import { getEip1193Provider, getNetworkProvider } from './utils/setupEthAdapter' import { PREDETERMINED_SALT_NONCE, predictSafeAddress @@ -59,7 +59,7 @@ describe('Contract utils', () => { const owners = [owner1.address] const threshold = 1 const safeVersion = safeVersionDeployed - const provider = await getEthAdapter(owner1.signer) + const provider = await getEip1193Provider(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -104,7 +104,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const threshold = 1 const safeVersion = safeVersionDeployed - const provider = await getEthAdapter(owner1.signer) + const provider = await getEip1193Provider(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -149,7 +149,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const threshold = 2 const safeVersion = safeVersionDeployed - const provider = await getEthAdapter(owner1.signer) + const provider = await getEip1193Provider(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -194,7 +194,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const invalidThreshold = 3 const safeVersion = safeVersionDeployed - const provider = await getEthAdapter(owner1.signer) + const provider = await getEip1193Provider(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -228,7 +228,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const invalidThreshold = 0 const safeVersion = safeVersionDeployed - const provider = await getEthAdapter(owner1.signer) + const provider = await getEip1193Provider(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -262,7 +262,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const invalidThreshold = -2 const safeVersion = safeVersionDeployed - const provider = await getEthAdapter(owner1.signer) + const provider = await getEip1193Provider(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -295,7 +295,7 @@ describe('Contract utils', () => { const invalidOwners: string[] = [] const threshold = 1 const safeVersion = safeVersionDeployed - const provider = await getEthAdapter(accounts[0].signer) + const provider = await getEip1193Provider(accounts[0].signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -329,7 +329,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const threshold = 1 const safeVersion = safeVersionDeployed - const provider = await getEthAdapter(owner1.signer) + const provider = await getEip1193Provider(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -422,7 +422,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const threshold = 2 const safeVersion = safeVersionDeployed - const provider = await getEthAdapter(owner1.signer) + const provider = await getEip1193Provider(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -486,7 +486,7 @@ describe('Contract utils', () => { const [owner1] = accounts const owners = [owner1.address] const threshold = 1 - const provider = await getEthAdapter(owner1.signer) + const provider = await getEip1193Provider(owner1.signer) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -525,8 +525,8 @@ describe('Contract utils', () => { const { contractNetworks } = await setupTests() const safeVersion = safeVersionDeployed - // Create EthAdapter instance - const provider = await getEthAdapter(getNetworkProvider('zksync')) + // Create ISafeProvider instance + const provider = await getEip1193Provider(getNetworkProvider('zksync')) const chainId = await provider.getChainId() const customContracts = contractNetworks[chainId.toString()] @@ -611,10 +611,10 @@ describe('Contract utils', () => { const [owner] = accounts const safeVersion = safeVersionDeployed - const gnosisEthAdapter = await getEthAdapter(getNetworkProvider('gnosis')) - const zkSyncEthAdapter = await getEthAdapter(getNetworkProvider('zksync')) - const sepoliaEthAdapter = await getEthAdapter(getNetworkProvider('sepolia')) - const mainnetEthAdapter = await getEthAdapter(getNetworkProvider('mainnet')) + const gnosisEthAdapter = await getEip1193Provider(getNetworkProvider('gnosis')) + const zkSyncEthAdapter = await getEip1193Provider(getNetworkProvider('zksync')) + const sepoliaEthAdapter = await getEip1193Provider(getNetworkProvider('sepolia')) + const mainnetEthAdapter = await getEip1193Provider(getNetworkProvider('mainnet')) // 1/1 Safe const safeAccountConfig: SafeAccountConfig = { diff --git a/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts b/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts index 993be65ed..715816bde 100644 --- a/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts +++ b/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts @@ -6,7 +6,7 @@ import Safe, { PredictedSafeProps } from '@safe-global/protocol-kit/index' import { getContractNetworks } from './utils/setupContractNetworks' import { itif } from './utils/helpers' import { getSafeWithOwners, getMultiSendCallOnly } from './utils/setupContracts' -import { getEthAdapter } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) @@ -44,7 +44,7 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, @@ -73,7 +73,7 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, @@ -109,7 +109,7 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, @@ -145,7 +145,7 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1, account2] = accounts - const provider = await getEthAdapter(account1.signer) + const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ provider, diff --git a/packages/safe-core-sdk-types/src/ethereumLibs/EthAdapter.ts b/packages/safe-core-sdk-types/src/ethereumLibs/EthAdapter.ts index a9425e706..6096fee1b 100644 --- a/packages/safe-core-sdk-types/src/ethereumLibs/EthAdapter.ts +++ b/packages/safe-core-sdk-types/src/ethereumLibs/EthAdapter.ts @@ -10,7 +10,7 @@ import { Eip3770Address, SafeEIP712Args, SafeVersion } from '@safe-global/safe-c import { SingletonDeployment } from '@safe-global/safe-deployments' import { AbiItem } from 'web3-utils' -export interface EthAdapterTransaction { +export interface SafeProviderTransaction { to: string from: string data: string @@ -29,7 +29,7 @@ export interface GetContractProps { isL1SafeSingleton?: boolean } -export interface EthAdapter { +export interface ISafeProvider { isAddress(address: string): boolean getEip3770Address(fullAddress: string): Promise getBalance(address: string, defaultBlock?: string | number): Promise @@ -93,10 +93,10 @@ export interface EthAdapter { signMessage(message: string): Promise signTypedData(safeEIP712Args: SafeEIP712Args, signTypedDataVersion?: string): Promise estimateGas( - transaction: EthAdapterTransaction, + transaction: SafeProviderTransaction, callback?: (error: Error, gas: number) => void ): Promise - call(transaction: EthAdapterTransaction, defaultBlock?: string | number): Promise + call(transaction: SafeProviderTransaction, defaultBlock?: string | number): Promise encodeParameters(types: string[], values: any[]): string decodeParameters(types: any[], values: string): { [key: string]: any } } From 77b95ff3609115250e367f949d02d401c86c929c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 12 Apr 2024 09:42:46 +0200 Subject: [PATCH 005/112] Initial commit --- .../tests/e2e/utilsContracts.test.ts | 48 ++++++++++++------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index 27f178439..d13c803e8 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -16,7 +16,7 @@ import { ContractNetworksConfig, Eip1193Provider } from '@safe-global/protocol-kit/types' -import Safe, { SafeFactory, DeploySafeProps } from '@safe-global/protocol-kit/index' +import Safe, { SafeFactory, DeploySafeProps, SafeProvider } from '@safe-global/protocol-kit/index' import { itif } from './utils/helpers' // test util funcion to deploy a safe (needed to check the expected Safe Address) @@ -60,6 +60,7 @@ describe('Contract utils', () => { const threshold = 1 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(owner1.signer) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -73,7 +74,7 @@ describe('Contract utils', () => { } const predictedSafeAddress = await predictSafeAddress({ - provider, + safeProvider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -105,6 +106,7 @@ describe('Contract utils', () => { const threshold = 1 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(owner1.signer) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -118,7 +120,7 @@ describe('Contract utils', () => { } const predictedSafeAddress = await predictSafeAddress({ - provider, + safeProvider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -150,6 +152,7 @@ describe('Contract utils', () => { const threshold = 2 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(owner1.signer) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -163,7 +166,7 @@ describe('Contract utils', () => { } const predictedSafeAddress = await predictSafeAddress({ - provider, + safeProvider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -195,6 +198,7 @@ describe('Contract utils', () => { const invalidThreshold = 3 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(owner1.signer) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -208,7 +212,7 @@ describe('Contract utils', () => { } const predictSafeAddressWithInvalidThreshold = { - provider, + safeProvider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -229,6 +233,7 @@ describe('Contract utils', () => { const invalidThreshold = 0 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(owner1.signer) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -242,7 +247,7 @@ describe('Contract utils', () => { } const predictSafeAddressWithInvalidThreshold = { - provider, + safeProvider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -263,6 +268,7 @@ describe('Contract utils', () => { const invalidThreshold = -2 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(owner1.signer) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -276,7 +282,7 @@ describe('Contract utils', () => { } const predictSafeAddressWithInvalidThreshold = { - provider, + safeProvider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -296,6 +302,7 @@ describe('Contract utils', () => { const threshold = 1 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(accounts[0].signer) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -309,7 +316,7 @@ describe('Contract utils', () => { } const predictSafeAddressWithInvalidThreshold = { - provider, + safeProvider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -330,6 +337,7 @@ describe('Contract utils', () => { const threshold = 1 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(owner1.signer) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -342,7 +350,7 @@ describe('Contract utils', () => { const thirdSaltNonce = '3' const predictedSafeAddress1 = await predictSafeAddress({ - provider, + safeProvider, chainId, safeAccountConfig, safeDeploymentConfig: { @@ -366,7 +374,7 @@ describe('Contract utils', () => { chai.expect(predictedSafeAddress1).to.be.equal(await firstDeployedSafe.getAddress()) const predictedSafeAddress2 = await predictSafeAddress({ - provider, + safeProvider, chainId, safeAccountConfig, safeDeploymentConfig: { @@ -390,7 +398,7 @@ describe('Contract utils', () => { chai.expect(predictedSafeAddress2).to.be.equal(await secondDeployedSafe.getAddress()) const predictedSafeAddress3 = await predictSafeAddress({ - provider, + safeProvider, chainId, safeAccountConfig, safeDeploymentConfig: { @@ -423,6 +431,7 @@ describe('Contract utils', () => { const threshold = 2 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(owner1.signer) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -447,7 +456,7 @@ describe('Contract utils', () => { const expectedSafeAddress = await deployedSafe.getAddress() const firstPredictedSafeAddress = await predictSafeAddress({ - provider, + safeProvider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -455,7 +464,7 @@ describe('Contract utils', () => { }) const secondPredictedSafeAddress = await predictSafeAddress({ - provider, + safeProvider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -463,7 +472,7 @@ describe('Contract utils', () => { }) const thirdPredictedSafeAddress = await predictSafeAddress({ - provider, + safeProvider, chainId, safeAccountConfig, safeDeploymentConfig, @@ -494,8 +503,10 @@ describe('Contract utils', () => { threshold } + const safeProvider = new SafeProvider({ provider }) + const predictedSafeAddress = await predictSafeAddress({ - provider, + safeProvider, chainId, safeAccountConfig, customContracts @@ -527,7 +538,8 @@ describe('Contract utils', () => { const safeVersion = safeVersionDeployed // Create ISafeProvider instance const provider = await getEip1193Provider(getNetworkProvider('zksync')) - const chainId = await provider.getChainId() + const safeProvider = new SafeProvider({ provider }) + const chainId = await safeProvider.getChainId() const customContracts = contractNetworks[chainId.toString()] // We check real deployments from zksync return the expected address. @@ -544,7 +556,7 @@ describe('Contract utils', () => { const expectedSafeAddress1 = '0x4e19dA81a54eFbaBeb9AD50646f7643076475D65' const firstPredictedSafeAddress = await predictSafeAddress({ - provider, + safeProvider, chainId, safeAccountConfig: safeAccountConfig1, safeDeploymentConfig: safeDeploymentConfig1, @@ -566,7 +578,7 @@ describe('Contract utils', () => { const expectedSafeAddress2 = '0x60c7F13dE7C8Fb88b3845e58859658bdc44243F8' const secondPredictedSafeAddress = await predictSafeAddress({ - provider, + safeProvider, chainId, safeAccountConfig: safeAccountConfig2, safeDeploymentConfig: safeDeploymentConfig2, From 872ca7608a318ec77491b8a1aaf1aaa688d1db63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 12 Apr 2024 11:08:30 +0200 Subject: [PATCH 006/112] Initial commit --- packages/protocol-kit/src/Safe.ts | 2 +- .../src/adapters/ethers/SafeProvider.ts | 25 +++++--- .../contracts/contractInstancesEthers.ts | 1 + .../protocol-kit/src/safeFactory/index.ts | 2 +- .../src/utils/transactions/utils.ts | 2 +- .../createSafeDeploymentTransaction.test.ts | 20 +++--- .../tests/e2e/ethAdapters.test.ts | 63 +++++++++++-------- .../protocol-kit/tests/e2e/execution.test.ts | 16 ++--- .../tests/e2e/safeFactory.test.ts | 8 ++- .../tests/e2e/utils/setupEthAdapter.ts | 20 ++---- .../tests/e2e/utilsContracts.test.ts | 51 ++++++++------- ...SafeTransactionIntoDeploymentBatch.test.ts | 4 +- 12 files changed, 116 insertions(+), 98 deletions(-) diff --git a/packages/protocol-kit/src/Safe.ts b/packages/protocol-kit/src/Safe.ts index cf74f7f75..a45051490 100644 --- a/packages/protocol-kit/src/Safe.ts +++ b/packages/protocol-kit/src/Safe.ts @@ -118,7 +118,7 @@ class Safe { this.#provider = provider this.#safeProvider = new SafeProvider({ - provider, + providerOrUrl: provider, signerAddress }) if (isSafeConfigWithPredictedSafe(config)) { diff --git a/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts b/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts index 22aa4c6c5..091fabcbc 100644 --- a/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts +++ b/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts @@ -11,7 +11,14 @@ import { SignMessageLibContract, SimulateTxAccessorContract } from '@safe-global/safe-core-sdk-types' -import { ethers, TransactionResponse, AbstractSigner, Provider, BrowserProvider } from 'ethers' +import { + ethers, + TransactionResponse, + AbstractSigner, + Provider, + BrowserProvider, + JsonRpcProvider +} from 'ethers' import CompatibilityFallbackHandlerContractEthers from './contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerEthersContract' import SafeContractEthers from './contracts/Safe/SafeContractEthers' import { @@ -34,22 +41,26 @@ import { Eip1193Provider } from '@safe-global/protocol-kit/types' export interface SafeProviderConfig { /** signerOrProvider - Ethers signer or provider */ - provider: Eip1193Provider + providerOrUrl: Eip1193Provider | string signerAddress?: string } class SafeProvider implements ISafeProvider { get #signer(): Promise { + console.log(this.#signerAddress) return this.#provider.getSigner(this.#signerAddress) } - #provider: BrowserProvider - #eip1193Provider: Eip1193Provider + #provider: BrowserProvider | JsonRpcProvider #signerAddress?: string - constructor({ provider, signerAddress }: SafeProviderConfig) { - this.#provider = new BrowserProvider(provider) - this.#eip1193Provider = provider + constructor({ providerOrUrl, signerAddress }: SafeProviderConfig) { + if (typeof providerOrUrl === 'string') { + this.#provider = new JsonRpcProvider(providerOrUrl) + } else { + this.#provider = new BrowserProvider(providerOrUrl) + } + this.#signerAddress = signerAddress } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts index 396d45383..5563590ee 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts @@ -160,6 +160,7 @@ export async function getMultiSendContractInstance( | MultiSendContract_V1_1_1_Ethers > { const chainId = await safeProvider.getChainId() + console.log(chainId, await safeProvider.getSigner()) switch (safeVersion) { case '1.4.1': return new MultiSendContract_V1_4_1_Ethers( diff --git a/packages/protocol-kit/src/safeFactory/index.ts b/packages/protocol-kit/src/safeFactory/index.ts index 9d3b6a94e..bdcae07ea 100644 --- a/packages/protocol-kit/src/safeFactory/index.ts +++ b/packages/protocol-kit/src/safeFactory/index.ts @@ -84,7 +84,7 @@ class SafeFactory { contractNetworks }: SafeFactoryInitConfig): Promise { this.#provider = provider - this.#safeProvider = new SafeProvider({ provider }) + this.#safeProvider = new SafeProvider({ providerOrUrl: provider }) this.#safeVersion = safeVersion this.#isL1SafeSingleton = isL1SafeSingleton this.#contractNetworks = contractNetworks diff --git a/packages/protocol-kit/src/utils/transactions/utils.ts b/packages/protocol-kit/src/utils/transactions/utils.ts index 3c601d165..3bcd4694c 100644 --- a/packages/protocol-kit/src/utils/transactions/utils.ts +++ b/packages/protocol-kit/src/utils/transactions/utils.ts @@ -80,7 +80,7 @@ export async function standardizeSafeTransactionData({ let safeTxGas - const safeProvider = new SafeProvider({ provider }) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) if (semverSatisfies(safeVersion, '>=1.3.0')) { safeTxGas = await estimateGas( safeVersion, diff --git a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts index 211cedb55..3fcaf50a1 100644 --- a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts @@ -6,6 +6,7 @@ import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/de import Safe, { PREDETERMINED_SALT_NONCE, PredictedSafeProps, + SafeProvider, encodeSetupCallData } from '@safe-global/protocol-kit/index' import { getContractNetworks } from './utils/setupContractNetworks' @@ -166,17 +167,16 @@ describe('createSafeDeploymentTransaction', () => { const [account1] = accounts const provider = await getEip1193Provider(account1.signer) - const safeSdk = await Safe.create({ provider, predictedSafe, contractNetworks }) - + const safeProvider = safeSdk.getSafeProvider() const deploymentTransaction = await safeSdk.createSafeDeploymentTransaction() const customContract = contractNetworks[chainId.toString()] - const safeContract = await provider.getSafeContract({ + const safeContract = await safeProvider.getSafeContract({ safeVersion: safeVersionDeployed, customContractAddress: customContract?.safeSingletonAddress, customContractAbi: customContract?.safeSingletonAbi @@ -184,7 +184,7 @@ describe('createSafeDeploymentTransaction', () => { // this is the call to the setup method that sets the threshold & owners of the new Safe const initializer = await encodeSetupCallData({ - provider, + safeProvider, safeContract, safeAccountConfig: predictedSafe.safeAccountConfig, customContracts: contractNetworks[chainId.toString()] @@ -200,14 +200,14 @@ describe('createSafeDeploymentTransaction', () => { const [account1] = accounts const provider = await getEip1193Provider(account1.signer) - + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeSdk = await Safe.create({ provider, predictedSafe, contractNetworks }) - const predeterminedSaltNonceEncoded = provider.encodeParameters( + const predeterminedSaltNonceEncoded = safeProvider.encodeParameters( ['uint256'], [`0x${Buffer.from(keccak_256(PREDETERMINED_SALT_NONCE + chainId)).toString('hex')}`] ) @@ -225,7 +225,7 @@ describe('createSafeDeploymentTransaction', () => { const [account1] = accounts const provider = await getEip1193Provider(account1.signer) - + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -234,7 +234,7 @@ describe('createSafeDeploymentTransaction', () => { const customSaltNonce = '123456789' - const customSaltNonceEncoded = provider.encodeParameters(['uint256'], [customSaltNonce]) + const customSaltNonceEncoded = safeProvider.encodeParameters(['uint256'], [customSaltNonce]) const deploymentTransaction = await safeSdk.createSafeDeploymentTransaction(customSaltNonce) @@ -262,7 +262,9 @@ describe('createSafeDeploymentTransaction', () => { contractNetworks }) - const saltNonceEncoded = safeProvider.encodeParameters(['uint256'], [customSaltNonce]) + const saltNonceEncoded = safeSdk + .getSafeProvider() + .encodeParameters(['uint256'], [customSaltNonce]) const deploymentTransaction = await safeSdk.createSafeDeploymentTransaction(customSaltNonce) diff --git a/packages/protocol-kit/tests/e2e/ethAdapters.test.ts b/packages/protocol-kit/tests/e2e/ethAdapters.test.ts index 6d0bf0cde..e93d3f8fb 100644 --- a/packages/protocol-kit/tests/e2e/ethAdapters.test.ts +++ b/packages/protocol-kit/tests/e2e/ethAdapters.test.ts @@ -21,8 +21,9 @@ import { getSafeSingleton, getSignMessageLib } from './utils/setupContracts' -import { getEip1193Provider, getNetworkProvider } from './utils/setupEthAdapter' +import { getEip1193Provider, getSafeProviderFromNetwork } from './utils/setupEthAdapter' import { getAccounts } from './utils/setupTestNetwork' +import { SafeProvider } from '@safe-global/protocol-kit/index' chai.use(chaiAsPromised) @@ -41,11 +42,11 @@ describe('Safe contracts', () => { describe('getSafeContract', async () => { it('should return an L1 Safe contract from safe-deployments', async () => { - const provider = await getEip1193Provider(getNetworkProvider('mainnet')) + const safeProvider = getSafeProviderFromNetwork('mainnet') const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getSafeContractDeployment(safeVersion, chainId) - const safeContract = await provider.getSafeContract({ + const safeContract = await safeProvider.getSafeContract({ safeVersion, singletonDeployment }) @@ -55,11 +56,11 @@ describe('Safe contracts', () => { }) it('should return an L2 Safe contract from safe-deployments', async () => { - const provider = await getEip1193Provider(getNetworkProvider('gnosis')) + const safeProvider = getSafeProviderFromNetwork('gnosis') const safeVersion: SafeVersion = '1.3.0' const chainId = 100n const singletonDeployment = getSafeContractDeployment(safeVersion, chainId) - const safeContract = await provider.getSafeContract({ + const safeContract = await safeProvider.getSafeContract({ safeVersion, singletonDeployment }) @@ -69,12 +70,12 @@ describe('Safe contracts', () => { }) it('should return an L1 Safe contract from safe-deployments using the L1 flag', async () => { - const provider = await getEip1193Provider(getNetworkProvider('gnosis')) + const safeProvider = getSafeProviderFromNetwork('gnosis') const safeVersion: SafeVersion = '1.3.0' const chainId = 100n const isL1SafeSingleton = true const singletonDeployment = getSafeContractDeployment(safeVersion, chainId, isL1SafeSingleton) - const safeContract = await provider.getSafeContract({ + const safeContract = await safeProvider.getSafeContract({ safeVersion, singletonDeployment }) @@ -87,9 +88,10 @@ describe('Safe contracts', () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts const provider = await getEip1193Provider(account1.signer) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] - const safeContract = await provider.getSafeContract({ + const safeContract = await safeProvider.getSafeContract({ safeVersion, customContractAddress: customContract?.safeSingletonAddress, customContractAbi: customContract?.safeSingletonAbi @@ -101,12 +103,13 @@ describe('Safe contracts', () => { }) describe('getMultiSendContract', async () => { - it('should return a MultiSend contract from safe-deployments', async () => { - const provider = await getEip1193Provider(getNetworkProvider('mainnet')) + it.only('should return a MultiSend contract from safe-deployments', async () => { + const { accounts } = await setupTests() + const safeProvider = getSafeProviderFromNetwork('mainnet', accounts[0].signer) const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getMultiSendContractDeployment(safeVersion, chainId) - const multiSendContract = await provider.getMultiSendContract({ + const multiSendContract = await safeProvider.getMultiSendContract({ safeVersion, singletonDeployment }) @@ -119,9 +122,10 @@ describe('Safe contracts', () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts const provider = await getEip1193Provider(account1.signer) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] - const multiSendContract = await provider.getMultiSendContract({ + const multiSendContract = await safeProvider.getMultiSendContract({ safeVersion, customContractAddress: customContract.multiSendAddress, customContractAbi: customContract.multiSendAbi @@ -134,11 +138,11 @@ describe('Safe contracts', () => { describe('getMultiSendCallOnlyContract', async () => { it('should return a MultiSendCallOnly contract from safe-deployments', async () => { - const provider = await getEip1193Provider(getNetworkProvider('mainnet')) + const safeProvider = getSafeProviderFromNetwork('mainnet') const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getMultiSendCallOnlyContractDeployment(safeVersion, chainId) - const multiSendCallOnlyContract = await provider.getMultiSendCallOnlyContract({ + const multiSendCallOnlyContract = await safeProvider.getMultiSendCallOnlyContract({ safeVersion, singletonDeployment }) @@ -151,9 +155,10 @@ describe('Safe contracts', () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts const provider = await getEip1193Provider(account1.signer) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] - const multiSendCallOnlyContract = await provider.getMultiSendCallOnlyContract({ + const multiSendCallOnlyContract = await safeProvider.getMultiSendCallOnlyContract({ safeVersion, customContractAddress: customContract.multiSendCallOnlyAddress, customContractAbi: customContract.multiSendCallOnlyAbi @@ -166,7 +171,7 @@ describe('Safe contracts', () => { describe('getCompatibilityFallbackHandlerContract', async () => { it('should return a CompatibilityFallbackHandler contract from safe-deployments', async () => { - const provider = await getEip1193Provider(getNetworkProvider('mainnet')) + const safeProvider = getSafeProviderFromNetwork('mainnet') const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getCompatibilityFallbackHandlerContractDeployment( @@ -174,7 +179,7 @@ describe('Safe contracts', () => { chainId ) const compatibilityFallbackHandlerContract = - await provider.getCompatibilityFallbackHandlerContract({ + await safeProvider.getCompatibilityFallbackHandlerContract({ safeVersion, singletonDeployment }) @@ -187,10 +192,11 @@ describe('Safe contracts', () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts const provider = await getEip1193Provider(account1.signer) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const compatibilityFallbackHandlerContract = - await provider.getCompatibilityFallbackHandlerContract({ + await safeProvider.getCompatibilityFallbackHandlerContract({ safeVersion, customContractAddress: customContract.fallbackHandlerAddress, customContractAbi: customContract.fallbackHandlerAbi @@ -203,11 +209,11 @@ describe('Safe contracts', () => { describe('getSafeProxyFactoryContract', async () => { it('should return a SafeProxyFactory contract from safe-deployments', async () => { - const provider = await getEip1193Provider(getNetworkProvider('mainnet')) + const safeProvider = getSafeProviderFromNetwork('mainnet') const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getSafeProxyFactoryContractDeployment(safeVersion, chainId) - const factoryContract = await provider.getSafeProxyFactoryContract({ + const factoryContract = await safeProvider.getSafeProxyFactoryContract({ safeVersion, singletonDeployment }) @@ -220,9 +226,10 @@ describe('Safe contracts', () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts const provider = await getEip1193Provider(account1.signer) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] - const factoryContract = await provider.getSafeProxyFactoryContract({ + const factoryContract = await safeProvider.getSafeProxyFactoryContract({ safeVersion, customContractAddress: customContract.safeProxyFactoryAddress, customContractAbi: customContract.safeProxyFactoryAbi @@ -235,11 +242,11 @@ describe('Safe contracts', () => { describe('getSignMessageLibContract', async () => { it('should return a SignMessageLib contract from safe-deployments', async () => { - const provider = await getEip1193Provider(getNetworkProvider('mainnet')) + const safeProvider = getSafeProviderFromNetwork('mainnet') const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getSignMessageLibContractDeployment(safeVersion, chainId) - const signMessageLibContract = await provider.getSignMessageLibContract({ + const signMessageLibContract = await safeProvider.getSignMessageLibContract({ safeVersion, singletonDeployment }) @@ -252,9 +259,10 @@ describe('Safe contracts', () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts const provider = await getEip1193Provider(account1.signer) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] - const signMessageLibContract = await provider.getSignMessageLibContract({ + const signMessageLibContract = await safeProvider.getSignMessageLibContract({ safeVersion, customContractAddress: customContract.signMessageLibAddress, customContractAbi: customContract.signMessageLibAbi @@ -267,11 +275,11 @@ describe('Safe contracts', () => { describe('getCreateCallContract', async () => { it('should return a CreateCall contract from safe-deployments', async () => { - const provider = await getEip1193Provider(getNetworkProvider('mainnet')) + const safeProvider = getSafeProviderFromNetwork('mainnet') const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getCreateCallContractDeployment(safeVersion, chainId) - const createCallContract = await provider.getCreateCallContract({ + const createCallContract = await safeProvider.getCreateCallContract({ safeVersion, singletonDeployment }) @@ -284,9 +292,10 @@ describe('Safe contracts', () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts const provider = await getEip1193Provider(account1.signer) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] - const createCallContract = await provider.getCreateCallContract({ + const createCallContract = await safeProvider.getCreateCallContract({ safeVersion, customContractAddress: customContract.createCallAddress, customContractAbi: customContract.createCallAbi diff --git a/packages/protocol-kit/tests/e2e/execution.test.ts b/packages/protocol-kit/tests/e2e/execution.test.ts index b4a4a25f7..e96d165e9 100644 --- a/packages/protocol-kit/tests/e2e/execution.test.ts +++ b/packages/protocol-kit/tests/e2e/execution.test.ts @@ -645,7 +645,7 @@ describe('Transactions execution', () => { const execOptions: EthersTransactionOptions = { gasLimit: 123456 } const txResponse = await safeSdk1.executeTransaction(tx, execOptions) await waitSafeTxReceipt(txResponse) - const txConfirmed = await provider.getTransaction(txResponse.hash) + const txConfirmed = await safeSdk1.getSafeProvider().getTransaction(txResponse.hash) chai.expect(execOptions.gasLimit).to.be.eq(Number(txConfirmed.gasLimit)) } ) @@ -679,7 +679,7 @@ describe('Transactions execution', () => { } const txResponse = await safeSdk1.executeTransaction(tx, execOptions) await waitSafeTxReceipt(txResponse) - const txConfirmed = await provider.getTransaction(txResponse.hash) + const txConfirmed = await safeSdk1.getSafeProvider().getTransaction(txResponse.hash) chai.expect(execOptions.gasPrice).to.be.eq(Number(txConfirmed.gasPrice)) chai.expect(execOptions.gasLimit).to.be.eq(Number(txConfirmed.gasLimit)) } @@ -714,7 +714,7 @@ describe('Transactions execution', () => { } const txResponse = await safeSdk1.executeTransaction(tx, execOptions) await waitSafeTxReceipt(txResponse) - const txConfirmed = await provider.getTransaction(txResponse.hash) + const txConfirmed = await safeSdk1.getSafeProvider().getTransaction(txResponse.hash) chai.expect(BigInt(execOptions.maxFeePerGas)).to.be.eq(txConfirmed.maxFeePerGas) chai .expect(BigInt(execOptions.maxPriorityFeePerGas)) @@ -748,7 +748,7 @@ describe('Transactions execution', () => { const execOptions: Web3TransactionOptions = { gas: 123456 } const txResponse = await safeSdk1.executeTransaction(tx, execOptions) await waitSafeTxReceipt(txResponse) - const txConfirmed = await provider.getTransaction(txResponse.hash) + const txConfirmed = await safeSdk1.getSafeProvider().getTransaction(txResponse.hash) chai.expect(execOptions.gas).to.be.eq(txConfirmed.gas) } ) @@ -782,7 +782,7 @@ describe('Transactions execution', () => { } const txResponse = await safeSdk1.executeTransaction(tx, execOptions) await waitSafeTxReceipt(txResponse) - const txConfirmed = await provider.getTransaction(txResponse.hash) + const txConfirmed = await safeSdk1.getSafeProvider().getTransaction(txResponse.hash) chai.expect(execOptions.gasPrice).to.be.eq(Number(txConfirmed.gasPrice)) chai.expect(execOptions.gas).to.be.eq(txConfirmed.gas) } @@ -817,7 +817,7 @@ describe('Transactions execution', () => { } const txResponse = await safeSdk1.executeTransaction(tx, execOptions) await waitSafeTxReceipt(txResponse) - const txConfirmed = await provider.getTransaction(txResponse.hash) + const txConfirmed = await safeSdk1.getSafeProvider().getTransaction(txResponse.hash) chai.expect(BigInt(execOptions.maxFeePerGas)).to.be.eq(BigInt(txConfirmed.maxFeePerGas)) chai .expect(BigInt(execOptions.maxPriorityFeePerGas)) @@ -845,12 +845,12 @@ describe('Transactions execution', () => { value: '500000000000000000', // 0.5 ETH data: '0x' } - const currentNonce = await provider.getNonce(account1.address, 'pending') + const currentNonce = await safeSdk1.getSafeProvider().getNonce(account1.address, 'pending') const tx = await safeSdk1.createTransaction({ transactions: [safeTransactionData] }) const execOptions: EthersTransactionOptions = { nonce: currentNonce } const txResponse = await safeSdk1.executeTransaction(tx, execOptions) await waitSafeTxReceipt(txResponse) - const txConfirmed = await provider.getTransaction(txResponse.hash) + const txConfirmed = await safeSdk1.getSafeProvider().getTransaction(txResponse.hash) chai.expect(execOptions.nonce).to.be.eq(txConfirmed.nonce) }) }) diff --git a/packages/protocol-kit/tests/e2e/safeFactory.test.ts b/packages/protocol-kit/tests/e2e/safeFactory.test.ts index 673b56dea..0842517cc 100644 --- a/packages/protocol-kit/tests/e2e/safeFactory.test.ts +++ b/packages/protocol-kit/tests/e2e/safeFactory.test.ts @@ -4,7 +4,8 @@ import { ContractNetworksConfig, DeploySafeProps, SafeAccountConfig, - SafeFactory + SafeFactory, + SafeProvider } from '@safe-global/protocol-kit/index' import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' import chai from 'chai' @@ -85,11 +86,12 @@ describe('SafeProxyFactory', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const provider = await getEip1193Provider(account1.signer) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeFactory = await SafeFactory.create({ provider, contractNetworks }) - const networkId = await provider.getChainId() + const networkId = await safeProvider.getChainId() chai .expect(await safeFactory.getAddress()) - .to.be.eq(contractNetworks[networkId].safeProxyFactoryAddress) + .to.be.eq(contractNetworks[networkId.toString()].safeProxyFactoryAddress) }) }) diff --git a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts b/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts index cba2e4aeb..67d06aef4 100644 --- a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts +++ b/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts @@ -3,6 +3,7 @@ import { ethers, web3 } from 'hardhat' import Web3 from 'web3' import { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers' import { Eip1193Provider } from '@safe-global/protocol-kit/types' +import { SafeProvider } from '@safe-global/protocol-kit/index' type Network = 'mainnet' | 'gnosis' | 'zksync' | 'goerli' | 'sepolia' @@ -14,7 +15,10 @@ export async function getEip1193Provider(signer: HardhatEthersSigner): Promise { const threshold = 1 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(owner1.signer) - const safeProvider = new SafeProvider({ provider }) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -106,7 +106,7 @@ describe('Contract utils', () => { const threshold = 1 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(owner1.signer) - const safeProvider = new SafeProvider({ provider }) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -152,7 +152,7 @@ describe('Contract utils', () => { const threshold = 2 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(owner1.signer) - const safeProvider = new SafeProvider({ provider }) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -198,7 +198,7 @@ describe('Contract utils', () => { const invalidThreshold = 3 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(owner1.signer) - const safeProvider = new SafeProvider({ provider }) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -233,7 +233,7 @@ describe('Contract utils', () => { const invalidThreshold = 0 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(owner1.signer) - const safeProvider = new SafeProvider({ provider }) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -268,7 +268,7 @@ describe('Contract utils', () => { const invalidThreshold = -2 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(owner1.signer) - const safeProvider = new SafeProvider({ provider }) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -302,7 +302,7 @@ describe('Contract utils', () => { const threshold = 1 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(accounts[0].signer) - const safeProvider = new SafeProvider({ provider }) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -337,7 +337,7 @@ describe('Contract utils', () => { const threshold = 1 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(owner1.signer) - const safeProvider = new SafeProvider({ provider }) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -431,7 +431,7 @@ describe('Contract utils', () => { const threshold = 2 const safeVersion = safeVersionDeployed const provider = await getEip1193Provider(owner1.signer) - const safeProvider = new SafeProvider({ provider }) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -503,7 +503,7 @@ describe('Contract utils', () => { threshold } - const safeProvider = new SafeProvider({ provider }) + const safeProvider = new SafeProvider({ providerOrUrl: provider }) const predictedSafeAddress = await predictSafeAddress({ safeProvider, @@ -537,8 +537,7 @@ describe('Contract utils', () => { const safeVersion = safeVersionDeployed // Create ISafeProvider instance - const provider = await getEip1193Provider(getNetworkProvider('zksync')) - const safeProvider = new SafeProvider({ provider }) + const safeProvider = getSafeProviderFromNetwork('zksync') const chainId = await safeProvider.getChainId() const customContracts = contractNetworks[chainId.toString()] @@ -601,7 +600,7 @@ describe('Contract utils', () => { const expectedSafeAddress3 = '0xD971FAA20db3ad4d51D453047ca03Ce4ec164CE2' const thirdPredictedSafeAddress = await predictSafeAddress({ - provider, + safeProvider, chainId, safeAccountConfig: safeAccountConfig3, safeDeploymentConfig: safeDeploymentConfig3, @@ -623,10 +622,10 @@ describe('Contract utils', () => { const [owner] = accounts const safeVersion = safeVersionDeployed - const gnosisEthAdapter = await getEip1193Provider(getNetworkProvider('gnosis')) - const zkSyncEthAdapter = await getEip1193Provider(getNetworkProvider('zksync')) - const sepoliaEthAdapter = await getEip1193Provider(getNetworkProvider('sepolia')) - const mainnetEthAdapter = await getEip1193Provider(getNetworkProvider('mainnet')) + const gnosisSafeProvider = getSafeProviderFromNetwork('gnosis') + const zkSyncSafeProvider = getSafeProviderFromNetwork('zksync') + const sepoliaSafeProvider = getSafeProviderFromNetwork('sepolia') + const mainnetSafeProvider = getSafeProviderFromNetwork('mainnet') // 1/1 Safe const safeAccountConfig: SafeAccountConfig = { @@ -639,29 +638,29 @@ describe('Contract utils', () => { } const gnosisPredictedSafeAddress = await predictSafeAddress({ - provider: gnosisEthAdapter, - chainId: await gnosisEthAdapter.getChainId(), + safeProvider: gnosisSafeProvider, + chainId: await gnosisSafeProvider.getChainId(), safeAccountConfig: safeAccountConfig, safeDeploymentConfig: safeDeploymentConfig }) const zkSyncPredictedSafeAddress = await predictSafeAddress({ - provider: zkSyncEthAdapter, - chainId: await zkSyncEthAdapter.getChainId(), + safeProvider: zkSyncSafeProvider, + chainId: await zkSyncSafeProvider.getChainId(), safeAccountConfig: safeAccountConfig, safeDeploymentConfig: safeDeploymentConfig }) const sepoliaPredictedSafeAddress = await predictSafeAddress({ - provider: sepoliaEthAdapter, - chainId: await sepoliaEthAdapter.getChainId(), + safeProvider: sepoliaSafeProvider, + chainId: await sepoliaSafeProvider.getChainId(), safeAccountConfig: safeAccountConfig, safeDeploymentConfig: safeDeploymentConfig }) const mainnetPredictedSafeAddress = await predictSafeAddress({ - provider: mainnetEthAdapter, - chainId: await mainnetEthAdapter.getChainId(), + safeProvider: mainnetSafeProvider, + chainId: await mainnetSafeProvider.getChainId(), safeAccountConfig: safeAccountConfig, safeDeploymentConfig: safeDeploymentConfig }) diff --git a/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts b/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts index 715816bde..efc0592bd 100644 --- a/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts +++ b/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts @@ -171,7 +171,9 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { customSaltNonce ) - const customSaltNonceEncoded = provider.encodeParameters(['uint256'], [customSaltNonce]) + const customSaltNonceEncoded = safeSdk + .getSafeProvider() + .encodeParameters(['uint256'], [customSaltNonce]) // custom salt nonce included in the deployment data chai.expect(batchTransaction.data).to.contains(customSaltNonceEncoded.replace('0x', '')) From 4b871e4d5c4e51b1a62169141a636367b19d6a05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 15 Apr 2024 12:44:05 +0200 Subject: [PATCH 007/112] Initial commit --- packages/protocol-kit/src/Safe.ts | 6 ++- .../src/adapters/ethers/SafeProvider.ts | 37 ++++++++++++------- .../contracts/contractInstancesEthers.ts | 2 +- .../protocol-kit/src/safeFactory/index.ts | 2 + packages/protocol-kit/src/types/index.ts | 3 ++ .../protocol-kit/tests/e2e/erc-20.test.ts | 27 ++++++++------ .../tests/e2e/ethAdapters.test.ts | 5 +-- 7 files changed, 51 insertions(+), 31 deletions(-) diff --git a/packages/protocol-kit/src/Safe.ts b/packages/protocol-kit/src/Safe.ts index a45051490..f5b279898 100644 --- a/packages/protocol-kit/src/Safe.ts +++ b/packages/protocol-kit/src/Safe.ts @@ -114,12 +114,14 @@ class Safe { * @throws "MultiSendCallOnly contract is not deployed on the current network" */ private async init(config: SafeConfig): Promise { - const { provider, signerAddress, isL1SafeSingleton, contractNetworks } = config + const { provider, signerAddress, privateKeyOrMnemonic, isL1SafeSingleton, contractNetworks } = + config this.#provider = provider this.#safeProvider = new SafeProvider({ providerOrUrl: provider, - signerAddress + signerAddress, + privateKeyOrMnemonic }) if (isSafeConfigWithPredictedSafe(config)) { this.#predictedSafe = config.predictedSafe diff --git a/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts b/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts index 091fabcbc..acf7a2abc 100644 --- a/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts +++ b/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts @@ -43,24 +43,22 @@ export interface SafeProviderConfig { /** signerOrProvider - Ethers signer or provider */ providerOrUrl: Eip1193Provider | string signerAddress?: string + privateKeyOrMnemonic?: string } class SafeProvider implements ISafeProvider { - get #signer(): Promise { - console.log(this.#signerAddress) - return this.#provider.getSigner(this.#signerAddress) - } - #provider: BrowserProvider | JsonRpcProvider #signerAddress?: string + #privateKeyOrMnemonic?: string - constructor({ providerOrUrl, signerAddress }: SafeProviderConfig) { + constructor({ providerOrUrl, signerAddress, privateKeyOrMnemonic }: SafeProviderConfig) { if (typeof providerOrUrl === 'string') { this.#provider = new JsonRpcProvider(providerOrUrl) } else { this.#provider = new BrowserProvider(providerOrUrl) } + this.#privateKeyOrMnemonic = privateKeyOrMnemonic this.#signerAddress = signerAddress } @@ -68,8 +66,21 @@ class SafeProvider implements ISafeProvider { return this.#provider } - getSigner(): Promise { - return this.#signer + async getSigner(): Promise { + if (this.#privateKeyOrMnemonic) { + const privateKeySigner = new ethers.Wallet(this.#privateKeyOrMnemonic, this.#provider) + return privateKeySigner + } + + if (this.#signerAddress) { + return this.#provider.getSigner(this.#signerAddress) + } + + if (this.#provider instanceof BrowserProvider) { + return this.#provider.getSigner() + } + + return undefined } isAddress(address: string): boolean { @@ -131,7 +142,7 @@ class SafeProvider implements ISafeProvider { if (!contractAddress) { throw new Error('Invalid SafeProxyFactory contract address') } - const signerOrProvider = (await this.#signer) || this.#provider + const signerOrProvider = (await this.getSigner()) || this.#provider return getSafeProxyFactoryContractInstance( safeVersion, contractAddress, @@ -195,7 +206,7 @@ class SafeProvider implements ISafeProvider { if (!contractAddress) { throw new Error('Invalid CompatibilityFallbackHandler contract address') } - const signerOrProvider = (await this.#signer) || this.#provider + const signerOrProvider = (await this.getSigner()) || this.#provider return getCompatibilityFallbackHandlerContractInstance( safeVersion, contractAddress, @@ -274,13 +285,13 @@ class SafeProvider implements ISafeProvider { } async getSignerAddress(): Promise { - const signer = await this.#signer + const signer = await this.getSigner() return signer?.getAddress() } async signMessage(message: string): Promise { - const signer = await this.#signer + const signer = await this.getSigner() if (!signer) { throw new Error('SafeProvider must be initialized with a signer to use this method') @@ -291,7 +302,7 @@ class SafeProvider implements ISafeProvider { } async signTypedData(safeEIP712Args: SafeEIP712Args): Promise { - const signer = await this.#signer + const signer = await this.getSigner() if (!signer) { throw new Error('SafeProvider must be initialized with a signer to use this method') diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts index 5563590ee..3281c76d6 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts @@ -160,7 +160,7 @@ export async function getMultiSendContractInstance( | MultiSendContract_V1_1_1_Ethers > { const chainId = await safeProvider.getChainId() - console.log(chainId, await safeProvider.getSigner()) + switch (safeVersion) { case '1.4.1': return new MultiSendContract_V1_4_1_Ethers( diff --git a/packages/protocol-kit/src/safeFactory/index.ts b/packages/protocol-kit/src/safeFactory/index.ts index bdcae07ea..552ea8044 100644 --- a/packages/protocol-kit/src/safeFactory/index.ts +++ b/packages/protocol-kit/src/safeFactory/index.ts @@ -37,6 +37,7 @@ export interface SafeFactoryConfig { /** safeProvider - Ethereum adapter */ provider: Eip1193Provider signerAddress?: string + privateKeyOrMnemonic?: string /** safeVersion - Versions of the Safe deployed by this Factory contract */ safeVersion?: SafeVersion /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ @@ -49,6 +50,7 @@ interface SafeFactoryInitConfig { /** safeProvider - Ethereum adapter */ provider: Eip1193Provider signerAddress?: string + privateKeyOrMnemonic?: string /** safeVersion - Versions of the Safe deployed by this Factory contract */ safeVersion: SafeVersion /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index 14fd0d4f1..abc827286 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -95,6 +95,7 @@ export type SafeConfigProps = { /** provider - Compatible EIP-1193 provider */ provider: Eip1193Provider signerAddress?: string + privateKeyOrMnemonic?: string /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ isL1SafeSingleton?: boolean /** contractNetworks - Contract network configuration */ @@ -123,6 +124,7 @@ type ConnectSafeConfigProps = { /** provider - Compatible EIP-1193 provider */ provider?: Eip1193Provider signerAddress?: string + privateKeyOrMnemonic?: string /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ isL1SafeSingleton?: boolean /** contractNetworks - Contract network configuration */ @@ -185,6 +187,7 @@ interface StandardizeSafeTransactionData { /** provider - Compatible EIP-1193 provider */ provider: Eip1193Provider signerAddress?: string + privateKeyOrMnemonic?: string /** tx - Safe transaction */ tx: SafeTransactionDataPartial /** contractNetworks - Contract network configuration */ diff --git a/packages/protocol-kit/tests/e2e/erc-20.test.ts b/packages/protocol-kit/tests/e2e/erc-20.test.ts index 5bde9428b..fd55ac5c7 100644 --- a/packages/protocol-kit/tests/e2e/erc-20.test.ts +++ b/packages/protocol-kit/tests/e2e/erc-20.test.ts @@ -1,4 +1,5 @@ import Safe, { + SafeProvider, createERC20TokenTransferTransaction, getERC20Decimals, isGasTokenCompatibleWithHandlePayment @@ -22,7 +23,13 @@ chai.use(chaiAsPromised) const ERC20_TOKEN_ADDRESS = '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d' -describe('ERC-20 utils', () => { +describe.only('ERC-20 utils', () => { + let callStub: sinon.SinonStub + + afterEach(() => { + callStub.restore() + }) + const setupTests = deployments.createFixture(async ({ deployments, getChainId }) => { await deployments.fixture() const accounts = await getAccounts() @@ -49,7 +56,7 @@ describe('ERC-20 utils', () => { const provider = await getEip1193Provider(account1.signer) // mock decimals() call - sinon.stub(provider, 'call').returns(Promise.resolve('0x12')) + callStub = sinon.stub(SafeProvider.prototype, 'call').returns(Promise.resolve('0x12')) const safeSdk = await Safe.create({ provider, @@ -74,7 +81,7 @@ describe('ERC-20 utils', () => { const provider = await getEip1193Provider(account1.signer) // mock decimals() call - sinon.stub(provider, 'call').returns(Promise.resolve('0x06')) + callStub = sinon.stub(SafeProvider.prototype, 'call').returns(Promise.resolve('0x06')) const safeSdk = await Safe.create({ provider, @@ -99,7 +106,7 @@ describe('ERC-20 utils', () => { const provider = await getEip1193Provider(account1.signer) // mock decimals() call - sinon.stub(safeProvider, 'call').returns(Promise.resolve('0x')) + callStub = sinon.stub(SafeProvider.prototype, 'call').returns(Promise.resolve('0x')) const safeSdk = await Safe.create({ provider, @@ -126,7 +133,7 @@ describe('ERC-20 utils', () => { const provider = await getEip1193Provider(account1.signer) const safeSdk = await Safe.create({ - safeProvider, + provider, safeAddress, contractNetworks }) @@ -151,7 +158,7 @@ describe('ERC-20 utils', () => { const provider = await getEip1193Provider(account1.signer) // mock decimals() call - sinon.stub(provider, 'call').returns(Promise.resolve('0x12')) + callStub = sinon.stub(SafeProvider.prototype, 'call').returns(Promise.resolve('0x12')) const safeSdk = await Safe.create({ provider, @@ -179,7 +186,7 @@ describe('ERC-20 utils', () => { const provider = await getEip1193Provider(account1.signer) // mock decimals() call - sinon.stub(provider, 'call').returns(Promise.resolve('0x06')) + callStub = sinon.stub(SafeProvider.prototype, 'call').returns(Promise.resolve('0x06')) const safeSdk = await Safe.create({ provider, @@ -202,11 +209,7 @@ describe('ERC-20 utils', () => { const toAddress = '0xbc2BB26a6d821e69A38016f3858561a1D80d4182' const amount = '12345' - const transfer = await createERC20TokenTransferTransaction( - ERC20_TOKEN_ADDRESS, - toAddress, - amount - ) + const transfer = createERC20TokenTransferTransaction(ERC20_TOKEN_ADDRESS, toAddress, amount) chai.expect(transfer).to.be.deep.equal({ to: ERC20_TOKEN_ADDRESS, diff --git a/packages/protocol-kit/tests/e2e/ethAdapters.test.ts b/packages/protocol-kit/tests/e2e/ethAdapters.test.ts index e93d3f8fb..cd1e25a3c 100644 --- a/packages/protocol-kit/tests/e2e/ethAdapters.test.ts +++ b/packages/protocol-kit/tests/e2e/ethAdapters.test.ts @@ -103,9 +103,8 @@ describe('Safe contracts', () => { }) describe('getMultiSendContract', async () => { - it.only('should return a MultiSend contract from safe-deployments', async () => { - const { accounts } = await setupTests() - const safeProvider = getSafeProviderFromNetwork('mainnet', accounts[0].signer) + it('should return a MultiSend contract from safe-deployments', async () => { + const safeProvider = getSafeProviderFromNetwork('mainnet') const safeVersion: SafeVersion = '1.3.0' const chainId = 1n const singletonDeployment = getMultiSendContractDeployment(safeVersion, chainId) From 0ba231bd8243ffead4cd7498f574742b264106a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 15 Apr 2024 12:44:45 +0200 Subject: [PATCH 008/112] Initial commit --- packages/protocol-kit/tests/e2e/erc-20.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol-kit/tests/e2e/erc-20.test.ts b/packages/protocol-kit/tests/e2e/erc-20.test.ts index fd55ac5c7..f12e96c61 100644 --- a/packages/protocol-kit/tests/e2e/erc-20.test.ts +++ b/packages/protocol-kit/tests/e2e/erc-20.test.ts @@ -23,7 +23,7 @@ chai.use(chaiAsPromised) const ERC20_TOKEN_ADDRESS = '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d' -describe.only('ERC-20 utils', () => { +describe('ERC-20 utils', () => { let callStub: sinon.SinonStub afterEach(() => { From 66ac7e2feb68ff4caddc07669a8a81f3c2727ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 15 Apr 2024 16:14:05 +0200 Subject: [PATCH 009/112] Initial commit --- packages/protocol-kit/src/Safe.ts | 2 +- packages/protocol-kit/tests/e2e/core.test.ts | 32 +++++++++++++++---- .../e2e/eip1271-contract-signatures.test.ts | 18 +++++++++-- .../protocol-kit/tests/e2e/eip1271.test.ts | 4 +-- 4 files changed, 43 insertions(+), 13 deletions(-) diff --git a/packages/protocol-kit/src/Safe.ts b/packages/protocol-kit/src/Safe.ts index f5b279898..48bff6e1e 100644 --- a/packages/protocol-kit/src/Safe.ts +++ b/packages/protocol-kit/src/Safe.ts @@ -693,7 +693,7 @@ class Safe { const owners = await this.getOwners() const signerAddress = await this.#safeProvider.getSignerAddress() - console.log('signerAddress', signerAddress) + if (!signerAddress) { throw new Error('SafeProvider must be initialized with a signer to use this method') } diff --git a/packages/protocol-kit/tests/e2e/core.test.ts b/packages/protocol-kit/tests/e2e/core.test.ts index 831e87e64..86f0626bb 100644 --- a/packages/protocol-kit/tests/e2e/core.test.ts +++ b/packages/protocol-kit/tests/e2e/core.test.ts @@ -80,7 +80,7 @@ describe('Safe Info', () => { it('should connect a deployed Safe', async () => { const { safe, accounts, contractNetworks } = await setupTests() - const [account1, account2] = accounts + const [account1, account2, account3] = accounts const provider = await getEip1193Provider(account1.signer) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ @@ -104,13 +104,18 @@ describe('Safe Info', () => { .expect(await safeSdk2.getSafeProvider().getSignerAddress()) .to.be.eq(await account2.signer.getAddress()) - const safe2 = await getSafeWithOwners([accounts[2].address]) + const safe2 = await getSafeWithOwners([account3.address]) + const provider3 = await getEip1193Provider(account3.signer) const safe2Address = await safe2.getAddress() - const safeSdk3 = await safeSdk2.connect({ safeAddress: safe2Address }) + const safeSdk3 = await safeSdk2.connect({ + safeAddress: safe2Address, + provider: provider3, + signerAddress: account3.address + }) chai.expect(await safeSdk3.getAddress()).to.be.eq(safe2Address) chai .expect(await safeSdk3.getSafeProvider().getSignerAddress()) - .to.be.eq(await account2.signer.getAddress()) + .to.be.eq(await account3.signer.getAddress()) }) }) @@ -334,10 +339,16 @@ describe('Safe Info', () => { contractNetworks }) chai.expect(await safeSdk.getBalance()).to.be.eq(0n) - await account1.signer.sendTransaction({ + + const txResponse = await account1.signer.sendTransaction({ to: await safeSdk.getAddress(), value: BigInt(`${1e18}`) }) + await txResponse.wait(1) + + // TODO: Not working without this delay + await new Promise((resolve) => setTimeout(resolve, 500)) + chai.expect(await safeSdk.getBalance()).to.be.eq(BigInt(`${1e18}`)) } ) @@ -349,14 +360,21 @@ describe('Safe Info', () => { const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, + signerAddress: account1.address, safeAddress, contractNetworks }) chai.expect(await safeSdk.getBalance()).to.be.eq(0n) - await account1.signer.sendTransaction({ - to: await safeSdk.getAddress(), + + const txResponse = await account1.signer.sendTransaction({ + to: safeAddress, value: BigInt(`${1e18}`) }) + await txResponse.wait(1) + + // TODO: Not working without this delay + await new Promise((resolve) => setTimeout(resolve, 500)) + chai.expect(await safeSdk.getBalance()).to.be.eq(BigInt(`${1e18}`)) }) }) diff --git a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts index 0b5d1545f..911b40410 100644 --- a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts @@ -254,12 +254,16 @@ describe('The EIP1271 implementation', () => { // EOA signatures message = await protocolKit.signMessage(message) // Owner 1 signature - protocolKit = await protocolKit.connect({ provider: provider2 }) // Connect another owner + protocolKit = await protocolKit.connect({ + provider: provider2, + signerAddress: account2.address + }) // Connect another owner message = await protocolKit.signMessage(message) // Owner 2 signature // 1/1 Signer Safe signature protocolKit = await protocolKit.connect({ provider: provider3, + signerAddress: account3.address, safeAddress: signerSafeAddress1_1 }) let signerSafeMessage1_1 = protocolKit.createMessage(MESSAGE) @@ -277,6 +281,7 @@ describe('The EIP1271 implementation', () => { // 2/3 Signer Safe signature protocolKit = await protocolKit.connect({ provider: provider4, + signerAddress: account4.address, safeAddress: signerSafeAddress2_3 }) let signerSafeMessage2_3 = protocolKit.createMessage(MESSAGE) @@ -285,7 +290,10 @@ describe('The EIP1271 implementation', () => { SigningMethod.SAFE_SIGNATURE, safeAddress ) - protocolKit = await protocolKit.connect({ provider: provider5 }) + protocolKit = await protocolKit.connect({ + provider: provider5, + signerAddress: account5.address + }) signerSafeMessage2_3 = await protocolKit.signMessage( signerSafeMessage2_3, SigningMethod.SAFE_SIGNATURE, @@ -298,7 +306,11 @@ describe('The EIP1271 implementation', () => { message.addSignature(signerSafeSig2_3) // Connect the original Safe - protocolKit = await protocolKit.connect({ provider: provider1, safeAddress }) + protocolKit = await protocolKit.connect({ + provider: provider1, + signerAddress: account1.address, + safeAddress + }) chai.expect( await protocolKit.isValidSignature(hashSafeMessage(MESSAGE), message.encodedSignatures()) diff --git a/packages/protocol-kit/tests/e2e/eip1271.test.ts b/packages/protocol-kit/tests/e2e/eip1271.test.ts index 70eac47e5..d324689d5 100644 --- a/packages/protocol-kit/tests/e2e/eip1271.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271.test.ts @@ -110,14 +110,14 @@ describe('The EIP1271 implementation', () => { itif(safeVersionDeployed >= '1.3.0')( 'should validate on-chain messages (Approved hashes)', async () => { - const { contractNetworks, safeSdk1, safeSdk2, provider1 } = await setupTests() + const { contractNetworks, safeSdk1, safeSdk2 } = await setupTests() const chainId = await safeSdk1.getChainId() const safeVersion = await safeSdk1.getContractVersion() const customContract = contractNetworks[chainId.toString()] - const signMessageLibContract = await provider1.getSignMessageLibContract({ + const signMessageLibContract = await safeSdk1.getSafeProvider().getSignMessageLibContract({ safeVersion, customContractAddress: customContract.signMessageLibAddress, customContractAbi: customContract.signMessageLibAbi From 861330ba1440a1d57ebdf5c35d8a771b8f30f3ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 15 Apr 2024 17:24:02 +0200 Subject: [PATCH 010/112] Initial commit --- packages/protocol-kit/package.json | 6 +- .../scripts/generateTypechainFiles.ts | 2 - .../protocol-kit/src/adapters/web3/README.md | 27 - .../src/adapters/web3/Web3Adapter.ts | 343 ----- ...ompatibilityFallbackHandlerWeb3Contract.ts | 21 - ...ompatibilityFallbackHandler_V1_3_0_Web3.ts | 10 - ...ompatibilityFallbackHandler_V1_4_1_Web3.ts | 10 - .../CreateCall/CreateCallBaseContractWeb3.ts | 55 - .../v1.3.0/CreateCallContract_v1_3_0_Web3.ts | 131 -- .../v1.4.1/CreateCallContract_v1_4_1_Web3.ts | 131 -- .../MultiSend/MultiSendBaseContractWeb3.ts | 55 - .../MultiSendCallOnlyBaseContractWeb3.ts | 55 - .../v1.1.1/MultiSendContract_V1_1_1_Web3.ts | 65 - .../MultiSendCallOnlyContract_V1_3_0_Web3.ts | 66 - .../v1.3.0/MultiSendContract_V1_3_0_Web3.ts | 65 - .../MultiSendCallOnlyContract_V1_4_1_Web3.ts | 66 - .../v1.4.1/MultiSendContract_V1_4_1_Web3.ts | 65 - .../contracts/Safe/SafeBaseContractWeb3.ts | 67 - .../web3/contracts/Safe/SafeContractWeb3.ts | 184 --- .../Safe/v1.0.0/SafeContract_v1_0_0_Web3.ts | 356 ----- .../Safe/v1.1.1/SafeContract_v1_1_1_Web3.ts | 341 ----- .../Safe/v1.2.0/SafeContract_v1_2_0_Web3.ts | 336 ----- .../Safe/v1.3.0/SafeContract_v1_3_0_Web3.ts | 356 ----- .../Safe/v1.4.1/SafeContract_v1_4_1_Web3.ts | 356 ----- .../SafeProxyFactoryBaseContractWeb3.ts | 58 - .../SafeProxyFactoryContract_v1_0_0_Web3.ts | 166 --- .../SafeProxyFactoryContract_v1_1_1_Web3.ts | 178 --- .../SafeProxyFactoryContract_v1_3_0_Web3.ts | 178 --- .../SafeProxyFactoryContract_v1_4_1_Web3.ts | 184 --- .../SignMessageLibBaseContractWeb3.ts | 55 - .../SignMessageLibContract_V1_3_0_Web3.ts | 119 -- .../SignMessageLibContract_V1_4_1_Web3.ts | 119 -- .../SimulateTxAccessorBaseContractWeb3.ts | 55 - .../SimulateTxAccessorContract_v1_3_0_Web3.ts | 76 - .../SimulateTxAccessorContract_v1_4_1_Web3.ts | 76 - .../web3/contracts/contractInstancesWeb3.ts | 377 ----- .../protocol-kit/src/adapters/web3/index.ts | 21 - .../protocol-kit/src/adapters/web3/types.ts | 28 - .../src/adapters/web3/utils/constants.ts | 3 - .../src/adapters/web3/utils/index.ts | 20 - .../CreateCall/CreateCallBaseContract.ts | 30 +- .../AbiType/Safe/SafeBaseContract.ts | 8 +- .../SafeProxyFactoryBaseContract.ts | 5 +- .../SignMessageLibBaseContract.ts | 17 +- packages/protocol-kit/src/index.ts | 22 - yarn.lock | 1289 +---------------- 46 files changed, 46 insertions(+), 6207 deletions(-) delete mode 100644 packages/protocol-kit/src/adapters/web3/README.md delete mode 100644 packages/protocol-kit/src/adapters/web3/Web3Adapter.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerWeb3Contract.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandler_V1_3_0_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandler_V1_4_1_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/CreateCall/CreateCallBaseContractWeb3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/MultiSend/MultiSendBaseContractWeb3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/MultiSend/MultiSendCallOnlyBaseContractWeb3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.1.1/MultiSendContract_V1_1_1_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_V1_3_0_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.3.0/MultiSendContract_V1_3_0_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/Safe/SafeBaseContractWeb3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/Safe/SafeContractWeb3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractWeb3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/SignMessageLibBaseContractWeb3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_V1_3_0_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractWeb3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/contractInstancesWeb3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/index.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/types.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/utils/constants.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/utils/index.ts diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index 58e751d4b..140fe76c5 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -60,7 +60,6 @@ "@safe-global/safe-contracts-v1.4.1": "npm:@safe-global/safe-contracts@1.4.1", "@safe-global/safe-core-sdk-types": "^4.0.1", "@typechain/ethers-v6": "^0.5.0", - "@typechain/web3-v1": "^6.0.7", "@types/chai": "^4.3.11", "@types/chai-as-promised": "^7.1.8", "@types/mocha": "^10.0.6", @@ -85,9 +84,6 @@ "@safe-global/safe-deployments": "^1.33.0", "ethereumjs-util": "^7.1.5", "ethers": "^6.7.1", - "semver": "^7.5.4", - "web3": "^1.10.3", - "web3-core": "^1.10.3", - "web3-utils": "^1.10.3" + "semver": "^7.5.4" } } diff --git a/packages/protocol-kit/scripts/generateTypechainFiles.ts b/packages/protocol-kit/scripts/generateTypechainFiles.ts index 3913e3e00..9b7c6245c 100644 --- a/packages/protocol-kit/scripts/generateTypechainFiles.ts +++ b/packages/protocol-kit/scripts/generateTypechainFiles.ts @@ -113,6 +113,4 @@ function generateTypes(typechainTarget: string) { testContracts_V1_2_0 ) } - -generateTypes('web3-v1') generateTypes('ethers-v6') diff --git a/packages/protocol-kit/src/adapters/web3/README.md b/packages/protocol-kit/src/adapters/web3/README.md deleted file mode 100644 index 71ab2cf35..000000000 --- a/packages/protocol-kit/src/adapters/web3/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# Web3 Adapter - -Web3.js wrapper that contains some utilities and the Safe contracts types (generated with `typechain` `web3-v1`). It is used to initialize the [Protocol Kit](https://github.com/safe-global/safe-core-sdk/tree/main/packages/protocol-kit). - -## How to use - -If the app integrating the SDK is using `Web3`, create an instance of the `Web3Adapter`, where `signerAddress` is the Ethereum account we are connecting and the one who will sign the transactions. - -```js -import Web3 from 'web3' -import { Web3Adapter } from '@safe-global/protocol-kit' - -const provider = new Web3.providers.HttpProvider('http://localhost:8545') -const web3 = new Web3(provider) -const safeOwner = '0x
' - -const ethAdapter = new Web3Adapter({ - web3, - signerAddress: safeOwner -}) -``` - -In case the `ethAdapter` instance is only used to execute read-only methods the `signerAddress` property can be omitted. - -```js -const readOnlyEthAdapter = new Web3Adapter({ web3 }) -``` diff --git a/packages/protocol-kit/src/adapters/web3/Web3Adapter.ts b/packages/protocol-kit/src/adapters/web3/Web3Adapter.ts deleted file mode 100644 index 07a3cf8f5..000000000 --- a/packages/protocol-kit/src/adapters/web3/Web3Adapter.ts +++ /dev/null @@ -1,343 +0,0 @@ -import { generateTypedData, validateEip3770Address } from '@safe-global/protocol-kit/utils' -import { SigningMethod } from '@safe-global/protocol-kit/types' -import { - CreateCallContract, - Eip3770Address, - ISafeProvider, - SafeProviderTransaction, - GetContractProps, - SafeEIP712Args, - SignMessageLibContract, - SimulateTxAccessorContract -} from '@safe-global/safe-core-sdk-types' -import Web3 from 'web3' -import { Transaction } from 'web3-core' -import { ContractOptions } from 'web3-eth-contract' -import { AbiItem } from 'web3-utils' -// TODO remove @types/web3 when migrating to web3@v4 -// Deprecated https://www.npmjs.com/package/@types/web3?activeTab=readme -// Migration guide https://docs.web3js.org/docs/guides/web3_migration_guide#types -import type { JsonRPCResponse, Provider } from 'web3/providers' -import CompatibilityFallbackHandlerWeb3Contract from './contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerWeb3Contract' -import SafeContractWeb3 from './contracts/Safe/SafeContractWeb3' -import { - getCompatibilityFallbackHandlerContractInstance, - getCreateCallContractInstance, - getMultiSendCallOnlyContractInstance, - getMultiSendContractInstance, - getSafeContractInstance, - getSafeProxyFactoryContractInstance, - getSignMessageLibContractInstance, - getSimulateTxAccessorContractInstance -} from './contracts/contractInstancesWeb3' -import MultiSendContract_v1_1_1_Web3 from './contracts/MultiSend/v1.1.1/MultiSendContract_V1_1_1_Web3' -import MultiSendContract_v1_3_0_Web3 from './contracts/MultiSend/v1.3.0/MultiSendContract_V1_3_0_Web3' -import MultiSendContract_v1_4_1_Web3 from './contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Web3' -import MultiSendCallOnlyContract_v1_3_0_Web3 from './contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_V1_3_0_Web3' -import MultiSendCallOnlyContract_v1_4_1_Web3 from './contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Web3' - -export interface Web3AdapterConfig { - /** web3 - Web3 library */ - web3: Web3 - /** signerAddress - Address of the signer */ - signerAddress?: string -} - -class Web3Adapter implements ISafeProvider { - #web3: Web3 - #signerAddress?: string - - constructor({ web3, signerAddress }: Web3AdapterConfig) { - if (!web3) { - throw new Error('web3 property missing from options') - } - this.#web3 = web3 - this.#signerAddress = signerAddress - } - - isAddress(address: string): boolean { - return this.#web3.utils.isAddress(address) - } - - async getEip3770Address(fullAddress: string): Promise { - const chainId = await this.getChainId() - return validateEip3770Address(fullAddress, chainId) - } - - async getBalance(address: string, defaultBlock?: string | number): Promise { - const balance = defaultBlock - ? await this.#web3.eth.getBalance(address, defaultBlock) - : await this.#web3.eth.getBalance(address) - return BigInt(balance) - } - - async getNonce(address: string, defaultBlock?: string | number): Promise { - const nonce = defaultBlock - ? await this.#web3.eth.getTransactionCount(address, defaultBlock) - : await this.#web3.eth.getTransactionCount(address) - return nonce - } - - async getChainId(): Promise { - return BigInt(await this.#web3.eth.getChainId()) - } - - getChecksummedAddress(address: string): string { - return this.#web3.utils.toChecksumAddress(address) - } - - async getSafeContract({ - safeVersion, - singletonDeployment, - customContractAddress, - customContractAbi, - isL1SafeSingleton - }: GetContractProps): Promise { - const chainId = await this.getChainId() - const contractAddress = - customContractAddress ?? singletonDeployment?.networkAddresses[chainId.toString()] - if (!contractAddress) { - throw new Error('Invalid SafeProxy contract address') - } - - return getSafeContractInstance( - safeVersion, - contractAddress, - this, - customContractAbi, - isL1SafeSingleton - ) - } - - async getSafeProxyFactoryContract({ - safeVersion, - singletonDeployment, - customContractAddress, - customContractAbi - }: GetContractProps) { - const chainId = await this.getChainId() - const contractAddress = - customContractAddress ?? singletonDeployment?.networkAddresses[chainId.toString()] - if (!contractAddress) { - throw new Error('Invalid SafeProxyFactory contract address') - } - return getSafeProxyFactoryContractInstance( - safeVersion, - contractAddress, - this, - customContractAbi - ) - } - - async getMultiSendContract({ - safeVersion, - singletonDeployment, - customContractAddress, - customContractAbi - }: GetContractProps): Promise< - MultiSendContract_v1_4_1_Web3 | MultiSendContract_v1_3_0_Web3 | MultiSendContract_v1_1_1_Web3 - > { - const chainId = await this.getChainId() - const contractAddress = - customContractAddress ?? singletonDeployment?.networkAddresses[chainId.toString()] - if (!contractAddress) { - throw new Error('Invalid MultiSend contract address') - } - return getMultiSendContractInstance(safeVersion, contractAddress, this, customContractAbi) - } - - async getMultiSendCallOnlyContract({ - safeVersion, - singletonDeployment, - customContractAddress, - customContractAbi - }: GetContractProps): Promise< - MultiSendCallOnlyContract_v1_4_1_Web3 | MultiSendCallOnlyContract_v1_3_0_Web3 - > { - const chainId = await this.getChainId() - const contractAddress = - customContractAddress ?? singletonDeployment?.networkAddresses[chainId.toString()] - if (!contractAddress) { - throw new Error('Invalid MultiSendCallOnly contract address') - } - return getMultiSendCallOnlyContractInstance( - safeVersion, - contractAddress, - this, - customContractAbi - ) - } - - async getCompatibilityFallbackHandlerContract({ - safeVersion, - singletonDeployment, - customContractAddress, - customContractAbi - }: GetContractProps): Promise { - const chainId = await this.getChainId() - const contractAddress = - customContractAddress ?? singletonDeployment?.networkAddresses[chainId.toString()] - if (!contractAddress) { - throw new Error('Invalid Compatibility Fallback Handler contract address') - } - const multiSendContract = this.getContract( - contractAddress, - customContractAbi ?? (singletonDeployment?.abi as AbiItem[]) - ) - return getCompatibilityFallbackHandlerContractInstance(safeVersion, multiSendContract) - } - - async getSignMessageLibContract({ - safeVersion, - singletonDeployment, - customContractAddress, - customContractAbi - }: GetContractProps): Promise { - const chainId = await this.getChainId() - const contractAddress = - customContractAddress ?? singletonDeployment?.networkAddresses[chainId.toString()] - if (!contractAddress) { - throw new Error('Invalid SignMessageLib contract address') - } - - return getSignMessageLibContractInstance(safeVersion, contractAddress, this, customContractAbi) - } - - async getCreateCallContract({ - safeVersion, - singletonDeployment, - customContractAddress, - customContractAbi - }: GetContractProps): Promise { - const chainId = await this.getChainId() - const contractAddress = - customContractAddress ?? singletonDeployment?.networkAddresses[chainId.toString()] - if (!contractAddress) { - throw new Error('Invalid CreateCall contract address') - } - return getCreateCallContractInstance(safeVersion, contractAddress, this, customContractAbi) - } - - async getSimulateTxAccessorContract({ - safeVersion, - singletonDeployment, - customContractAddress, - customContractAbi - }: GetContractProps): Promise { - const chainId = await this.getChainId() - const contractAddress = - customContractAddress ?? singletonDeployment?.networkAddresses[chainId.toString()] - if (!contractAddress) { - throw new Error('Invalid SimulateTxAccessor contract address') - } - return getSimulateTxAccessorContractInstance( - safeVersion, - contractAddress, - this, - customContractAbi - ) - } - - getContract(address: string, abi: AbiItem | AbiItem[], options?: ContractOptions): any { - return new this.#web3.eth.Contract(abi, address, options) - } - - async getContractCode(address: string, defaultBlock?: string | number): Promise { - const code = defaultBlock - ? await this.#web3.eth.getCode(address, defaultBlock) - : await this.#web3.eth.getCode(address) - return code - } - - async isContractDeployed(address: string, defaultBlock?: string | number): Promise { - const contractCode = await this.getContractCode(address, defaultBlock) - return contractCode !== '0x' - } - - async getStorageAt(address: string, position: string): Promise { - const content = await this.#web3.eth.getStorageAt(address, position) - const decodedContent = this.decodeParameters(['address'], content) - return decodedContent[0] - } - - async getTransaction(transactionHash: string): Promise { - return this.#web3.eth.getTransaction(transactionHash) - } - - async getSignerAddress(): Promise { - return this.#signerAddress - } - - signMessage(message: string): Promise { - if (!this.#signerAddress) { - throw new Error('SafeProvider must be initialized with a signer to use this method') - } - return this.#web3.eth.sign(message, this.#signerAddress) - } - - async signTypedData( - safeEIP712Args: SafeEIP712Args, - methodVersion?: 'v3' | 'v4' - ): Promise { - if (!this.#signerAddress) { - throw new Error('This method requires a signer') - } - const typedData = generateTypedData(safeEIP712Args) - let method = SigningMethod.ETH_SIGN_TYPED_DATA_V3 - if (methodVersion === 'v4') { - method = SigningMethod.ETH_SIGN_TYPED_DATA_V4 - } else if (!methodVersion) { - method = SigningMethod.ETH_SIGN_TYPED_DATA - } - const jsonTypedData = JSON.stringify(typedData) - const signedTypedData = { - jsonrpc: '2.0', - method, - params: - methodVersion === 'v3' || methodVersion === 'v4' - ? [this.#signerAddress, jsonTypedData] - : [jsonTypedData, this.#signerAddress], - from: this.#signerAddress, - id: new Date().getTime() - } - return new Promise((resolve, reject) => { - const provider = this.#web3.currentProvider as Provider - function callback(err: Error): void - function callback(err: null, val: JsonRPCResponse): void - function callback(err: null | Error, val?: JsonRPCResponse): void { - if (err) { - reject(err) - return - } - - if (val?.result == null) { - reject(new Error("EIP-712 is not supported by user's wallet")) - return - } - resolve(val.result) - } - provider.send(signedTypedData, callback) - }) - } - - async estimateGas( - transaction: SafeProviderTransaction, - callback?: (error: Error, gas: number) => void - ): Promise { - return (await this.#web3.eth.estimateGas(transaction, callback)).toString() - } - - call(transaction: SafeProviderTransaction, defaultBlock?: string | number): Promise { - return this.#web3.eth.call(transaction, defaultBlock) - } - - encodeParameters(types: string[], values: any[]): string { - return this.#web3.eth.abi.encodeParameters(types, values) - } - - decodeParameters(types: any[], values: string): { [key: string]: any } { - return this.#web3.eth.abi.decodeParameters(types, values) - } -} - -export default Web3Adapter diff --git a/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerWeb3Contract.ts b/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerWeb3Contract.ts deleted file mode 100644 index 8daaab819..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerWeb3Contract.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Compatibility_fallback_handler as CompatibilityFallbackHandler_V1_3_0 } from '@safe-global/protocol-kit/typechain/src/web3-v1/v1.3.0/Compatibility_fallback_handler' -import { Compatibility_fallback_handler as CompatibilityFallbackHandler_V1_4_1 } from '@safe-global/protocol-kit/typechain/src/web3-v1/v1.4.1/Compatibility_fallback_handler' -import { CompatibilityFallbackHandlerContract } from '@safe-global/safe-core-sdk-types' - -abstract class CompatibilityFallbackHandlerWeb3Contract - implements CompatibilityFallbackHandlerContract -{ - constructor( - public contract: CompatibilityFallbackHandler_V1_4_1 | CompatibilityFallbackHandler_V1_3_0 - ) {} - - getAddress(): Promise { - return Promise.resolve(this.contract.options.address) - } - - encode(methodName: string, params: any[]): string { - return (this.contract as any).methods[methodName](...params).encodeABI() - } -} - -export default CompatibilityFallbackHandlerWeb3Contract diff --git a/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandler_V1_3_0_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandler_V1_3_0_Web3.ts deleted file mode 100644 index 3d179d43a..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandler_V1_3_0_Web3.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Compatibility_fallback_handler as CompatibilityFallbackHandler } from '@safe-global/protocol-kit/typechain/src/web3-v1/v1.3.0/Compatibility_fallback_handler' -import CompatibilityFallbackHandlerWeb3Contract from '../CompatibilityFallbackHandlerWeb3Contract' - -class CompatibilityFallbackHandler_V1_3_0_Web3 extends CompatibilityFallbackHandlerWeb3Contract { - constructor(public contract: CompatibilityFallbackHandler) { - super(contract) - } -} - -export default CompatibilityFallbackHandler_V1_3_0_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandler_V1_4_1_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandler_V1_4_1_Web3.ts deleted file mode 100644 index 0670913ab..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandler_V1_4_1_Web3.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Compatibility_fallback_handler as CompatibilityFallbackHandler } from '@safe-global/protocol-kit/typechain/src/web3-v1/v1.4.1/Compatibility_fallback_handler' -import CompatibilityFallbackHandlerWeb3Contract from '../CompatibilityFallbackHandlerWeb3Contract' - -class CompatibilityFallbackHandler_V1_4_1_Web3 extends CompatibilityFallbackHandlerWeb3Contract { - constructor(public contract: CompatibilityFallbackHandler) { - super(contract) - } -} - -export default CompatibilityFallbackHandler_V1_4_1_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/CreateCall/CreateCallBaseContractWeb3.ts b/packages/protocol-kit/src/adapters/web3/contracts/CreateCall/CreateCallBaseContractWeb3.ts deleted file mode 100644 index cf7b0e0dc..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/CreateCall/CreateCallBaseContractWeb3.ts +++ /dev/null @@ -1,55 +0,0 @@ -import Contract from 'web3-eth-contract' -import { AbiItem } from 'web3-utils' - -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import CreateCallBaseContract from '@safe-global/protocol-kit/adapters/CreateCallBaseContract' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' - -/** - * Abstract class CreateCallBaseContractWeb3 extends CreateCallBaseContract to specifically integrate with the Web3.js v6 library. - * It is designed to be instantiated for different versions of the Safe contract. - * - * This abstract class sets up the Web3 v6 Contract object that interacts with a CreateCall contract version. - * - * Subclasses of CreateCallBaseContractWeb3 are expected to represent specific versions of the contract. - * - * @template CreateCallContractAbiType - The ABI type specific to the version of the CreateCall contract, extending InterfaceAbi from Web3. - * @extends CreateCallBaseContract - Extends the generic CreateCallBaseContract with Web3-specific implementation. - * - * Example subclasses: - * - CreateCallContract_v1_4_1_Web3 extends CreateCallBaseContractWeb3 - * - CreateCallContract_v1_3_0_Web3 extends CreateCallBaseContractWeb3 - */ -abstract class CreateCallBaseContractWeb3< - CreateCallContractAbiType extends AbiItem[] -> extends CreateCallBaseContract { - contract: Contract - adapter: Web3Adapter - - /** - * @constructor - * Constructs an instance of CreateCallBaseContractWeb3. - * - * @param chainId - The chain ID of the contract. - * @param web3Adapter - An instance of Web3Adapter. - * @param defaultAbi - The default ABI for the CreateCall contract. It should be compatible with the specific version of the contract. - * @param safeVersion - The version of the Safe contract. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the ABI is derived from the Safe deployments or the defaultAbi is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - defaultAbi: CreateCallContractAbiType, - safeVersion: SafeVersion, - customContractAddress?: string, - customContractAbi?: CreateCallContractAbiType - ) { - super(chainId, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.adapter = web3Adapter - this.contract = web3Adapter.getContract(this.contractAddress, this.contractAbi) - } -} - -export default CreateCallBaseContractWeb3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Web3.ts deleted file mode 100644 index 3d3442b6b..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Web3.ts +++ /dev/null @@ -1,131 +0,0 @@ -import CreateCallBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/CreateCall/CreateCallBaseContractWeb3' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { - DeepWriteable, - Web3TransactionOptions, - Web3TransactionResult -} from '@safe-global/protocol-kit/adapters/web3/types' -import CreateCallContract_v1_3_0_Contract, { - CreateCallContract_v1_3_0_Abi -} from '@safe-global/protocol-kit/contracts/AbiType/CreateCall/v1.3.0/CreateCallContract_v1_3_0' -import CreateCall_1_3_0_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/CreateCall/v1.3.0/create_call' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import { - EncodeCreateCallFunction, - EstimateGasCreateCallFunction, - GetAddressCreateCallFunction -} from '@safe-global/protocol-kit/contracts/AbiType/CreateCall/CreateCallBaseContract' -import { toTxResult } from '@safe-global/protocol-kit/adapters/web3/utils' - -/** - * CreateCallContract_V1_3_0_Web3 is the implementation specific to the CreateCall contract version 1.3.0. - * - * This class specializes in handling interactions with the CreateCall contract version 1.3.0 using Web3.js. - * - * @extends CreateCallBaseContractWeb3 - Inherits from CreateCallBaseContractWeb3 with ABI specific to CreateCall contract version 1.3.0. - * @implements CreateCallContract_v1_3_0_Contract - Implements the interface specific to CreateCall contract version 1.3.0. - */ -class CreateCallContract_V1_3_0_Web3 - extends CreateCallBaseContractWeb3> - implements CreateCallContract_v1_3_0_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of CreateCallContract_V1_3_0_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the CreateCall deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: CreateCallContract_v1_3_0_Abi - ) { - const safeVersion = '1.3.0' - const defaultAbi = - CreateCall_1_3_0_ContractArtifacts.abi as DeepWriteable - - super( - chainId, - web3Adapter, - defaultAbi, - safeVersion, - customContractAddress, - customContractAbi as DeepWriteable - ) - - this.safeVersion = safeVersion - } - - getAddress: GetAddressCreateCallFunction = () => { - return Promise.resolve(this.contract.options.address) - } - - encode: EncodeCreateCallFunction = (functionToEncode, args) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } - - estimateGas: EstimateGasCreateCallFunction< - CreateCallContract_v1_3_0_Abi, - Web3TransactionOptions - > = async (functionToEstimate, args, options = {}) => { - return ( - await this.contract.methods[functionToEstimate](...args).estimateGas(options) - ).toString() - } - - async performCreate( - args: readonly [value: bigint, deploymentData: string], - options?: Web3TransactionOptions - ): Promise { - if (options && !options.gas) { - options.gas = (await this.estimateGas('performCreate', args, { ...options })).toString() - } - const txResponse = this.contract.methods.performCreate(...args).send(options) - return toTxResult(txResponse, options) - } - - async performCreate2( - args: readonly [value: bigint, deploymentData: string, salt: string], - options?: Web3TransactionOptions - ): Promise { - if (options && !options.gas) { - options.gas = (await this.estimateGas('performCreate2', args, { ...options })).toString() - } - const txResponse = this.contract.methods.performCreate2(...args).send(options) - return toTxResult(txResponse, options) - } - - // TODO: Remove this mapper after remove Typechain - mapToTypechainContract(): any { - return { - contract: this.contract, - - getAddress: this.getAddress.bind(this), - - encode: this.encode.bind(this), - - estimateGas: async (...args: Parameters) => - (await this.estimateGas(...args)).toString(), - - performCreate: async ( - value: string, - deploymentData: string, - options?: Web3TransactionOptions - ) => this.performCreate([BigInt(value), deploymentData], options), - - performCreate2: async ( - value: string, - deploymentData: string, - salt: string, - options?: Web3TransactionOptions - ) => this.performCreate2([BigInt(value), deploymentData, salt], options) - } - } -} - -export default CreateCallContract_V1_3_0_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Web3.ts deleted file mode 100644 index ce962ad63..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Web3.ts +++ /dev/null @@ -1,131 +0,0 @@ -import CreateCallBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/CreateCall/CreateCallBaseContractWeb3' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { - DeepWriteable, - Web3TransactionOptions, - Web3TransactionResult -} from '@safe-global/protocol-kit/adapters/web3/types' -import CreateCallContract_v1_4_1_Contract, { - CreateCallContract_v1_4_1_Abi -} from '@safe-global/protocol-kit/contracts/AbiType/CreateCall/v1.4.1/CreateCallContract_v1_4_1' -import CreateCall_1_4_1_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/CreateCall/v1.4.1/create_call' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import { - EncodeCreateCallFunction, - EstimateGasCreateCallFunction, - GetAddressCreateCallFunction -} from '@safe-global/protocol-kit/contracts/AbiType/CreateCall/CreateCallBaseContract' -import { toTxResult } from '@safe-global/protocol-kit/adapters/web3/utils' - -/** - * CreateCallContract_V1_4_1_Web3 is the implementation specific to the CreateCall contract version 1.4.1. - * - * This class specializes in handling interactions with the CreateCall contract version 1.4.1 using Web3.js. - * - * @extends CreateCallBaseContractWeb3 - Inherits from CreateCallBaseContractWeb3 with ABI specific to CreateCall contract version 1.4.1. - * @implements CreateCallContract_v1_4_1_Contract - Implements the interface specific to CreateCall contract version 1.4.1. - */ -class CreateCallContract_V1_4_1_Web3 - extends CreateCallBaseContractWeb3> - implements CreateCallContract_v1_4_1_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of CreateCallContract_V1_4_1_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the CreateCall deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: CreateCallContract_v1_4_1_Abi - ) { - const safeVersion = '1.4.1' - const defaultAbi = - CreateCall_1_4_1_ContractArtifacts.abi as DeepWriteable - - super( - chainId, - web3Adapter, - defaultAbi, - safeVersion, - customContractAddress, - customContractAbi as DeepWriteable - ) - - this.safeVersion = safeVersion - } - - getAddress: GetAddressCreateCallFunction = () => { - return Promise.resolve(this.contract.options.address) - } - - encode: EncodeCreateCallFunction = (functionToEncode, args) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } - - estimateGas: EstimateGasCreateCallFunction< - CreateCallContract_v1_4_1_Abi, - Web3TransactionOptions - > = async (functionToEstimate, args, options = {}) => { - return ( - await this.contract.methods[functionToEstimate](...args).estimateGas(options) - ).toString() - } - - async performCreate( - args: readonly [value: bigint, deploymentData: string], - options?: Web3TransactionOptions - ): Promise { - if (options && !options.gas) { - options.gas = (await this.estimateGas('performCreate', args, { ...options })).toString() - } - const txResponse = this.contract.methods.performCreate(...args).send(options) - return toTxResult(txResponse, options) - } - - async performCreate2( - args: readonly [value: bigint, deploymentData: string, salt: string], - options?: Web3TransactionOptions - ): Promise { - if (options && !options.gas) { - options.gas = (await this.estimateGas('performCreate2', args, { ...options })).toString() - } - const txResponse = this.contract.methods.performCreate2(...args).send(options) - return toTxResult(txResponse, options) - } - - // TODO: Remove this mapper after remove Typechain - mapToTypechainContract(): any { - return { - contract: this.contract, - - getAddress: this.getAddress.bind(this), - - encode: this.encode.bind(this), - - estimateGas: async (...args: Parameters) => - (await this.estimateGas(...args)).toString(), - - performCreate: async ( - value: string, - deploymentData: string, - options?: Web3TransactionOptions - ) => this.performCreate([BigInt(value), deploymentData], options), - - performCreate2: async ( - value: string, - deploymentData: string, - salt: string, - options?: Web3TransactionOptions - ) => this.performCreate2([BigInt(value), deploymentData, salt], options) - } - } -} - -export default CreateCallContract_V1_4_1_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/MultiSendBaseContractWeb3.ts b/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/MultiSendBaseContractWeb3.ts deleted file mode 100644 index 2ec4bf6aa..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/MultiSendBaseContractWeb3.ts +++ /dev/null @@ -1,55 +0,0 @@ -import Contract from 'web3-eth-contract' -import { AbiItem } from 'web3-utils' - -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import MultiSendBaseContract from '@safe-global/protocol-kit/adapters/MultiSendBaseContract' - -/** - * Abstract class MultiSendBaseContractWeb3 extends MultiSendBaseContract to specifically integrate with the Web3.js v6 library. - * It is designed to be instantiated for different versions of the MultiSend contract. - * - * This abstract class sets up the Web3 v6 Contract object that interacts with a MultiSend contract version. - * - * Subclasses of MultiSendBaseContractWeb3 are expected to represent specific versions of the MultiSend contract. - * - * @template MultiSendContractAbiType - The ABI type specific to the version of the MultiSend contract, extending InterfaceAbi from Web3. - * @extends MultiSendBaseContract - Extends the generic MultiSendBaseContract with Web3-specific implementation. - * - * Example subclasses: - * - MultiSendContract_v1_4_1_Web3 extends MultiSendBaseContractWeb3 - * - MultiSendContract_v1_3_0_Web3 extends MultiSendBaseContractWeb3 - */ -abstract class MultiSendBaseContractWeb3< - MultiSendContractAbiType extends AbiItem[] -> extends MultiSendBaseContract { - contract: Contract - adapter: Web3Adapter - - /** - * @constructor - * Constructs an instance of MultiSendBaseContractWeb3. - * - * @param chainId - The chain ID of the contract. - * @param web3Adapter - An instance of Web3Adapter. - * @param defaultAbi - The default ABI for the MultiSend contract. It should be compatible with the specific version of the MultiSend contract. - * @param safeVersion - The version of the MultiSend contract. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSend deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the ABI is derived from the MultiSend deployments or the defaultAbi is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - defaultAbi: MultiSendContractAbiType, - safeVersion: SafeVersion, - customContractAddress?: string, - customContractAbi?: MultiSendContractAbiType - ) { - super(chainId, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.adapter = web3Adapter - this.contract = web3Adapter.getContract(this.contractAddress, this.contractAbi) - } -} - -export default MultiSendBaseContractWeb3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/MultiSendCallOnlyBaseContractWeb3.ts b/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/MultiSendCallOnlyBaseContractWeb3.ts deleted file mode 100644 index f776cf0ad..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/MultiSendCallOnlyBaseContractWeb3.ts +++ /dev/null @@ -1,55 +0,0 @@ -import Contract from 'web3-eth-contract' -import { AbiItem } from 'web3-utils' - -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import MultiSendCallOnlyBaseContract from '@safe-global/protocol-kit/adapters/MultiSendCallOnlyBaseContract' - -/** - * Abstract class MultiSendBaseContractWeb3 extends MultiSendCallOnlyBaseContract to specifically integrate with the Web3.js v6 library. - * It is designed to be instantiated for different versions of the MultiSendCallOnly contract. - * - * This abstract class sets up the Web3 v6 Contract object that interacts with a MultiSendCallOnly contract version. - * - * Subclasses of MultiSendCallOnlyBaseContractWeb3 are expected to represent specific versions of the MultiSendCallOnly contract. - * - * @template MultiSendCallOnlyContractAbiType - The ABI type specific to the version of the MultiSendCallOnly contract, extending InterfaceAbi from Web3. - * @extends MultiSendCallOnlyBaseContract - Extends the generic MultiSendCallOnlyBaseContract with Web3-specific implementation. - * - * Example subclasses: - * - MultiSendCallOnlyContract_v1_4_1_Web3 extends MultiSendCallOnlyBaseContractWeb3 - * - MultiSendCallOnlyContract_v1_3_0_Web3 extends MultiSendCallOnlyBaseContractWeb3 - */ -abstract class MultiSendCallOnlyBaseContractWeb3< - MultiSendCallOnlyContractAbiType extends AbiItem[] -> extends MultiSendCallOnlyBaseContract { - contract: Contract - adapter: Web3Adapter - - /** - * @constructor - * Constructs an instance of MultiSendCallOnlyBaseContractWeb3. - * - * @param chainId - The chain ID of the contract. - * @param web3Adapter - An instance of Web3Adapter. - * @param defaultAbi - The default ABI for the MultiSendCallOnly contract. It should be compatible with the specific version of the MultiSendCallOnly contract. - * @param safeVersion - The version of the MultiSendCallOnly contract. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSendCallOnly deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the ABI is derived from the MultiSendCallOnly deployments or the defaultAbi is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - defaultAbi: MultiSendCallOnlyContractAbiType, - safeVersion: SafeVersion, - customContractAddress?: string, - customContractAbi?: MultiSendCallOnlyContractAbiType - ) { - super(chainId, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.adapter = web3Adapter - this.contract = web3Adapter.getContract(this.contractAddress, this.contractAbi) - } -} - -export default MultiSendCallOnlyBaseContractWeb3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.1.1/MultiSendContract_V1_1_1_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.1.1/MultiSendContract_V1_1_1_Web3.ts deleted file mode 100644 index 7343a588e..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.1.1/MultiSendContract_V1_1_1_Web3.ts +++ /dev/null @@ -1,65 +0,0 @@ -import MultiSendBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/MultiSend/MultiSendBaseContractWeb3' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { DeepWriteable } from '@safe-global/protocol-kit/adapters/web3/types' -import MultiSendContract_v1_1_1_Contract, { - MultiSendContract_v1_1_1_Abi as MultiSendContract_v1_1_1_Abi_Readonly -} from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/v1.1.1/MultiSendContract_v1_1_1' -import multiSend_1_1_1_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/MultiSend/v1.1.1/multi_send' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import { - EncodeMultiSendFunction, - GetAddressMultiSendFunction -} from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/MultiSendBaseContract' - -// Remove all nested `readonly` modifiers from the ABI type -type MultiSendContract_v1_1_1_Abi = DeepWriteable - -/** - * MultiSendContract_v1_1_1_Web3 is the implementation specific to the MultiSend contract version 1.1.1. - * - * This class specializes in handling interactions with the MultiSend contract version 1.1.1 using Web3.js v6. - * - * @extends MultiSendBaseContractWeb3 - Inherits from MultiSendBaseContractWeb3 with ABI specific to MultiSend contract version 1.1.1. - * @implements MultiSendContract_v1_1_1_Contract - Implements the interface specific to MultiSend contract version 1.1.1. - */ -class MultiSendContract_v1_1_1_Web3 - extends MultiSendBaseContractWeb3 - implements MultiSendContract_v1_1_1_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of MultiSendContract_v1_1_1_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSend deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.1.1 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: MultiSendContract_v1_1_1_Abi - ) { - const safeVersion = '1.1.1' - const defaultAbi = multiSend_1_1_1_ContractArtifacts.abi as MultiSendContract_v1_1_1_Abi - - super(chainId, web3Adapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.safeVersion = safeVersion - } - - getAddress: GetAddressMultiSendFunction = () => { - return Promise.resolve(this.contract.options.address) - } - - encode: EncodeMultiSendFunction = ( - functionToEncode, - args - ) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } -} - -export default MultiSendContract_v1_1_1_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_V1_3_0_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_V1_3_0_Web3.ts deleted file mode 100644 index 5e2718251..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_V1_3_0_Web3.ts +++ /dev/null @@ -1,66 +0,0 @@ -import MultiSendCallOnlyBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/MultiSend/MultiSendCallOnlyBaseContractWeb3' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { DeepWriteable } from '@safe-global/protocol-kit/adapters/web3/types' -import MultiSendCallOnlyContract_v1_3_0_Contract, { - MultiSendCallOnlyContract_v1_3_0_Abi as MultiSendCallOnlyContract_v1_3_0_Abi_Readonly -} from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0' -import multiSend_1_3_0_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/MultiSend/v1.3.0/multi_send_call_only' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import { - EncodeMultiSendCallOnlyFunction, - GetAddressMultiSendCallOnlyFunction -} from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/MultiSendCallOnlyBaseContract' - -// Remove all nested `readonly` modifiers from the ABI type -type MultiSendCallOnlyContract_v1_3_0_Abi = - DeepWriteable - -/** - * MultiSendCallOnlyContract_v1_3_0_Web3 is the implementation specific to the MultiSendCallOnly contract version 1.3.0. - * - * This class specializes in handling interactions with the MultiSendCallOnly contract version 1.3.0 using Web3.js v6. - * - * @extends MultiSendCallOnlyBaseContractWeb3 - Inherits from MultiSendCallOnlyBaseContractWeb3 with ABI specific to MultiSendCallOnly contract version 1.3.0. - * @implements MultiSendCallOnlyContract_v1_3_0_Contract - Implements the interface specific to MultiSendCallOnly contract version 1.3.0. - */ -class MultiSendCallOnlyContract_v1_3_0_Web3 - extends MultiSendCallOnlyBaseContractWeb3 - implements MultiSendCallOnlyContract_v1_3_0_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SafeContract_v1_3_0_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSendCallOnly deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: MultiSendCallOnlyContract_v1_3_0_Abi - ) { - const safeVersion = '1.3.0' - const defaultAbi = multiSend_1_3_0_ContractArtifacts.abi as MultiSendCallOnlyContract_v1_3_0_Abi - - super(chainId, web3Adapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.safeVersion = safeVersion - } - - getAddress: GetAddressMultiSendCallOnlyFunction = () => { - return Promise.resolve(this.contract.options.address) - } - - encode: EncodeMultiSendCallOnlyFunction = ( - functionToEncode, - args - ) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } -} - -export default MultiSendCallOnlyContract_v1_3_0_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.3.0/MultiSendContract_V1_3_0_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.3.0/MultiSendContract_V1_3_0_Web3.ts deleted file mode 100644 index 5c5966d41..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.3.0/MultiSendContract_V1_3_0_Web3.ts +++ /dev/null @@ -1,65 +0,0 @@ -import MultiSendBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/MultiSend/MultiSendBaseContractWeb3' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { DeepWriteable } from '@safe-global/protocol-kit/adapters/web3/types' -import MultiSendContract_v1_3_0_Contract, { - MultiSendContract_v1_3_0_Abi as MultiSendContract_v1_3_0_Abi_Readonly -} from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/v1.3.0/MultiSendContract_v1_3_0' -import multiSend_1_3_0_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/MultiSend/v1.3.0/multi_send' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import { - EncodeMultiSendFunction, - GetAddressMultiSendFunction -} from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/MultiSendBaseContract' - -// Remove all nested `readonly` modifiers from the ABI type -type MultiSendContract_v1_3_0_Abi = DeepWriteable - -/** - * MultiSendContract_v1_3_0_Web3 is the implementation specific to the MultiSend contract version 1.3.0. - * - * This class specializes in handling interactions with the MultiSend contract version 1.3.0 using Web3.js v6. - * - * @extends MultiSendBaseContractWeb3 - Inherits from MultiSendBaseContractWeb3 with ABI specific to MultiSend contract version 1.3.0. - * @implements MultiSendContract_v1_3_0_Contract - Implements the interface specific to MultiSend contract version 1.3.0. - */ -class MultiSendContract_v1_3_0_Web3 - extends MultiSendBaseContractWeb3 - implements MultiSendContract_v1_3_0_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of MultiSendContract_v1_3_0_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSend deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: MultiSendContract_v1_3_0_Abi - ) { - const safeVersion = '1.3.0' - const defaultAbi = multiSend_1_3_0_ContractArtifacts.abi as MultiSendContract_v1_3_0_Abi - - super(chainId, web3Adapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.safeVersion = safeVersion - } - - getAddress: GetAddressMultiSendFunction = () => { - return Promise.resolve(this.contract.options.address) - } - - encode: EncodeMultiSendFunction = ( - functionToEncode, - args - ) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } -} - -export default MultiSendContract_v1_3_0_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Web3.ts deleted file mode 100644 index 6af6b3e27..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Web3.ts +++ /dev/null @@ -1,66 +0,0 @@ -import MultiSendCallOnlyBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/MultiSend/MultiSendCallOnlyBaseContractWeb3' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { DeepWriteable } from '@safe-global/protocol-kit/adapters/web3/types' -import MultiSendCallOnlyContract_v1_4_1_Contract, { - MultiSendCallOnlyContract_v1_4_1_Abi as MultiSendCallOnlyContract_v1_4_1_Abi_Readonly -} from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1' -import multiSend_1_4_1_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/MultiSend/v1.4.1/multi_send_call_only' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import { - EncodeMultiSendCallOnlyFunction, - GetAddressMultiSendCallOnlyFunction -} from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/MultiSendCallOnlyBaseContract' - -// Remove all nested `readonly` modifiers from the ABI type -type MultiSendCallOnlyContract_v1_4_1_Abi = - DeepWriteable - -/** - * MultiSendCallOnlyContract_v1_4_1_Web3 is the implementation specific to the MultiSendCallOnly contract version 1.4.1. - * - * This class specializes in handling interactions with the MultiSendCallOnly contract version 1.4.1 using Web3.js v6. - * - * @extends MultiSendCallOnlyBaseContractWeb3 - Inherits from MultiSendBaseContractWeb3 with ABI specific to MultiSendCallOnly contract version 1.4.1. - * @implements MultiSendContract_v1_4_1_Contract - Implements the interface specific to MultiSendCallOnly contract version 1.4.1. - */ -class MultiSendCallOnlyContract_v1_4_1_Web3 - extends MultiSendCallOnlyBaseContractWeb3 - implements MultiSendCallOnlyContract_v1_4_1_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of MultiSendCallOnlyContract_v1_4_1_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSendCallOnly deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: MultiSendCallOnlyContract_v1_4_1_Abi - ) { - const safeVersion = '1.4.1' - const defaultAbi = multiSend_1_4_1_ContractArtifacts.abi as MultiSendCallOnlyContract_v1_4_1_Abi - - super(chainId, web3Adapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.safeVersion = safeVersion - } - - getAddress: GetAddressMultiSendCallOnlyFunction = () => { - return Promise.resolve(this.contract.options.address) - } - - encode: EncodeMultiSendCallOnlyFunction = ( - functionToEncode, - args - ) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } -} - -export default MultiSendCallOnlyContract_v1_4_1_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Web3.ts deleted file mode 100644 index f6db61407..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Web3.ts +++ /dev/null @@ -1,65 +0,0 @@ -import MultiSendBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/MultiSend/MultiSendBaseContractWeb3' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { DeepWriteable } from '@safe-global/protocol-kit/adapters/web3/types' -import MultiSendContract_v1_4_1_Contract, { - MultiSendContract_v1_4_1_Abi as MultiSendContract_v1_4_1_Abi_Readonly -} from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/v1.4.1/MultiSendContract_v1_4_1' -import multiSend_1_4_1_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/MultiSend/v1.4.1/multi_send' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import { - EncodeMultiSendFunction, - GetAddressMultiSendFunction -} from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/MultiSendBaseContract' - -// Remove all nested `readonly` modifiers from the ABI type -type MultiSendContract_v1_4_1_Abi = DeepWriteable - -/** - * MultiSendContract_v1_4_1_Web3 is the implementation specific to the MultiSend contract version 1.4.1. - * - * This class specializes in handling interactions with the MultiSend contract version 1.4.1 using Web3.js v6. - * - * @extends MultiSendBaseContractWeb3 - Inherits from MultiSendBaseContractWeb3 with ABI specific to MultiSend contract version 1.4.1. - * @implements MultiSendContract_v1_4_1_Contract - Implements the interface specific to MultiSend contract version 1.4.1. - */ -class MultiSendContract_v1_4_1_Web3 - extends MultiSendBaseContractWeb3 - implements MultiSendContract_v1_4_1_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of MultiSendContract_v1_4_1_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSend deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: MultiSendContract_v1_4_1_Abi - ) { - const safeVersion = '1.4.1' - const defaultAbi = multiSend_1_4_1_ContractArtifacts.abi as MultiSendContract_v1_4_1_Abi - - super(chainId, web3Adapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.safeVersion = safeVersion - } - - getAddress: GetAddressMultiSendFunction = () => { - return Promise.resolve(this.contract.options.address) - } - - encode: EncodeMultiSendFunction = ( - functionToEncode, - args - ) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } -} - -export default MultiSendContract_v1_4_1_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/Safe/SafeBaseContractWeb3.ts b/packages/protocol-kit/src/adapters/web3/contracts/Safe/SafeBaseContractWeb3.ts deleted file mode 100644 index bcd8c8853..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/Safe/SafeBaseContractWeb3.ts +++ /dev/null @@ -1,67 +0,0 @@ -import Contract from 'web3-eth-contract' -import { AbiItem } from 'web3-utils' - -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import SafeBaseContract from '@safe-global/protocol-kit/adapters/SafeBaseContract' - -/** - * Abstract class SafeBaseContractWeb3 extends SafeBaseContract to specifically integrate with the Web3.js library. - * It is designed to be instantiated for different versions of the Safe contract. - * - * This abstract class sets up the Web3.js Contract object that interacts with a Safe contract version. - * - * Subclasses of SafeBaseContractWeb3 are expected to represent specific versions of the Safe contract. - * - * @template SafeContractAbiType - The ABI type specific to the version of the Safe contract, extending AbiItem. - * @extends SafeBaseContract - Extends the generic SafeBaseContract with Web3-specific implementation. - * - * Example subclasses: - * - SafeContract_v1_4_1_Web3 extends SafeBaseContractWeb3 - * - SafeContract_v1_3_0_Web3 extends SafeBaseContractWeb3 - * - SafeContract_v1_2_0_Web3 extends SafeBaseContractWeb3 - * - SafeContract_v1_1_1_Web3 extends SafeBaseContractWeb3 - * - SafeContract_v1_0_0_Web3 extends SafeBaseContractWeb3 - */ -abstract class SafeBaseContractWeb3< - SafeContractAbiType extends AbiItem[] -> extends SafeBaseContract { - contract: Contract - adapter: Web3Adapter - - /** - * @constructor - * Constructs an instance of SafeBaseContractWeb3. - * - * @param chainId - The chain ID of the contract. - * @param web3Adapter - An instance of Web3Adapter. - * @param defaultAbi - The default ABI for the Safe contract. It should be compatible with the specific version of the Safe contract. - * @param safeVersion - The version of the Safe contract. - * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the ABI is derived from the Safe deployments or the defaultAbi is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - defaultAbi: SafeContractAbiType, - safeVersion: SafeVersion, - isL1SafeSingleton = false, - customContractAddress?: string, - customContractAbi?: SafeContractAbiType - ) { - super( - chainId, - defaultAbi, - safeVersion, - isL1SafeSingleton, - customContractAddress, - customContractAbi - ) - - this.adapter = web3Adapter - this.contract = web3Adapter.getContract(this.contractAddress, this.contractAbi) - } -} - -export default SafeBaseContractWeb3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/Safe/SafeContractWeb3.ts b/packages/protocol-kit/src/adapters/web3/contracts/Safe/SafeContractWeb3.ts deleted file mode 100644 index 0990cec6e..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/Safe/SafeContractWeb3.ts +++ /dev/null @@ -1,184 +0,0 @@ -import { - Web3TransactionOptions, - Web3TransactionResult -} from '@safe-global/protocol-kit/adapters/web3/types' -import { toTxResult } from '@safe-global/protocol-kit/adapters/web3/utils' -import { - SafeContract, - SafeSetupConfig, - SafeTransaction, - SafeTransactionData, - SafeVersion -} from '@safe-global/safe-core-sdk-types' - -// TODO remove class when Typechain is removed -abstract class SafeContractWeb3 implements SafeContract { - constructor(public contract: any) {} - - abstract setup( - setupConfig: SafeSetupConfig, - options?: Web3TransactionOptions - ): Promise - - async getVersion(): Promise { - return (await this.contract.methods.VERSION().call()) as SafeVersion - } - - getAddress(): Promise { - return Promise.resolve(this.contract.options.address) - } - - async getNonce(): Promise { - return Number(await this.contract.methods.nonce().call()) - } - - async getThreshold(): Promise { - return Number(await this.contract.methods.getThreshold().call()) - } - - async getOwners(): Promise { - return this.contract.methods.getOwners().call() - } - - async isOwner(address: string): Promise { - return this.contract.methods.isOwner(address).call() - } - - async getTransactionHash(safeTransactionData: SafeTransactionData): Promise { - return this.contract.methods - .getTransactionHash( - safeTransactionData.to, - safeTransactionData.value, - safeTransactionData.data, - safeTransactionData.operation, - safeTransactionData.safeTxGas, - safeTransactionData.baseGas, - safeTransactionData.gasPrice, - safeTransactionData.gasToken, - safeTransactionData.refundReceiver, - safeTransactionData.nonce - ) - .call() - } - - async approvedHashes(ownerAddress: string, hash: string): Promise { - return BigInt(await this.contract.methods.approvedHashes(ownerAddress, hash).call()) - } - - async approveHash( - hash: string, - options?: Web3TransactionOptions - ): Promise { - if (options && !options.gas) { - options.gas = await this.estimateGas('approveHash', [hash], { ...options }) - } - const txResponse = this.contract.methods.approveHash(hash).send(options) - return toTxResult(txResponse, options) - } - - abstract getModules(): Promise - - abstract isModuleEnabled(moduleAddress: string): Promise - - async isValidTransaction( - safeTransaction: SafeTransaction, - options?: Web3TransactionOptions - ): Promise { - let isTxValid = false - try { - if (options && !options.gas) { - options.gas = await this.estimateGas( - 'execTransaction', - [ - safeTransaction.data.to, - safeTransaction.data.value, - safeTransaction.data.data, - safeTransaction.data.operation, - safeTransaction.data.safeTxGas, - safeTransaction.data.baseGas, - safeTransaction.data.gasPrice, - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ], - { - ...options - } - ) - } - isTxValid = await this.contract.methods - .execTransaction( - safeTransaction.data.to, - safeTransaction.data.value, - safeTransaction.data.data, - safeTransaction.data.operation, - safeTransaction.data.safeTxGas, - safeTransaction.data.baseGas, - safeTransaction.data.gasPrice, - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ) - .call(options) - } catch {} - return isTxValid - } - - async execTransaction( - safeTransaction: SafeTransaction, - options?: Web3TransactionOptions - ): Promise { - if (options && !options.gas) { - options.gas = await this.estimateGas( - 'execTransaction', - [ - safeTransaction.data.to, - safeTransaction.data.value, - safeTransaction.data.data, - safeTransaction.data.operation, - safeTransaction.data.safeTxGas, - safeTransaction.data.baseGas, - safeTransaction.data.gasPrice, - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ], - { - ...options - } - ) - } - const txResponse = this.contract.methods - .execTransaction( - safeTransaction.data.to, - safeTransaction.data.value, - safeTransaction.data.data, - safeTransaction.data.operation, - safeTransaction.data.safeTxGas, - safeTransaction.data.baseGas, - safeTransaction.data.gasPrice, - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ) - .send(options) - - return toTxResult(txResponse, options) - } - - encode(methodName: string, params: any[]): string { - return (this.contract.methods as any)[methodName](...params).encodeABI() - } - - async estimateGas( - methodName: string, - params: any[], - options: Web3TransactionOptions - ): Promise { - return ( - await (this.contract.methods as any)[methodName](...params).estimateGas(options) - ).toString() - } -} - -export default SafeContractWeb3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Web3.ts deleted file mode 100644 index a58e556b6..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Web3.ts +++ /dev/null @@ -1,356 +0,0 @@ -import SafeBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/Safe/SafeBaseContractWeb3' -import { - DeepWriteable, - Web3TransactionOptions, - Web3TransactionResult -} from '@safe-global/protocol-kit/adapters/web3/types' -import { toTxResult } from '@safe-global/protocol-kit/adapters/web3/utils' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import safe_1_0_0_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/Safe/v1.0.0/gnosis_safe' -import { - EncodeSafeFunction, - EstimateGasSafeFunction -} from '@safe-global/protocol-kit/contracts/AbiType/Safe/SafeBaseContract' -import SafeContract_v1_0_0_Contract, { - SafeContract_v1_0_0_Abi as SafeContract_v1_0_0_Abi_Readonly -} from '@safe-global/protocol-kit/contracts/AbiType/Safe/v1.0.0/SafeContract_v1_0_0' -import { sameString } from '@safe-global/protocol-kit/utils' -import { SafeTransaction, SafeTransactionData, SafeVersion } from '@safe-global/safe-core-sdk-types' - -// Remove all nested `readonly` modifiers from the ABI type -type SafeContract_v1_0_0_Abi = DeepWriteable - -/** - * SafeContract_v1_0_0_Web3 is the implementation specific to the Safe contract version 1.0.0. - * - * This class specializes in handling interactions with the Safe contract version 1.0.0 using Web3.js. - * - * @extends SafeBaseContractWeb3 - Inherits from SafeBaseContractWeb3 with ABI specific to Safe contract version 1.0.0. - * @implements SafeContract_v1_0_0_Contract - Implements the interface specific to Safe contract version 1.0.0. - */ -class SafeContract_v1_0_0_Web3 - extends SafeBaseContractWeb3> - implements SafeContract_v1_0_0_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SafeContract_v1_0_0_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.0.0 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - isL1SafeSingleton = false, - customContractAddress?: string, - customContractAbi?: SafeContract_v1_0_0_Abi_Readonly - ) { - const safeVersion = '1.0.0' - const defaultAbi = safe_1_0_0_ContractArtifacts.abi as DeepWriteable - - super( - chainId, - web3Adapter, - defaultAbi, - safeVersion, - isL1SafeSingleton, - customContractAddress, - customContractAbi as DeepWriteable - ) - - this.safeVersion = safeVersion - } - - /* ----- Specific v1.0.0 properties ----- */ - async DOMAIN_SEPARATOR_TYPEHASH(): Promise<[string]> { - return [await this.contract.methods.DOMAIN_SEPARATOR_TYPEHASH().call()] - } - - async SENTINEL_MODULES(): Promise<[string]> { - return [await this.contract.methods.SENTINEL_MODULES().call()] - } - - async SENTINEL_OWNERS(): Promise<[string]> { - return [await this.contract.methods.SENTINEL_OWNERS().call()] - } - - async SAFE_MSG_TYPEHASH(): Promise<[string]> { - return [await this.contract.methods.SAFE_MSG_TYPEHASH().call()] - } - - async SAFE_TX_TYPEHASH(): Promise<[string]> { - return [await this.contract.methods.SAFE_TX_TYPEHASH().call()] - } - /* ----- End of specific v1.0.0 properties ----- */ - - async NAME(): Promise<[string]> { - return [await this.contract.methods.NAME().call()] - } - - async VERSION(): Promise<[SafeVersion]> { - return [await this.contract.methods.VERSION().call()] - } - - async approvedHashes(args: readonly [owner: string, txHash: string]): Promise<[bigint]> { - return [await this.contract.methods.approvedHashes(...args).call()] - } - - async domainSeparator(): Promise<[string]> { - return [await this.contract.methods.domainSeparator().call()] - } - - async getModules(): Promise<[string[]]> { - return [await this.contract.methods.getModules().call()] - } - - async getOwners(): Promise { - return [await this.contract.methods.getOwners().call()] - } - - async getThreshold(): Promise<[bigint]> { - return [await this.contract.methods.getThreshold().call()] - } - - async isOwner(args: readonly [address: string]): Promise<[boolean]> { - return [await this.contract.methods.isOwner(...args).call()] - } - - async nonce(): Promise<[bigint]> { - return [await this.contract.methods.nonce().call()] - } - - async signedMessages(args: readonly [messageHash: string]): Promise<[bigint]> { - return [await this.contract.methods.signedMessages(...args).call()] - } - - async getMessageHash(args: readonly [message: string]): Promise<[string]> { - return [await this.contract.methods.getMessageHash(...args).call()] - } - - async encodeTransactionData( - args: readonly [ - to: string, - value: bigint, - data: string, - operation: number, - safeTxGas: bigint, - baseGas: bigint, - gasPrice: bigint, - gasToken: string, - refundReceiver: string, - _nonce: bigint - ] - ): Promise<[string]> { - return [await this.contract.methods.encodeTransactionData(...args).call()] - } - - async getTransactionHash( - args: readonly [ - to: string, - value: bigint, - data: string, - operation: number, - safeTxGas: bigint, - baseGas: bigint, - gasPrice: bigint, - gasToken: string, - refundReceiver: string, - _nonce: bigint - ] - ): Promise<[string]> { - return [await this.contract.methods.getTransactionHash(...args).call()] - } - - encode: EncodeSafeFunction = (functionToEncode, args) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } - - estimateGas: EstimateGasSafeFunction = ( - functionToEstimate, - args, - options = {} - ) => { - return this.contract.methods[functionToEstimate](...args) - .estimateGas(options) - .then(BigInt) - } - - // Custom method (not defined in the Safe Contract) - getAddress(): Promise { - return Promise.resolve(this.contract.options.address) - } - - // Custom method (not defined in the Safe Contract) - async execTransaction( - safeTransaction: SafeTransaction, - options?: Web3TransactionOptions - ): Promise { - if (options && !options.gas) { - options.gas = ( - await this.estimateGas( - 'execTransaction', - [ - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ], - options - ) - ).toString() - } - const txResponse = this.contract.methods - .execTransaction( - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ) - .send(options) - - return toTxResult(txResponse, options) - } - - // Custom method (not defined in the Safe Contract) - async isModuleEnabled(moduleAddress: string): Promise { - const [modules] = await this.getModules() - const isModuleEnabled = modules.some((enabledModuleAddress: string) => - sameString(enabledModuleAddress, moduleAddress) - ) - return isModuleEnabled - } - - // Custom method (not defined in the Safe Contract) - async isValidTransaction( - safeTransaction: SafeTransaction, - options?: Web3TransactionOptions - ): Promise { - let isTxValid = false - try { - if (options && !options.gas) { - options.gas = ( - await this.estimateGas( - 'execTransaction', - [ - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ], - options - ) - ).toString() - } - isTxValid = await this.contract.methods - .execTransaction( - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ) - .call(options) - } catch {} - return isTxValid - } - - // Custom method (not defined in the Safe Contract) - async approveHash( - hash: string, - options?: Web3TransactionOptions - ): Promise { - if (options && !options.gas) { - options.gas = (await this.estimateGas('approveHash', [hash], { ...options })).toString() - } - const txResponse = this.contract.methods.approveHash(hash).send(options) - return toTxResult(txResponse, options) - } - - // TODO: Remove this mapper after remove Typechain - mapToTypechainContract(): any { - return { - contract: this.contract, - - setup: (): any => { - // setup function is labelled as `external` on the contract code, but not present on type SafeContract_v1_0_0_Contract - return - }, - - getModules: async () => (await this.getModules())[0], - - isModuleEnabled: this.isModuleEnabled.bind(this), - - getVersion: async () => (await this.VERSION())[0], - - getAddress: this.getAddress.bind(this), - - getNonce: async () => Number((await this.nonce())[0]), - - getThreshold: async () => Number((await this.getThreshold())[0]), - - getOwners: async () => (await this.getOwners())[0], - - isOwner: async (address: string) => (await this.isOwner([address]))[0], - - getTransactionHash: async (safeTransactionData: SafeTransactionData) => { - return ( - await this.getTransactionHash([ - safeTransactionData.to, - BigInt(safeTransactionData.value), - safeTransactionData.data, - safeTransactionData.operation, - BigInt(safeTransactionData.safeTxGas), - BigInt(safeTransactionData.baseGas), - BigInt(safeTransactionData.gasPrice), - safeTransactionData.gasToken, - safeTransactionData.refundReceiver, - BigInt(safeTransactionData.nonce) - ]) - )[0] - }, - - approvedHashes: async (ownerAddress: string, hash: string) => - (await this.approvedHashes([ownerAddress, hash]))[0], - - approveHash: this.approveHash.bind(this), - - isValidTransaction: this.isValidTransaction.bind(this), - - execTransaction: this.execTransaction.bind(this), - - encode: this.encode.bind(this), - - estimateGas: this.estimateGas.bind(this) - } - } -} - -export default SafeContract_v1_0_0_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Web3.ts deleted file mode 100644 index 0a8832396..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Web3.ts +++ /dev/null @@ -1,341 +0,0 @@ -import SafeBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/Safe/SafeBaseContractWeb3' -import { - DeepWriteable, - Web3TransactionOptions, - Web3TransactionResult -} from '@safe-global/protocol-kit/adapters/web3/types' -import { toTxResult } from '@safe-global/protocol-kit/adapters/web3/utils' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import safe_1_1_1_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/Safe/v1.1.1/gnosis_safe' -import { - EncodeSafeFunction, - EstimateGasSafeFunction -} from '@safe-global/protocol-kit/contracts/AbiType/Safe/SafeBaseContract' -import SafeContract_v1_1_1_Contract, { - SafeContract_v1_1_1_Abi as SafeContract_v1_1_1_Abi_Readonly -} from '@safe-global/protocol-kit/contracts/AbiType/Safe/v1.1.1/SafeContract_v1_1_1' -import { sameString } from '@safe-global/protocol-kit/utils' -import { SafeTransaction, SafeTransactionData, SafeVersion } from '@safe-global/safe-core-sdk-types' - -// Remove all nested `readonly` modifiers from the ABI type -type SafeContract_v1_1_1_Abi = DeepWriteable - -/** - * SafeContract_v1_1_1_Web3 is the implementation specific to the Safe contract version 1.1.1. - * - * This class specializes in handling interactions with the Safe contract version 1.1.1 using Web3.js. - * - * @extends SafeBaseContractWeb3 - Inherits from SafeBaseContractWeb3 with ABI specific to Safe contract version 1.1.1. - * @implements SafeContract_v1_1_1_Contract - Implements the interface specific to Safe contract version 1.1.1. - */ -class SafeContract_v1_1_1_Web3 - extends SafeBaseContractWeb3> - implements SafeContract_v1_1_1_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SafeContract_v1_1_1_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.1.1 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - isL1SafeSingleton = false, - customContractAddress?: string, - customContractAbi?: SafeContract_v1_1_1_Abi_Readonly - ) { - const safeVersion = '1.1.1' - const defaultAbi = safe_1_1_1_ContractArtifacts.abi as DeepWriteable - - super( - chainId, - web3Adapter, - defaultAbi, - safeVersion, - isL1SafeSingleton, - customContractAddress, - customContractAbi as DeepWriteable - ) - - this.safeVersion = safeVersion - } - - async NAME(): Promise<[string]> { - return [await this.contract.methods.NAME().call()] - } - - async VERSION(): Promise<[SafeVersion]> { - return [await this.contract.methods.VERSION().call()] - } - - async approvedHashes(args: readonly [owner: string, txHash: string]): Promise<[bigint]> { - return [await this.contract.methods.approvedHashes(...args).call()] - } - - async domainSeparator(): Promise<[string]> { - return [await this.contract.methods.domainSeparator().call()] - } - - async getModules(): Promise<[string[]]> { - return [await this.contract.methods.getModules().call()] - } - - async getModulesPaginated( - args: readonly [start: string, pageSize: bigint] - ): Promise<[modules: string[], next: string]> { - const res = await this.contract.methods.getModulesPaginated(...args).call() - return [res.array, res.next] - } - - async getOwners(): Promise { - return [await this.contract.methods.getOwners().call()] - } - - async getThreshold(): Promise<[bigint]> { - return [await this.contract.methods.getThreshold().call()] - } - - async isOwner(args: readonly [address: string]): Promise<[boolean]> { - return [await this.contract.methods.isOwner(...args).call()] - } - - async nonce(): Promise<[bigint]> { - return [await this.contract.methods.nonce().call()] - } - - async signedMessages(args: readonly [messageHash: string]): Promise<[bigint]> { - return [await this.contract.methods.signedMessages(...args).call()] - } - - async getMessageHash(args: readonly [message: string]): Promise<[string]> { - return [await this.contract.methods.getMessageHash(...args).call()] - } - - async encodeTransactionData( - args: readonly [ - to: string, - value: bigint, - data: string, - operation: number, - safeTxGas: bigint, - baseGas: bigint, - gasPrice: bigint, - gasToken: string, - refundReceiver: string, - _nonce: bigint - ] - ): Promise<[string]> { - return [await this.contract.methods.encodeTransactionData(...args).call()] - } - - async getTransactionHash( - args: readonly [ - to: string, - value: bigint, - data: string, - operation: number, - safeTxGas: bigint, - baseGas: bigint, - gasPrice: bigint, - gasToken: string, - refundReceiver: string, - _nonce: bigint - ] - ): Promise<[string]> { - return [await this.contract.methods.getTransactionHash(...args).call()] - } - - encode: EncodeSafeFunction = (functionToEncode, args) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } - - estimateGas: EstimateGasSafeFunction = ( - functionToEstimate, - args, - options = {} - ) => { - return this.contract.methods[functionToEstimate](...args) - .estimateGas(options) - .then(BigInt) - } - - // Custom method (not defined in the Safe Contract) - getAddress(): Promise { - return Promise.resolve(this.contract.options.address) - } - - // Custom method (not defined in the Safe Contract) - async execTransaction( - safeTransaction: SafeTransaction, - options?: Web3TransactionOptions - ): Promise { - if (options && !options.gas) { - options.gas = ( - await this.estimateGas( - 'execTransaction', - [ - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ], - options - ) - ).toString() - } - const txResponse = this.contract.methods - .execTransaction( - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ) - .send(options) - - return toTxResult(txResponse, options) - } - - // Custom method (not defined in the Safe Contract) - async isModuleEnabled(moduleAddress: string): Promise { - const [modules] = await this.getModules() - const isModuleEnabled = modules.some((enabledModuleAddress: string) => - sameString(enabledModuleAddress, moduleAddress) - ) - return isModuleEnabled - } - - // Custom method (not defined in the Safe Contract) - async isValidTransaction( - safeTransaction: SafeTransaction, - options?: Web3TransactionOptions - ): Promise { - let isTxValid = false - try { - if (options && !options.gas) { - options.gas = ( - await this.estimateGas( - 'execTransaction', - [ - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ], - options - ) - ).toString() - } - isTxValid = await this.contract.methods - .execTransaction( - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ) - .call(options) - } catch {} - return isTxValid - } - - // Custom method (not defined in the Safe Contract) - async approveHash( - hash: string, - options?: Web3TransactionOptions - ): Promise { - if (options && !options.gas) { - options.gas = (await this.estimateGas('approveHash', [hash], { ...options })).toString() - } - const txResponse = this.contract.methods.approveHash(hash).send(options) - return toTxResult(txResponse, options) - } - - // TODO: Remove this mapper after remove Typechain - mapToTypechainContract(): any { - return { - contract: this.contract, - - setup: (): any => { - // setup function is labelled as `external` on the contract code, but not present on type SafeContract_v1_1_1_Contract - return - }, - - getModules: async () => (await this.getModules())[0], - - isModuleEnabled: this.isModuleEnabled.bind(this), - - getVersion: async () => (await this.VERSION())[0], - - getAddress: this.getAddress.bind(this), - - getNonce: async () => Number((await this.nonce())[0]), - - getThreshold: async () => Number((await this.getThreshold())[0]), - - getOwners: async () => (await this.getOwners())[0], - - isOwner: async (address: string) => (await this.isOwner([address]))[0], - - getTransactionHash: async (safeTransactionData: SafeTransactionData) => { - return ( - await this.getTransactionHash([ - safeTransactionData.to, - BigInt(safeTransactionData.value), - safeTransactionData.data, - safeTransactionData.operation, - BigInt(safeTransactionData.safeTxGas), - BigInt(safeTransactionData.baseGas), - BigInt(safeTransactionData.gasPrice), - safeTransactionData.gasToken, - safeTransactionData.refundReceiver, - BigInt(safeTransactionData.nonce) - ]) - )[0] - }, - - approvedHashes: async (ownerAddress: string, hash: string) => - (await this.approvedHashes([ownerAddress, hash]))[0], - - approveHash: this.approveHash.bind(this), - - isValidTransaction: this.isValidTransaction.bind(this), - - execTransaction: this.execTransaction.bind(this), - - encode: this.encode.bind(this), - - estimateGas: this.estimateGas.bind(this) - } - } -} - -export default SafeContract_v1_1_1_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Web3.ts deleted file mode 100644 index 5ea57fb34..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Web3.ts +++ /dev/null @@ -1,336 +0,0 @@ -import SafeBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/Safe/SafeBaseContractWeb3' -import { - DeepWriteable, - Web3TransactionOptions, - Web3TransactionResult -} from '@safe-global/protocol-kit/adapters/web3/types' -import { toTxResult } from '@safe-global/protocol-kit/adapters/web3/utils' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import safe_1_2_0_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/Safe/v1.2.0/gnosis_safe' -import { - EncodeSafeFunction, - EstimateGasSafeFunction -} from '@safe-global/protocol-kit/contracts/AbiType/Safe/SafeBaseContract' -import SafeContract_v1_2_0_Contract, { - SafeContract_v1_2_0_Abi as SafeContract_v1_2_0_Abi_Readonly -} from '@safe-global/protocol-kit/contracts/AbiType/Safe/v1.2.0/SafeContract_v1_2_0' -import { SafeTransaction, SafeTransactionData, SafeVersion } from '@safe-global/safe-core-sdk-types' - -// Remove all nested `readonly` modifiers from the ABI type -type SafeContract_v1_2_0_Abi = DeepWriteable - -/** - * SafeContract_v1_2_0_Web3 is the implementation specific to the Safe contract version 1.2.0. - * - * This class specializes in handling interactions with the Safe contract version 1.2.0 using Web3.js. - * - * @extends SafeBaseContractWeb3 - Inherits from SafeBaseContractWeb3 with ABI specific to Safe contract version 1.2.0. - * @implements SafeContract_v1_2_0_Contract - Implements the interface specific to Safe contract version 1.2.0. - */ -class SafeContract_v1_2_0_Web3 - extends SafeBaseContractWeb3> - implements SafeContract_v1_2_0_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SafeContract_v1_2_0_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.2.0 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - isL1SafeSingleton = false, - customContractAddress?: string, - customContractAbi?: SafeContract_v1_2_0_Abi_Readonly - ) { - const safeVersion = '1.2.0' - const defaultAbi = safe_1_2_0_ContractArtifacts.abi as DeepWriteable - - super( - chainId, - web3Adapter, - defaultAbi, - safeVersion, - isL1SafeSingleton, - customContractAddress, - customContractAbi as DeepWriteable - ) - - this.safeVersion = safeVersion - } - - async NAME(): Promise<[string]> { - return [await this.contract.methods.NAME().call()] - } - - async VERSION(): Promise<[SafeVersion]> { - return [await this.contract.methods.VERSION().call()] - } - - async approvedHashes(args: readonly [owner: string, txHash: string]): Promise<[bigint]> { - return [await this.contract.methods.approvedHashes(...args).call()] - } - - async domainSeparator(): Promise<[string]> { - return [await this.contract.methods.domainSeparator().call()] - } - - async getModules(): Promise<[string[]]> { - return [await this.contract.methods.getModules().call()] - } - - async getModulesPaginated( - args: readonly [start: string, pageSize: bigint] - ): Promise<[modules: string[], next: string]> { - const res = await this.contract.methods.getModulesPaginated(...args).call() - return [res.array, res.next] - } - - async getOwners(): Promise { - return [await this.contract.methods.getOwners().call()] - } - - async getThreshold(): Promise<[bigint]> { - return [await this.contract.methods.getThreshold().call()] - } - - async isModuleEnabled(args: readonly [moduleAddress: string]): Promise<[boolean]> { - return [await this.contract.methods.isModuleEnabled(...args).call()] - } - - async isOwner(args: readonly [address: string]): Promise<[boolean]> { - return [await this.contract.methods.isOwner(...args).call()] - } - - async nonce(): Promise<[bigint]> { - return [await this.contract.methods.nonce().call()] - } - - async signedMessages(args: readonly [messageHash: string]): Promise<[bigint]> { - return [await this.contract.methods.signedMessages(...args).call()] - } - - async getMessageHash(args: readonly [message: string]): Promise<[string]> { - return [await this.contract.methods.getMessageHash(...args).call()] - } - - async encodeTransactionData( - args: readonly [ - to: string, - value: bigint, - data: string, - operation: number, - safeTxGas: bigint, - baseGas: bigint, - gasPrice: bigint, - gasToken: string, - refundReceiver: string, - _nonce: bigint - ] - ): Promise<[string]> { - return [await this.contract.methods.encodeTransactionData(...args).call()] - } - - async getTransactionHash( - args: readonly [ - to: string, - value: bigint, - data: string, - operation: number, - safeTxGas: bigint, - baseGas: bigint, - gasPrice: bigint, - gasToken: string, - refundReceiver: string, - _nonce: bigint - ] - ): Promise<[string]> { - return [await this.contract.methods.getTransactionHash(...args).call()] - } - - encode: EncodeSafeFunction = (functionToEncode, args) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } - - estimateGas: EstimateGasSafeFunction = ( - functionToEstimate, - args, - options = {} - ) => { - return this.contract.methods[functionToEstimate](...args) - .estimateGas(options) - .then(BigInt) - } - - // Custom method (not defined in the Safe Contract) - getAddress(): Promise { - return Promise.resolve(this.contract.options.address) - } - - // Custom method (not defined in the Safe Contract) - async execTransaction( - safeTransaction: SafeTransaction, - options?: Web3TransactionOptions - ): Promise { - if (options && !options.gas) { - options.gas = ( - await this.estimateGas( - 'execTransaction', - [ - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ], - options - ) - ).toString() - } - const txResponse = this.contract.methods - .execTransaction( - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ) - .send(options) - - return toTxResult(txResponse, options) - } - - // Custom method (not defined in the Safe Contract) - async isValidTransaction( - safeTransaction: SafeTransaction, - options?: Web3TransactionOptions - ): Promise { - let isTxValid = false - try { - if (options && !options.gas) { - options.gas = ( - await this.estimateGas( - 'execTransaction', - [ - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ], - options - ) - ).toString() - } - isTxValid = await this.contract.methods - .execTransaction( - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ) - .call(options) - } catch {} - return isTxValid - } - - // Custom method (not defined in the Safe Contract) - async approveHash( - hash: string, - options?: Web3TransactionOptions - ): Promise { - if (options && !options.gas) { - options.gas = (await this.estimateGas('approveHash', [hash], { ...options })).toString() - } - const txResponse = this.contract.methods.approveHash(hash).send(options) - return toTxResult(txResponse, options) - } - - // TODO: Remove this mapper after remove Typechain - mapToTypechainContract(): any { - return { - contract: this.contract, - - setup: (): any => { - // setup function is labelled as `external` on the contract code, but not present on type SafeContract_v1_2_0_Contract - return - }, - - approveHash: this.approveHash.bind(this), - - isValidTransaction: this.isValidTransaction.bind(this), - - execTransaction: this.execTransaction.bind(this), - - getAddress: this.getAddress.bind(this), - - getModules: async () => (await this.getModules())[0], - - isModuleEnabled: async (moduleAddress: string) => - (await this.isModuleEnabled([moduleAddress]))[0], - - getVersion: async () => (await this.VERSION())[0] as SafeVersion, - - getNonce: async () => Number((await this.nonce())[0]), - - getThreshold: async () => Number((await this.getThreshold())[0]), - - getOwners: async () => (await this.getOwners())[0], - - isOwner: async (address: string) => (await this.isOwner([address]))[0], - - getTransactionHash: async (safeTransactionData: SafeTransactionData) => { - return ( - await this.getTransactionHash([ - safeTransactionData.to, - BigInt(safeTransactionData.value), - safeTransactionData.data, - safeTransactionData.operation, - BigInt(safeTransactionData.safeTxGas), - BigInt(safeTransactionData.baseGas), - BigInt(safeTransactionData.gasPrice), - safeTransactionData.gasToken, - safeTransactionData.refundReceiver, - BigInt(safeTransactionData.nonce) - ]) - )[0] - }, - - approvedHashes: async (ownerAddress: string, hash: string) => - (await this.approvedHashes([ownerAddress, hash]))[0], - - encode: this.encode.bind(this), - - estimateGas: this.estimateGas.bind(this) - } - } -} - -export default SafeContract_v1_2_0_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Web3.ts deleted file mode 100644 index 7de3153f0..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Web3.ts +++ /dev/null @@ -1,356 +0,0 @@ -import SafeBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/Safe/SafeBaseContractWeb3' -import { - DeepWriteable, - Web3TransactionOptions, - Web3TransactionResult -} from '@safe-global/protocol-kit/adapters/web3/types' -import { toTxResult } from '@safe-global/protocol-kit/adapters/web3/utils' -import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/adapters/web3/utils/constants' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import safe_1_3_0_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/Safe/v1.3.0/gnosis_safe_l2' -import { - EncodeSafeFunction, - EstimateGasSafeFunction -} from '@safe-global/protocol-kit/contracts/AbiType/Safe/SafeBaseContract' -import SafeContract_v1_3_0_Contract, { - SafeContract_v1_3_0_Abi as SafeContract_v1_3_0_Abi_Readonly -} from '@safe-global/protocol-kit/contracts/AbiType/Safe/v1.3.0/SafeContract_v1_3_0' -import { SafeTransaction, SafeTransactionData, SafeVersion } from '@safe-global/safe-core-sdk-types' - -// Remove all nested `readonly` modifiers from the ABI type -type SafeContract_v1_3_0_Abi = DeepWriteable - -/** - * SafeContract_v1_3_0_Web3 is the implementation specific to the Safe contract version 1.3.0. - * - * This class specializes in handling interactions with the Safe contract version 1.3.0 using Web3.js. - * - * @extends SafeBaseContractWeb3 - Inherits from SafeBaseContractWeb3 with ABI specific to Safe contract version 1.3.0. - * @implements SafeContract_v1_3_0_Contract - Implements the interface specific to Safe contract version 1.3.0. - */ -class SafeContract_v1_3_0_Web3 - extends SafeBaseContractWeb3> - implements SafeContract_v1_3_0_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SafeContract_v1_3_0_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - isL1SafeSingleton = false, - customContractAddress?: string, - customContractAbi?: SafeContract_v1_3_0_Abi_Readonly - ) { - const safeVersion = '1.3.0' - const defaultAbi = safe_1_3_0_ContractArtifacts.abi as DeepWriteable - - super( - chainId, - web3Adapter, - defaultAbi, - safeVersion, - isL1SafeSingleton, - customContractAddress, - customContractAbi as DeepWriteable - ) - - this.safeVersion = safeVersion - } - - async VERSION(): Promise<[SafeVersion]> { - return [await this.contract.methods.VERSION().call()] - } - - async approvedHashes(args: readonly [owner: string, txHash: string]): Promise<[bigint]> { - return [await this.contract.methods.approvedHashes(...args).call()] - } - - async checkNSignatures( - args: readonly [dataHash: string, data: string, signatures: string, requiredSignatures: bigint] - ): Promise<[]> { - // this method just checks whether the signature provided is valid for the provided data and hash. Reverts otherwise. - if (this.contract.methods.checkNSignatures) { - await this.contract.methods.checkNSignatures(...args).call() - } - return [] - } - - async checkSignatures( - args: readonly [dataHash: string, data: string, signatures: string] - ): Promise<[]> { - await this.contract.methods.checkSignatures(...args).call() - return [] - } - - async domainSeparator(): Promise<[string]> { - return [await this.contract.methods.domainSeparator().call()] - } - - async encodeTransactionData( - args: readonly [ - to: string, - value: bigint, - data: string, - operation: number, - safeTxGas: bigint, - baseGas: bigint, - gasPrice: bigint, - gasToken: string, - refundReceiver: string, - _nonce: bigint - ] - ): Promise<[string]> { - return [await this.contract.methods.encodeTransactionData(...args).call()] - } - - async getChainId(): Promise<[bigint]> { - return [await this.contract.methods.getChainId().call()] - } - - async getModulesPaginated( - args: readonly [start: string, pageSize: bigint] - ): Promise<[modules: string[], next: string]> { - const res = await this.contract.methods.getModulesPaginated(...args).call() - return [res.array, res.next] - } - - async getOwners(): Promise { - return [await this.contract.methods.getOwners().call()] - } - - async getStorageAt(args: readonly [offset: bigint, length: bigint]): Promise<[string]> { - return [await this.contract.methods.getStorageAt(...args).call()] - } - - async getThreshold(): Promise<[bigint]> { - return [await this.contract.methods.getThreshold().call()] - } - - async getTransactionHash( - args: readonly [ - to: string, - value: bigint, - data: string, - operation: number, - safeTxGas: bigint, - baseGas: bigint, - gasPrice: bigint, - gasToken: string, - refundReceiver: string, - _nonce: bigint - ] - ): Promise<[string]> { - return [await this.contract.methods.getTransactionHash(...args).call()] - } - - async isModuleEnabled(args: readonly [moduleAddress: string]): Promise<[boolean]> { - return [await this.contract.methods.isModuleEnabled(...args).call()] - } - - async isOwner(args: readonly [address: string]): Promise<[boolean]> { - return [await this.contract.methods.isOwner(...args).call()] - } - - async nonce(): Promise<[bigint]> { - return [await this.contract.methods.nonce().call()] - } - - async signedMessages(args: readonly [messageHash: string]): Promise<[bigint]> { - return [await this.contract.methods.signedMessages(...args).call()] - } - - encode: EncodeSafeFunction = (functionToEncode, args) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } - - estimateGas: EstimateGasSafeFunction = ( - functionToEstimate, - args, - options = {} - ) => { - return this.contract.methods[functionToEstimate](...args) - .estimateGas(options) - .then(BigInt) - } - - // Custom method (not defined in the Safe Contract) - async getModules(): Promise { - const [modules] = await this.getModulesPaginated([SENTINEL_ADDRESS, BigInt(10)]) - return modules - } - - // Custom method (not defined in the Safe Contract) - getAddress(): Promise { - return Promise.resolve(this.contract.options.address) - } - - // Custom method (not defined in the Safe Contract) - async execTransaction( - safeTransaction: SafeTransaction, - options?: Web3TransactionOptions - ): Promise { - if (options && !options.gas) { - options.gas = ( - await this.estimateGas( - 'execTransaction', - [ - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ], - options - ) - ).toString() - } - const txResponse = this.contract.methods - .execTransaction( - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ) - .send(options) - - return toTxResult(txResponse, options) - } - - // Custom method (not defined in the Safe Contract) - async isValidTransaction( - safeTransaction: SafeTransaction, - options?: Web3TransactionOptions - ): Promise { - let isTxValid = false - try { - if (options && !options.gas) { - options.gas = ( - await this.estimateGas( - 'execTransaction', - [ - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ], - options - ) - ).toString() - } - isTxValid = await this.contract.methods - .execTransaction( - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ) - .call(options) - } catch {} - return isTxValid - } - - // Custom method (not defined in the Safe Contract) - async approveHash( - hash: string, - options?: Web3TransactionOptions - ): Promise { - if (options && !options.gas) { - options.gas = (await this.estimateGas('approveHash', [hash], { ...options })).toString() - } - const txResponse = this.contract.methods.approveHash(hash).send(options) - return toTxResult(txResponse, options) - } - - // TODO: Remove this mapper after remove Typechain - mapToTypechainContract(): any { - return { - contract: this.contract, - - setup: (): any => { - // setup function is labelled as `external` on the contract code, but not present on type SafeContract_v1_3_0_Contract - return - }, - - approveHash: this.approveHash.bind(this), - - isValidTransaction: this.isValidTransaction.bind(this), - - execTransaction: this.execTransaction.bind(this), - - getAddress: this.getAddress.bind(this), - - getModules: this.getModules.bind(this), - - isModuleEnabled: async (moduleAddress: string) => - (await this.isModuleEnabled([moduleAddress]))[0], - - getVersion: async () => (await this.VERSION())[0] as SafeVersion, - - getNonce: async () => Number((await this.nonce())[0]), - - getThreshold: async () => Number((await this.getThreshold())[0]), - - getOwners: async () => (await this.getOwners())[0], - - isOwner: async (address: string) => (await this.isOwner([address]))[0], - - getTransactionHash: async (safeTransactionData: SafeTransactionData) => { - return ( - await this.getTransactionHash([ - safeTransactionData.to, - BigInt(safeTransactionData.value), - safeTransactionData.data, - safeTransactionData.operation, - BigInt(safeTransactionData.safeTxGas), - BigInt(safeTransactionData.baseGas), - BigInt(safeTransactionData.gasPrice), - safeTransactionData.gasToken, - safeTransactionData.refundReceiver, - BigInt(safeTransactionData.nonce) - ]) - )[0] - }, - - approvedHashes: async (ownerAddress: string, hash: string) => - (await this.approvedHashes([ownerAddress, hash]))[0], - - encode: this.encode.bind(this), - - estimateGas: this.estimateGas.bind(this) - } - } -} - -export default SafeContract_v1_3_0_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Web3.ts deleted file mode 100644 index 3568ab481..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Web3.ts +++ /dev/null @@ -1,356 +0,0 @@ -import SafeBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/Safe/SafeBaseContractWeb3' -import { - DeepWriteable, - Web3TransactionOptions, - Web3TransactionResult -} from '@safe-global/protocol-kit/adapters/web3/types' -import { toTxResult } from '@safe-global/protocol-kit/adapters/web3/utils' -import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/adapters/web3/utils/constants' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import safe_1_4_1_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/Safe/v1.4.1/safe_l2' -import { - EncodeSafeFunction, - EstimateGasSafeFunction -} from '@safe-global/protocol-kit/contracts/AbiType/Safe/SafeBaseContract' -import SafeContract_v1_4_1_Contract, { - SafeContract_v1_4_1_Abi as SafeContract_v1_4_1_Abi_Readonly -} from '@safe-global/protocol-kit/contracts/AbiType/Safe/v1.4.1/SafeContract_v1_4_1' -import { SafeTransaction, SafeTransactionData, SafeVersion } from '@safe-global/safe-core-sdk-types' - -// Remove all nested `readonly` modifiers from the ABI type -type SafeContract_v1_4_1_Abi = DeepWriteable - -/** - * SafeContract_v1_4_1_Web3 is the implementation specific to the Safe contract version 1.4.1. - * - * This class specializes in handling interactions with the Safe contract version 1.4.1 using Web3.js. - * - * @extends SafeBaseContractWeb3 - Inherits from SafeBaseContractWeb3 with ABI specific to Safe contract version 1.4.1. - * @implements SafeContract_v1_4_1_Contract - Implements the interface specific to Safe contract version 1.4.1. - */ -class SafeContract_v1_4_1_Web3 - extends SafeBaseContractWeb3 - implements SafeContract_v1_4_1_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SafeContract_v1_4_1_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - isL1SafeSingleton = false, - customContractAddress?: string, - customContractAbi?: SafeContract_v1_4_1_Abi_Readonly - ) { - const safeVersion = '1.4.1' - const defaultAbi = safe_1_4_1_ContractArtifacts.abi as SafeContract_v1_4_1_Abi - - super( - chainId, - web3Adapter, - defaultAbi, - safeVersion, - isL1SafeSingleton, - customContractAddress, - customContractAbi as SafeContract_v1_4_1_Abi - ) - - this.safeVersion = safeVersion - } - - async VERSION(): Promise<[SafeVersion]> { - return [await this.contract.methods.VERSION().call()] - } - - async approvedHashes(args: readonly [owner: string, txHash: string]): Promise<[bigint]> { - return [await this.contract.methods.approvedHashes(...args).call()] - } - - async checkNSignatures( - args: readonly [dataHash: string, data: string, signatures: string, requiredSignatures: bigint] - ): Promise<[]> { - // this method just checks whether the signature provided is valid for the provided data and hash. Reverts otherwise. - if (this.contract.methods.checkNSignatures) { - await this.contract.methods.checkNSignatures(...args).call() - } - return [] - } - - async checkSignatures( - args: readonly [dataHash: string, data: string, signatures: string] - ): Promise<[]> { - await this.contract.methods.checkSignatures(...args).call() - return [] - } - - async domainSeparator(): Promise<[string]> { - return [await this.contract.methods.domainSeparator().call()] - } - - async encodeTransactionData( - args: readonly [ - to: string, - value: bigint, - data: string, - operation: number, - safeTxGas: bigint, - baseGas: bigint, - gasPrice: bigint, - gasToken: string, - refundReceiver: string, - _nonce: bigint - ] - ): Promise<[string]> { - return [await this.contract.methods.encodeTransactionData(...args).call()] - } - - async getChainId(): Promise<[bigint]> { - return [await this.contract.methods.getChainId().call()] - } - - async getModulesPaginated( - args: readonly [start: string, pageSize: bigint] - ): Promise<[modules: string[], next: string]> { - const res = await this.contract.methods.getModulesPaginated(...args).call() - return [res.array, res.next] - } - - async getOwners(): Promise { - return [await this.contract.methods.getOwners().call()] - } - - async getStorageAt(args: readonly [offset: bigint, length: bigint]): Promise<[string]> { - return [await this.contract.methods.getStorageAt(...args).call()] - } - - async getThreshold(): Promise<[bigint]> { - return [await this.contract.methods.getThreshold().call()] - } - - async getTransactionHash( - args: readonly [ - to: string, - value: bigint, - data: string, - operation: number, - safeTxGas: bigint, - baseGas: bigint, - gasPrice: bigint, - gasToken: string, - refundReceiver: string, - _nonce: bigint - ] - ): Promise<[string]> { - return [await this.contract.methods.getTransactionHash(...args).call()] - } - - async isModuleEnabled(args: readonly [moduleAddress: string]): Promise<[boolean]> { - return [await this.contract.methods.isModuleEnabled(...args).call()] - } - - async isOwner(args: readonly [address: string]): Promise<[boolean]> { - return [await this.contract.methods.isOwner(...args).call()] - } - - async nonce(): Promise<[bigint]> { - return [await this.contract.methods.nonce().call()] - } - - async signedMessages(args: readonly [messageHash: string]): Promise<[bigint]> { - return [await this.contract.methods.signedMessages(...args).call()] - } - - encode: EncodeSafeFunction = (functionToEncode, args) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } - - estimateGas: EstimateGasSafeFunction = ( - functionToEstimate, - args, - options = {} - ) => { - return this.contract.methods[functionToEstimate](...args) - .estimateGas(options) - .then(BigInt) - } - - // Custom method (not defined in the Safe Contract) - async getModules(): Promise { - const [modules] = await this.getModulesPaginated([SENTINEL_ADDRESS, BigInt(10)]) - return modules - } - - // Custom method (not defined in the Safe Contract) - getAddress(): Promise { - return Promise.resolve(this.contract.options.address) - } - - // Custom method (not defined in the Safe Contract) - async execTransaction( - safeTransaction: SafeTransaction, - options?: Web3TransactionOptions - ): Promise { - if (options && !options.gas) { - options.gas = ( - await this.estimateGas( - 'execTransaction', - [ - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ], - options - ) - ).toString() - } - const txResponse = this.contract.methods - .execTransaction( - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ) - .send(options) - - return toTxResult(txResponse, options) - } - - // Custom method (not defined in the Safe Contract) - async isValidTransaction( - safeTransaction: SafeTransaction, - options?: Web3TransactionOptions - ): Promise { - let isTxValid = false - try { - if (options && !options.gas) { - options.gas = ( - await this.estimateGas( - 'execTransaction', - [ - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ], - options - ) - ).toString() - } - isTxValid = await this.contract.methods - .execTransaction( - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ) - .call(options) - } catch {} - return isTxValid - } - - // Custom method (not defined in the Safe Contract) - async approveHash( - hash: string, - options?: Web3TransactionOptions - ): Promise { - if (options && !options.gas) { - options.gas = (await this.estimateGas('approveHash', [hash], { ...options })).toString() - } - const txResponse = this.contract.methods.approveHash(hash).send(options) - return toTxResult(txResponse, options) - } - - // TODO: Remove this mapper after remove Typechain - mapToTypechainContract(): any { - return { - contract: this.contract, - - setup: (): any => { - // setup function is labelled as `external` on the contract code, but not present on type SafeContract_v1_4_1_Contract - return - }, - - approveHash: this.approveHash.bind(this), - - isValidTransaction: this.isValidTransaction.bind(this), - - execTransaction: this.execTransaction.bind(this), - - getAddress: this.getAddress.bind(this), - - getModules: this.getModules.bind(this), - - isModuleEnabled: async (moduleAddress: string) => - (await this.isModuleEnabled([moduleAddress]))[0], - - getVersion: async () => (await this.VERSION())[0] as SafeVersion, - - getNonce: async () => Number((await this.nonce())[0]), - - getThreshold: async () => Number((await this.getThreshold())[0]), - - getOwners: async () => (await this.getOwners())[0], - - isOwner: async (address: string) => (await this.isOwner([address]))[0], - - getTransactionHash: async (safeTransactionData: SafeTransactionData) => { - return ( - await this.getTransactionHash([ - safeTransactionData.to, - BigInt(safeTransactionData.value), - safeTransactionData.data, - safeTransactionData.operation, - BigInt(safeTransactionData.safeTxGas), - BigInt(safeTransactionData.baseGas), - BigInt(safeTransactionData.gasPrice), - safeTransactionData.gasToken, - safeTransactionData.refundReceiver, - BigInt(safeTransactionData.nonce) - ]) - )[0] - }, - - approvedHashes: async (ownerAddress: string, hash: string) => - (await this.approvedHashes([ownerAddress, hash]))[0], - - encode: this.encode.bind(this), - - estimateGas: this.estimateGas.bind(this) - } - } -} - -export default SafeContract_v1_4_1_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractWeb3.ts b/packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractWeb3.ts deleted file mode 100644 index 25ec95daf..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractWeb3.ts +++ /dev/null @@ -1,58 +0,0 @@ -import Contract from 'web3-eth-contract' -import { AbiItem } from 'web3-utils' - -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import SafeProxyFactoryBaseContract from '@safe-global/protocol-kit/adapters/SafeProxyFactoryBaseContract' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' - -/** - * Abstract class SafeProxyFactoryBaseContractWeb3 extends SafeProxyFactoryBaseContract to specifically integrate with the Web3.js library. - * It is designed to be instantiated for different versions of the Safe contract. - * - * This abstract class sets up the Web3.js Contract object that interacts with a Safe Proxy Factory contract version. - * - * Subclasses of SafeProxyFactoryBaseContractWeb3 are expected to represent specific versions of the contract. - * - * @template SafeProxyFactoryContractAbiType - The ABI type specific to the version of the Safe Proxy Factory contract, extending AbiItem[]. - * @extends SafeProxyFactoryBaseContract - Extends the generic SafeProxyFactoryBaseContract with Web3.js-specific implementation. - * - * Example subclasses: - * - SafeProxyFactoryContract_v1_4_1_Web3 extends SafeProxyFactoryBaseContractWeb3 - * - SafeProxyFactoryContract_v1_3_0_Web3 extends SafeProxyFactoryBaseContractWeb3 - * - SafeProxyFactoryContract_v1_2_0_Web3 extends SafeProxyFactoryBaseContractWeb3 - * - SafeProxyFactoryContract_v1_1_1_Web3 extends SafeProxyFactoryBaseContractWeb3 - * - SafeProxyFactoryContract_v1_0_0_Web3 extends SafeProxyFactoryBaseContractWeb3 - */ -abstract class SafeProxyFactoryBaseContractWeb3< - SafeProxyFactoryContractAbiType extends AbiItem[] -> extends SafeProxyFactoryBaseContract { - contract: Contract - adapter: Web3Adapter - - /** - * @constructor - * Constructs an instance of SafeProxyFactoryBaseContractWeb3. - * - * @param chainId - The chain ID of the contract. - * @param web3Adapter - An instance of Web3Adapter. - * @param defaultAbi - The default ABI for the Safe contract. It should be compatible with the specific version of the contract. - * @param safeVersion - The version of the Safe contract. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the ABI is derived from the Safe deployments or the defaultAbi is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - defaultAbi: SafeProxyFactoryContractAbiType, - safeVersion: SafeVersion, - customContractAddress?: string, - customContractAbi?: SafeProxyFactoryContractAbiType - ) { - super(chainId, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.adapter = web3Adapter - this.contract = web3Adapter.getContract(this.contractAddress, this.contractAbi) - } -} - -export default SafeProxyFactoryBaseContractWeb3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Web3.ts deleted file mode 100644 index 4f20af4d4..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Web3.ts +++ /dev/null @@ -1,166 +0,0 @@ -import { TransactionReceipt } from 'web3-core/types' -import SafeProxyFactoryBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractWeb3' -import { toTxResult } from '@safe-global/protocol-kit/adapters/web3/utils' -import { - DeepWriteable, - Web3TransactionOptions -} from '@safe-global/protocol-kit/adapters/web3/types' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import safeProxyFactory_1_0_0_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/SafeProxyFactory/v1.0.0/proxy_factory' -import { - EncodeSafeProxyFactoryFunction, - EstimateGasSafeProxyFactoryFunction -} from '@safe-global/protocol-kit/contracts/AbiType/SafeProxyFactory/SafeProxyFactoryBaseContract' -import SafeProxyFactoryContract_v1_0_0_Contract, { - SafeProxyFactoryContract_v1_0_0_Abi -} from '@safe-global/protocol-kit/contracts/AbiType/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0' -import { - CreateProxyProps as CreateProxyPropsGeneral, - SafeVersion -} from '@safe-global/safe-core-sdk-types' - -export interface CreateProxyProps extends CreateProxyPropsGeneral { - options?: Web3TransactionOptions -} - -/** - * SafeProxyFactoryContract_v1_0_0_Web3 is the implementation specific to the Safe Proxy Factory contract version 1.0.0. - * - * This class specializes in handling interactions with the Safe Proxy Factory contract version 1.0.0 using Web3.js. - * - * @extends SafeProxyFactoryBaseContractWeb3 - Inherits from SafeProxyFactoryBaseContractWeb3 with ABI specific to Safe Proxy Factory contract version 1.0.0. - * @implements SafeProxyFactoryContract_v1_0_0_Contract - Implements the interface specific to Safe Proxy Factory contract version 1.0.0. - */ -class SafeProxyFactoryContract_v1_0_0_Web3 - extends SafeProxyFactoryBaseContractWeb3> - implements SafeProxyFactoryContract_v1_0_0_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SafeProxyFactoryContract_v1_0_0_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.0.0 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: SafeProxyFactoryContract_v1_0_0_Abi - ) { - const safeVersion = '1.0.0' - const defaultAbi = - safeProxyFactory_1_0_0_ContractArtifacts.abi as DeepWriteable - - super( - chainId, - web3Adapter, - defaultAbi, - safeVersion, - customContractAddress, - customContractAbi as DeepWriteable - ) - - this.safeVersion = safeVersion - } - - encode: EncodeSafeProxyFactoryFunction = ( - functionToEncode, - args - ) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } - - estimateGas: EstimateGasSafeProxyFactoryFunction< - SafeProxyFactoryContract_v1_0_0_Abi, - Web3TransactionOptions - > = async (functionToEstimate, args, options = {}) => { - return await this.contract.methods[functionToEstimate](...args).estimateGas(options) - } - - getAddress(): Promise { - return Promise.resolve(this.contract.options.address) - } - - async proxyCreationCode(): Promise<[string]> { - return [await this.contract.methods.proxyCreationCode().call()] - } - - async proxyRuntimeCode(): Promise<[string]> { - return [await this.contract.methods.proxyRuntimeCode().call()] - } - - async createProxy(args: readonly [masterCopy: string, data: string]): Promise<[string]> { - return [await this.contract.methods.createProxy(...args).call()] - } - - async createProxyWithNonce( - args: readonly [masterCopy: string, initializer: string, saltNonce: bigint] - ): Promise<[string]> { - return [await this.contract.methods.createProxyWithNonce(...args).call()] - } - - async createProxyWithOptions({ - safeSingletonAddress, - initializer, - saltNonce, - options, - callback - }: CreateProxyProps): Promise { - const saltNonceBigInt = BigInt(saltNonce) - - if (saltNonceBigInt < 0) throw new Error('saltNonce must be greater than or equal to 0') - if (options && !options.gas) { - options.gas = ( - await this.estimateGas( - 'createProxyWithNonce', - [safeSingletonAddress, initializer, saltNonceBigInt], - { - ...options - } - ) - ).toString() - } - - const txResponse = this.contract.methods - .createProxyWithNonce(safeSingletonAddress, initializer, saltNonce) - .send(options) - - if (callback) { - const txResult = await toTxResult(txResponse) - callback(txResult.hash) - } - - const txResult: TransactionReceipt = await new Promise((resolve, reject) => - txResponse.once('receipt', (receipt: TransactionReceipt) => resolve(receipt)).catch(reject) - ) - const proxyAddress = txResult.events?.ProxyCreation?.returnValues?.proxy - if (!proxyAddress) { - throw new Error('SafeProxy was not deployed correctly') - } - return proxyAddress - } - - // TODO: Remove this mapper after remove Typechain - mapToTypechainContract(): any { - return { - contract: this.contract, - - encode: this.encode.bind(this), - - estimateGas: async (...args: Parameters) => - (await this.estimateGas(...args)).toString(), - - createProxy: this.createProxyWithOptions.bind(this), - - getAddress: this.getAddress.bind(this), - - proxyCreationCode: async () => (await this.proxyCreationCode())[0] - } - } -} - -export default SafeProxyFactoryContract_v1_0_0_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Web3.ts deleted file mode 100644 index dbfcb05d2..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Web3.ts +++ /dev/null @@ -1,178 +0,0 @@ -import { TransactionReceipt } from 'web3-core/types' -import SafeProxyFactoryBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractWeb3' -import { toTxResult } from '@safe-global/protocol-kit/adapters/web3/utils' -import { - DeepWriteable, - Web3TransactionOptions -} from '@safe-global/protocol-kit/adapters/web3/types' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import safeProxyFactory_1_1_1_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/SafeProxyFactory/v1.1.1/proxy_factory' -import { - EncodeSafeProxyFactoryFunction, - EstimateGasSafeProxyFactoryFunction -} from '@safe-global/protocol-kit/contracts/AbiType/SafeProxyFactory/SafeProxyFactoryBaseContract' -import SafeProxyFactoryContract_v1_1_1_Contract, { - SafeProxyFactoryContract_v1_1_1_Abi -} from '@safe-global/protocol-kit/contracts/AbiType/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1' -import { - CreateProxyProps as CreateProxyPropsGeneral, - SafeVersion -} from '@safe-global/safe-core-sdk-types' - -export interface CreateProxyProps extends CreateProxyPropsGeneral { - options?: Web3TransactionOptions -} - -/** - * SafeProxyFactoryContract_v1_1_1_Web3 is the implementation specific to the Safe Proxy Factory contract version 1.1.1. - * - * This class specializes in handling interactions with the Safe Proxy Factory contract version 1.1.1 using Web3.js. - * - * @extends SafeProxyFactoryBaseContractWeb3 - Inherits from SafeProxyFactoryBaseContractWeb3 with ABI specific to Safe Proxy Factory contract version 1.1.1. - * @implements SafeProxyFactoryContract_v1_1_1_Contract - Implements the interface specific to Safe Proxy Factory contract version 1.1.1. - */ -class SafeProxyFactoryContract_v1_1_1_Web3 - extends SafeProxyFactoryBaseContractWeb3> - implements SafeProxyFactoryContract_v1_1_1_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SafeProxyFactoryContract_v1_1_1_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.1.1 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: SafeProxyFactoryContract_v1_1_1_Abi - ) { - const safeVersion = '1.1.1' - const defaultAbi = - safeProxyFactory_1_1_1_ContractArtifacts.abi as DeepWriteable - - super( - chainId, - web3Adapter, - defaultAbi, - safeVersion, - customContractAddress, - customContractAbi as DeepWriteable - ) - - this.safeVersion = safeVersion - } - - encode: EncodeSafeProxyFactoryFunction = ( - functionToEncode, - args - ) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } - - estimateGas: EstimateGasSafeProxyFactoryFunction< - SafeProxyFactoryContract_v1_1_1_Abi, - Web3TransactionOptions - > = async (functionToEstimate, args, options = {}) => { - return await this.contract.methods[functionToEstimate](...args).estimateGas(options) - } - - getAddress(): Promise { - return Promise.resolve(this.contract.options.address) - } - - async proxyCreationCode(): Promise<[string]> { - return [await this.contract.methods.proxyCreationCode().call()] - } - - async proxyRuntimeCode(): Promise<[string]> { - return [await this.contract.methods.proxyRuntimeCode().call()] - } - - async calculateCreateProxyWithNonceAddress( - args: readonly [masterCopy: string, initializer: string, saltNonce: bigint] - ): Promise<[string]> { - return [await this.contract.methods.calculateCreateProxyWithNonceAddress(...args).call()] - } - - async createProxy(args: readonly [masterCopy: string, data: string]): Promise<[string]> { - return [await this.contract.methods.createProxy(...args).call()] - } - - async createProxyWithCallback( - args: readonly [masterCopy: string, initializer: string, saltNonce: bigint, callback: string] - ): Promise<[string]> { - return [await this.contract.methods.createProxyWithCallback(...args).call()] - } - - async createProxyWithNonce( - args: readonly [masterCopy: string, initializer: string, saltNonce: bigint] - ): Promise<[string]> { - return [await this.contract.methods.createProxyWithNonce(...args).call()] - } - - async createProxyWithOptions({ - safeSingletonAddress, - initializer, - saltNonce, - options, - callback - }: CreateProxyProps): Promise { - const saltNonceBigInt = BigInt(saltNonce) - - if (saltNonceBigInt < 0) throw new Error('saltNonce must be greater than or equal to 0') - if (options && !options.gas) { - options.gas = ( - await this.estimateGas( - 'createProxyWithNonce', - [safeSingletonAddress, initializer, saltNonceBigInt], - { - ...options - } - ) - ).toString() - } - - const txResponse = this.contract.methods - .createProxyWithNonce(safeSingletonAddress, initializer, saltNonce) - .send(options) - - if (callback) { - const txResult = await toTxResult(txResponse) - callback(txResult.hash) - } - - const txResult: TransactionReceipt = await new Promise((resolve, reject) => - txResponse.once('receipt', (receipt: TransactionReceipt) => resolve(receipt)).catch(reject) - ) - const proxyAddress = txResult.events?.ProxyCreation?.returnValues?.proxy - if (!proxyAddress) { - throw new Error('SafeProxy was not deployed correctly') - } - return proxyAddress - } - - // TODO: Remove this mapper after remove Typechain - mapToTypechainContract(): any { - return { - contract: this.contract, - - encode: this.encode.bind(this), - - estimateGas: async (...args: Parameters) => - (await this.estimateGas(...args)).toString(), - - createProxy: this.createProxyWithOptions.bind(this), - - getAddress: this.getAddress.bind(this), - - proxyCreationCode: async () => (await this.proxyCreationCode())[0] - } - } -} - -export default SafeProxyFactoryContract_v1_1_1_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Web3.ts deleted file mode 100644 index 05f1e9ea2..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Web3.ts +++ /dev/null @@ -1,178 +0,0 @@ -import { TransactionReceipt } from 'web3-core/types' -import SafeProxyFactoryBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractWeb3' -import { toTxResult } from '@safe-global/protocol-kit/adapters/web3/utils' -import { - DeepWriteable, - Web3TransactionOptions -} from '@safe-global/protocol-kit/adapters/web3/types' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import safeProxyFactory_1_3_0_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/SafeProxyFactory/v1.3.0/proxy_factory' -import { - EncodeSafeProxyFactoryFunction, - EstimateGasSafeProxyFactoryFunction -} from '@safe-global/protocol-kit/contracts/AbiType/SafeProxyFactory/SafeProxyFactoryBaseContract' -import SafeProxyFactoryContract_v1_3_0_Contract, { - SafeProxyFactoryContract_v1_3_0_Abi -} from '@safe-global/protocol-kit/contracts/AbiType/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0' -import { - CreateProxyProps as CreateProxyPropsGeneral, - SafeVersion -} from '@safe-global/safe-core-sdk-types' - -export interface CreateProxyProps extends CreateProxyPropsGeneral { - options?: Web3TransactionOptions -} - -/** - * SafeProxyFactoryContract_v1_3_0_Web3 is the implementation specific to the Safe Proxy Factory contract version 1.3.0. - * - * This class specializes in handling interactions with the Safe Proxy Factory contract version 1.3.0 using Web3.js. - * - * @extends SafeProxyFactoryBaseContractWeb3 - Inherits from SafeProxyFactoryBaseContractWeb3 with ABI specific to Safe Proxy Factory contract version 1.3.0. - * @implements SafeProxyFactoryContract_v1_3_0_Contract - Implements the interface specific to Safe Proxy Factory contract version 1.3.0. - */ -class SafeProxyFactoryContract_v1_3_0_Web3 - extends SafeProxyFactoryBaseContractWeb3> - implements SafeProxyFactoryContract_v1_3_0_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SafeProxyFactoryContract_v1_3_0_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: SafeProxyFactoryContract_v1_3_0_Abi - ) { - const safeVersion = '1.3.0' - const defaultAbi = - safeProxyFactory_1_3_0_ContractArtifacts.abi as DeepWriteable - - super( - chainId, - web3Adapter, - defaultAbi, - safeVersion, - customContractAddress, - customContractAbi as DeepWriteable - ) - - this.safeVersion = safeVersion - } - - encode: EncodeSafeProxyFactoryFunction = ( - functionToEncode, - args - ) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } - - estimateGas: EstimateGasSafeProxyFactoryFunction< - SafeProxyFactoryContract_v1_3_0_Abi, - Web3TransactionOptions - > = async (functionToEstimate, args, options = {}) => { - return await this.contract.methods[functionToEstimate](...args).estimateGas(options) - } - - getAddress(): Promise { - return Promise.resolve(this.contract.options.address) - } - - async proxyCreationCode(): Promise<[string]> { - return [await this.contract.methods.proxyCreationCode().call()] - } - - async proxyRuntimeCode(): Promise<[string]> { - return [await this.contract.methods.proxyRuntimeCode().call()] - } - - async calculateCreateProxyWithNonceAddress( - args: readonly [singleton: string, initializer: string, saltNonce: bigint] - ): Promise<[string]> { - return [await this.contract.methods.calculateCreateProxyWithNonceAddress(...args).call()] - } - - async createProxy(args: readonly [singleton: string, data: string]): Promise<[string]> { - return [await this.contract.methods.createProxy(...args).call()] - } - - async createProxyWithCallback( - args: readonly [singleton: string, initializer: string, saltNonce: bigint, callback: string] - ): Promise<[string]> { - return [await this.contract.methods.createProxyWithCallback(...args).call()] - } - - async createProxyWithNonce( - args: readonly [singleton: string, initializer: string, saltNonce: bigint] - ): Promise<[string]> { - return [await this.contract.methods.createProxyWithNonce(...args).call()] - } - - async createProxyWithOptions({ - safeSingletonAddress, - initializer, - saltNonce, - options, - callback - }: CreateProxyProps): Promise { - const saltNonceBigInt = BigInt(saltNonce) - - if (saltNonceBigInt < 0) throw new Error('saltNonce must be greater than or equal to 0') - if (options && !options.gas) { - options.gas = ( - await this.estimateGas( - 'createProxyWithNonce', - [safeSingletonAddress, initializer, saltNonceBigInt], - { - ...options - } - ) - ).toString() - } - - const txResponse = this.contract.methods - .createProxyWithNonce(safeSingletonAddress, initializer, saltNonce) - .send(options) - - if (callback) { - const txResult = await toTxResult(txResponse) - callback(txResult.hash) - } - - const txResult: TransactionReceipt = await new Promise((resolve, reject) => - txResponse.once('receipt', (receipt: TransactionReceipt) => resolve(receipt)).catch(reject) - ) - const proxyAddress = txResult.events?.ProxyCreation?.returnValues?.proxy - if (!proxyAddress) { - throw new Error('SafeProxy was not deployed correctly') - } - return proxyAddress - } - - // TODO: Remove this mapper after remove Typechain - mapToTypechainContract(): any { - return { - contract: this.contract, - - encode: this.encode.bind(this), - - estimateGas: async (...args: Parameters) => - (await this.estimateGas(...args)).toString(), - - createProxy: this.createProxyWithOptions.bind(this), - - getAddress: this.getAddress.bind(this), - - proxyCreationCode: async () => (await this.proxyCreationCode())[0] - } - } -} - -export default SafeProxyFactoryContract_v1_3_0_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Web3.ts deleted file mode 100644 index d1f49a830..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Web3.ts +++ /dev/null @@ -1,184 +0,0 @@ -import { TransactionReceipt } from 'web3-core/types' -import SafeProxyFactoryBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractWeb3' -import { toTxResult } from '@safe-global/protocol-kit/adapters/web3/utils' -import { - DeepWriteable, - Web3TransactionOptions -} from '@safe-global/protocol-kit/adapters/web3/types' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import safeProxyFactory_1_4_1_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/SafeProxyFactory/v1.4.1/safe_proxy_factory' -import { - EncodeSafeProxyFactoryFunction, - EstimateGasSafeProxyFactoryFunction -} from '@safe-global/protocol-kit/contracts/AbiType/SafeProxyFactory/SafeProxyFactoryBaseContract' -import SafeProxyFactoryContract_v1_4_1_Contract, { - SafeProxyFactoryContract_v1_4_1_Abi -} from '@safe-global/protocol-kit/contracts/AbiType/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1' -import { - CreateProxyProps as CreateProxyPropsGeneral, - SafeVersion -} from '@safe-global/safe-core-sdk-types' - -export interface CreateProxyProps extends CreateProxyPropsGeneral { - options?: Web3TransactionOptions -} - -/** - * SafeProxyFactoryContract_v1_4_1_Web3 is the implementation specific to the Safe Proxy Factory contract version 1.4.1. - * - * This class specializes in handling interactions with the Safe Proxy Factory contract version 1.4.1 using Web3.js. - * - * @extends SafeProxyFactoryBaseContractWeb3 - Inherits from SafeProxyFactoryBaseContractWeb3 with ABI specific to Safe Proxy Factory contract version 1.4.1. - * @implements SafeProxyFactoryContract_v1_4_1_Contract - Implements the interface specific to Safe Proxy Factory contract version 1.4.1. - */ -class SafeProxyFactoryContract_v1_4_1_Web3 - extends SafeProxyFactoryBaseContractWeb3> - implements SafeProxyFactoryContract_v1_4_1_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SafeProxyFactoryContract_v1_4_1_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: SafeProxyFactoryContract_v1_4_1_Abi - ) { - const safeVersion = '1.4.1' - const defaultAbi = - safeProxyFactory_1_4_1_ContractArtifacts.abi as DeepWriteable - - super( - chainId, - web3Adapter, - defaultAbi, - safeVersion, - customContractAddress, - customContractAbi as DeepWriteable - ) - - this.safeVersion = safeVersion - } - - encode: EncodeSafeProxyFactoryFunction = ( - functionToEncode, - args - ) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } - - estimateGas: EstimateGasSafeProxyFactoryFunction< - SafeProxyFactoryContract_v1_4_1_Abi, - Web3TransactionOptions - > = async (functionToEstimate, args, options = {}) => { - return await this.contract.methods[functionToEstimate](...args).estimateGas(options) - } - - getAddress(): Promise { - return Promise.resolve(this.contract.options.address) - } - - async getChainId(): Promise<[bigint]> { - return [await this.contract.methods.getChainId().call()] - } - - async proxyCreationCode(): Promise<[string]> { - return [await this.contract.methods.proxyCreationCode().call()] - } - - async createChainSpecificProxyWithNonce( - args: readonly [singleton: string, initializer: string, saltNonce: bigint] - ): Promise<[string]> { - return [await this.contract.methods.createChainSpecificProxyWithNonce(...args).call()] - } - - async proxyRuntimeCode(): Promise<[string]> { - return [await this.contract.methods.proxyRuntimeCode().call()] - } - - async calculateCreateProxyWithNonceAddress( - args: readonly [singleton: string, initializer: string, saltNonce: bigint] - ): Promise<[string]> { - return [await this.contract.methods.calculateCreateProxyWithNonceAddress(...args).call()] - } - - async createProxyWithCallback( - args: readonly [singleton: string, initializer: string, saltNonce: bigint, callback: string] - ): Promise<[string]> { - return [await this.contract.methods.createProxyWithCallback(...args).call()] - } - - async createProxyWithNonce( - args: readonly [singleton: string, initializer: string, saltNonce: bigint] - ): Promise<[string]> { - return [await this.contract.methods.createProxyWithNonce(...args).call()] - } - - async createProxy({ - safeSingletonAddress, - initializer, - saltNonce, - options, - callback - }: CreateProxyProps): Promise { - const saltNonceBigInt = BigInt(saltNonce) - - if (saltNonceBigInt < 0) throw new Error('saltNonce must be greater than or equal to 0') - if (options && !options.gas) { - options.gas = ( - await this.estimateGas( - 'createProxyWithNonce', - [safeSingletonAddress, initializer, saltNonceBigInt], - { - ...options - } - ) - ).toString() - } - - const txResponse = this.contract.methods - .createProxyWithNonce(safeSingletonAddress, initializer, saltNonce) - .send(options) - - if (callback) { - const txResult = await toTxResult(txResponse) - callback(txResult.hash) - } - - const txResult: TransactionReceipt = await new Promise((resolve, reject) => - txResponse.once('receipt', (receipt: TransactionReceipt) => resolve(receipt)).catch(reject) - ) - const proxyAddress = txResult.events?.ProxyCreation?.returnValues?.proxy - if (!proxyAddress) { - throw new Error('SafeProxy was not deployed correctly') - } - return proxyAddress - } - - // TODO: Remove this mapper after remove Typechain - mapToTypechainContract(): any { - return { - contract: this.contract, - - encode: this.encode.bind(this), - - estimateGas: async (...args: Parameters) => - (await this.estimateGas(...args)).toString(), - - createProxy: this.createProxy.bind(this), - - getAddress: this.getAddress.bind(this), - - proxyCreationCode: async () => (await this.proxyCreationCode())[0] - } - } -} - -export default SafeProxyFactoryContract_v1_4_1_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/SignMessageLibBaseContractWeb3.ts b/packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/SignMessageLibBaseContractWeb3.ts deleted file mode 100644 index 4e90685b6..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/SignMessageLibBaseContractWeb3.ts +++ /dev/null @@ -1,55 +0,0 @@ -import Contract from 'web3-eth-contract' -import { AbiItem } from 'web3-utils' - -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import SignMessageLibBaseContract from '@safe-global/protocol-kit/adapters/SignMessageLibBaseContract' - -/** - * Abstract class SignMessageLibBaseContractWeb3 extends SignMessageLibBaseContract to specifically integrate with the Web3.js v6 library. - * It is designed to be instantiated for different versions of the SignMessageLib contract. - * - * This abstract class sets up the Web3 v6 Contract object that interacts with a SignMessageLib contract version. - * - * Subclasses of SignMessageLibBaseContractWeb3 are expected to represent specific versions of the SignMessageLib contract. - * - * @template SignMessageLibContractAbiType - The ABI type specific to the version of the SignMessageLib contract, extending InterfaceAbi from Web3. - * @extends SignMessageLibBaseContract - Extends the generic SignMessageLibBaseContract with Web3-specific implementation. - * - * Example subclasses: - * - SignMessageLibContract_v1_4_1_Web3 extends SignMessageLibBaseContractWeb3 - * - SignMessageLibContract_v1_3_0_Web3 extends SignMessageLibBaseContractWeb3 - */ -abstract class SignMessageLibBaseContractWeb3< - SignMessageLibContractAbiType extends AbiItem[] -> extends SignMessageLibBaseContract { - contract: Contract - adapter: Web3Adapter - - /** - * @constructor - * Constructs an instance of SignMessageLibBaseContractWeb3. - * - * @param chainId - The chain ID of the contract. - * @param web3Adapter - An instance of Web3Adapter. - * @param defaultAbi - The default ABI for the SignMessageLib contract. It should be compatible with the specific version of the SignMessageLib contract. - * @param safeVersion - The version of the SignMessageLib contract. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SignMessageLib deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the ABI is derived from the SignMessageLib deployments or the defaultAbi is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - defaultAbi: SignMessageLibContractAbiType, - safeVersion: SafeVersion, - customContractAddress?: string, - customContractAbi?: SignMessageLibContractAbiType - ) { - super(chainId, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.adapter = web3Adapter - this.contract = web3Adapter.getContract(this.contractAddress, this.contractAbi) - } -} - -export default SignMessageLibBaseContractWeb3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_V1_3_0_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_V1_3_0_Web3.ts deleted file mode 100644 index ae2781fac..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_V1_3_0_Web3.ts +++ /dev/null @@ -1,119 +0,0 @@ -import { - Web3TransactionOptions, - DeepWriteable -} from '@safe-global/protocol-kit/adapters/web3/types' -import { toTxResult } from '@safe-global/protocol-kit/adapters/web3/utils' -import SignMessageLibBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/SignMessageLib/SignMessageLibBaseContractWeb3' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import SignMessageLibContract_v1_3_0_Contract, { - SignMessageLibContract_v1_3_0_Abi as SignMessageLibContract_v1_3_0_Abi_Readonly -} from '@safe-global/protocol-kit/contracts/AbiType/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0' -import signMessageLib_1_3_0_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/SignMessageLib/v1.3.0/sign_message_lib' -import { SafeVersion, SignMessageLibContract } from '@safe-global/safe-core-sdk-types' -import { - EncodeSignMessageLibFunction, - EstimateGasSignMessageLibFunction, - GetAddressSignMessageLibFunction, - SignMessageFunction -} from '@safe-global/protocol-kit/contracts/AbiType/SignMessageLib/SignMessageLibBaseContract' - -// Remove all nested `readonly` modifiers from the ABI type -type SignMessageLibContract_v1_3_0_Abi = DeepWriteable - -/** - * SignMessageLibContract_v1_3_0_Web3 is the implementation specific to the SignMessageLib contract version 1.3.0. - * - * This class specializes in handling interactions with the SignMessageLib contract version 1.3.0 using Web3.js v6. - * - * @extends SignMessageLibBaseContractWeb3 - Inherits from SignMessageLibBaseContractWeb3 with ABI specific to SignMessageLib contract version 1.3.0. - * @implements SignMessageLibContract_v1_3_0_Contract - Implements the interface specific to SignMessageLib contract version 1.3.0. - */ -class SignMessageLibContract_v1_3_0_Web3 - extends SignMessageLibBaseContractWeb3 - implements SignMessageLibContract_v1_3_0_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SignMessageLibContract_v1_3_0_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SignMessageLib deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: SignMessageLibContract_v1_3_0_Abi - ) { - const safeVersion = '1.3.0' - const defaultAbi = - signMessageLib_1_3_0_ContractArtifacts.abi as DeepWriteable - - super(chainId, web3Adapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.safeVersion = safeVersion - } - - encode: EncodeSignMessageLibFunction = ( - functionToEncode, - args - ) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } - - estimateGas: EstimateGasSignMessageLibFunction< - SignMessageLibContract_v1_3_0_Abi_Readonly, - Web3TransactionOptions - > = (functionToEstimate, args, options = {}) => { - return this.contract.methods[functionToEstimate](...args) - .estimateGas(options) - .then(BigInt) - } - - getAddress: GetAddressSignMessageLibFunction = () => { - return Promise.resolve(this.contract.options.address) - } - - async getMessageHash(args: readonly [string]): Promise { - return [await this.contract.methods.getMessageHash(...args).call()] - } - - signMessage: SignMessageFunction< - SignMessageLibContract_v1_3_0_Abi_Readonly, - Web3TransactionOptions - > = async (data, options) => { - if (options && !options.gas) { - options.gas = Number(await this.estimateGas('signMessage', data, { ...options })) - } - - const txResponse = this.contract.methods.signMessage(data).send(options) - - return toTxResult(txResponse, options) - } - - // TODO: Remove this mapper after remove Typechain - mapToTypechainContract(): SignMessageLibContract { - return { - encode: this.encode.bind(this), - - estimateGas: async (methodName: string, params: any[], options: Web3TransactionOptions) => { - const gas = await this.estimateGas(methodName as 'signMessage', params as [string], options) - - return gas.toString() - }, - - getAddress: this.getAddress.bind(this), - - getMessageHash: async (message: string) => (await this.getMessageHash([message]))[0], - - signMessage: async (data: string, options?: Web3TransactionOptions) => { - return this.signMessage([data], options) - } - } - } -} - -export default SignMessageLibContract_v1_3_0_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Web3.ts deleted file mode 100644 index bfd11a843..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Web3.ts +++ /dev/null @@ -1,119 +0,0 @@ -import { - Web3TransactionOptions, - DeepWriteable -} from '@safe-global/protocol-kit/adapters/web3/types' -import { toTxResult } from '@safe-global/protocol-kit/adapters/web3/utils' -import SignMessageLibBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/SignMessageLib/SignMessageLibBaseContractWeb3' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import SignMessageLibContract_v1_4_1_Contract, { - SignMessageLibContract_v1_4_1_Abi as SignMessageLibContract_v1_4_1_Abi_Readonly -} from '@safe-global/protocol-kit/contracts/AbiType/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1' -import signMessageLib_1_4_1_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/SignMessageLib/v1.4.1/sign_message_lib' -import { SafeVersion, SignMessageLibContract } from '@safe-global/safe-core-sdk-types' -import { - EncodeSignMessageLibFunction, - EstimateGasSignMessageLibFunction, - GetAddressSignMessageLibFunction, - SignMessageFunction -} from '@safe-global/protocol-kit/contracts/AbiType/SignMessageLib/SignMessageLibBaseContract' - -// Remove all nested `readonly` modifiers from the ABI type -type SignMessageLibContract_v1_4_1_Abi = DeepWriteable - -/** - * SignMessageLibContract_v1_4_1_Web3 is the implementation specific to the SignMessageLib contract version 1.4.1. - * - * This class specializes in handling interactions with the SignMessageLib contract version 1.4.1 using Web3.js v6. - * - * @extends SignMessageLibBaseContractWeb3 - Inherits from SignMessageLibBaseContractWeb3 with ABI specific to SignMessageLib contract version 1.4.1. - * @implements SignMessageLibContract_v1_4_1_Contract - Implements the interface specific to SignMessageLib contract version 1.4.1. - */ -class SignMessageLibContract_v1_4_1_Web3 - extends SignMessageLibBaseContractWeb3 - implements SignMessageLibContract_v1_4_1_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SignMessageLibContract_v1_4_1_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SignMessageLib deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: SignMessageLibContract_v1_4_1_Abi - ) { - const safeVersion = '1.4.1' - const defaultAbi = - signMessageLib_1_4_1_ContractArtifacts.abi as DeepWriteable - - super(chainId, web3Adapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.safeVersion = safeVersion - } - - encode: EncodeSignMessageLibFunction = ( - functionToEncode, - args - ) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } - - estimateGas: EstimateGasSignMessageLibFunction< - SignMessageLibContract_v1_4_1_Abi_Readonly, - Web3TransactionOptions - > = (functionToEstimate, args, options = {}) => { - return this.contract.methods[functionToEstimate](...args) - .estimateGas(options) - .then(BigInt) - } - - getAddress: GetAddressSignMessageLibFunction = () => { - return Promise.resolve(this.contract.options.address) - } - - async getMessageHash(args: readonly [string]): Promise { - return [await this.contract.methods.getMessageHash(...args).call()] - } - - signMessage: SignMessageFunction< - SignMessageLibContract_v1_4_1_Abi_Readonly, - Web3TransactionOptions - > = async (data, options) => { - if (options && !options.gas) { - options.gas = Number(await this.estimateGas('signMessage', data, { ...options })) - } - - const txResponse = this.contract.methods.signMessage(data).send(options) - - return toTxResult(txResponse, options) - } - - // TODO: Remove this mapper after remove Typechain - mapToTypechainContract(): SignMessageLibContract { - return { - encode: this.encode.bind(this), - - estimateGas: async (methodName: string, params: any[], options: Web3TransactionOptions) => { - const gas = await this.estimateGas(methodName as 'signMessage', params as [string], options) - - return gas.toString() - }, - - getAddress: this.getAddress.bind(this), - - getMessageHash: async (message: string) => (await this.getMessageHash([message]))[0], - - signMessage: async (data: string, options?: Web3TransactionOptions) => { - return this.signMessage([data], options) - } - } - } -} - -export default SignMessageLibContract_v1_4_1_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractWeb3.ts b/packages/protocol-kit/src/adapters/web3/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractWeb3.ts deleted file mode 100644 index 31339cd9b..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractWeb3.ts +++ /dev/null @@ -1,55 +0,0 @@ -import Contract from 'web3-eth-contract' -import { AbiItem } from 'web3-utils' - -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import SimulateTxAccessorBaseContract from '@safe-global/protocol-kit/adapters/SimulateTxAccessorBaseContract' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' - -/** - * Abstract class SimulateTxAccessorBaseContractWeb3 extends SimulateTxAccessorBaseContract to specifically integrate with the Web3.js v6 library. - * It is designed to be instantiated for different versions of the Safe contract. - * - * This abstract class sets up the Web3 v6 Contract object that interacts with a SimulateTxAccessor contract version. - * - * Subclasses of SimulateTxAccessorBaseContractWeb3 are expected to represent specific versions of the contract. - * - * @template SimulateTxAccessorContractAbiType - The ABI type specific to the version of the SimulateTxAccessor contract, extending InterfaceAbi from Web3. - * @extends SimulateTxAccessorBaseContract - Extends the generic SimulateTxAccessorBaseContract with Web3-specific implementation. - * - * Example subclasses: - * - SimulateTxAccessorContract_v1_4_1_Web3 extends SimulateTxAccessorBaseContractWeb3 - * - SimulateTxAccessorContract_v1_3_0_Web3 extends SimulateTxAccessorBaseContractWeb3 - */ -abstract class SimulateTxAccessorBaseContractWeb3< - SimulateTxAccessorContractAbiType extends AbiItem[] -> extends SimulateTxAccessorBaseContract { - contract: Contract - adapter: Web3Adapter - - /** - * @constructor - * Constructs an instance of SimulateTxAccessorBaseContractWeb3. - * - * @param chainId - The chain ID of the contract. - * @param web3Adapter - An instance of Web3Adapter. - * @param defaultAbi - The default ABI for the SimulateTxAccessor contract. It should be compatible with the specific version of the contract. - * @param safeVersion - The version of the Safe contract. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the ABI is derived from the Safe deployments or the defaultAbi is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - defaultAbi: SimulateTxAccessorContractAbiType, - safeVersion: SafeVersion, - customContractAddress?: string, - customContractAbi?: SimulateTxAccessorContractAbiType - ) { - super(chainId, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.adapter = web3Adapter - this.contract = web3Adapter.getContract(this.contractAddress, this.contractAbi) - } -} - -export default SimulateTxAccessorBaseContractWeb3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Web3.ts deleted file mode 100644 index f25f9b8a1..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Web3.ts +++ /dev/null @@ -1,76 +0,0 @@ -import SimulateTxAccessorBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractWeb3' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import SimulateTxAccessorContract_v1_3_0_Contract, { - SimulateTxAccessorContract_v1_3_0_Abi -} from '@safe-global/protocol-kit/contracts/AbiType/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0' -import SimulateTxAccessor_1_3_0_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/SimulateTxAccessor/v1.3.0/simulate_tx_accessor' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import { - EncodeSimulateTxAccessorFunction, - GetAddressSimulateTxAccessorFunction -} from '@safe-global/protocol-kit/contracts/AbiType/SimulateTxAccessor/SimulateTxAccessorBaseContract' -import { DeepWriteable } from '@safe-global/protocol-kit/adapters/web3/types' - -/** - * SimulateTxAccessorContract_v1_3_0_Web3 is the implementation specific to the SimulateTxAccessor contract version 1.3.0. - * - * This class specializes in handling interactions with the SimulateTxAccessor contract version 1.3.0 using Web3.js. - * - * @extends SimulateTxAccessorBaseContractWeb3 - Inherits from SimulateTxAccessorBaseContractWeb3 with ABI specific to SimulateTxAccessor contract version 1.3.0. - * @implements SimulateTxAccessorContract_v1_3_0_Contract - Implements the interface specific to SimulateTxAccessor contract version 1.3.0. - */ -class SimulateTxAccessorContract_v1_3_0_Web3 - extends SimulateTxAccessorBaseContractWeb3> - implements SimulateTxAccessorContract_v1_3_0_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SimulateTxAccessorContract_v1_3_0_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SimulateTxAccessor deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: SimulateTxAccessorContract_v1_3_0_Abi - ) { - const safeVersion = '1.3.0' - const defaultAbi = - SimulateTxAccessor_1_3_0_ContractArtifacts.abi as DeepWriteable - - super( - chainId, - web3Adapter, - defaultAbi, - safeVersion, - customContractAddress, - customContractAbi as DeepWriteable - ) - - this.safeVersion = safeVersion - } - - getAddress: GetAddressSimulateTxAccessorFunction = () => { - return Promise.resolve(this.contract.options.address) - } - - encode: EncodeSimulateTxAccessorFunction = ( - functionToEncode, - args - ) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } - - simulate: SimulateTxAccessorContract_v1_3_0_Contract['simulate'] = ( - args: readonly [to: string, value: bigint, data: string, operation: number] - ) => { - return this.contract.methods.simulate(...args).call() - } -} - -export default SimulateTxAccessorContract_v1_3_0_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Web3.ts deleted file mode 100644 index de8ffcb4d..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Web3.ts +++ /dev/null @@ -1,76 +0,0 @@ -import SimulateTxAccessorBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractWeb3' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import SimulateTxAccessorContract_v1_4_1_Contract, { - SimulateTxAccessorContract_v1_4_1_Abi -} from '@safe-global/protocol-kit/contracts/AbiType/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1' -import SimulateTxAccessor_1_4_1_ContractArtifacts from '@safe-global/protocol-kit/contracts/AbiType/assets/SimulateTxAccessor/v1.4.1/simulate_tx_accessor' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import { - EncodeSimulateTxAccessorFunction, - GetAddressSimulateTxAccessorFunction -} from '@safe-global/protocol-kit/contracts/AbiType/SimulateTxAccessor/SimulateTxAccessorBaseContract' -import { DeepWriteable } from '@safe-global/protocol-kit/adapters/web3/types' - -/** - * SimulateTxAccessorContract_v1_4_1_Web3 is the implementation specific to the SimulateTxAccessor contract version 1.4.1. - * - * This class specializes in handling interactions with the SimulateTxAccessor contract version 1.4.1 using Web3.js. - * - * @extends SimulateTxAccessorBaseContractWeb3 - Inherits from SimulateTxAccessorBaseContractWeb3 with ABI specific to SimulateTxAccessor contract version 1.4.1. - * @implements SimulateTxAccessorContract_v1_4_1_Contract - Implements the interface specific to SimulateTxAccessor contract version 1.4.1. - */ -class SimulateTxAccessorContract_v1_4_1_Web3 - extends SimulateTxAccessorBaseContractWeb3> - implements SimulateTxAccessorContract_v1_4_1_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SimulateTxAccessorContract_v1_4_1_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SimulateTxAccessor deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: SimulateTxAccessorContract_v1_4_1_Abi - ) { - const safeVersion = '1.4.1' - const defaultAbi = - SimulateTxAccessor_1_4_1_ContractArtifacts.abi as DeepWriteable - - super( - chainId, - web3Adapter, - defaultAbi, - safeVersion, - customContractAddress, - customContractAbi as DeepWriteable - ) - - this.safeVersion = safeVersion - } - - getAddress: GetAddressSimulateTxAccessorFunction = () => { - return Promise.resolve(this.contract.options.address) - } - - encode: EncodeSimulateTxAccessorFunction = ( - functionToEncode, - args - ) => { - return this.contract.methods[functionToEncode](...args).encodeABI() - } - - simulate: SimulateTxAccessorContract_v1_4_1_Contract['simulate'] = ( - args: readonly [to: string, value: bigint, data: string, operation: number] - ) => { - return this.contract.methods.simulate(...args).call() - } -} - -export default SimulateTxAccessorContract_v1_4_1_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/contractInstancesWeb3.ts b/packages/protocol-kit/src/adapters/web3/contracts/contractInstancesWeb3.ts deleted file mode 100644 index dec034eb5..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/contractInstancesWeb3.ts +++ /dev/null @@ -1,377 +0,0 @@ -import { AbiItem } from 'web3-utils' -import SafeContract_v1_0_0_Web3 from '@safe-global/protocol-kit/adapters/web3/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Web3' -import SafeContract_v1_1_1_Web3 from '@safe-global/protocol-kit/adapters/web3/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Web3' -import SafeContract_v1_2_0_Web3 from '@safe-global/protocol-kit/adapters/web3/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Web3' -import SafeContract_v1_3_0_Web3 from '@safe-global/protocol-kit/adapters/web3/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Web3' -import SafeContract_v1_4_1_Web3 from '@safe-global/protocol-kit/adapters/web3/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Web3' -import SafeProxyFactoryContract_v1_0_0_Web3 from '@safe-global/protocol-kit/adapters/web3/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Web3' -import SafeProxyFactoryContract_v1_1_1_Web3 from '@safe-global/protocol-kit/adapters/web3/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Web3' -import SafeProxyFactoryContract_v1_3_0_Web3 from '@safe-global/protocol-kit/adapters/web3/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Web3' -import SafeProxyFactoryContract_v1_4_1_Web3 from '@safe-global/protocol-kit/adapters/web3/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Web3' -import SimulateTxAccessorContract_v1_3_0_Web3 from '@safe-global/protocol-kit/adapters/web3/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Web3' -import SimulateTxAccessorContract_v1_4_1_Web3 from '@safe-global/protocol-kit/adapters/web3/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Web3' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { SafeContract_v1_0_0_Abi } from '@safe-global/protocol-kit/contracts/AbiType/Safe/v1.0.0/SafeContract_v1_0_0' -import { SafeContract_v1_1_1_Abi } from '@safe-global/protocol-kit/contracts/AbiType/Safe/v1.1.1/SafeContract_v1_1_1' -import { SafeContract_v1_2_0_Abi } from '@safe-global/protocol-kit/contracts/AbiType/Safe/v1.2.0/SafeContract_v1_2_0' -import { SafeContract_v1_3_0_Abi } from '@safe-global/protocol-kit/contracts/AbiType/Safe/v1.3.0/SafeContract_v1_3_0' -import { SafeContract_v1_4_1_Abi } from '@safe-global/protocol-kit/contracts/AbiType/Safe/v1.4.1/SafeContract_v1_4_1' -import { SafeProxyFactoryContract_v1_0_0_Abi } from '@safe-global/protocol-kit/contracts/AbiType/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0' -import { SafeProxyFactoryContract_v1_1_1_Abi } from '@safe-global/protocol-kit/contracts/AbiType/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1' -import { SafeProxyFactoryContract_v1_3_0_Abi } from '@safe-global/protocol-kit/contracts/AbiType/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0' -import { SafeProxyFactoryContract_v1_4_1_Abi } from '@safe-global/protocol-kit/contracts/AbiType/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1' -import { Compatibility_fallback_handler as CompatibilityFallbackHandler_V1_3_0 } from '@safe-global/protocol-kit/typechain/src/web3-v1/v1.3.0/Compatibility_fallback_handler' -import { Compatibility_fallback_handler as CompatibilityFallbackHandler_V1_4_1 } from '@safe-global/protocol-kit/typechain/src/web3-v1/v1.4.1/Compatibility_fallback_handler' -import { - CreateCallContract, - SafeVersion, - SignMessageLibContract, - SimulateTxAccessorContract -} from '@safe-global/safe-core-sdk-types' -import CompatibilityFallbackHandler_V1_3_0_Web3 from './CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandler_V1_3_0_Web3' -import CompatibilityFallbackHandler_V1_4_1_Web3 from './CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandler_V1_4_1_Web3' -import CreateCallContract_V1_3_0_Web3 from './CreateCall/v1.3.0/CreateCallContract_v1_3_0_Web3' -import CreateCallContract_V1_4_1_Web3 from './CreateCall/v1.4.1/CreateCallContract_v1_4_1_Web3' -import MultiSendContract_V1_1_1_Web3 from './MultiSend/v1.1.1/MultiSendContract_V1_1_1_Web3' -import MultiSendContract_V1_3_0_Web3 from './MultiSend/v1.3.0/MultiSendContract_V1_3_0_Web3' -import MultiSendContract_V1_4_1_Web3 from './MultiSend/v1.4.1/MultiSendContract_V1_4_1_Web3' -import MultiSendCallOnlyContract_V1_3_0_Web3 from './MultiSend/v1.3.0/MultiSendCallOnlyContract_V1_3_0_Web3' -import MultiSendCallOnlyContract_V1_4_1_Web3 from './MultiSend/v1.4.1/MultiSendCallOnlyContract_V1_4_1_Web3' -import SignMessageLibContract_v1_3_0_Web3 from './SignMessageLib/v1.3.0/SignMessageLibContract_V1_3_0_Web3' -import SignMessageLibContract_v1_4_1_Web3 from './SignMessageLib/v1.4.1/SignMessageLibContract_V1_4_1_Web3' -import { CreateCallContract_v1_4_1_Abi } from '@safe-global/protocol-kit/contracts/AbiType/CreateCall/v1.4.1/CreateCallContract_v1_4_1' -import { CreateCallContract_v1_3_0_Abi } from '@safe-global/protocol-kit/contracts/AbiType/CreateCall/v1.3.0/CreateCallContract_v1_3_0' -import { MultiSendContract_v1_4_1_Abi as MultiSendContract_v1_4_1_Abi_Readonly } from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/v1.4.1/MultiSendContract_v1_4_1' -import { MultiSendContract_v1_3_0_Abi as MultiSendContract_v1_3_0_Abi_Readonly } from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/v1.3.0/MultiSendContract_v1_3_0' -import { MultiSendContract_v1_1_1_Abi as MultiSendContract_v1_1_1_Abi_Readonly } from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/v1.1.1/MultiSendContract_v1_1_1' -import { MultiSendCallOnlyContract_v1_3_0_Abi as MultiSendCallOnlyContract_v1_3_0_Abi_Readonly } from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0' -import { MultiSendCallOnlyContract_v1_4_1_Abi as MultiSendCallOnlyContract_v1_4_1_Abi_Readonly } from '@safe-global/protocol-kit/contracts/AbiType/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1' -import { SignMessageLibContract_v1_4_1_Abi as SignMessageLibContract_v1_4_1_Abi_Readonly } from '@safe-global/protocol-kit/contracts/AbiType/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1' -import { SignMessageLibContract_v1_3_0_Abi as SignMessageLibContract_v1_3_0_Abi_Readonly } from '@safe-global/protocol-kit/contracts/AbiType/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0' -import { SimulateTxAccessorContract_v1_3_0_Abi } from '@safe-global/protocol-kit/contracts/AbiType/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0' -import { SimulateTxAccessorContract_v1_4_1_Abi } from '@safe-global/protocol-kit/contracts/AbiType/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1' -import { DeepWriteable } from '@safe-global/protocol-kit/adapters/web3/types' - -type MultiSendContract_v1_1_1_Abi = DeepWriteable -type MultiSendContract_v1_3_0_Abi = DeepWriteable -type MultiSendContract_v1_4_1_Abi = DeepWriteable -type MultiSendCallOnlyContract_v1_3_0_Abi = - DeepWriteable -type MultiSendCallOnlyContract_v1_4_1_Abi = - DeepWriteable -type SignMessageLibContract_v1_3_0_Abi = DeepWriteable -type SignMessageLibContract_v1_4_1_Abi = DeepWriteable - -export async function getSafeContractInstance( - safeVersion: SafeVersion, - contractAddress: string, - web3Adapter: Web3Adapter, - customContractAbi?: AbiItem | AbiItem[] | undefined, - isL1SafeSingleton?: boolean - // TODO return type used until Typechain is removed -): Promise { - const chainId = await web3Adapter.getChainId() - let safeContract - switch (safeVersion) { - case '1.4.1': - safeContract = new SafeContract_v1_4_1_Web3( - chainId, - web3Adapter, - isL1SafeSingleton, - contractAddress, - // TODO: Remove this unknown after remove Typechain - customContractAbi as unknown as SafeContract_v1_4_1_Abi - ) - // TODO: Remove this mapper after remove typechain - return safeContract.mapToTypechainContract() - case '1.3.0': - safeContract = new SafeContract_v1_3_0_Web3( - chainId, - web3Adapter, - isL1SafeSingleton, - contractAddress, - // TODO: Remove this unknown after remove Typechain - customContractAbi as unknown as SafeContract_v1_3_0_Abi - ) - // TODO: Remove this mapper after remove typechain - return safeContract.mapToTypechainContract() - case '1.2.0': - safeContract = new SafeContract_v1_2_0_Web3( - chainId, - web3Adapter, - isL1SafeSingleton, - contractAddress, - // TODO: Remove this unknown after remove Typechain - customContractAbi as unknown as SafeContract_v1_2_0_Abi - ) - // TODO: Remove this mapper after remove typechain - return safeContract.mapToTypechainContract() - case '1.1.1': - safeContract = new SafeContract_v1_1_1_Web3( - chainId, - web3Adapter, - isL1SafeSingleton, - contractAddress, - // TODO: Remove this unknown after remove Typechain - customContractAbi as unknown as SafeContract_v1_1_1_Abi - ) - // TODO: Remove this mapper after remove typechain - return safeContract.mapToTypechainContract() - case '1.0.0': - safeContract = new SafeContract_v1_0_0_Web3( - chainId, - web3Adapter, - isL1SafeSingleton, - contractAddress, - // TODO: Remove this unknown after remove Typechain - customContractAbi as unknown as SafeContract_v1_0_0_Abi - ) - // TODO: Remove this mapper after remove typechain - return safeContract.mapToTypechainContract() - default: - throw new Error('Invalid Safe version') - } -} - -export function getCompatibilityFallbackHandlerContractInstance( - safeVersion: SafeVersion, - compatibilityFallbackhandlerContract: - | CompatibilityFallbackHandler_V1_4_1 - | CompatibilityFallbackHandler_V1_3_0 -): CompatibilityFallbackHandler_V1_4_1_Web3 | CompatibilityFallbackHandler_V1_3_0_Web3 { - switch (safeVersion) { - case '1.4.1': - return new CompatibilityFallbackHandler_V1_4_1_Web3( - compatibilityFallbackhandlerContract as CompatibilityFallbackHandler_V1_4_1 - ) - case '1.3.0': - case '1.2.0': - case '1.1.1': - return new CompatibilityFallbackHandler_V1_3_0_Web3( - compatibilityFallbackhandlerContract as CompatibilityFallbackHandler_V1_3_0 - ) - default: - throw new Error('Invalid Safe version') - } -} - -export async function getMultiSendContractInstance( - safeVersion: SafeVersion, - contractAddress: string, - web3Adapter: Web3Adapter, - customContractAbi?: AbiItem | AbiItem[] | undefined -): Promise< - MultiSendContract_V1_4_1_Web3 | MultiSendContract_V1_3_0_Web3 | MultiSendContract_V1_1_1_Web3 -> { - const chainId = await web3Adapter.getChainId() - switch (safeVersion) { - case '1.4.1': - return new MultiSendContract_V1_4_1_Web3( - chainId, - web3Adapter, - contractAddress, - customContractAbi as unknown as MultiSendContract_v1_4_1_Abi - ) - case '1.3.0': - return new MultiSendContract_V1_3_0_Web3( - chainId, - web3Adapter, - contractAddress, - customContractAbi as unknown as MultiSendContract_v1_3_0_Abi - ) - case '1.2.0': - case '1.1.1': - case '1.0.0': - return new MultiSendContract_V1_1_1_Web3( - chainId, - web3Adapter, - contractAddress, - customContractAbi as unknown as MultiSendContract_v1_1_1_Abi - ) - default: - throw new Error('Invalid Safe version') - } -} - -export async function getMultiSendCallOnlyContractInstance( - safeVersion: SafeVersion, - contractAddress: string, - web3Adapter: Web3Adapter, - customContractAbi?: AbiItem | AbiItem[] | undefined -): Promise { - const chainId = await web3Adapter.getChainId() - switch (safeVersion) { - case '1.4.1': - return new MultiSendCallOnlyContract_V1_4_1_Web3( - chainId, - web3Adapter, - contractAddress, - customContractAbi as unknown as MultiSendCallOnlyContract_v1_4_1_Abi - ) - case '1.3.0': - case '1.2.0': - case '1.1.1': - case '1.0.0': - return new MultiSendCallOnlyContract_V1_3_0_Web3( - chainId, - web3Adapter, - contractAddress, - customContractAbi as unknown as MultiSendCallOnlyContract_v1_3_0_Abi - ) - default: - throw new Error('Invalid Safe version') - } -} - -export async function getSafeProxyFactoryContractInstance( - safeVersion: SafeVersion, - contractAddress: string, - web3Adapter: Web3Adapter, - customContractAbi?: AbiItem | AbiItem[] | undefined -) { - const chainId = await web3Adapter.getChainId() - let safeProxyFactoryContract - - switch (safeVersion) { - case '1.4.1': - safeProxyFactoryContract = new SafeProxyFactoryContract_v1_4_1_Web3( - chainId, - web3Adapter, - contractAddress, - // TODO: Remove this unknown after remove Typechain - customContractAbi as unknown as SafeProxyFactoryContract_v1_4_1_Abi - ) - return safeProxyFactoryContract.mapToTypechainContract() // remove this mapper after remove typechain - case '1.3.0': - safeProxyFactoryContract = new SafeProxyFactoryContract_v1_3_0_Web3( - chainId, - web3Adapter, - contractAddress, - // TODO: Remove this unknown after remove Typechain - customContractAbi as unknown as SafeProxyFactoryContract_v1_3_0_Abi - ) - return safeProxyFactoryContract.mapToTypechainContract() // remove this mapper after remove typechain - case '1.2.0': - case '1.1.1': - safeProxyFactoryContract = new SafeProxyFactoryContract_v1_1_1_Web3( - chainId, - web3Adapter, - contractAddress, - // TODO: Remove this unknown after remove Typechain - customContractAbi as unknown as SafeProxyFactoryContract_v1_1_1_Abi - ) - return safeProxyFactoryContract.mapToTypechainContract() // remove this mapper after remove typechain - case '1.0.0': - safeProxyFactoryContract = new SafeProxyFactoryContract_v1_0_0_Web3( - chainId, - web3Adapter, - contractAddress, - // TODO: Remove this unknown after remove Typechain - customContractAbi as unknown as SafeProxyFactoryContract_v1_0_0_Abi - ) - return safeProxyFactoryContract.mapToTypechainContract() // remove this mapper after remove typechain - default: - throw new Error('Invalid Safe version') - } -} - -export async function getSignMessageLibContractInstance( - safeVersion: SafeVersion, - contractAddress: string, - web3Adapter: Web3Adapter, - customContractAbi?: AbiItem | AbiItem[] | undefined -): Promise { - const chainId = await web3Adapter.getChainId() - let signMessageLibContract - - switch (safeVersion) { - case '1.4.1': - signMessageLibContract = new SignMessageLibContract_v1_4_1_Web3( - chainId, - web3Adapter, - contractAddress, - customContractAbi as unknown as SignMessageLibContract_v1_4_1_Abi - ) - - // TODO: Remove this mapper after remove typechain - return signMessageLibContract.mapToTypechainContract() - case '1.3.0': - signMessageLibContract = new SignMessageLibContract_v1_3_0_Web3( - chainId, - web3Adapter, - contractAddress, - customContractAbi as unknown as SignMessageLibContract_v1_3_0_Abi - ) - - // TODO: Remove this mapper after remove typechain - return signMessageLibContract.mapToTypechainContract() - default: - throw new Error('Invalid Safe version') - } -} - -export async function getCreateCallContractInstance( - safeVersion: SafeVersion, - contractAddress: string, - web3Adapter: Web3Adapter, - customContractAbi?: AbiItem | AbiItem[] | undefined -): Promise { - const chainId = await web3Adapter.getChainId() - let createCallContract - - switch (safeVersion) { - case '1.4.1': - createCallContract = new CreateCallContract_V1_4_1_Web3( - chainId, - web3Adapter, - contractAddress, - customContractAbi as unknown as CreateCallContract_v1_4_1_Abi - ) - - // TODO: Remove this mapper after remove typechain - return createCallContract.mapToTypechainContract() - case '1.3.0': - case '1.2.0': - case '1.1.1': - case '1.0.0': - createCallContract = new CreateCallContract_V1_3_0_Web3( - chainId, - web3Adapter, - contractAddress, - customContractAbi as unknown as CreateCallContract_v1_3_0_Abi - ) - - // TODO: Remove this mapper after remove typechain - return createCallContract.mapToTypechainContract() - default: - throw new Error('Invalid Safe version') - } -} - -export async function getSimulateTxAccessorContractInstance( - safeVersion: SafeVersion, - contractAddress: string, - web3Adapter: Web3Adapter, - customContractAbi?: AbiItem | AbiItem[] | undefined -): Promise { - const chainId = await web3Adapter.getChainId() - - switch (safeVersion) { - case '1.4.1': - return new SimulateTxAccessorContract_v1_4_1_Web3( - chainId, - web3Adapter, - contractAddress, - customContractAbi as unknown as SimulateTxAccessorContract_v1_4_1_Abi - ) - case '1.3.0': - return new SimulateTxAccessorContract_v1_3_0_Web3( - chainId, - web3Adapter, - contractAddress, - customContractAbi as unknown as SimulateTxAccessorContract_v1_3_0_Abi - ) - default: - throw new Error('Invalid Safe version') - } -} diff --git a/packages/protocol-kit/src/adapters/web3/index.ts b/packages/protocol-kit/src/adapters/web3/index.ts deleted file mode 100644 index 8318273e0..000000000 --- a/packages/protocol-kit/src/adapters/web3/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -import Web3Adapter, { Web3AdapterConfig } from './Web3Adapter' -import CreateCallBaseContractWeb3 from './contracts/CreateCall/CreateCallBaseContractWeb3' -import MultiSendBaseContractWeb3 from './contracts/MultiSend/MultiSendBaseContractWeb3' -import MultiSendCallOnlyBaseContractWeb3 from './contracts/MultiSend/MultiSendCallOnlyBaseContractWeb3' -import SafeContractWeb3 from './contracts/Safe/SafeContractWeb3' -import SafeProxyFactoryBaseContractWeb3 from './contracts/SafeProxyFactory/SafeProxyFactoryBaseContractWeb3' -import SignMessageLibBaseContractWeb3 from './contracts/SignMessageLib/SignMessageLibBaseContractWeb3' -import { Web3TransactionOptions, Web3TransactionResult } from './types' - -export { - CreateCallBaseContractWeb3, - MultiSendCallOnlyBaseContractWeb3, - MultiSendBaseContractWeb3, - SafeContractWeb3, - SafeProxyFactoryBaseContractWeb3, - SignMessageLibBaseContractWeb3, - Web3Adapter, - Web3AdapterConfig, - Web3TransactionOptions, - Web3TransactionResult -} diff --git a/packages/protocol-kit/src/adapters/web3/types.ts b/packages/protocol-kit/src/adapters/web3/types.ts deleted file mode 100644 index af01ceb97..000000000 --- a/packages/protocol-kit/src/adapters/web3/types.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { BaseTransactionResult } from '@safe-global/safe-core-sdk-types' -import { PromiEvent, TransactionReceipt } from 'web3-core/types' - -export interface Web3TransactionOptions { - from?: string - gas?: number | string - gasPrice?: number | string - maxFeePerGas?: number | string - maxPriorityFeePerGas?: number | string - nonce?: number -} - -export interface Web3TransactionResult extends BaseTransactionResult { - promiEvent: PromiEvent - options?: Web3TransactionOptions -} - -/** - * Removes `readonly` modifier from all properties in T recursively. - * - * @template T - The type to make writable. - */ -export type DeepWriteable = T extends object & NotFunction - ? { -readonly [K in keyof T]: DeepWriteable } - : T - -type Not = T extends U ? never : T -type NotFunction = Not any> diff --git a/packages/protocol-kit/src/adapters/web3/utils/constants.ts b/packages/protocol-kit/src/adapters/web3/utils/constants.ts deleted file mode 100644 index b8a31c39f..000000000 --- a/packages/protocol-kit/src/adapters/web3/utils/constants.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const ZERO_ADDRESS = `0x${'0'.repeat(40)}` -export const EMPTY_DATA = '0x' -export const SENTINEL_ADDRESS = '0x0000000000000000000000000000000000000001' diff --git a/packages/protocol-kit/src/adapters/web3/utils/index.ts b/packages/protocol-kit/src/adapters/web3/utils/index.ts deleted file mode 100644 index 2c36e0712..000000000 --- a/packages/protocol-kit/src/adapters/web3/utils/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { PromiEvent, TransactionReceipt } from 'web3-core/types' -import { - Web3TransactionOptions, - Web3TransactionResult -} from '@safe-global/protocol-kit/adapters/web3/types' - -export function sameString(str1: string, str2: string): boolean { - return str1.toLowerCase() === str2.toLowerCase() -} - -export async function toTxResult( - promiEvent: PromiEvent, - options?: Web3TransactionOptions -): Promise { - return new Promise((resolve, reject) => - promiEvent - .once('transactionHash', (hash: string) => resolve({ hash, promiEvent, options })) - .catch(reject) - ) -} diff --git a/packages/protocol-kit/src/contracts/AbiType/CreateCall/CreateCallBaseContract.ts b/packages/protocol-kit/src/contracts/AbiType/CreateCall/CreateCallBaseContract.ts index ec7ac24e0..a41588687 100644 --- a/packages/protocol-kit/src/contracts/AbiType/CreateCall/CreateCallBaseContract.ts +++ b/packages/protocol-kit/src/contracts/AbiType/CreateCall/CreateCallBaseContract.ts @@ -9,11 +9,6 @@ import { EthersTransactionOptions, EthersTransactionResult } from '@safe-global/protocol-kit/adapters/ethers' -import { - Web3TransactionOptions, - Web3TransactionResult -} from '@safe-global/protocol-kit/adapters/web3' - /** * Encodes a function call for a CreateCall contract. * @@ -42,7 +37,7 @@ export type GetAddressCreateCallFunction = () => Promise */ export type EstimateGasCreateCallFunction< CreateCallContractAbi extends Abi, // Abi of the CreateCall Contract, - TransactionOptions extends EthersTransactionOptions | Web3TransactionOptions, + TransactionOptions extends EthersTransactionOptions, CreateCallFunction extends ExtractAbiFunctionNames = ExtractAbiFunctionNames > = ( @@ -70,13 +65,13 @@ export type CreateCallContractReadFunctions = */ export type PerformCreateFunction< CreateCallContractAbi extends Abi, // Abi of the CreateCall Contract, - TransactionOptions extends EthersTransactionOptions | Web3TransactionOptions + TransactionOptions extends EthersTransactionOptions > = ( args: AbiParametersToPrimitiveTypes< ExtractAbiFunction['inputs'] >, options?: TransactionOptions -) => Promise +) => Promise /** * Deploys a new contract using the create2 opcode. @@ -85,13 +80,13 @@ export type PerformCreateFunction< */ export type PerformCreate2Function< CreateCallContractAbi extends Abi, // Abi of the CreateCall Contract, - TransactionOptions extends EthersTransactionOptions | Web3TransactionOptions + TransactionOptions extends EthersTransactionOptions > = ( args: AbiParametersToPrimitiveTypes< ExtractAbiFunction['inputs'] >, options?: TransactionOptions -) => Promise +) => Promise type CreateCallBaseContract = { [ProxyFactoryFunction in CreateCallContractReadFunctions]: ( @@ -111,18 +106,9 @@ type CreateCallBaseContract = { safeVersion: SafeVersion encode: EncodeCreateCallFunction getAddress: GetAddressCreateCallFunction - estimateGas: EstimateGasCreateCallFunction< - CreateCallContractAbi, - EthersTransactionOptions | Web3TransactionOptions - > - performCreate: PerformCreateFunction< - CreateCallContractAbi, - EthersTransactionOptions | Web3TransactionOptions - > - performCreate2: PerformCreate2Function< - CreateCallContractAbi, - EthersTransactionOptions | Web3TransactionOptions - > + estimateGas: EstimateGasCreateCallFunction + performCreate: PerformCreateFunction + performCreate2: PerformCreate2Function } export default CreateCallBaseContract diff --git a/packages/protocol-kit/src/contracts/AbiType/Safe/SafeBaseContract.ts b/packages/protocol-kit/src/contracts/AbiType/Safe/SafeBaseContract.ts index d451be4c3..f6599b4fa 100644 --- a/packages/protocol-kit/src/contracts/AbiType/Safe/SafeBaseContract.ts +++ b/packages/protocol-kit/src/contracts/AbiType/Safe/SafeBaseContract.ts @@ -1,5 +1,4 @@ import { EthersTransactionOptions } from '@safe-global/protocol-kit/adapters/ethers' -import { Web3TransactionOptions } from '@safe-global/protocol-kit/adapters/web3' import { Abi, AbiParametersToPrimitiveTypes, @@ -72,7 +71,7 @@ export type EncodeSafeFunction< */ export type EstimateGasSafeFunction< SafeContractAbi extends Abi, // Abi of the Safe Contract, - TransactionOptions extends EthersTransactionOptions | Web3TransactionOptions, + TransactionOptions extends EthersTransactionOptions, SafeFunction extends ExtractAbiFunctionNames = ExtractAbiFunctionNames > = ( @@ -108,10 +107,7 @@ type SafeBaseContract = { } & { safeVersion: SafeVersion encode: EncodeSafeFunction - estimateGas: EstimateGasSafeFunction< - SafeContractAbi, - EthersTransactionOptions | Web3TransactionOptions - > + estimateGas: EstimateGasSafeFunction } export default SafeBaseContract diff --git a/packages/protocol-kit/src/contracts/AbiType/SafeProxyFactory/SafeProxyFactoryBaseContract.ts b/packages/protocol-kit/src/contracts/AbiType/SafeProxyFactory/SafeProxyFactoryBaseContract.ts index 96eac92a7..686dbaa84 100644 --- a/packages/protocol-kit/src/contracts/AbiType/SafeProxyFactory/SafeProxyFactoryBaseContract.ts +++ b/packages/protocol-kit/src/contracts/AbiType/SafeProxyFactory/SafeProxyFactoryBaseContract.ts @@ -5,7 +5,6 @@ import { ExtractAbiFunctionNames } from 'abitype' import { EthersTransactionOptions } from '@safe-global/protocol-kit/adapters/ethers' -import { Web3TransactionOptions } from '@safe-global/protocol-kit/adapters/web3' import { SafeVersion } from '@safe-global/safe-core-sdk-types' /** @@ -52,7 +51,7 @@ export type EncodeSafeProxyFactoryFunction< */ export type EstimateGasSafeProxyFactoryFunction< SafeProxyFactoryContractAbi extends Abi, // Abi of the Safe Proxy Factory Contract, - TransactionOptions extends EthersTransactionOptions | Web3TransactionOptions, + TransactionOptions extends EthersTransactionOptions, ProxyFactoryFunction extends ExtractAbiFunctionNames = ExtractAbiFunctionNames > = ( @@ -91,7 +90,7 @@ type SafeProxyFactoryBaseContract = { encode: EncodeSafeProxyFactoryFunction estimateGas: EstimateGasSafeProxyFactoryFunction< SafeProxyFactoryContractAbi, - EthersTransactionOptions | Web3TransactionOptions + EthersTransactionOptions > } diff --git a/packages/protocol-kit/src/contracts/AbiType/SignMessageLib/SignMessageLibBaseContract.ts b/packages/protocol-kit/src/contracts/AbiType/SignMessageLib/SignMessageLibBaseContract.ts index 361196a59..9b1d8ba49 100644 --- a/packages/protocol-kit/src/contracts/AbiType/SignMessageLib/SignMessageLibBaseContract.ts +++ b/packages/protocol-kit/src/contracts/AbiType/SignMessageLib/SignMessageLibBaseContract.ts @@ -2,10 +2,6 @@ import { EthersTransactionOptions, EthersTransactionResult } from '@safe-global/protocol-kit/adapters/ethers' -import { - Web3TransactionOptions, - Web3TransactionResult -} from '@safe-global/protocol-kit/adapters/web3' import { Abi, AbiParametersToPrimitiveTypes, @@ -58,7 +54,7 @@ export type EncodeSignMessageLibFunction< */ export type EstimateGasSignMessageLibFunction< SignMessageLibContractAbi extends Abi, // Abi of the SignMessageLib Contract, - TransactionOptions extends EthersTransactionOptions | Web3TransactionOptions, + TransactionOptions extends EthersTransactionOptions, SignMessageLibFunction extends ExtractAbiFunctionNames = ExtractAbiFunctionNames > = ( @@ -77,13 +73,13 @@ export type EstimateGasSignMessageLibFunction< */ export type SignMessageFunction< SignMessageLibContractAbi extends Abi, // Abi of the SignMessageLib Contract, - TransactionOptions extends EthersTransactionOptions | Web3TransactionOptions + TransactionOptions extends EthersTransactionOptions > = ( args: AbiParametersToPrimitiveTypes< ExtractAbiFunction['inputs'] >, options?: TransactionOptions -) => Promise +) => Promise export type GetAddressSignMessageLibFunction = () => Promise @@ -108,12 +104,9 @@ type SignMessageLibBaseContract = { getAddress: GetAddressSignMessageLibFunction estimateGas: EstimateGasSignMessageLibFunction< SignMessageLibContractAbi, - EthersTransactionOptions | Web3TransactionOptions - > - signMessage: SignMessageFunction< - SignMessageLibContractAbi, - EthersTransactionOptions | Web3TransactionOptions + EthersTransactionOptions > + signMessage: SignMessageFunction } export default SignMessageLibBaseContract diff --git a/packages/protocol-kit/src/index.ts b/packages/protocol-kit/src/index.ts index b2d17473a..ecdc92333 100644 --- a/packages/protocol-kit/src/index.ts +++ b/packages/protocol-kit/src/index.ts @@ -11,18 +11,6 @@ import { SafeProxyFactoryBaseContractEthers, SignMessageLibBaseContractEthers } from './adapters/ethers' -import { - CreateCallBaseContractWeb3, - MultiSendBaseContractWeb3, - MultiSendCallOnlyBaseContractWeb3, - SafeContractWeb3, - SafeProxyFactoryBaseContractWeb3, - SignMessageLibBaseContractWeb3, - Web3Adapter, - Web3AdapterConfig, - Web3TransactionOptions, - Web3TransactionResult -} from './adapters/web3' import { DEFAULT_SAFE_VERSION } from './contracts/config' import { getCompatibilityFallbackHandlerContract, @@ -104,7 +92,6 @@ export { ContractManager, ContractNetworksConfig, CreateCallBaseContractEthers, - CreateCallBaseContractWeb3, createERC20TokenTransferTransaction, CreateTransactionProps, DEFAULT_SAFE_VERSION, @@ -115,9 +102,7 @@ export { EthersTransactionOptions, EthersTransactionResult, MultiSendCallOnlyBaseContractEthers, - MultiSendCallOnlyBaseContractWeb3, MultiSendBaseContractEthers, - MultiSendBaseContractWeb3, PREDETERMINED_SALT_NONCE, PredictedSafeProps, RemoveOwnerTxParams, @@ -126,22 +111,15 @@ export { SafeConfigWithPredictedSafe, SafeConfigWithSafeAddress, SafeContractEthers, - SafeContractWeb3, SafeDeploymentConfig, SafeFactory, SafeFactoryConfig, SafeProxyFactoryBaseContractEthers, - SafeProxyFactoryBaseContractWeb3, SafeTransactionOptionalProps, SignMessageLibBaseContractEthers, - SignMessageLibBaseContractWeb3, StandardizeSafeTransactionDataProps, SwapOwnerTxParams, SigningMethod, - Web3Adapter, - Web3AdapterConfig, - Web3TransactionOptions, - Web3TransactionResult, encodeCreateProxyWithNonce, encodeMultiSendData, encodeSetupCallData, diff --git a/yarn.lock b/yarn.lock index 27e1b0d3c..cb0cfbe04 100644 --- a/yarn.lock +++ b/yarn.lock @@ -397,14 +397,6 @@ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.56.0.tgz#ef20350fec605a7f7035a01764731b2de0f3782b" integrity sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A== -"@ethereumjs/common@2.6.5", "@ethereumjs/common@^2.6.4": - version "2.6.5" - resolved "https://registry.npmjs.org/@ethereumjs/common/-/common-2.6.5.tgz" - integrity sha512-lRyVQOeCDaIVtgfbowla32pzeDv2Obr8oR8Put5RdUBNRGr1VGPGQNGP6elWIpgK3YdpzqTOh4GyUGOureVeeA== - dependencies: - crc-32 "^1.2.0" - ethereumjs-util "^7.1.5" - "@ethereumjs/common@^3.2.0": version "3.2.0" resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-3.2.0.tgz#b71df25845caf5456449163012074a55f048e0a0" @@ -431,14 +423,6 @@ resolved "https://registry.yarnpkg.com/@ethereumjs/rlp/-/rlp-5.0.1.tgz#56c5433b9242f956e354fd7e4ce3523815e24854" integrity sha512-Ab/Hfzz+T9Zl+65Nkg+9xAmwKPLicsnQ4NW49pgvJp9ovefuic95cgOS9CbPc9izIEgsqm1UitV0uNveCvud9w== -"@ethereumjs/tx@3.5.2": - version "3.5.2" - resolved "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.5.2.tgz" - integrity sha512-gQDNJWKrSDGu2w7w0PzVXVBNMzb7wwdDOmOqczmhNjqFxFuIbhVJDwiGEnxFNC2/b8ifcZzY7MLcluizohRzNw== - dependencies: - "@ethereumjs/common" "^2.6.4" - ethereumjs-util "^7.1.5" - "@ethereumjs/tx@^4.2.0": version "4.2.0" resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-4.2.0.tgz#5988ae15daf5a3b3c815493bc6b495e76009e853" @@ -476,7 +460,7 @@ "@ethereumjs/rlp" "^5.0.1" ethereum-cryptography "^2.1.2" -"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.6.3", "@ethersproject/abi@^5.7.0": +"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz" integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== @@ -2003,11 +1987,6 @@ resolved "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz" integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== -"@sindresorhus/is@^4.0.0", "@sindresorhus/is@^4.6.0": - version "4.6.0" - resolved "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz" - integrity sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw== - "@sinonjs/commons@^1.7.0": version "1.8.6" resolved "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz" @@ -2065,20 +2044,6 @@ resolved "https://registry.npmjs.org/@stripe/stripe-js/-/stripe-js-1.54.2.tgz" integrity sha512-R1PwtDvUfs99cAjfuQ/WpwJ3c92+DAMy9xGApjqlWQMj0FKQabUAys2swfTRNzuYAYJh7NqK2dzcYVNkKLEKUg== -"@szmarczak/http-timer@^4.0.5": - version "4.0.6" - resolved "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz" - integrity sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w== - dependencies: - defer-to-connect "^2.0.0" - -"@szmarczak/http-timer@^5.0.1": - version "5.0.1" - resolved "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-5.0.1.tgz" - integrity sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw== - dependencies: - defer-to-connect "^2.0.1" - "@tootallnate/once@2": version "2.0.0" resolved "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz" @@ -2292,16 +2257,6 @@ dependencies: "@types/node" "*" -"@types/cacheable-request@^6.0.1", "@types/cacheable-request@^6.0.2": - version "6.0.3" - resolved "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz" - integrity sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw== - dependencies: - "@types/http-cache-semantics" "*" - "@types/keyv" "^3.1.4" - "@types/node" "*" - "@types/responselike" "^1.0.0" - "@types/chai-as-promised@^7.1.8": version "7.1.8" resolved "https://registry.npmjs.org/@types/chai-as-promised/-/chai-as-promised-7.1.8.tgz" @@ -2328,11 +2283,6 @@ dependencies: "@types/node" "*" -"@types/http-cache-semantics@*": - version "4.0.1" - resolved "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz" - integrity sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ== - "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.4" resolved "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz" @@ -2374,13 +2324,6 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== -"@types/keyv@^3.1.4": - version "3.1.4" - resolved "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz" - integrity sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg== - dependencies: - "@types/node" "*" - "@types/lru-cache@^5.1.0": version "5.1.1" resolved "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.1.tgz" @@ -2461,13 +2404,6 @@ "@types/node" "*" safe-buffer "~5.1.1" -"@types/responselike@^1.0.0": - version "1.0.0" - resolved "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz" - integrity sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA== - dependencies: - "@types/node" "*" - "@types/secp256k1@^4.0.1": version "4.0.3" resolved "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz" @@ -2719,14 +2655,6 @@ abstract-level@^1.0.0, abstract-level@^1.0.2, abstract-level@^1.0.3: module-error "^1.0.1" queue-microtask "^1.2.3" -accepts@~1.3.8: - version "1.3.8" - resolved "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz" - integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== - dependencies: - mime-types "~2.1.34" - negotiator "0.6.3" - acorn-globals@^7.0.0: version "7.0.1" resolved "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz" @@ -2794,7 +2722,7 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" -ajv@^6.12.3, ajv@^6.12.4: +ajv@^6.12.4: version "6.12.6" resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -2927,11 +2855,6 @@ array-differ@^3.0.0: resolved "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz" integrity sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg== -array-flatten@1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz" - integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== - array-ify@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz" @@ -2952,28 +2875,11 @@ arrify@^2.0.1: resolved "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz" integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== -asn1@~0.2.3: - version "0.2.6" - resolved "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz" - integrity sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ== - dependencies: - safer-buffer "~2.1.0" - -assert-plus@1.0.0, assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz" - integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw== - assertion-error@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz" integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== -async-limiter@~1.0.0: - version "1.0.1" - resolved "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz" - integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== - async-mutex@^0.4.0: version "0.4.0" resolved "https://registry.npmjs.org/async-mutex/-/async-mutex-0.4.0.tgz" @@ -2996,16 +2902,6 @@ available-typed-arrays@^1.0.5: resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz" - integrity sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA== - -aws4@^1.8.0: - version "1.12.0" - resolved "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz" - integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg== - axios@0.27.2: version "0.27.2" resolved "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz" @@ -3095,7 +2991,7 @@ balanced-match@^1.0.0: resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -base-x@^3.0.2, base-x@^3.0.8: +base-x@^3.0.2: version "3.0.9" resolved "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz" integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ== @@ -3112,13 +3008,6 @@ base64url@^3.0.1: resolved "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz" integrity sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A== -bcrypt-pbkdf@^1.0.0: - version "1.0.2" - resolved "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz" - integrity sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w== - dependencies: - tweetnacl "^0.14.3" - bech32@1.1.4: version "1.1.4" resolved "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz" @@ -3163,17 +3052,12 @@ blakejs@^1.1.0: resolved "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz" integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== -bluebird@^3.5.0: - version "3.7.2" - resolved "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz" - integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== - bn.js@4.11.6: version "4.11.6" resolved "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz" integrity sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA== -bn.js@^4.11.0, bn.js@^4.11.6, bn.js@^4.11.8, bn.js@^4.11.9: +bn.js@^4.11.0, bn.js@^4.11.8, bn.js@^4.11.9: version "4.12.0" resolved "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== @@ -3183,42 +3067,6 @@ bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1: resolved "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== -body-parser@1.20.1: - version "1.20.1" - resolved "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz" - integrity sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw== - dependencies: - bytes "3.1.2" - content-type "~1.0.4" - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - http-errors "2.0.0" - iconv-lite "0.4.24" - on-finished "2.4.1" - qs "6.11.0" - raw-body "2.5.1" - type-is "~1.6.18" - unpipe "1.0.0" - -body-parser@^1.16.0: - version "1.20.2" - resolved "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz" - integrity sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA== - dependencies: - bytes "3.1.2" - content-type "~1.0.5" - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - http-errors "2.0.0" - iconv-lite "0.4.24" - on-finished "2.4.1" - qs "6.11.0" - raw-body "2.5.2" - type-is "~1.6.18" - unpipe "1.0.0" - bowser@^2.11.0: version "2.11.0" resolved "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz" @@ -3330,17 +3178,12 @@ buffer-from@^1.0.0: resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -buffer-to-arraybuffer@^0.0.5: - version "0.0.5" - resolved "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz" - integrity sha512-3dthu5CYiVB1DEJp61FtApNnNndTckcqe4pFcLdvHtrpG+kcyekCJKg4MRiDcFW7A6AODnXB9U4dwQiCW5kzJQ== - buffer-xor@^1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz" integrity sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ== -buffer@^5.0.5, buffer@^5.5.0, buffer@^5.6.0: +buffer@^5.5.0: version "5.7.1" resolved "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz" integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== @@ -3435,29 +3278,6 @@ cacache@^17.0.0: tar "^6.1.11" unique-filename "^3.0.0" -cacheable-lookup@^5.0.3: - version "5.0.4" - resolved "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz" - integrity sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA== - -cacheable-lookup@^6.0.4: - version "6.1.0" - resolved "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-6.1.0.tgz" - integrity sha512-KJ/Dmo1lDDhmW2XDPMo+9oiy/CeqosPguPCrgcVzKyZrL6pM1gU2GmPY/xo6OQPTUaA/c0kwHuywB4E6nmT9ww== - -cacheable-request@^7.0.2: - version "7.0.2" - resolved "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz" - integrity sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew== - dependencies: - clone-response "^1.0.2" - get-stream "^5.1.0" - http-cache-semantics "^4.0.0" - keyv "^4.0.0" - lowercase-keys "^2.0.0" - normalize-url "^6.0.1" - responselike "^2.0.0" - caching-transform@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz" @@ -3511,11 +3331,6 @@ case@^1.6.3: resolved "https://registry.npmjs.org/case/-/case-1.6.3.tgz" integrity sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ== -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz" - integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== - catering@^2.1.0, catering@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/catering/-/catering-2.1.1.tgz" @@ -3603,11 +3418,6 @@ chokidar@3.5.3, chokidar@^3.4.0, chokidar@^3.5.2, chokidar@^3.5.3: optionalDependencies: fsevents "~2.3.2" -chownr@^1.1.4: - version "1.1.4" - resolved "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz" - integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== - chownr@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz" @@ -3623,17 +3433,6 @@ ci-info@^3.2.0, ci-info@^3.6.1: resolved "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz" integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== -cids@^0.7.1: - version "0.7.5" - resolved "https://registry.npmjs.org/cids/-/cids-0.7.5.tgz" - integrity sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA== - dependencies: - buffer "^5.5.0" - class-is "^1.1.0" - multibase "~0.6.0" - multicodec "^1.0.0" - multihashes "~0.4.15" - cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: version "1.0.4" resolved "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz" @@ -3647,11 +3446,6 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz" integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== -class-is@^1.1.0: - version "1.1.0" - resolved "https://registry.npmjs.org/class-is/-/class-is-1.1.0.tgz" - integrity sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw== - classic-level@^1.2.0: version "1.3.0" resolved "https://registry.npmjs.org/classic-level/-/classic-level-1.3.0.tgz" @@ -3741,13 +3535,6 @@ clone-deep@4.0.1: kind-of "^6.0.2" shallow-clone "^3.0.0" -clone-response@^1.0.2: - version "1.0.3" - resolved "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz" - integrity sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA== - dependencies: - mimic-response "^1.0.0" - clone@^1.0.2: version "1.0.4" resolved "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz" @@ -3810,7 +3597,7 @@ columnify@1.6.0: strip-ansi "^6.0.1" wcwidth "^1.0.0" -combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: +combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== @@ -3890,27 +3677,6 @@ console-control-strings@^1.1.0: resolved "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz" integrity sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ== -content-disposition@0.5.4: - version "0.5.4" - resolved "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz" - integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== - dependencies: - safe-buffer "5.2.1" - -content-hash@^2.5.2: - version "2.5.2" - resolved "https://registry.npmjs.org/content-hash/-/content-hash-2.5.2.tgz" - integrity sha512-FvIQKy0S1JaWV10sMsA7TRx8bpU+pqPkhbsfvOJAdjRXvYxEckAwQWGwtRjiaJfh+E0DvcWUGqcdjwMGFjsSdw== - dependencies: - cids "^0.7.1" - multicodec "^0.5.5" - multihashes "^0.4.15" - -content-type@~1.0.4, content-type@~1.0.5: - version "1.0.5" - resolved "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz" - integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== - conventional-changelog-angular@7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz#5eec8edbff15aa9b1680a8dcfbd53e2d7eb2ba7a" @@ -3994,39 +3760,16 @@ convert-source-map@^2.0.0: resolved "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== -cookie-signature@1.0.6: - version "1.0.6" - resolved "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz" - integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== - -cookie@0.5.0: - version "0.5.0" - resolved "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz" - integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== - cookie@^0.4.1: version "0.4.2" resolved "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz" integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA== -core-util-is@1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz" - integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ== - core-util-is@~1.0.0: version "1.0.3" resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz" integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== -cors@^2.8.1: - version "2.8.5" - resolved "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz" - integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g== - dependencies: - object-assign "^4" - vary "^1" - cosmiconfig@^8.2.0: version "8.3.6" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-8.3.6.tgz#060a2b871d66dba6c8538ea1118ba1ac16f5fae3" @@ -4139,13 +3882,6 @@ dargs@^7.0.0: resolved "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz" integrity sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg== -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz" - integrity sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g== - dependencies: - assert-plus "^1.0.0" - data-urls@^3.0.2: version "3.0.2" resolved "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz" @@ -4160,13 +3896,6 @@ dateformat@^3.0.3: resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== -debug@2.6.9, debug@^2.2.0: - version "2.6.9" - resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - debug@4, debug@4.3.4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4, debug@~4.3.1, debug@~4.3.2: version "4.3.4" resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" @@ -4174,6 +3903,13 @@ debug@4, debug@4.3.4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, de dependencies: ms "2.1.2" +debug@^2.2.0: + version "2.6.9" + resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + decamelize-keys@^1.1.0: version "1.1.1" resolved "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz" @@ -4197,25 +3933,6 @@ decimal.js@^10.4.2: resolved "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz" integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== -decode-uri-component@^0.2.0: - version "0.2.2" - resolved "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz" - integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ== - -decompress-response@^3.3.0: - version "3.3.0" - resolved "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz" - integrity sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA== - dependencies: - mimic-response "^1.0.0" - -decompress-response@^6.0.0: - version "6.0.0" - resolved "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz" - integrity sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ== - dependencies: - mimic-response "^3.1.0" - dedent@0.7.0: version "0.7.0" resolved "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz" @@ -4280,11 +3997,6 @@ defaults@^1.0.3: dependencies: clone "^1.0.2" -defer-to-connect@^2.0.0, defer-to-connect@^2.0.1: - version "2.0.1" - resolved "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz" - integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== - define-data-property@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz" @@ -4324,11 +4036,6 @@ deprecation@^2.0.0: resolved "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz" integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ== -destroy@1.2.0: - version "1.2.0" - resolved "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz" - integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== - detect-indent@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz" @@ -4373,11 +4080,6 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -dom-walk@^0.1.0: - version "0.1.2" - resolved "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz" - integrity sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w== - domexception@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz" @@ -4412,19 +4114,6 @@ eastasianwidth@^0.2.0: resolved "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz" integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== -ecc-jsbn@~0.1.1: - version "0.1.2" - resolved "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz" - integrity sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw== - dependencies: - jsbn "~0.1.0" - safer-buffer "^2.1.0" - -ee-first@1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz" - integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== - ejs@^3.1.7: version "3.1.9" resolved "https://registry.npmjs.org/ejs/-/ejs-3.1.9.tgz" @@ -4437,7 +4126,7 @@ electron-to-chromium@^1.4.535: resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.589.tgz" integrity sha512-zF6y5v/YfoFIgwf2dDfAqVlPPsyQeWNpEWXbAlDUS8Ax4Z2VoiiZpAPC0Jm9hXEkJm2vIZpwB6rc4KnLTQffbQ== -elliptic@6.5.4, elliptic@^6.4.0, elliptic@^6.5.2, elliptic@^6.5.4: +elliptic@6.5.4, elliptic@^6.5.2, elliptic@^6.5.4: version "6.5.4" resolved "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz" integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== @@ -4470,11 +4159,6 @@ encode-utf8@^1.0.2: resolved "https://registry.npmjs.org/encode-utf8/-/encode-utf8-1.0.3.tgz" integrity sha512-ucAnuBEhUK4boH2HjVYG5Q2mQyPorvv0u/ocS+zhdw0S8AlHYY+GOFhP1Gio5z4icpP2ivFSvhtFjQi8+T9ppw== -encodeurl@~1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz" - integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== - encoding@^0.1.13: version "0.1.13" resolved "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz" @@ -4580,11 +4264,6 @@ escalade@^3.1.1: resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz" integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== -escape-html@~1.0.3: - version "1.0.3" - resolved "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz" - integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== - escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz" @@ -4720,40 +4399,6 @@ esutils@^2.0.2: resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -etag@~1.8.1: - version "1.8.1" - resolved "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz" - integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== - -eth-ens-namehash@2.0.8: - version "2.0.8" - resolved "https://registry.npmjs.org/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz" - integrity sha512-VWEI1+KJfz4Km//dadyvBBoBeSQ0MHTXPvr8UIXiLW6IanxvAV+DmlZAijZwAyggqGUfwQBeHf7tc9wzc1piSw== - dependencies: - idna-uts46-hx "^2.3.1" - js-sha3 "^0.5.7" - -eth-lib@0.2.8: - version "0.2.8" - resolved "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz" - integrity sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw== - dependencies: - bn.js "^4.11.6" - elliptic "^6.4.0" - xhr-request-promise "^0.1.2" - -eth-lib@^0.1.26: - version "0.1.29" - resolved "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.29.tgz" - integrity sha512-bfttrr3/7gG4E02HoWTDUcDDslN003OlOoBxk9virpAZQ1ja/jDgwkWB8QfJF7ojuEowrqy+lzp9VcJG7/k5bQ== - dependencies: - bn.js "^4.11.6" - elliptic "^6.4.0" - nano-json-stream-parser "^0.1.2" - servify "^0.1.12" - ws "^3.0.0" - xhr-request-promise "^0.1.2" - eth-testing@^1.14.0: version "1.14.0" resolved "https://registry.npmjs.org/eth-testing/-/eth-testing-1.14.0.tgz" @@ -5014,43 +4659,6 @@ expect@^29.0.0, expect@^29.7.0: jest-message-util "^29.7.0" jest-util "^29.7.0" -express@^4.14.0: - version "4.18.2" - resolved "https://registry.npmjs.org/express/-/express-4.18.2.tgz" - integrity sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ== - dependencies: - accepts "~1.3.8" - array-flatten "1.1.1" - body-parser "1.20.1" - content-disposition "0.5.4" - content-type "~1.0.4" - cookie "0.5.0" - cookie-signature "1.0.6" - debug "2.6.9" - depd "2.0.0" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - finalhandler "1.2.0" - fresh "0.5.2" - http-errors "2.0.0" - merge-descriptors "1.0.1" - methods "~1.1.2" - on-finished "2.4.1" - parseurl "~1.3.3" - path-to-regexp "0.1.7" - proxy-addr "~2.0.7" - qs "6.11.0" - range-parser "~1.2.1" - safe-buffer "5.2.1" - send "0.18.0" - serve-static "1.15.0" - setprototypeof "1.2.0" - statuses "2.0.1" - type-is "~1.6.18" - utils-merge "1.0.1" - vary "~1.1.2" - ext@^1.1.2: version "1.7.0" resolved "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz" @@ -5058,11 +4666,6 @@ ext@^1.1.2: dependencies: type "^2.7.2" -extend@~3.0.2: - version "3.0.2" - resolved "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz" - integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== - external-editor@^3.0.3: version "3.1.0" resolved "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz" @@ -5072,16 +4675,6 @@ external-editor@^3.0.3: iconv-lite "^0.4.24" tmp "^0.0.33" -extsprintf@1.3.0: - version "1.3.0" - resolved "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz" - integrity sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g== - -extsprintf@^1.2.0: - version "1.4.1" - resolved "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.1.tgz" - integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA== - fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" @@ -5165,19 +4758,6 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" -finalhandler@1.2.0: - version "1.2.0" - resolved "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz" - integrity sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg== - dependencies: - debug "2.6.9" - encodeurl "~1.0.2" - escape-html "~1.0.3" - on-finished "2.4.1" - parseurl "~1.3.3" - statuses "2.0.1" - unpipe "~1.0.0" - find-cache-dir@^3.2.0: version "3.3.2" resolved "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz" @@ -5270,16 +4850,6 @@ foreground-child@^3.1.0: cross-spawn "^7.0.0" signal-exit "^4.0.1" -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz" - integrity sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw== - -form-data-encoder@1.7.1: - version "1.7.1" - resolved "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.1.tgz" - integrity sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg== - form-data@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz" @@ -5289,20 +4859,6 @@ form-data@^4.0.0: combined-stream "^1.0.8" mime-types "^2.1.12" -form-data@~2.3.2: - version "2.3.3" - resolved "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz" - integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.6" - mime-types "^2.1.12" - -forwarded@0.2.0: - version "0.2.0" - resolved "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz" - integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== - fp-ts@1.19.3: version "1.19.3" resolved "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.3.tgz" @@ -5313,11 +4869,6 @@ fp-ts@^1.0.0: resolved "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.5.tgz" integrity sha512-wDNqTimnzs8QqpldiId9OavWK2NptormjXnRJTQecNjzwfyp6P/8s/zG8e4h3ja3oqkKaY72UlTjQYt/1yXf9A== -fresh@0.5.2: - version "0.5.2" - resolved "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz" - integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== - fromentries@^1.2.0: version "1.3.2" resolved "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz" @@ -5357,15 +4908,6 @@ fs-extra@^11.1.0, fs-extra@^11.1.1: jsonfile "^6.0.1" universalify "^2.0.0" -fs-extra@^4.0.2: - version "4.0.3" - resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz" - integrity sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg== - dependencies: - graceful-fs "^4.1.2" - jsonfile "^4.0.0" - universalify "^0.1.0" - fs-extra@^7.0.0, fs-extra@^7.0.1: version "7.0.1" resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz" @@ -5375,13 +4917,6 @@ fs-extra@^7.0.0, fs-extra@^7.0.1: jsonfile "^4.0.0" universalify "^0.1.0" -fs-minipass@^1.2.7: - version "1.2.7" - resolved "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz" - integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== - dependencies: - minipass "^2.6.0" - fs-minipass@^2.0.0, fs-minipass@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz" @@ -5480,25 +5015,11 @@ get-stream@6.0.0: resolved "https://registry.npmjs.org/get-stream/-/get-stream-6.0.0.tgz" integrity sha512-A1B3Bh1UmL0bidM/YX2NsCOTnGJePL9rO/M+Mw3m9f2gUpfokS0hi5Eah0WSUEWZdZhIZtMjkIYS7mDfOqNHbg== -get-stream@^5.1.0: - version "5.2.0" - resolved "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz" - integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== - dependencies: - pump "^3.0.0" - get-stream@^6.0.0, get-stream@^6.0.1: version "6.0.1" resolved "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz" - integrity sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng== - dependencies: - assert-plus "^1.0.0" - git-raw-commits@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-3.0.0.tgz#5432f053a9744f67e8db03dbc48add81252cfdeb" @@ -5640,14 +5161,6 @@ glob@^9.2.0, glob@^9.3.1: minipass "^4.2.4" path-scurry "^1.6.1" -global@~4.4.0: - version "4.4.0" - resolved "https://registry.npmjs.org/global/-/global-4.4.0.tgz" - integrity sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w== - dependencies: - min-document "^2.19.0" - process "^0.11.10" - globals@^11.1.0: version "11.12.0" resolved "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz" @@ -5679,42 +5192,6 @@ gopd@^1.0.1: dependencies: get-intrinsic "^1.1.3" -got@12.1.0: - version "12.1.0" - resolved "https://registry.npmjs.org/got/-/got-12.1.0.tgz" - integrity sha512-hBv2ty9QN2RdbJJMK3hesmSkFTjVIHyIDDbssCKnSmq62edGgImJWD10Eb1k77TiV1bxloxqcFAVK8+9pkhOig== - dependencies: - "@sindresorhus/is" "^4.6.0" - "@szmarczak/http-timer" "^5.0.1" - "@types/cacheable-request" "^6.0.2" - "@types/responselike" "^1.0.0" - cacheable-lookup "^6.0.4" - cacheable-request "^7.0.2" - decompress-response "^6.0.0" - form-data-encoder "1.7.1" - get-stream "^6.0.1" - http2-wrapper "^2.1.10" - lowercase-keys "^3.0.0" - p-cancelable "^3.0.0" - responselike "^2.0.0" - -got@^11.8.5: - version "11.8.6" - resolved "https://registry.npmjs.org/got/-/got-11.8.6.tgz" - integrity sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g== - dependencies: - "@sindresorhus/is" "^4.0.0" - "@szmarczak/http-timer" "^4.0.5" - "@types/cacheable-request" "^6.0.1" - "@types/responselike" "^1.0.0" - cacheable-lookup "^5.0.3" - cacheable-request "^7.0.2" - decompress-response "^6.0.0" - http2-wrapper "^1.0.0-beta.5.2" - lowercase-keys "^2.0.0" - p-cancelable "^2.0.0" - responselike "^2.0.0" - graceful-fs@4.2.11, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.6, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" @@ -5737,19 +5214,6 @@ handlebars@^4.7.7: optionalDependencies: uglify-js "^3.1.4" -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz" - integrity sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q== - -har-validator@~5.1.3: - version "5.1.5" - resolved "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz" - integrity sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w== - dependencies: - ajv "^6.12.3" - har-schema "^2.0.0" - hard-rejection@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz" @@ -5974,7 +5438,7 @@ html-escaper@^2.0.0: resolved "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== -http-cache-semantics@^4.0.0, http-cache-semantics@^4.1.0, http-cache-semantics@^4.1.1: +http-cache-semantics@^4.1.0, http-cache-semantics@^4.1.1: version "4.1.1" resolved "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz" integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ== @@ -6004,31 +5468,6 @@ http-proxy-agent@^5.0.0: agent-base "6" debug "4" -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz" - integrity sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ== - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - -http2-wrapper@^1.0.0-beta.5.2: - version "1.0.3" - resolved "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz" - integrity sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg== - dependencies: - quick-lru "^5.1.1" - resolve-alpn "^1.0.0" - -http2-wrapper@^2.1.10: - version "2.2.0" - resolved "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.0.tgz" - integrity sha512-kZB0wxMo0sh1PehyjJUWRFEd99KC5TLjZ2cULC4f9iqJBAmKQQXEICjxl5iPJRwP40dpeHFqqhm7tYCvODpqpQ== - dependencies: - quick-lru "^5.1.1" - resolve-alpn "^1.2.0" - https-proxy-agent@^5.0.0, https-proxy-agent@^5.0.1: version "5.0.1" resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz" @@ -6073,13 +5512,6 @@ iconv-lite@0.6.3, iconv-lite@^0.6.2: dependencies: safer-buffer ">= 2.1.2 < 3.0.0" -idna-uts46-hx@^2.3.1: - version "2.3.1" - resolved "https://registry.npmjs.org/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz" - integrity sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA== - dependencies: - punycode "2.1.0" - ieee754@^1.1.13, ieee754@^1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz" @@ -6209,11 +5641,6 @@ ip@^2.0.0: resolved "https://registry.yarnpkg.com/ip/-/ip-2.0.1.tgz#e8f3595d33a3ea66490204234b77636965307105" integrity sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ== -ipaddr.js@1.9.1: - version "1.9.1" - resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz" - integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== - is-arguments@^1.0.4: version "1.1.1" resolved "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz" @@ -6283,11 +5710,6 @@ is-fullwidth-code-point@^4.0.0: resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz" integrity sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ== -is-function@^1.0.1: - version "1.0.2" - resolved "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz" - integrity sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ== - is-generator-fn@^2.0.0: version "2.1.0" resolved "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz" @@ -6411,7 +5833,7 @@ is-typed-array@^1.1.10, is-typed-array@^1.1.3: gopd "^1.0.1" has-tostringtag "^1.0.0" -is-typedarray@^1.0.0, is-typedarray@~1.0.0: +is-typedarray@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz" integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== @@ -6463,11 +5885,6 @@ isomorphic-ws@^5.0.0: resolved "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz" integrity sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw== -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz" - integrity sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g== - istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: version "3.2.0" resolved "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz" @@ -6951,11 +6368,6 @@ js-sha3@0.8.0, js-sha3@^0.8.0: resolved "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz" integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== -js-sha3@^0.5.7: - version "0.5.7" - resolved "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz" - integrity sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g== - "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" @@ -6976,11 +6388,6 @@ js-yaml@^3.10.0, js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz" - integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== - jsdom@^20.0.0: version "20.0.3" resolved "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz" @@ -7018,11 +6425,6 @@ jsesc@^2.5.1: resolved "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== -json-buffer@3.0.1: - version "3.0.1" - resolved "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz" - integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== - json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz" @@ -7043,11 +6445,6 @@ json-schema-traverse@^0.4.1: resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== -json-schema@0.4.0: - version "0.4.0" - resolved "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz" - integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA== - json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" @@ -7063,7 +6460,7 @@ json-stable-stringify@^1.0.2: jsonify "^0.0.1" object-keys "^1.1.1" -json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: +json-stringify-safe@^5.0.1: version "5.0.1" resolved "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== @@ -7116,16 +6513,6 @@ jsonschema@^1.4.1: resolved "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.1.tgz" integrity sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ== -jsprim@^1.2.2: - version "1.4.2" - resolved "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz" - integrity sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw== - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.4.0" - verror "1.10.0" - just-extend@^4.0.2: version "4.2.1" resolved "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz" @@ -7140,13 +6527,6 @@ keccak@^3.0.0, keccak@^3.0.2: node-gyp-build "^4.2.0" readable-stream "^3.6.0" -keyv@^4.0.0: - version "4.5.2" - resolved "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz" - integrity sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g== - dependencies: - json-buffer "3.0.1" - kind-of@^6.0.2, kind-of@^6.0.3: version "6.0.3" resolved "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz" @@ -7472,16 +6852,6 @@ loupe@^2.3.6: dependencies: get-func-name "^2.0.0" -lowercase-keys@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz" - integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== - -lowercase-keys@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz" - integrity sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ== - lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz" @@ -7617,11 +6987,6 @@ md5.js@^1.3.4: inherits "^2.0.1" safe-buffer "^5.1.2" -media-typer@0.3.0: - version "0.3.0" - resolved "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz" - integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== - memory-level@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/memory-level/-/memory-level-1.0.0.tgz" @@ -7653,11 +7018,6 @@ meow@^8.1.2: type-fest "^0.18.0" yargs-parser "^20.2.3" -merge-descriptors@1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz" - integrity sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w== - merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz" @@ -7668,11 +7028,6 @@ merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -methods@~1.1.2: - version "1.1.2" - resolved "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz" - integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== - micro-ftch@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/micro-ftch/-/micro-ftch-0.3.1.tgz#6cb83388de4c1f279a034fb0cf96dfc050853c5f" @@ -7691,18 +7046,13 @@ mime-db@1.52.0: resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12, mime-types@^2.1.16, mime-types@~2.1.19, mime-types@~2.1.24, mime-types@~2.1.34: +mime-types@^2.1.12: version "2.1.35" resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== dependencies: mime-db "1.52.0" -mime@1.6.0: - version "1.6.0" - resolved "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz" - integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== - mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz" @@ -7713,23 +7063,6 @@ mimic-fn@^4.0.0: resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz" integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw== -mimic-response@^1.0.0: - version "1.0.1" - resolved "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz" - integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== - -mimic-response@^3.1.0: - version "3.1.0" - resolved "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz" - integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== - -min-document@^2.19.0: - version "2.19.0" - resolved "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz" - integrity sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ== - dependencies: - dom-walk "^0.1.0" - min-indent@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz" @@ -7866,14 +7199,6 @@ minipass-sized@^1.0.3: dependencies: minipass "^3.0.0" -minipass@^2.6.0, minipass@^2.9.0: - version "2.9.0" - resolved "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz" - integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== - dependencies: - safe-buffer "^5.1.2" - yallist "^3.0.0" - minipass@^3.0.0, minipass@^3.1.1, minipass@^3.1.6: version "3.3.6" resolved "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz" @@ -7896,13 +7221,6 @@ minipass@^5.0.0: resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.4.tgz#dbce03740f50a4786ba994c1fb908844d27b038c" integrity sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ== -minizlib@^1.3.3: - version "1.3.3" - resolved "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz" - integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== - dependencies: - minipass "^2.9.0" - minizlib@^2.1.1, minizlib@^2.1.2: version "2.1.2" resolved "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz" @@ -7911,25 +7229,6 @@ minizlib@^2.1.1, minizlib@^2.1.2: minipass "^3.0.0" yallist "^4.0.0" -mkdirp-promise@^5.0.1: - version "5.0.1" - resolved "https://registry.npmjs.org/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz" - integrity sha512-Hepn5kb1lJPtVW84RFT40YG1OddBNTOVUZR2bzQUHc+Z03en8/3uX0+060JDhcEzyO08HmipsN9DcnFMxhIL9w== - dependencies: - mkdirp "*" - -mkdirp@*: - version "3.0.0" - resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.0.tgz" - integrity sha512-7+JDnNsyCvZXoUJdkMR0oUE2AmAdsNXGTmRbiOjYIwQ6q+bL6NwrozGQdPcmYaNcrhH37F50HHBUzoaBV6FITQ== - -mkdirp@^0.5.5: - version "0.5.6" - resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz" - integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== - dependencies: - minimist "^1.2.6" - mkdirp@^1.0.3, mkdirp@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz" @@ -7969,11 +7268,6 @@ mocha@^10.0.0, mocha@^10.2.0: yargs-parser "20.2.4" yargs-unparser "2.0.0" -mock-fs@^4.1.0: - version "4.14.0" - resolved "https://registry.npmjs.org/mock-fs/-/mock-fs-4.14.0.tgz" - integrity sha512-qYvlv/exQ4+svI3UOvPUpLDF0OMX5euvUH0Ny4N5QyRyhNdgAgUrVH3iUINSzEPLvx0kbo/Bp28GJKIqvE7URw== - modify-values@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" @@ -7999,46 +7293,6 @@ ms@2.1.3, ms@^2.0.0: resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -multibase@^0.7.0: - version "0.7.0" - resolved "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz" - integrity sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg== - dependencies: - base-x "^3.0.8" - buffer "^5.5.0" - -multibase@~0.6.0: - version "0.6.1" - resolved "https://registry.npmjs.org/multibase/-/multibase-0.6.1.tgz" - integrity sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw== - dependencies: - base-x "^3.0.8" - buffer "^5.5.0" - -multicodec@^0.5.5: - version "0.5.7" - resolved "https://registry.npmjs.org/multicodec/-/multicodec-0.5.7.tgz" - integrity sha512-PscoRxm3f+88fAtELwUnZxGDkduE2HD9Q6GHUOywQLjOGT/HAdhjLDYNZ1e7VR0s0TP0EwZ16LNUTFpoBGivOA== - dependencies: - varint "^5.0.0" - -multicodec@^1.0.0: - version "1.0.4" - resolved "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz" - integrity sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg== - dependencies: - buffer "^5.6.0" - varint "^5.0.0" - -multihashes@^0.4.15, multihashes@~0.4.15: - version "0.4.21" - resolved "https://registry.npmjs.org/multihashes/-/multihashes-0.4.21.tgz" - integrity sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw== - dependencies: - buffer "^5.5.0" - multibase "^0.7.0" - varint "^5.0.0" - multimatch@5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/multimatch/-/multimatch-5.0.0.tgz" @@ -8074,11 +7328,6 @@ mylas@^2.1.9: resolved "https://registry.npmjs.org/mylas/-/mylas-2.1.13.tgz" integrity sha512-+MrqnJRtxdF+xngFfUUkIMQrUUL0KsxbADUkn23Z/4ibGg192Q+z+CQyiYwvWTsYjJygmMR8+w3ZDa98Zh6ESg== -nano-json-stream-parser@^0.1.2: - version "0.1.2" - resolved "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz" - integrity sha512-9MqxMH/BSJC7dnLsEMPyfN5Dvoo49IsPFYMcHw3Bcfc2kN0lpHRBSzlMSVx4HGyJ7s9B31CyBTVehWJoQ8Ctew== - nanoid@3.3.3: version "3.3.3" resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz" @@ -8094,7 +7343,7 @@ natural-compare@^1.4.0: resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -negotiator@0.6.3, negotiator@^0.6.3: +negotiator@^0.6.3: version "0.6.3" resolved "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz" integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== @@ -8229,11 +7478,6 @@ normalize-path@^3.0.0, normalize-path@~3.0.0: resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== -normalize-url@^6.0.1: - version "6.1.0" - resolved "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz" - integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== - npm-bundled@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.2.tgz" @@ -8447,16 +7691,6 @@ nyc@^15.1.0: test-exclude "^6.0.0" yargs "^15.0.2" -oauth-sign@~0.9.0: - version "0.9.0" - resolved "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz" - integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== - -object-assign@^4, object-assign@^4.1.0, object-assign@^4.1.1: - version "4.1.1" - resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz" - integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== - object-inspect@^1.9.0: version "1.12.3" resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz" @@ -8484,13 +7718,6 @@ oboe@2.1.5: dependencies: http-https "^1.0.0" -on-finished@2.4.1: - version "2.4.1" - resolved "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz" - integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== - dependencies: - ee-first "1.1.1" - once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" @@ -8575,16 +7802,6 @@ os-tmpdir@~1.0.2: resolved "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz" integrity sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g== -p-cancelable@^2.0.0: - version "2.1.1" - resolved "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz" - integrity sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg== - -p-cancelable@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/p-cancelable/-/p-cancelable-3.0.0.tgz" - integrity sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw== - p-finally@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz" @@ -8734,11 +7951,6 @@ parent-module@^1.0.0: dependencies: callsites "^3.0.0" -parse-headers@^2.0.0: - version "2.0.5" - resolved "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz" - integrity sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA== - parse-json@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz" @@ -8778,11 +7990,6 @@ parse5@^7.0.0, parse5@^7.1.1: dependencies: entities "^4.4.0" -parseurl@~1.3.3: - version "1.3.3" - resolved "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz" - integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== - path-exists@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz" @@ -8821,11 +8028,6 @@ path-scurry@^1.10.1, path-scurry@^1.6.1: lru-cache "^9.1.1 || ^10.0.0" minipass "^5.0.0 || ^6.0.2 || ^7.0.0" -path-to-regexp@0.1.7: - version "0.1.7" - resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz" - integrity sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ== - path-to-regexp@^1.7.0: version "1.8.0" resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz" @@ -8861,11 +8063,6 @@ pbkdf2@^3.0.17: safe-buffer "^5.0.1" sha.js "^2.4.8" -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz" - integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== - picocolors@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz" @@ -9016,20 +8213,12 @@ protocols@^2.0.0, protocols@^2.0.1: resolved "https://registry.npmjs.org/protocols/-/protocols-2.0.1.tgz" integrity sha512-/XJ368cyBJ7fzLMwLKv1e4vLxOju2MNAIokcr7meSaNcVbWz/CPcW22cP04mwxOErdA5mwjA8Q6w/cdAQxVn7Q== -proxy-addr@~2.0.7: - version "2.0.7" - resolved "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz" - integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg== - dependencies: - forwarded "0.2.0" - ipaddr.js "1.9.1" - proxy-from-env@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz" integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== -psl@^1.1.28, psl@^1.1.33: +psl@^1.1.33: version "1.9.0" resolved "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz" integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== @@ -9042,11 +8231,6 @@ pump@^3.0.0: end-of-stream "^1.1.0" once "^1.3.1" -punycode@2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz" - integrity sha512-Yxz2kRwT90aPiWEMHVYnEf4+rhwF1tBmmZ4KepCP+Wkium9JxtWnUm1nqGwpiAHr/tnTSeHqr3wb++jgSkXjhA== - punycode@^2.1.0, punycode@^2.1.1: version "2.3.0" resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz" @@ -9057,13 +8241,6 @@ pure-rand@^6.0.0: resolved "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.1.tgz" integrity sha512-t+x1zEHDjBwkDGY5v5ApnZ/utcd4XYDiJsaQQoptTXgUXX95sDg1elCdJghzicm7n2mbCBJ3uYWr6M22SO19rg== -qs@6.11.0: - version "6.11.0" - resolved "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz" - integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== - dependencies: - side-channel "^1.0.4" - qs@^6.9.4: version "6.11.1" resolved "https://registry.npmjs.org/qs/-/qs-6.11.1.tgz" @@ -9071,20 +8248,6 @@ qs@^6.9.4: dependencies: side-channel "^1.0.4" -qs@~6.5.2: - version "6.5.3" - resolved "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz" - integrity sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA== - -query-string@^5.0.1: - version "5.1.1" - resolved "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz" - integrity sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw== - dependencies: - decode-uri-component "^0.2.0" - object-assign "^4.1.0" - strict-uri-encode "^1.0.0" - querystringify@^2.1.1: version "2.2.0" resolved "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz" @@ -9105,11 +8268,6 @@ quick-lru@^4.0.1: resolved "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz" integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== -quick-lru@^5.1.1: - version "5.1.1" - resolved "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz" - integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== - randombytes@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz" @@ -9117,22 +8275,7 @@ randombytes@^2.1.0: dependencies: safe-buffer "^5.1.0" -range-parser@~1.2.1: - version "1.2.1" - resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz" - integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== - -raw-body@2.5.1: - version "2.5.1" - resolved "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz" - integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig== - dependencies: - bytes "3.1.2" - http-errors "2.0.0" - iconv-lite "0.4.24" - unpipe "1.0.0" - -raw-body@2.5.2, raw-body@^2.4.1: +raw-body@^2.4.1: version "2.5.2" resolved "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz" integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== @@ -9293,32 +8436,6 @@ release-zalgo@^1.0.0: dependencies: es6-error "^4.0.1" -request@^2.79.0: - version "2.88.2" - resolved "https://registry.npmjs.org/request/-/request-2.88.2.tgz" - integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.8.0" - caseless "~0.12.0" - combined-stream "~1.0.6" - extend "~3.0.2" - forever-agent "~0.6.1" - form-data "~2.3.2" - har-validator "~5.1.3" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.19" - oauth-sign "~0.9.0" - performance-now "^2.1.0" - qs "~6.5.2" - safe-buffer "^5.1.2" - tough-cookie "~2.5.0" - tunnel-agent "^0.6.0" - uuid "^3.3.2" - require-directory@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" @@ -9339,11 +8456,6 @@ requires-port@^1.0.0: resolved "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz" integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== -resolve-alpn@^1.0.0, resolve-alpn@^1.2.0: - version "1.2.1" - resolved "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz" - integrity sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g== - resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz" @@ -9382,13 +8494,6 @@ resolve@^1.10.0, resolve@^1.20.0: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -responselike@^2.0.0: - version "2.0.1" - resolved "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz" - integrity sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw== - dependencies: - lowercase-keys "^2.0.0" - restore-cursor@^3.1.0: version "3.1.0" resolved "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz" @@ -9494,7 +8599,7 @@ rxjs@^7.5.5: dependencies: tslib "^2.1.0" -safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -9504,7 +8609,7 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: +"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== @@ -9523,7 +8628,7 @@ scheduler@^0.23.0: dependencies: loose-envify "^1.1.0" -scrypt-js@3.0.1, scrypt-js@^3.0.0, scrypt-js@^3.0.1: +scrypt-js@3.0.1, scrypt-js@^3.0.0: version "3.0.1" resolved "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz" integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== @@ -9561,25 +8666,6 @@ semver@^7.0.0, semver@^7.1.1, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semve dependencies: lru-cache "^6.0.0" -send@0.18.0: - version "0.18.0" - resolved "https://registry.npmjs.org/send/-/send-0.18.0.tgz" - integrity sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg== - dependencies: - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - fresh "0.5.2" - http-errors "2.0.0" - mime "1.6.0" - ms "2.1.3" - on-finished "2.4.1" - range-parser "~1.2.1" - statuses "2.0.1" - serialize-javascript@6.0.0: version "6.0.0" resolved "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz" @@ -9587,27 +8673,6 @@ serialize-javascript@6.0.0: dependencies: randombytes "^2.1.0" -serve-static@1.15.0: - version "1.15.0" - resolved "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz" - integrity sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g== - dependencies: - encodeurl "~1.0.2" - escape-html "~1.0.3" - parseurl "~1.3.3" - send "0.18.0" - -servify@^0.1.12: - version "0.1.12" - resolved "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz" - integrity sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw== - dependencies: - body-parser "^1.16.0" - cors "^2.8.1" - express "^4.14.0" - request "^2.79.0" - xhr "^2.3.3" - set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz" @@ -9690,20 +8755,6 @@ sigstore@^1.3.0, sigstore@^1.4.0: "@sigstore/tuf" "^1.0.3" make-fetch-happen "^11.0.1" -simple-concat@^1.0.0: - version "1.0.1" - resolved "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz" - integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== - -simple-get@^2.7.0: - version "2.8.2" - resolved "https://registry.npmjs.org/simple-get/-/simple-get-2.8.2.tgz" - integrity sha512-Ijd/rV5o+mSBBs4F/x9oDPtTx9Zb6X9brmnXvMW4J7IR15ngi9q5xxqWBKU744jTZiaXtxaPL7uHG6vtN8kUkw== - dependencies: - decompress-response "^3.3.0" - once "^1.3.1" - simple-concat "^1.0.0" - sinon-chai@^3.7.0: version "3.7.0" resolved "https://registry.npmjs.org/sinon-chai/-/sinon-chai-3.7.0.tgz" @@ -9879,21 +8930,6 @@ sprintf-js@~1.0.2: resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== -sshpk@^1.7.0: - version "1.17.0" - resolved "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz" - integrity sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ== - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - bcrypt-pbkdf "^1.0.0" - dashdash "^1.12.0" - ecc-jsbn "~0.1.1" - getpass "^0.1.1" - jsbn "~0.1.0" - safer-buffer "^2.0.2" - tweetnacl "~0.14.0" - ssri@^10.0.0, ssri@^10.0.1: version "10.0.3" resolved "https://registry.npmjs.org/ssri/-/ssri-10.0.3.tgz" @@ -9927,11 +8963,6 @@ statuses@2.0.1: resolved "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== -strict-uri-encode@^1.0.0: - version "1.1.0" - resolved "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz" - integrity sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ== - string-argv@0.3.2: version "0.3.2" resolved "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz" @@ -10091,23 +9122,6 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -swarm-js@^0.1.40: - version "0.1.42" - resolved "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.42.tgz" - integrity sha512-BV7c/dVlA3R6ya1lMlSSNPLYrntt0LUq4YMgy3iwpCIc6rZnS5W2wUoctarZ5pXlpKtxDDf9hNziEkcfrxdhqQ== - dependencies: - bluebird "^3.5.0" - buffer "^5.0.5" - eth-lib "^0.1.26" - fs-extra "^4.0.2" - got "^11.8.5" - mime-types "^2.1.16" - mkdirp-promise "^5.0.1" - mock-fs "^4.1.0" - setimmediate "^1.0.5" - tar "^4.0.2" - xhr-request "^1.0.1" - symbol-tree@^3.2.4: version "3.2.4" resolved "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz" @@ -10154,19 +9168,6 @@ tar@6.1.11: mkdirp "^1.0.3" yallist "^4.0.0" -tar@^4.0.2: - version "4.4.19" - resolved "https://registry.npmjs.org/tar/-/tar-4.4.19.tgz" - integrity sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA== - dependencies: - chownr "^1.1.4" - fs-minipass "^1.2.7" - minipass "^2.9.0" - minizlib "^1.3.3" - mkdirp "^0.5.5" - safe-buffer "^5.2.1" - yallist "^3.1.1" - tar@^6.1.11, tar@^6.1.2: version "6.1.13" resolved "https://registry.npmjs.org/tar/-/tar-6.1.13.tgz" @@ -10216,11 +9217,6 @@ through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6: resolved "https://registry.npmjs.org/through/-/through-2.3.8.tgz" integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== -timed-out@^4.0.1: - version "4.0.1" - resolved "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz" - integrity sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA== - titleize@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/titleize/-/titleize-3.0.0.tgz#71c12eb7fdd2558aa8a44b0be83b8a76694acd53" @@ -10272,14 +9268,6 @@ tough-cookie@^4.1.2: universalify "^0.2.0" url-parse "^1.5.3" -tough-cookie@~2.5.0: - version "2.5.0" - resolved "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== - dependencies: - psl "^1.1.28" - punycode "^2.1.1" - tr46@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz" @@ -10401,23 +9389,11 @@ tuf-js@^1.1.7: debug "^4.3.4" make-fetch-happen "^11.1.1" -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz" - integrity sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w== - dependencies: - safe-buffer "^5.0.1" - tweetnacl-util@^0.15.1: version "0.15.1" resolved "https://registry.npmjs.org/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz" integrity sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw== -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz" - integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== - tweetnacl@^1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz" @@ -10482,14 +9458,6 @@ type-fest@^1.0.2: resolved "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz" integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA== -type-is@~1.6.18: - version "1.6.18" - resolved "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz" - integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== - dependencies: - media-typer "0.3.0" - mime-types "~2.1.24" - type@^1.0.1: version "1.2.0" resolved "https://registry.npmjs.org/type/-/type-1.2.0.tgz" @@ -10548,11 +9516,6 @@ uglify-js@^3.1.4: resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz" integrity sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g== -ultron@~1.1.0: - version "1.1.1" - resolved "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz" - integrity sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og== - undici-types@~5.26.4: version "5.26.5" resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz" @@ -10618,7 +9581,7 @@ unload@^2.4.1: resolved "https://registry.npmjs.org/unload/-/unload-2.4.1.tgz" integrity sha512-IViSAm8Z3sRBYA+9wc0fLQmU9Nrxb16rcDmIiR6Y9LJSZzI7QY5QsDhqPpKOjAn0O9/kfK1TfNEMMAGPTIraPw== -unpipe@1.0.0, unpipe@~1.0.0: +unpipe@1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== @@ -10656,11 +9619,6 @@ url-parse@^1.5.3: querystringify "^2.1.1" requires-port "^1.0.0" -url-set-query@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz" - integrity sha512-3AChu4NiXquPfeckE5R5cGdiHCMWJx1dwCWOmWIL4KHAziJNOFIYJlpGFeKDvwLPHovZRCxK3cYlwzqI9Vp+Gg== - utf-8-validate@^5.0.2: version "5.0.10" resolved "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz" @@ -10689,16 +9647,6 @@ util@^0.12.5: is-typed-array "^1.1.3" which-typed-array "^1.1.2" -utils-merge@1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz" - integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== - -uuid@^3.3.2: - version "3.4.0" - resolved "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz" - integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== - uuid@^7.0.3: version "7.0.3" resolved "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz" @@ -10755,25 +9703,6 @@ validate-npm-package-name@^3.0.0: dependencies: builtins "^1.0.3" -varint@^5.0.0: - version "5.0.2" - resolved "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz" - integrity sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow== - -vary@^1, vary@~1.1.2: - version "1.1.2" - resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz" - integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== - -verror@1.10.0: - version "1.10.0" - resolved "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz" - integrity sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw== - dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" - w3c-xmlserializer@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz" @@ -10795,15 +9724,6 @@ wcwidth@^1.0.0, wcwidth@^1.0.1: dependencies: defaults "^1.0.3" -web3-bzz@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.10.3.tgz" - integrity sha512-XDIRsTwekdBXtFytMpHBuun4cK4x0ZMIDXSoo1UVYp+oMyZj07c7gf7tNQY5qZ/sN+CJIas4ilhN25VJcjSijQ== - dependencies: - "@types/node" "^12.12.6" - got "12.1.0" - swarm-js "^0.1.40" - web3-core-helpers@1.10.3: version "1.10.3" resolved "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.10.3.tgz" @@ -10849,7 +9769,7 @@ web3-core-subscriptions@1.10.3: eventemitter3 "4.0.4" web3-core-helpers "1.10.3" -web3-core@1.10.3, web3-core@^1.10.3: +web3-core@^1.10.3: version "1.10.3" resolved "https://registry.npmjs.org/web3-core/-/web3-core-1.10.3.tgz" integrity sha512-Vbk0/vUNZxJlz3RFjAhNNt7qTpX8yE3dn3uFxfX5OHbuon5u65YEOd3civ/aQNW745N0vGUlHFNxxmn+sG9DIw== @@ -10862,58 +9782,6 @@ web3-core@1.10.3, web3-core@^1.10.3: web3-core-requestmanager "1.10.3" web3-utils "1.10.3" -web3-eth-abi@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.10.3.tgz" - integrity sha512-O8EvV67uhq0OiCMekqYsDtb6FzfYzMXT7VMHowF8HV6qLZXCGTdB/NH4nJrEh2mFtEwVdS6AmLFJAQd2kVyoMQ== - dependencies: - "@ethersproject/abi" "^5.6.3" - web3-utils "1.10.3" - -web3-eth-accounts@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.10.3.tgz" - integrity sha512-8MipGgwusDVgn7NwKOmpeo3gxzzd+SmwcWeBdpXknuyDiZSQy9tXe+E9LeFGrmys/8mLLYP79n3jSbiTyv+6pQ== - dependencies: - "@ethereumjs/common" "2.6.5" - "@ethereumjs/tx" "3.5.2" - "@ethereumjs/util" "^8.1.0" - eth-lib "0.2.8" - scrypt-js "^3.0.1" - uuid "^9.0.0" - web3-core "1.10.3" - web3-core-helpers "1.10.3" - web3-core-method "1.10.3" - web3-utils "1.10.3" - -web3-eth-contract@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.10.3.tgz" - integrity sha512-Y2CW61dCCyY4IoUMD4JsEQWrILX4FJWDWC/Txx/pr3K/+fGsBGvS9kWQN5EsVXOp4g7HoFOfVh9Lf7BmVVSRmg== - dependencies: - "@types/bn.js" "^5.1.1" - web3-core "1.10.3" - web3-core-helpers "1.10.3" - web3-core-method "1.10.3" - web3-core-promievent "1.10.3" - web3-core-subscriptions "1.10.3" - web3-eth-abi "1.10.3" - web3-utils "1.10.3" - -web3-eth-ens@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.10.3.tgz" - integrity sha512-hR+odRDXGqKemw1GFniKBEXpjYwLgttTES+bc7BfTeoUyUZXbyDHe5ifC+h+vpzxh4oS0TnfcIoarK0Z9tFSiQ== - dependencies: - content-hash "^2.5.2" - eth-ens-namehash "2.0.8" - web3-core "1.10.3" - web3-core-helpers "1.10.3" - web3-core-promievent "1.10.3" - web3-eth-abi "1.10.3" - web3-eth-contract "1.10.3" - web3-utils "1.10.3" - web3-eth-iban@1.10.3: version "1.10.3" resolved "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.10.3.tgz" @@ -10922,45 +9790,6 @@ web3-eth-iban@1.10.3: bn.js "^5.2.1" web3-utils "1.10.3" -web3-eth-personal@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.10.3.tgz" - integrity sha512-avrQ6yWdADIvuNQcFZXmGLCEzulQa76hUOuVywN7O3cklB4nFc/Gp3yTvD3bOAaE7DhjLQfhUTCzXL7WMxVTsw== - dependencies: - "@types/node" "^12.12.6" - web3-core "1.10.3" - web3-core-helpers "1.10.3" - web3-core-method "1.10.3" - web3-net "1.10.3" - web3-utils "1.10.3" - -web3-eth@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-eth/-/web3-eth-1.10.3.tgz" - integrity sha512-Uk1U2qGiif2mIG8iKu23/EQJ2ksB1BQXy3wF3RvFuyxt8Ft9OEpmGlO7wOtAyJdoKzD5vcul19bJpPcWSAYZhA== - dependencies: - web3-core "1.10.3" - web3-core-helpers "1.10.3" - web3-core-method "1.10.3" - web3-core-subscriptions "1.10.3" - web3-eth-abi "1.10.3" - web3-eth-accounts "1.10.3" - web3-eth-contract "1.10.3" - web3-eth-ens "1.10.3" - web3-eth-iban "1.10.3" - web3-eth-personal "1.10.3" - web3-net "1.10.3" - web3-utils "1.10.3" - -web3-net@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-net/-/web3-net-1.10.3.tgz" - integrity sha512-IoSr33235qVoI1vtKssPUigJU9Fc/Ph0T9CgRi15sx+itysmvtlmXMNoyd6Xrgm9LuM4CIhxz7yDzH93B79IFg== - dependencies: - web3-core "1.10.3" - web3-core-method "1.10.3" - web3-utils "1.10.3" - web3-providers-http@1.10.3: version "1.10.3" resolved "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.10.3.tgz" @@ -10988,16 +9817,6 @@ web3-providers-ws@1.10.3: web3-core-helpers "1.10.3" websocket "^1.0.32" -web3-shh@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-shh/-/web3-shh-1.10.3.tgz" - integrity sha512-cAZ60CPvs9azdwMSQ/PSUdyV4PEtaW5edAZhu3rCXf6XxQRliBboic+AvwUvB6j3eswY50VGa5FygfVmJ1JVng== - dependencies: - web3-core "1.10.3" - web3-core-method "1.10.3" - web3-core-subscriptions "1.10.3" - web3-net "1.10.3" - web3-utils@1.10.3, web3-utils@^1.10.3: version "1.10.3" resolved "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.3.tgz" @@ -11012,19 +9831,6 @@ web3-utils@1.10.3, web3-utils@^1.10.3: randombytes "^2.1.0" utf8 "3.0.0" -web3@^1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3/-/web3-1.10.3.tgz" - integrity sha512-DgUdOOqC/gTqW+VQl1EdPxrVRPB66xVNtuZ5KD4adVBtko87hkgM8BTZ0lZ8IbUfnQk6DyjcDujMiH3oszllAw== - dependencies: - web3-bzz "1.10.3" - web3-core "1.10.3" - web3-eth "1.10.3" - web3-eth-personal "1.10.3" - web3-net "1.10.3" - web3-shh "1.10.3" - web3-utils "1.10.3" - webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" @@ -11243,15 +10049,6 @@ ws@8.5.0: resolved "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz" integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== -ws@^3.0.0: - version "3.3.3" - resolved "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz" - integrity sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA== - dependencies: - async-limiter "~1.0.0" - safe-buffer "~5.1.0" - ultron "~1.1.0" - ws@^7.4.6: version "7.5.9" resolved "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz" @@ -11267,36 +10064,6 @@ ws@~8.11.0: resolved "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz" integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg== -xhr-request-promise@^0.1.2: - version "0.1.3" - resolved "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz" - integrity sha512-YUBytBsuwgitWtdRzXDDkWAXzhdGB8bYm0sSzMPZT7Z2MBjMSTHFsyCT1yCRATY+XC69DUrQraRAEgcoCRaIPg== - dependencies: - xhr-request "^1.1.0" - -xhr-request@^1.0.1, xhr-request@^1.1.0: - version "1.1.0" - resolved "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz" - integrity sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA== - dependencies: - buffer-to-arraybuffer "^0.0.5" - object-assign "^4.1.1" - query-string "^5.0.1" - simple-get "^2.7.0" - timed-out "^4.0.1" - url-set-query "^1.0.0" - xhr "^2.0.4" - -xhr@^2.0.4, xhr@^2.3.3: - version "2.6.0" - resolved "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz" - integrity sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA== - dependencies: - global "~4.4.0" - is-function "^1.0.1" - parse-headers "^2.0.0" - xtend "^4.0.0" - xml-name-validator@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz" @@ -11312,7 +10079,7 @@ xmlhttprequest-ssl@~2.0.0: resolved "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz" integrity sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A== -xtend@^4.0.0, xtend@~4.0.1: +xtend@~4.0.1: version "4.0.2" resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== @@ -11332,7 +10099,7 @@ yaeti@^0.0.6: resolved "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz" integrity sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug== -yallist@^3.0.0, yallist@^3.0.2, yallist@^3.1.1: +yallist@^3.0.2: version "3.1.1" resolved "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== From 625e0e5482b2395c7fc7c0caabb6e08a158a0163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 16 Apr 2024 09:32:55 +0200 Subject: [PATCH 011/112] Add viem --- .github/workflows/test_contracts.yml | 2 +- packages/protocol-kit/package.json | 7 + .../tests/e2e/utils/setupEthAdapter.ts | 33 +- yarn.lock | 297 +++++++++++++++++- 4 files changed, 320 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test_contracts.yml b/.github/workflows/test_contracts.yml index 49e36f45f..6940d616f 100644 --- a/.github/workflows/test_contracts.yml +++ b/.github/workflows/test_contracts.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: node-version: [18.x] - provider: [ethers, web3] + provider: [ethers, web3, viem] contract-version: [v1.0.0, v1.1.1, v1.2.0, v1.3.0, v1.4.1] steps: - uses: actions/checkout@v3 diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index 140fe76c5..1fb84cef5 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -33,6 +33,11 @@ "test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && hardhat deploy && nyc hardhat test", "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && hardhat deploy && nyc hardhat test", "test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && hardhat deploy && nyc hardhat test", + "test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && hardhat deploy && nyc hardhat test", + "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && hardhat deploy && nyc hardhat test", + "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && hardhat deploy && nyc hardhat test", + "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && hardhat deploy && nyc hardhat test", + "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && hardhat deploy && nyc hardhat test", "coverage": "nyc report --reporter=lcov", "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", @@ -77,6 +82,8 @@ "nyc": "^15.1.0", "tsconfig-paths": "^4.2.0", "typechain": "^8.3.2", + "viem": "^2.9.19", + "web3": "^4.7.0", "yargs": "^17.7.2" }, "dependencies": { diff --git a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts b/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts index 67d06aef4..09b668455 100644 --- a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts +++ b/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts @@ -1,17 +1,36 @@ -import { Provider } from 'ethers' -import { ethers, web3 } from 'hardhat' +import hre, { ethers } from 'hardhat' import Web3 from 'web3' import { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers' import { Eip1193Provider } from '@safe-global/protocol-kit/types' import { SafeProvider } from '@safe-global/protocol-kit/index' +import { custom, createWalletClient } from 'viem' type Network = 'mainnet' | 'gnosis' | 'zksync' | 'goerli' | 'sepolia' -export async function getEip1193Provider(signer: HardhatEthersSigner): Promise { - return { - request: async (request) => { - return signer.provider.send(request.method, [...((request.params as unknown[]) ?? [])]) - } +export async function getEip1193Provider(): Promise { + switch (process.env.ETH_LIB) { + case 'viem': + const client = createWalletClient({ + transport: custom(hre.network.provider) + }) + + return { request: client.request } as Eip1193Provider + + case 'web3': + const web3Provider = new Web3(hre.network.provider) + + return web3Provider.currentProvider as Eip1193Provider + + case 'ethers': + const browserProvider = new ethers.BrowserProvider(hre.network.provider) + + return { + request: async (request) => { + return browserProvider.send(request.method, [...((request.params as unknown[]) ?? [])]) + } + } + default: + throw new Error('ETH_LIB not set') } } diff --git a/yarn.lock b/yarn.lock index cb0cfbe04..072f8f6e6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17,6 +17,11 @@ resolved "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz" integrity sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg== +"@adraffy/ens-normalize@^1.8.8": + version "1.10.1" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" + integrity sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw== + "@ampproject/remapping@^2.2.0": version "2.2.1" resolved "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz" @@ -1267,7 +1272,7 @@ dependencies: "@noble/hashes" "1.3.1" -"@noble/curves@1.2.0": +"@noble/curves@1.2.0", "@noble/curves@~1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== @@ -1294,7 +1299,7 @@ resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz" integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== -"@noble/hashes@^1.3.1", "@noble/hashes@^1.3.3", "@noble/hashes@~1.3.0", "@noble/hashes@~1.3.1": +"@noble/hashes@^1.3.1", "@noble/hashes@^1.3.3", "@noble/hashes@~1.3.0", "@noble/hashes@~1.3.1", "@noble/hashes@~1.3.2": version "1.3.3" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.3.tgz#39908da56a4adc270147bb07968bf3b16cfe1699" integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA== @@ -1851,6 +1856,11 @@ resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.3.tgz#8584115565228290a6c6c4961973e0903bb3df2f" integrity sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q== +"@scure/base@~1.1.2": + version "1.1.6" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.6.tgz#8ce5d304b436e4c84f896e0550c83e4d88cb917d" + integrity sha512-ok9AWwhcgYuGG3Zfhyqg+zwl+Wn5uE+dwC0NV/2qQkx4dABbb/bx96vWu8NSj+BNjjSjno+JRYRjle1jV08k3g== + "@scure/bip32@1.1.5": version "1.1.5" resolved "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.5.tgz" @@ -1869,6 +1879,15 @@ "@noble/hashes" "~1.3.1" "@scure/base" "~1.1.0" +"@scure/bip32@1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.2.tgz#90e78c027d5e30f0b22c1f8d50ff12f3fb7559f8" + integrity sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA== + dependencies: + "@noble/curves" "~1.2.0" + "@noble/hashes" "~1.3.2" + "@scure/base" "~1.1.2" + "@scure/bip39@1.1.1": version "1.1.1" resolved "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.1.tgz" @@ -2195,14 +2214,6 @@ lodash "^4.17.15" ts-essentials "^7.0.1" -"@typechain/web3-v1@^6.0.7": - version "6.0.7" - resolved "https://registry.npmjs.org/@typechain/web3-v1/-/web3-v1-6.0.7.tgz" - integrity sha512-HWkGplyPL3eWiP0sszqKZh6Bjrdm23srtirUdKp/4BEWKp/o6zofLt8lDn468bRQlQdHaobrbfEeT+3gf/r4eg== - dependencies: - lodash "^4.17.15" - ts-essentials "^7.0.1" - "@types/babel__core@^7.1.14": version "7.20.0" resolved "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz" @@ -2459,6 +2470,13 @@ "@types/bn.js" "*" "@types/underscore" "*" +"@types/ws@8.5.3": + version "8.5.3" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.3.tgz#7d25a1ffbecd3c4f2d35068d0b283c037003274d" + integrity sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w== + dependencies: + "@types/node" "*" + "@types/yargs-parser@*": version "21.0.0" resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz" @@ -2620,6 +2638,16 @@ abbrev@^1.0.0: resolved "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz" integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== +abitype@0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.7.1.tgz#16db20abe67de80f6183cf75f3de1ff86453b745" + integrity sha512-VBkRHTDZf9Myaek/dO3yMmOzB/y2s3Zo6nVU7yaw1G+TvCHAjwaJzNGN9yo4K5D8bU/VZXKP1EJpRhFr862PlQ== + +abitype@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.0.tgz#237176dace81d90d018bebf3a45cb42f2a2d9e97" + integrity sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ== + abitype@^0.1.6: version "0.1.8" resolved "https://registry.npmjs.org/abitype/-/abitype-0.1.8.tgz" @@ -3780,7 +3808,7 @@ cosmiconfig@^8.2.0: parse-json "^5.2.0" path-type "^4.0.0" -crc-32@^1.2.0: +crc-32@^1.2.0, crc-32@^1.2.2: version "1.2.2" resolved "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz" integrity sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ== @@ -5885,6 +5913,11 @@ isomorphic-ws@^5.0.0: resolved "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz" integrity sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw== +isows@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.3.tgz#93c1cf0575daf56e7120bab5c8c448b0809d0d74" + integrity sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg== + istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: version "3.2.0" resolved "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz" @@ -9703,6 +9736,20 @@ validate-npm-package-name@^3.0.0: dependencies: builtins "^1.0.3" +viem@^2.9.19: + version "2.9.19" + resolved "https://registry.yarnpkg.com/viem/-/viem-2.9.19.tgz#095cd0331930e10ba82c32a046d704ef8d349e94" + integrity sha512-1txsVoTz9+XGQpuN62wcDXasNtalW52UR41KnzwWTwHtV2cDcGuVuS/j/hcuQdZ7pU8X8jtq2IrwwR4jjKpy9Q== + dependencies: + "@adraffy/ens-normalize" "1.10.0" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@scure/bip32" "1.3.2" + "@scure/bip39" "1.2.1" + abitype "1.0.0" + isows "1.0.3" + ws "8.13.0" + w3c-xmlserializer@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz" @@ -9782,6 +9829,81 @@ web3-core@^1.10.3: web3-core-requestmanager "1.10.3" web3-utils "1.10.3" +web3-core@^4.3.0, web3-core@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-4.3.2.tgz#f24b11d6a57dee527de8d42c89de2a439f0c4bed" + integrity sha512-uIMVd/j4BgOnwfpY8ZT+QKubOyM4xohEhFZXz9xB8wimXWMMlYVlIK/TbfHqFolS9uOerdSGhsMbcK9lETae8g== + dependencies: + web3-errors "^1.1.4" + web3-eth-accounts "^4.1.0" + web3-eth-iban "^4.0.7" + web3-providers-http "^4.1.0" + web3-providers-ws "^4.0.7" + web3-types "^1.3.1" + web3-utils "^4.1.0" + web3-validator "^2.0.3" + optionalDependencies: + web3-providers-ipc "^4.0.7" + +web3-errors@^1.1.3, web3-errors@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/web3-errors/-/web3-errors-1.1.4.tgz#5667a0a5f66fc936e101ef32032ccc1e8ca4d5a1" + integrity sha512-WahtszSqILez+83AxGecVroyZsMuuRT+KmQp4Si5P4Rnqbczno1k748PCrZTS1J4UCPmXMG2/Vt+0Bz2zwXkwQ== + dependencies: + web3-types "^1.3.1" + +web3-eth-abi@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-4.2.0.tgz#398d415e7783442d06fb7939e40ce3de7a3f04e9" + integrity sha512-x7dUCmk6th+5N63s5kUusoNtsDJKUUQgl9+jECvGTBOTiyHe/V6aOY0120FUjaAGaapOnR7BImQdhqHv6yT2YQ== + dependencies: + abitype "0.7.1" + web3-errors "^1.1.4" + web3-types "^1.3.1" + web3-utils "^4.1.1" + web3-validator "^2.0.4" + +web3-eth-accounts@^4.1.0, web3-eth-accounts@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-4.1.1.tgz#55225e5510b961e1cacb4eccc996544998e907fc" + integrity sha512-9JqhRi1YhO1hQOEmmBHgEGsME/B1FHMxpA/AK3vhpvQ8QeP6KbJW+cForTLfPpUbkmPxnRunG4PNNaETNlZfrA== + dependencies: + "@ethereumjs/rlp" "^4.0.1" + crc-32 "^1.2.2" + ethereum-cryptography "^2.0.0" + web3-errors "^1.1.4" + web3-types "^1.3.1" + web3-utils "^4.1.1" + web3-validator "^2.0.4" + +web3-eth-contract@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-4.3.0.tgz#5cacbac25f9dbb27bea90ea99fea290e5ebd3f87" + integrity sha512-4fzSklA65zUn6SthU3T3tbVJacfP8/wkJmCuvmPaf2ZTFdnhsF96G5IQtCRf0+wASb4yk0A6IBvXZfk1B4R4HA== + dependencies: + web3-core "^4.3.2" + web3-errors "^1.1.4" + web3-eth "^4.5.0" + web3-eth-abi "^4.2.0" + web3-types "^1.5.0" + web3-utils "^4.2.2" + web3-validator "^2.0.5" + +web3-eth-ens@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/web3-eth-ens/-/web3-eth-ens-4.2.0.tgz#8734b034efd48a735f7052fef0205653a78b84cb" + integrity sha512-qYj34te2UctoObt8rlEIY/t2MuTMiMiiHhO2JAHRGqSLCQ7b8DM3RpvkiiSB0N0ZyEn+CetZqJCTYb8DNKBS/g== + dependencies: + "@adraffy/ens-normalize" "^1.8.8" + web3-core "^4.3.2" + web3-errors "^1.1.4" + web3-eth "^4.5.0" + web3-eth-contract "^4.3.0" + web3-net "^4.0.7" + web3-types "^1.5.0" + web3-utils "^4.2.2" + web3-validator "^2.0.5" + web3-eth-iban@1.10.3: version "1.10.3" resolved "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.10.3.tgz" @@ -9790,6 +9912,55 @@ web3-eth-iban@1.10.3: bn.js "^5.2.1" web3-utils "1.10.3" +web3-eth-iban@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-4.0.7.tgz#ee504f845d7b6315f0be78fcf070ccd5d38e4aaf" + integrity sha512-8weKLa9KuKRzibC87vNLdkinpUE30gn0IGY027F8doeJdcPUfsa4IlBgNC4k4HLBembBB2CTU0Kr/HAOqMeYVQ== + dependencies: + web3-errors "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-validator "^2.0.3" + +web3-eth-personal@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-4.0.8.tgz#b51628c560de550ca8b354fa784f9556aae6065c" + integrity sha512-sXeyLKJ7ddQdMxz1BZkAwImjqh7OmKxhXoBNF3isDmD4QDpMIwv/t237S3q4Z0sZQamPa/pHebJRWVuvP8jZdw== + dependencies: + web3-core "^4.3.0" + web3-eth "^4.3.1" + web3-rpc-methods "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-validator "^2.0.3" + +web3-eth@^4.3.1, web3-eth@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/web3-eth/-/web3-eth-4.5.0.tgz#57f5cc020c9b3c4c20d0dacbd87eaa1a9d6c86c0" + integrity sha512-crisE46o/SHMVm+XHAXEaR8k76NCImq+hi0QQEJ+VaLZbDobI/Gvog1HwTukDUDRgnYSAFGqD0cTRyAwDurwpA== + dependencies: + setimmediate "^1.0.5" + web3-core "^4.3.2" + web3-errors "^1.1.4" + web3-eth-abi "^4.2.0" + web3-eth-accounts "^4.1.1" + web3-net "^4.0.7" + web3-providers-ws "^4.0.7" + web3-rpc-methods "^1.2.0" + web3-types "^1.5.0" + web3-utils "^4.2.1" + web3-validator "^2.0.4" + +web3-net@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/web3-net/-/web3-net-4.0.7.tgz#ed2c1bd700cf94be93a6dbd8bd8aa413d8681942" + integrity sha512-SzEaXFrBjY25iQGk5myaOfO9ZyfTwQEa4l4Ps4HDNVMibgZji3WPzpjq8zomVHMwi8bRp6VV7YS71eEsX7zLow== + dependencies: + web3-core "^4.3.0" + web3-rpc-methods "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-providers-http@1.10.3: version "1.10.3" resolved "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.10.3.tgz" @@ -9800,6 +9971,16 @@ web3-providers-http@1.10.3: es6-promise "^4.2.8" web3-core-helpers "1.10.3" +web3-providers-http@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-4.1.0.tgz#8d7afda67d1d8542ca85b30f60a3d1fe1993b561" + integrity sha512-6qRUGAhJfVQM41E5t+re5IHYmb5hSaLc02BE2MaRQsz2xKA6RjmHpOA5h/+ojJxEpI9NI2CrfDKOAgtJfoUJQg== + dependencies: + cross-fetch "^4.0.0" + web3-errors "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-providers-ipc@1.10.3: version "1.10.3" resolved "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.10.3.tgz" @@ -9808,6 +9989,15 @@ web3-providers-ipc@1.10.3: oboe "2.1.5" web3-core-helpers "1.10.3" +web3-providers-ipc@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-4.0.7.tgz#9ec4c8565053af005a5170ba80cddeb40ff3e3d3" + integrity sha512-YbNqY4zUvIaK2MHr1lQFE53/8t/ejHtJchrWn9zVbFMGXlTsOAbNoIoZWROrg1v+hCBvT2c9z8xt7e/+uz5p1g== + dependencies: + web3-errors "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-providers-ws@1.10.3: version "1.10.3" resolved "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.10.3.tgz" @@ -9817,6 +10007,32 @@ web3-providers-ws@1.10.3: web3-core-helpers "1.10.3" websocket "^1.0.32" +web3-providers-ws@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-4.0.7.tgz#7a78a0dcf077e0e802da524fbb37d080b356c14b" + integrity sha512-n4Dal9/rQWjS7d6LjyEPM2R458V8blRm0eLJupDEJOOIBhGYlxw5/4FthZZ/cqB7y/sLVi7K09DdYx2MeRtU5w== + dependencies: + "@types/ws" "8.5.3" + isomorphic-ws "^5.0.0" + web3-errors "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + ws "^8.8.1" + +web3-rpc-methods@^1.1.3, web3-rpc-methods@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/web3-rpc-methods/-/web3-rpc-methods-1.2.0.tgz#761dcb036ab16edb2b03e80c11e3f5df24690345" + integrity sha512-CWJ/g4I4WyYvLkf21wCZAehdhU/VjX/OAPHnqF5/FPDJlogOsOnGXHqi1Z5AP+ocdt395PNubd8jyMMJoYGSBA== + dependencies: + web3-core "^4.3.2" + web3-types "^1.5.0" + web3-validator "^2.0.4" + +web3-types@^1.3.0, web3-types@^1.3.1, web3-types@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/web3-types/-/web3-types-1.5.0.tgz#35b5c0ab149b0d566efeaed8ddaa40db159c748e" + integrity sha512-geWuMIeegQ8AedKAO6wO4G4j1gyQ1F/AyKLMw2vud4bsfZayyzWJgCMDZtjYMm5uo2a7i8j1W3/4QFmzlSy5cw== + web3-utils@1.10.3, web3-utils@^1.10.3: version "1.10.3" resolved "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.3.tgz" @@ -9831,6 +10047,50 @@ web3-utils@1.10.3, web3-utils@^1.10.3: randombytes "^2.1.0" utf8 "3.0.0" +web3-utils@^4.0.7, web3-utils@^4.1.0, web3-utils@^4.1.1, web3-utils@^4.2.1, web3-utils@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-4.2.2.tgz#8fb7c58cfc02d681f17d7806732ce9fb1170c338" + integrity sha512-z+4owWcnoB4EH8yWIL1FBeyqe+sXwaGxUDtVTNPTMf2oB5C+paCToZUdCV5Bi+M543zZEzlzNTabOD+OWNc7NA== + dependencies: + ethereum-cryptography "^2.0.0" + eventemitter3 "^5.0.1" + web3-errors "^1.1.4" + web3-types "^1.5.0" + web3-validator "^2.0.5" + +web3-validator@^2.0.3, web3-validator@^2.0.4, web3-validator@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/web3-validator/-/web3-validator-2.0.5.tgz#de1984bdb34f292251b86400dba7169700db0849" + integrity sha512-2gLOSW8XqEN5pw5jVUm20EB7A8SbQiekpAtiI0JBmCIV0a2rp97v8FgWY5E3UEqnw5WFfEqvcDVW92EyynDTyQ== + dependencies: + ethereum-cryptography "^2.0.0" + util "^0.12.5" + web3-errors "^1.1.4" + web3-types "^1.5.0" + zod "^3.21.4" + +web3@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/web3/-/web3-4.7.0.tgz#d6cb8ff8653b92f26ddd6da0957999e61ae7f107" + integrity sha512-3g+1e7B/IW0Nw9WP1dotrZKWD9o5IBfl27dxEnE1LxBZBax6ZkviiAwf18utIhlNBD07RgI+PPfKDXxfDBlHWA== + dependencies: + web3-core "^4.3.2" + web3-errors "^1.1.4" + web3-eth "^4.5.0" + web3-eth-abi "^4.2.0" + web3-eth-accounts "^4.1.1" + web3-eth-contract "^4.3.0" + web3-eth-ens "^4.2.0" + web3-eth-iban "^4.0.7" + web3-eth-personal "^4.0.8" + web3-net "^4.0.7" + web3-providers-http "^4.1.0" + web3-providers-ws "^4.0.7" + web3-rpc-methods "^1.2.0" + web3-types "^1.5.0" + web3-utils "^4.2.2" + web3-validator "^2.0.5" + webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" @@ -10044,6 +10304,11 @@ ws@7.4.6: resolved "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz" integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== +ws@8.13.0: + version "8.13.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" + integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== + ws@8.5.0: version "8.5.0" resolved "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz" @@ -10059,6 +10324,11 @@ ws@^8.11.0, ws@^8.5.0: resolved "https://registry.yarnpkg.com/ws/-/ws-8.14.2.tgz#6c249a806eb2db7a20d26d51e7709eab7b2e6c7f" integrity sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g== +ws@^8.8.1: + version "8.16.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.16.0.tgz#d1cd774f36fbc07165066a60e40323eab6446fd4" + integrity sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ== + ws@~8.11.0: version "8.11.0" resolved "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz" @@ -10204,3 +10474,8 @@ zksync-web3@^0.14.3: version "0.14.3" resolved "https://registry.npmjs.org/zksync-web3/-/zksync-web3-0.14.3.tgz" integrity sha512-hT72th4AnqyLW1d5Jlv8N2B/qhEnl2NePK2A3org7tAa24niem/UAaHMkEvmWI3SF9waYUPtqAtjpf+yvQ9zvQ== + +zod@^3.21.4: + version "3.22.4" + resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.4.tgz#f31c3a9386f61b1f228af56faa9255e845cf3fff" + integrity sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg== From d613babb770fc7c83a17222399f12977e79577a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 16 Apr 2024 10:02:31 +0200 Subject: [PATCH 012/112] Remove signer from getEip1193Provider() --- .../tests/e2e/contractManager.test.ts | 24 ++-- packages/protocol-kit/tests/e2e/core.test.ts | 71 +++++------- .../createSafeDeploymentTransaction.test.ts | 47 ++++---- .../tests/e2e/createTransaction.test.ts | 33 +++--- .../tests/e2e/createTransactionBatch.test.ts | 2 +- .../e2e/eip1271-contract-signatures.test.ts | 20 ++-- .../protocol-kit/tests/e2e/eip1271.test.ts | 4 +- .../protocol-kit/tests/e2e/erc-20.test.ts | 32 ++---- .../tests/e2e/ethAdapters.test.ts | 32 +++--- .../protocol-kit/tests/e2e/execution.test.ts | 92 ++++++++-------- .../tests/e2e/fallbackHandlerManager.test.ts | 79 ++++++------- .../tests/e2e/getEncodedTransaction.test.ts | 6 +- .../tests/e2e/guardManager.test.ts | 81 +++++++------- .../tests/e2e/moduleManager.test.ts | 84 ++++++-------- .../tests/e2e/offChainSignatures.test.ts | 69 +++++------- .../tests/e2e/onChainSignatures.test.ts | 20 ++-- .../tests/e2e/ownerManager.test.ts | 104 +++++++++--------- .../tests/e2e/safeFactory.test.ts | 63 +++++------ .../protocol-kit/tests/e2e/threshold.test.ts | 29 ++--- .../tests/e2e/utils/setupEthAdapter.ts | 2 +- .../tests/e2e/utilsContracts.test.ts | 20 ++-- ...SafeTransactionIntoDeploymentBatch.test.ts | 8 +- 22 files changed, 406 insertions(+), 516 deletions(-) diff --git a/packages/protocol-kit/tests/e2e/contractManager.test.ts b/packages/protocol-kit/tests/e2e/contractManager.test.ts index 7a906da13..0a2d44820 100644 --- a/packages/protocol-kit/tests/e2e/contractManager.test.ts +++ b/packages/protocol-kit/tests/e2e/contractManager.test.ts @@ -38,8 +38,7 @@ describe('Safe contracts manager', () => { describe('create', async () => { it('should initialize the SDK with a Safe that is not deployed', async () => { const { accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const predictedSafe: PredictedSafeProps = { safeAccountConfig: { owners: [accounts[0].address], @@ -59,9 +58,8 @@ describe('Safe contracts manager', () => { }) it('should fail if the current network is not a default network and no contractNetworks is provided', async () => { - const { safe, accounts } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() await chai .expect( @@ -74,9 +72,8 @@ describe('Safe contracts manager', () => { }) it('should fail if SafeProxy contract is not deployed on the current network', async () => { - const { accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { contractNetworks } = await setupTests() + const provider = getEip1193Provider() await chai .expect( Safe.create({ @@ -89,7 +86,7 @@ describe('Safe contracts manager', () => { }) it('should fail if MultiSend contract is specified in contractNetworks but not deployed', async () => { - const { safe, accounts, chainId } = await setupTests() + const { safe, chainId } = await setupTests() const customContractNetworks: ContractNetworksConfig = { [chainId.toString()]: { safeSingletonAddress: ZERO_ADDRESS, @@ -110,8 +107,8 @@ describe('Safe contracts manager', () => { simulateTxAccessorAbi: (await getSimulateTxAccessor()).abi } } - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() await chai .expect( @@ -125,9 +122,8 @@ describe('Safe contracts manager', () => { }) it('should set the MultiSend contract available on the current network', async () => { - const { safe, accounts, chainId, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, chainId, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, diff --git a/packages/protocol-kit/tests/e2e/core.test.ts b/packages/protocol-kit/tests/e2e/core.test.ts index 86f0626bb..e08903e60 100644 --- a/packages/protocol-kit/tests/e2e/core.test.ts +++ b/packages/protocol-kit/tests/e2e/core.test.ts @@ -41,9 +41,8 @@ describe('Safe Info', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail to connect a Safe { - const { predictedSafe, safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -64,7 +63,7 @@ describe('Safe Info', () => { async () => { const { predictedSafe, safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -81,7 +80,7 @@ describe('Safe Info', () => { it('should connect a deployed Safe', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -93,7 +92,7 @@ describe('Safe Info', () => { .expect(await safeSdk.getSafeProvider().getSignerAddress()) .to.be.eq(await account1.signer.getAddress()) - const provider2 = await getEip1193Provider(account2.signer) + const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk.connect({ provider: provider2, signerAddress: account2.address, @@ -105,7 +104,7 @@ describe('Safe Info', () => { .to.be.eq(await account2.signer.getAddress()) const safe2 = await getSafeWithOwners([account3.address]) - const provider3 = await getEip1193Provider(account3.signer) + const provider3 = getEip1193Provider() const safe2Address = await safe2.getAddress() const safeSdk3 = await safeSdk2.connect({ safeAddress: safe2Address, @@ -121,9 +120,8 @@ describe('Safe Info', () => { describe('getContractVersion', async () => { it('should return the contract version of a Safe that is not deployed with a custom version configuration', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -134,9 +132,8 @@ describe('Safe Info', () => { }) it('should return the contract version of a Safe that is not deployed with a default version configuration', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeConfig: PredictedSafeProps = { ...predictedSafe, safeDeploymentConfig: {} @@ -151,9 +148,8 @@ describe('Safe Info', () => { }) it('should return the Safe contract version', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -169,9 +165,8 @@ describe('Safe Info', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail to return the address of a Safe { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -189,9 +184,8 @@ describe('Safe Info', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return the address of a Safe >=v1.3.0 that is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -212,9 +206,8 @@ describe('Safe Info', () => { ) it('should return the address of a deployed Safe', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -229,7 +222,7 @@ describe('Safe Info', () => { it('should return the connected ISafeProvider', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -244,9 +237,8 @@ describe('Safe Info', () => { describe('getNonce', async () => { it('should return the nonce of a Safe that is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -258,7 +250,7 @@ describe('Safe Info', () => { it('should return the Safe nonce', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ @@ -282,9 +274,8 @@ describe('Safe Info', () => { describe('getChainId', async () => { it('should return the chainId of a Safe that is not deployed', async () => { - const { predictedSafe, accounts, chainId, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, chainId, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -294,9 +285,8 @@ describe('Safe Info', () => { }) it('should return the chainId of the current network', async () => { - const { safe, accounts, chainId, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, chainId, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -311,9 +301,8 @@ describe('Safe Info', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail to return the balance of a Safe { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -332,7 +321,7 @@ describe('Safe Info', () => { async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -356,7 +345,7 @@ describe('Safe Info', () => { it('should return the balance of a deployed Safe', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, diff --git a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts index 3fcaf50a1..bb1599de2 100644 --- a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts @@ -43,10 +43,9 @@ describe('createSafeDeploymentTransaction', () => { }) itif(safeVersionDeployed == '1.4.1')('should return a Safe deployment transactions', async () => { - const { accounts, contractNetworks, predictedSafe } = await setupTests() - const [account1] = accounts + const { contractNetworks, predictedSafe } = await setupTests() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -67,10 +66,9 @@ describe('createSafeDeploymentTransaction', () => { }) itif(safeVersionDeployed == '1.3.0')('should return a Safe deployment transactions', async () => { - const { accounts, contractNetworks, predictedSafe } = await setupTests() - const [account1] = accounts + const { contractNetworks, predictedSafe } = await setupTests() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -91,10 +89,9 @@ describe('createSafeDeploymentTransaction', () => { }) itif(safeVersionDeployed == '1.2.0')('should return a Safe deployment transactions', async () => { - const { accounts, contractNetworks, predictedSafe } = await setupTests() - const [account1] = accounts + const { contractNetworks, predictedSafe } = await setupTests() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -115,10 +112,9 @@ describe('createSafeDeploymentTransaction', () => { }) itif(safeVersionDeployed == '1.1.1')('should return a Safe deployment transactions', async () => { - const { accounts, contractNetworks, predictedSafe } = await setupTests() - const [account1] = accounts + const { contractNetworks, predictedSafe } = await setupTests() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -139,10 +135,9 @@ describe('createSafeDeploymentTransaction', () => { }) itif(safeVersionDeployed == '1.0.0')('should return a Safe deployment transactions', async () => { - const { accounts, contractNetworks, predictedSafe } = await setupTests() - const [account1] = accounts + const { contractNetworks, predictedSafe } = await setupTests() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -163,10 +158,9 @@ describe('createSafeDeploymentTransaction', () => { }) it('should contain the initializer setup call in the deployment data to sets the threshold & owners of the deployed Safe', async () => { - const { accounts, contractNetworks, predictedSafe, chainId } = await setupTests() - const [account1] = accounts + const { contractNetworks, predictedSafe, chainId } = await setupTests() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -196,10 +190,9 @@ describe('createSafeDeploymentTransaction', () => { describe('salt nonce', () => { it('should include the predetermined salt nonce in the Safe deployment data', async () => { - const { accounts, contractNetworks, predictedSafe, chainId } = await setupTests() - const [account1] = accounts + const { contractNetworks, predictedSafe, chainId } = await setupTests() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeSdk = await Safe.create({ provider, @@ -221,10 +214,9 @@ describe('createSafeDeploymentTransaction', () => { }) it('should include the custom salt nonce in the Safe deployment data', async () => { - const { accounts, contractNetworks, predictedSafe } = await setupTests() - const [account1] = accounts + const { contractNetworks, predictedSafe } = await setupTests() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeSdk = await Safe.create({ provider, @@ -243,10 +235,9 @@ describe('createSafeDeploymentTransaction', () => { }) it('should include the salt nonce included in the safeDeploymentConfig in the Safe deployment data', async () => { - const { accounts, contractNetworks, predictedSafe } = await setupTests() - const [account1] = accounts + const { contractNetworks, predictedSafe } = await setupTests() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const customSaltNonce = '123456789' @@ -278,7 +269,7 @@ describe('createSafeDeploymentTransaction', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ diff --git a/packages/protocol-kit/tests/e2e/createTransaction.test.ts b/packages/protocol-kit/tests/e2e/createTransaction.test.ts index 8f2df9b20..3ef1c353b 100644 --- a/packages/protocol-kit/tests/e2e/createTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createTransaction.test.ts @@ -57,7 +57,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -85,7 +85,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -114,7 +114,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -144,7 +144,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -172,7 +172,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -202,7 +202,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -231,7 +231,7 @@ describe('Transactions creation', () => { it('should create a single transaction with gasPrice=0', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -254,7 +254,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -285,7 +285,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -316,7 +316,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -338,7 +338,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -367,7 +367,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -382,7 +382,7 @@ describe('Transactions creation', () => { const { accounts, contractNetworks, erc20Mintable, chainId } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -418,7 +418,7 @@ describe('Transactions creation', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, @@ -460,9 +460,8 @@ describe('Transactions creation', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail to create a transaction if the Safe with version { - const { safe, predictedSafe, accounts, contractNetworks } = await setupTests() - const account = accounts[0] - const provider = await getEip1193Provider(account.signer) + const { safe, predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, diff --git a/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts b/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts index af17d470e..6ac024824 100644 --- a/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts +++ b/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts @@ -44,7 +44,7 @@ describe('createTransactionBatch', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ diff --git a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts index 911b40410..d41858101 100644 --- a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts @@ -77,11 +77,11 @@ describe('The EIP1271 implementation', () => { // Create adapters and the protocol kit instance const [account1, account2, account3, account4, account5] = accounts - const provider1 = await getEip1193Provider(account1.signer) - const provider2 = await getEip1193Provider(account2.signer) - const provider3 = await getEip1193Provider(account3.signer) - const provider4 = await getEip1193Provider(account4.signer) - const provider5 = await getEip1193Provider(account5.signer) + const provider1 = getEip1193Provider() + const provider2 = getEip1193Provider() + const provider3 = getEip1193Provider() + const provider4 = getEip1193Provider() + const provider5 = getEip1193Provider() let protocolKit = await Safe.create({ provider: provider1, @@ -238,11 +238,11 @@ describe('The EIP1271 implementation', () => { // Create adapters and the protocol kit instance const [account1, account2, account3, account4, account5] = accounts - const provider1 = await getEip1193Provider(account1.signer) - const provider2 = await getEip1193Provider(account2.signer) - const provider3 = await getEip1193Provider(account3.signer) - const provider4 = await getEip1193Provider(account4.signer) - const provider5 = await getEip1193Provider(account5.signer) + const provider1 = getEip1193Provider() + const provider2 = getEip1193Provider() + const provider3 = getEip1193Provider() + const provider4 = getEip1193Provider() + const provider5 = getEip1193Provider() let protocolKit = await Safe.create({ provider: provider1, diff --git a/packages/protocol-kit/tests/e2e/eip1271.test.ts b/packages/protocol-kit/tests/e2e/eip1271.test.ts index d324689d5..98a475007 100644 --- a/packages/protocol-kit/tests/e2e/eip1271.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271.test.ts @@ -66,7 +66,7 @@ describe('The EIP1271 implementation', () => { const safeAddress = await safe.getAddress() // Adapter and Safe instance for owner 1 - const provider1 = await getEip1193Provider(account1.signer) + const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, @@ -74,7 +74,7 @@ describe('The EIP1271 implementation', () => { }) // Adapter and Safe instance for owner 2 - const provider2 = await getEip1193Provider(account2.signer) + const provider2 = getEip1193Provider() const safeSdk2 = await Safe.create({ provider: provider2, signerAddress: account2.address, diff --git a/packages/protocol-kit/tests/e2e/erc-20.test.ts b/packages/protocol-kit/tests/e2e/erc-20.test.ts index f12e96c61..eea7100af 100644 --- a/packages/protocol-kit/tests/e2e/erc-20.test.ts +++ b/packages/protocol-kit/tests/e2e/erc-20.test.ts @@ -47,13 +47,11 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return the correct decimals for a standard ERC20 token', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = await safe.getAddress() - const [account1] = accounts - - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() // mock decimals() call callStub = sinon.stub(SafeProvider.prototype, 'call').returns(Promise.resolve('0x12')) @@ -73,12 +71,10 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return the correct decimals for a non-standard ERC20 token', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = await safe.getAddress() - const [account1] = accounts - - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() // mock decimals() call callStub = sinon.stub(SafeProvider.prototype, 'call').returns(Promise.resolve('0x06')) @@ -98,12 +94,10 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should throw an error if decimals() fn is not defined', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = await safe.getAddress() - const [account1] = accounts - - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() // mock decimals() call callStub = sinon.stub(SafeProvider.prototype, 'call').returns(Promise.resolve('0x')) @@ -130,7 +124,7 @@ describe('ERC-20 utils', () => { const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -150,12 +144,10 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return true if it is an standard ERC20 token', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = await safe.getAddress() - const [account1] = accounts - - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() // mock decimals() call callStub = sinon.stub(SafeProvider.prototype, 'call').returns(Promise.resolve('0x12')) @@ -178,12 +170,10 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return false for a non-standard ERC20 token', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = await safe.getAddress() - const [account1] = accounts - - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() // mock decimals() call callStub = sinon.stub(SafeProvider.prototype, 'call').returns(Promise.resolve('0x06')) diff --git a/packages/protocol-kit/tests/e2e/ethAdapters.test.ts b/packages/protocol-kit/tests/e2e/ethAdapters.test.ts index cd1e25a3c..aff8bde47 100644 --- a/packages/protocol-kit/tests/e2e/ethAdapters.test.ts +++ b/packages/protocol-kit/tests/e2e/ethAdapters.test.ts @@ -85,9 +85,8 @@ describe('Safe contracts', () => { }) it('should return a Safe contract from the custom addresses', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { contractNetworks, chainId } = await setupTests() + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -118,9 +117,8 @@ describe('Safe contracts', () => { }) it('should return a MultiSend contract from the custom addresses', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { contractNetworks, chainId } = await setupTests() + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -151,9 +149,8 @@ describe('Safe contracts', () => { }) it('should return a MultiSendCallOnly contract from the custom addresses', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { contractNetworks, chainId } = await setupTests() + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -188,9 +185,8 @@ describe('Safe contracts', () => { }) it('should return a CompatibilityFallbackHandler contract from the custom addresses', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { contractNetworks, chainId } = await setupTests() + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -224,7 +220,7 @@ describe('Safe contracts', () => { it('should return a SafeProxyFactory contract from the custom addresses', async () => { const { accounts, contractNetworks, chainId } = await setupTests() const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -255,9 +251,8 @@ describe('Safe contracts', () => { }) it('should return a SignMessageLib contract from the custom addresses', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { contractNetworks, chainId } = await setupTests() + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -288,9 +283,8 @@ describe('Safe contracts', () => { }) it('should return a SafeProxyFactory contract from the custom addresses', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { contractNetworks, chainId } = await setupTests() + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] diff --git a/packages/protocol-kit/tests/e2e/execution.test.ts b/packages/protocol-kit/tests/e2e/execution.test.ts index e96d165e9..1b08ad20b 100644 --- a/packages/protocol-kit/tests/e2e/execution.test.ts +++ b/packages/protocol-kit/tests/e2e/execution.test.ts @@ -37,13 +37,13 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider1 = await getEip1193Provider(account1.signer) + const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, contractNetworks }) - const provider2 = await getEip1193Provider(account2.signer) + const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address, @@ -76,7 +76,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -106,7 +106,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -130,13 +130,13 @@ describe('Transactions execution', () => { const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, contractNetworks }) - const provider2 = await getEip1193Provider(account2.signer) + const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address @@ -161,7 +161,7 @@ describe('Transactions execution', () => { const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -183,13 +183,13 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider1 = await getEip1193Provider(account1.signer) + const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, contractNetworks }) - const provider2 = await getEip1193Provider(account2.signer) + const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address, @@ -220,7 +220,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -247,7 +247,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -274,7 +274,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -311,9 +311,9 @@ describe('Transactions execution', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - const provider1 = await getEip1193Provider(account1.signer) - const provider2 = await getEip1193Provider(account2.signer) - const provider3 = await getEip1193Provider(account3.signer) + const provider1 = getEip1193Provider() + const provider2 = getEip1193Provider() + const provider3 = getEip1193Provider() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, @@ -369,10 +369,10 @@ describe('Transactions execution', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - const provider1 = await getEip1193Provider(account1.signer) - const provider2 = await getEip1193Provider(account2.signer) - const provider3 = await getEip1193Provider(account3.signer) - const provider4 = await getEip1193Provider(account4.signer) + const provider1 = getEip1193Provider() + const provider2 = getEip1193Provider() + const provider3 = getEip1193Provider() + const provider4 = getEip1193Provider() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, @@ -436,11 +436,11 @@ describe('Transactions execution', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - const provider1 = await getEip1193Provider(account1.signer) - const provider2 = await getEip1193Provider(account2.signer) - const provider3 = await getEip1193Provider(account3.signer) - const provider4 = await getEip1193Provider(account4.signer) - const provider5 = await getEip1193Provider(account5.signer) + const provider1 = getEip1193Provider() + const provider2 = getEip1193Provider() + const provider3 = getEip1193Provider() + const provider4 = getEip1193Provider() + const provider5 = getEip1193Provider() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, @@ -512,12 +512,12 @@ describe('Transactions execution', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - const provider1 = await getEip1193Provider(account1.signer) - const provider2 = await getEip1193Provider(account2.signer) - const provider3 = await getEip1193Provider(account3.signer) - const provider4 = await getEip1193Provider(account4.signer) - const provider5 = await getEip1193Provider(account5.signer) - const provider6 = await getEip1193Provider(account6.signer) + const provider1 = getEip1193Provider() + const provider2 = getEip1193Provider() + const provider3 = getEip1193Provider() + const provider4 = getEip1193Provider() + const provider5 = getEip1193Provider() + const provider6 = getEip1193Provider() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, @@ -581,19 +581,19 @@ describe('Transactions execution', () => { it('should execute a transaction when is not submitted by an owner', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3] = accounts - const provider1 = await getEip1193Provider(account1.signer) + const provider1 = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, contractNetworks }) - const provider2 = await getEip1193Provider(account2.signer) + const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address }) - const provider3 = await getEip1193Provider(account3.signer) + const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ provider: provider3, signerAddress: account3.address @@ -626,7 +626,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -657,7 +657,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -692,7 +692,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -729,7 +729,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -760,7 +760,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -795,7 +795,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -830,7 +830,7 @@ describe('Transactions execution', () => { const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -861,18 +861,18 @@ describe('Transactions execution', () => { const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() - const provider1 = await getEip1193Provider(account1.signer) + const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, contractNetworks }) - const provider2 = await getEip1193Provider(account2.signer) + const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address }) - const provider3 = await getEip1193Provider(account3.signer) + const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ provider: provider3, signerAddress: account3.address @@ -912,18 +912,18 @@ describe('Transactions execution', () => { const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() - const provider1 = await getEip1193Provider(account1.signer) + const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress, contractNetworks }) - const provider2 = await getEip1193Provider(account2.signer) + const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address }) - const provider3 = await getEip1193Provider(account3.signer) + const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ provider: provider3, signerAddress: account3.address diff --git a/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts b/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts index 2a45db668..100ebc3cd 100644 --- a/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts @@ -48,10 +48,9 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed < '1.1.1')( 'should fail if getting the enabled fallback handler is not supported', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = await safe.getAddress() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, @@ -67,9 +66,8 @@ describe('Fallback handler manager', () => { ) itif(safeVersionDeployed >= '1.1.1')('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -79,9 +77,8 @@ describe('Fallback handler manager', () => { }) itif(safeVersionDeployed >= '1.1.1')('should return the enabled fallback handler', async () => { - const { safe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks, defaultCallbackHandler } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -107,10 +104,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail if the Safe with version { - const { predictedSafe, accounts, contractNetworks, defaultCallbackHandler } = - await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks, defaultCallbackHandler } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -128,10 +123,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should fail if the Safe with version >=v1.3.0 is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks, defaultCallbackHandler } = - await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks, defaultCallbackHandler } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -145,9 +138,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed < '1.1.1')( 'should fail if enabling a fallback handler is not supported', async () => { - const { safe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks, defaultCallbackHandler } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -164,9 +156,8 @@ describe('Fallback handler manager', () => { ) itif(safeVersionDeployed >= '1.1.1')('should fail if address is invalid', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -180,9 +171,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')( 'should fail if address is equal to 0x address', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -195,9 +185,8 @@ describe('Fallback handler manager', () => { ) itif(safeVersionDeployed >= '1.1.1')('should fail if address is already enabled', async () => { - const { safe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks, defaultCallbackHandler } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -216,9 +205,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')( 'should build the transaction with the optional props', async () => { - const { safe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks, defaultCallbackHandler } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -247,9 +235,8 @@ describe('Fallback handler manager', () => { ) itif(safeVersionDeployed >= '1.1.1')('should enable a fallback handler', async () => { - const { safe, accounts, contractNetworks, defaultCallbackHandler } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks, defaultCallbackHandler } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -275,9 +262,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail if the Safe with version { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -295,10 +281,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should fail if the Safe with version >=v1.3.0 is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks, defaultCallbackHandler } = - await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks, defaultCallbackHandler } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -316,7 +300,7 @@ describe('Fallback handler manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, @@ -334,9 +318,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')( 'should fail if no fallback handler is enabled', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -361,7 +344,7 @@ describe('Fallback handler manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, @@ -399,7 +382,7 @@ describe('Fallback handler manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, diff --git a/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts b/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts index ec833726e..22f8efbfb 100644 --- a/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts @@ -26,7 +26,7 @@ describe('getEncodedTransaction', () => { const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -57,7 +57,7 @@ describe('getEncodedTransaction', () => { const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -88,7 +88,7 @@ describe('getEncodedTransaction', () => { const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, diff --git a/packages/protocol-kit/tests/e2e/guardManager.test.ts b/packages/protocol-kit/tests/e2e/guardManager.test.ts index 8a9d86fb2..7f8859bc0 100644 --- a/packages/protocol-kit/tests/e2e/guardManager.test.ts +++ b/packages/protocol-kit/tests/e2e/guardManager.test.ts @@ -44,9 +44,8 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail if getting the enabled guard is not supported', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -63,9 +62,8 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -77,9 +75,8 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return 0x address when no Safe guard is enabled', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -91,9 +88,8 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should return the enabled Safe guard', async () => { - const { safe, accounts, contractNetworks, debugTransactionGuard } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks, debugTransactionGuard } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -112,9 +108,9 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail if enabling a Safe guard is not supported', async () => { - const { safe, accounts, contractNetworks, debugTransactionGuard } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks, debugTransactionGuard } = await setupTests() + + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -131,10 +127,9 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, debugTransactionGuard, contractNetworks } = - await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, debugTransactionGuard, contractNetworks } = await setupTests() + + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -145,9 +140,9 @@ describe('Safe guard manager', () => { }) itif(safeVersionDeployed >= '1.3.0')('should fail if address is invalid', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -161,9 +156,9 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should fail if address is equal to 0x address', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -176,9 +171,9 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should fail if address is already enabled', async () => { - const { safe, accounts, contractNetworks, debugTransactionGuard } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks, debugTransactionGuard } = await setupTests() + + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -195,9 +190,9 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should build the transaction with the optional props', async () => { - const { safe, accounts, contractNetworks, debugTransactionGuard } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks, debugTransactionGuard } = await setupTests() + + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -226,9 +221,9 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should enable a Safe guard', async () => { - const { safe, accounts, contractNetworks, debugTransactionGuard } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks, debugTransactionGuard } = await setupTests() + + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -250,7 +245,7 @@ describe('Safe guard manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -267,9 +262,9 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should fail if the Safe is not deployed', async () => { - const { accounts, predictedSafe, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -280,9 +275,9 @@ describe('Safe guard manager', () => { }) itif(safeVersionDeployed >= '1.3.0')('should fail if no Safe guard is enabled', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -300,7 +295,7 @@ describe('Safe guard manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, @@ -333,7 +328,7 @@ describe('Safe guard manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, diff --git a/packages/protocol-kit/tests/e2e/moduleManager.test.ts b/packages/protocol-kit/tests/e2e/moduleManager.test.ts index 37a919fda..0a287aecc 100644 --- a/packages/protocol-kit/tests/e2e/moduleManager.test.ts +++ b/packages/protocol-kit/tests/e2e/moduleManager.test.ts @@ -46,9 +46,8 @@ describe('Safe modules manager', () => { describe('getModules', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -58,9 +57,8 @@ describe('Safe modules manager', () => { }) it('should return all the enabled modules', async () => { - const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, dailyLimitModule, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -77,9 +75,8 @@ describe('Safe modules manager', () => { describe('isModuleEnabled', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, dailyLimitModule, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, dailyLimitModule, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -90,9 +87,8 @@ describe('Safe modules manager', () => { }) it('should return true if a module is enabled', async () => { - const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, dailyLimitModule, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -109,9 +105,8 @@ describe('Safe modules manager', () => { describe('createEnableModuleTx', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, dailyLimitModule, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, dailyLimitModule, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -122,9 +117,8 @@ describe('Safe modules manager', () => { }) it('should fail if address is invalid', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -136,9 +130,8 @@ describe('Safe modules manager', () => { }) it('should fail if address is equal to sentinel', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -150,9 +143,8 @@ describe('Safe modules manager', () => { }) it('should fail if address is equal to 0x address', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -164,9 +156,8 @@ describe('Safe modules manager', () => { }) it('should fail if address is already enabled', async () => { - const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, dailyLimitModule, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -181,9 +172,8 @@ describe('Safe modules manager', () => { }) it('should build the transaction with the optional props', async () => { - const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, dailyLimitModule, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -208,9 +198,8 @@ describe('Safe modules manager', () => { }) it('should enable a Safe module', async () => { - const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, dailyLimitModule, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -229,9 +218,8 @@ describe('Safe modules manager', () => { describe('createDisableModuleTx', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, dailyLimitModule, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, dailyLimitModule, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -242,9 +230,8 @@ describe('Safe modules manager', () => { }) it('should fail if address is invalid', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -256,9 +243,8 @@ describe('Safe modules manager', () => { }) it('should fail if address is equal to sentinel', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -270,9 +256,8 @@ describe('Safe modules manager', () => { }) it('should fail if address is equal to 0x address', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -284,9 +269,8 @@ describe('Safe modules manager', () => { }) it('should fail if address is not enabled', async () => { - const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, dailyLimitModule, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -302,7 +286,7 @@ describe('Safe modules manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, @@ -338,7 +322,7 @@ describe('Safe modules manager', () => { const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, diff --git a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts index 64929d1b7..d612dfd9f 100644 --- a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts @@ -37,9 +37,8 @@ describe('Off-chain signatures', () => { describe('signHash', async () => { it('should sign a transaction hash with the current signer if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -51,9 +50,8 @@ describe('Off-chain signatures', () => { }) it('should sign a transaction hash with the current signer', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -76,9 +74,8 @@ describe('Off-chain signatures', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail to sign a transaction if the Safe with version { - const { safe, predictedSafe, accounts, contractNetworks } = await setupTests() - const account = accounts[0] - const provider = await getEip1193Provider(account.signer) + const { safe, predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -110,9 +107,8 @@ describe('Off-chain signatures', () => { itif(safeVersionDeployed >= '1.3.0')( 'should sign a transaction with the current signer if the Safe with version >=v1.3.0 is using predicted config', async () => { - const { safe, predictedSafe, accounts, contractNetworks } = await setupTests() - const account = accounts[0] - const provider = await getEip1193Provider(account.signer) + const { safe, predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -135,7 +131,7 @@ describe('Off-chain signatures', () => { it('should fail if the signature is added by an account that is not an owner', async () => { const { safe, accounts, contractNetworks } = await setupTests() const account3 = accounts[2] - const provider = await getEip1193Provider(account3.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -155,9 +151,8 @@ describe('Off-chain signatures', () => { }) it('should ignore duplicated signatures', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -181,9 +176,8 @@ describe('Off-chain signatures', () => { itif(safeVersionDeployed === '1.0.0')( 'should fail if the signature of the current signer is added using eth_sign and safeVersion===1.0.0', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -205,9 +199,8 @@ describe('Off-chain signatures', () => { itif(safeVersionDeployed > '1.0.0')( 'should add the signature of the current signer using eth_sign if safeVersion>1.0.0', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -230,9 +223,8 @@ describe('Off-chain signatures', () => { itif(process.env.ETH_LIB === 'ethers')( 'should add the signature of the current signer using eth_signTypedData with ethers provider', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -255,9 +247,8 @@ describe('Off-chain signatures', () => { itif(process.env.ETH_LIB === 'web3')( 'should fail if the signature of the current signer is added using eth_signTypedData with web3 provider', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -279,9 +270,8 @@ describe('Off-chain signatures', () => { itif(process.env.ETH_LIB === 'ethers')( 'should add the signature of the current signer using eth_signTypedData_v3 with ethers provider', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -304,9 +294,8 @@ describe('Off-chain signatures', () => { itif(process.env.ETH_LIB === 'web3')( 'should fail if the signature of the current signer is added using eth_signTypedData_v3 with web3 provider', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -326,9 +315,8 @@ describe('Off-chain signatures', () => { ) it('should add the signature of the current signer using eth_signTypedData_v4', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -348,9 +336,8 @@ describe('Off-chain signatures', () => { }) it('should add the signature of the current signer using eth_signTypedData_v4 by default', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -372,7 +359,7 @@ describe('Off-chain signatures', () => { it('should sign a transaction received from the Safe Transaction Service', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, diff --git a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts index 6957437e8..37b59f16c 100644 --- a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts @@ -36,9 +36,8 @@ describe('On-chain signatures', () => { describe('approveTransactionHash', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, predictedSafe, @@ -53,7 +52,7 @@ describe('On-chain signatures', () => { it('should fail if a transaction hash is approved by an account that is not an owner', async () => { const { safe, accounts, contractNetworks } = await setupTests() const account3 = accounts[2] - const provider = await getEip1193Provider(account3.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ provider, @@ -76,7 +75,7 @@ describe('On-chain signatures', () => { it('should approve the transaction hash', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ provider, @@ -98,7 +97,7 @@ describe('On-chain signatures', () => { it('should ignore a duplicated signatures', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ provider, @@ -124,9 +123,8 @@ describe('On-chain signatures', () => { describe('getOwnersWhoApprovedTx', async () => { it('should fail if Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider1 = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ provider: provider1, predictedSafe, @@ -140,14 +138,14 @@ describe('On-chain signatures', () => { it('should return the list of owners who approved a transaction hash', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider1 = await getEip1193Provider(account1.signer) + const provider1 = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress: safeAddress, contractNetworks }) - const provider2 = await getEip1193Provider(account2.signer) + const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address diff --git a/packages/protocol-kit/tests/e2e/ownerManager.test.ts b/packages/protocol-kit/tests/e2e/ownerManager.test.ts index 1bc526275..127677c31 100644 --- a/packages/protocol-kit/tests/e2e/ownerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/ownerManager.test.ts @@ -44,9 +44,8 @@ describe('Safe owners manager', () => { describe('getOwners', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -59,7 +58,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address, account2.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -76,7 +75,7 @@ describe('Safe owners manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -89,7 +88,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -103,7 +102,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -118,7 +117,7 @@ describe('Safe owners manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -132,7 +131,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -146,7 +145,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -160,7 +159,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -174,7 +173,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -188,7 +187,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -208,7 +207,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -222,7 +221,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -249,7 +248,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -274,7 +273,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -302,7 +301,7 @@ describe('Safe owners manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -313,9 +312,8 @@ describe('Safe owners manager', () => { }) it('should fail if address is invalid', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -326,9 +324,8 @@ describe('Safe owners manager', () => { }) it('should fail if address is equal to sentinel', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -339,9 +336,8 @@ describe('Safe owners manager', () => { }) it('should fail if address is equal to 0x address', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -354,7 +350,7 @@ describe('Safe owners manager', () => { it('should fail if address is not an owner', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, , , account4] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -367,7 +363,7 @@ describe('Safe owners manager', () => { it('should fail if the threshold is bigger than the number of owners', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -386,7 +382,7 @@ describe('Safe owners manager', () => { it('should fail if the threshold is not bigger than 0', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -399,7 +395,7 @@ describe('Safe owners manager', () => { it('should build the transaction with the optional props', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider1 = await getEip1193Provider(account1.signer) + const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress: await safe.getAddress(), @@ -425,18 +421,18 @@ describe('Safe owners manager', () => { it('should remove the first owner of a Safe and decrease the threshold', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3] = accounts - const provider1 = await getEip1193Provider(account1.signer) + const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress: await safe.getAddress(), contractNetworks }) - const provider2 = await getEip1193Provider(account2.signer) + const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address }) - const provider3 = await getEip1193Provider(account3.signer) + const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ provider: provider3, signerAddress: account3.address @@ -463,18 +459,18 @@ describe('Safe owners manager', () => { it('should remove any owner of a Safe and decrease the threshold', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3] = accounts - const provider1 = await getEip1193Provider(account1.signer) + const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress: await safe.getAddress(), contractNetworks }) - const provider2 = await getEip1193Provider(account2.signer) + const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address }) - const provider3 = await getEip1193Provider(account3.signer) + const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ provider: provider3, signerAddress: account3.address, @@ -502,18 +498,18 @@ describe('Safe owners manager', () => { it('should remove an owner and update the threshold', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3] = accounts - const provider1 = await getEip1193Provider(account1.signer) + const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress: await safe.getAddress(), contractNetworks }) - const provider2 = await getEip1193Provider(account2.signer) + const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address }) - const provider3 = await getEip1193Provider(account3.signer) + const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ provider: provider3, signerAddress: account3.address @@ -544,7 +540,7 @@ describe('Safe owners manager', () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -561,7 +557,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -578,7 +574,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -595,7 +591,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -612,7 +608,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -629,7 +625,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -646,7 +642,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -663,7 +659,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2, , account4] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -680,7 +676,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -697,7 +693,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -727,7 +723,7 @@ describe('Safe owners manager', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -750,18 +746,18 @@ describe('Safe owners manager', () => { it('should replace any owner of a Safe', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1, account2, account3, account4] = accounts - const provider1 = await getEip1193Provider(account1.signer) + const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ provider: provider1, safeAddress: await safe.getAddress(), contractNetworks }) - const provider2 = await getEip1193Provider(account2.signer) + const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, signerAddress: account2.address }) - const provider3 = await getEip1193Provider(account3.signer) + const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ provider: provider3, signerAddress: account3.address diff --git a/packages/protocol-kit/tests/e2e/safeFactory.test.ts b/packages/protocol-kit/tests/e2e/safeFactory.test.ts index 0842517cc..a766d2512 100644 --- a/packages/protocol-kit/tests/e2e/safeFactory.test.ts +++ b/packages/protocol-kit/tests/e2e/safeFactory.test.ts @@ -45,18 +45,15 @@ describe('SafeProxyFactory', () => { describe('create', async () => { it('should fail if the current network is not a default network and no contractNetworks is provided', async () => { - const { accounts } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() chai .expect(SafeFactory.create({ provider })) .rejectedWith('Invalid SafeProxyFactory contract') }) it('should fail if the contractNetworks provided are not deployed', async () => { - const { accounts, chainId } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { chainId } = await setupTests() + const provider = getEip1193Provider() const contractNetworks: ContractNetworksConfig = { [chainId.toString()]: { safeSingletonAddress: ZERO_ADDRESS, @@ -83,9 +80,8 @@ describe('SafeProxyFactory', () => { }) it('should instantiate the SafeProxyFactory', async () => { - const { accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const networkId = await safeProvider.getChainId() @@ -99,7 +95,7 @@ describe('SafeProxyFactory', () => { it('should return the connected ISafeProvider', async () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) chai .expect(await safeFactory.getSafeProvider().getSignerAddress()) @@ -109,9 +105,8 @@ describe('SafeProxyFactory', () => { describe('getChainId', async () => { it('should return the chainId of the current network', async () => { - const { accounts, chainId, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { chainId, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) chai.expect(await safeFactory.getChainId()).to.be.eq(chainId) }) @@ -119,9 +114,8 @@ describe('SafeProxyFactory', () => { describe('predictSafeAddress', async () => { it('should fail if there are no owners', async () => { - const { accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners: string[] = [] const threshold = 2 @@ -136,7 +130,7 @@ describe('SafeProxyFactory', () => { it('should fail if the threshold is lower than 0', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const invalidThreshold = 0 @@ -151,7 +145,7 @@ describe('SafeProxyFactory', () => { it('should fail if the threshold is higher than the threshold', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const invalidThreshold = 3 @@ -166,7 +160,7 @@ describe('SafeProxyFactory', () => { it('should fail if the saltNonce is lower than 0', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -185,7 +179,7 @@ describe('SafeProxyFactory', () => { it('should predict a new Safe with saltNonce', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -212,7 +206,7 @@ describe('SafeProxyFactory', () => { async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -241,7 +235,7 @@ describe('SafeProxyFactory', () => { async () => { const { accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -271,9 +265,8 @@ describe('SafeProxyFactory', () => { describe('deploySafe', async () => { it('should fail if there are no owners', async () => { - const { accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners: string[] = [] const threshold = 2 @@ -287,7 +280,7 @@ describe('SafeProxyFactory', () => { it('should fail if the threshold is lower than 0', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const threshold = 0 @@ -301,7 +294,7 @@ describe('SafeProxyFactory', () => { it('should fail if the threshold is higher than the threshold', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const threshold = 3 @@ -315,7 +308,7 @@ describe('SafeProxyFactory', () => { it('should fail if the saltNonce is lower than 0', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -336,7 +329,7 @@ describe('SafeProxyFactory', () => { async () => { const { accounts, contractNetworks, defaultCallbackHandler } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -365,7 +358,7 @@ describe('SafeProxyFactory', () => { async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -387,7 +380,7 @@ describe('SafeProxyFactory', () => { it('should deploy a new Safe without saltNonce', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -407,7 +400,7 @@ describe('SafeProxyFactory', () => { it('should deploy a new Safe with saltNonce', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -432,7 +425,7 @@ describe('SafeProxyFactory', () => { const callback = (txHash: string) => { callbackResult = txHash } - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -454,7 +447,7 @@ describe('SafeProxyFactory', () => { async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const threshold = 2 @@ -469,7 +462,7 @@ describe('SafeProxyFactory', () => { it('should deploy a specific Safe version', async () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, diff --git a/packages/protocol-kit/tests/e2e/threshold.test.ts b/packages/protocol-kit/tests/e2e/threshold.test.ts index 19bd588c7..17a814654 100644 --- a/packages/protocol-kit/tests/e2e/threshold.test.ts +++ b/packages/protocol-kit/tests/e2e/threshold.test.ts @@ -39,9 +39,8 @@ describe('Safe Threshold', () => { describe('getThreshold', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -51,9 +50,8 @@ describe('Safe Threshold', () => { }) it('should return the Safe threshold', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -65,9 +63,8 @@ describe('Safe Threshold', () => { describe('createChangeThresholdTx', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { predictedSafe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -80,9 +77,8 @@ describe('Safe Threshold', () => { }) it('should fail if the threshold is bigger than the number of owners', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -97,9 +93,8 @@ describe('Safe Threshold', () => { }) it('should fail if the threshold is not bigger than 0', async () => { - const { safe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const provider = await getEip1193Provider(account1.signer) + const { safe, contractNetworks } = await setupTests() + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -115,7 +110,7 @@ describe('Safe Threshold', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address, account2.address], 1) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -144,7 +139,7 @@ describe('Safe Threshold', () => { const { accounts, contractNetworks } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address, account2.address], 1) - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), diff --git a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts b/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts index 09b668455..929d51b6d 100644 --- a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts +++ b/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts @@ -7,7 +7,7 @@ import { custom, createWalletClient } from 'viem' type Network = 'mainnet' | 'gnosis' | 'zksync' | 'goerli' | 'sepolia' -export async function getEip1193Provider(): Promise { +export function getEip1193Provider(): Eip1193Provider { switch (process.env.ETH_LIB) { case 'viem': const client = createWalletClient({ diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index ca3847f7d..c4b65afdc 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -59,7 +59,7 @@ describe('Contract utils', () => { const owners = [owner1.address] const threshold = 1 const safeVersion = safeVersionDeployed - const provider = await getEip1193Provider(owner1.signer) + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] @@ -105,7 +105,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const threshold = 1 const safeVersion = safeVersionDeployed - const provider = await getEip1193Provider(owner1.signer) + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] @@ -151,7 +151,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const threshold = 2 const safeVersion = safeVersionDeployed - const provider = await getEip1193Provider(owner1.signer) + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] @@ -197,7 +197,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const invalidThreshold = 3 const safeVersion = safeVersionDeployed - const provider = await getEip1193Provider(owner1.signer) + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] @@ -232,7 +232,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const invalidThreshold = 0 const safeVersion = safeVersionDeployed - const provider = await getEip1193Provider(owner1.signer) + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] @@ -267,7 +267,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const invalidThreshold = -2 const safeVersion = safeVersionDeployed - const provider = await getEip1193Provider(owner1.signer) + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] @@ -301,7 +301,7 @@ describe('Contract utils', () => { const invalidOwners: string[] = [] const threshold = 1 const safeVersion = safeVersionDeployed - const provider = await getEip1193Provider(accounts[0].signer) + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] @@ -336,7 +336,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const threshold = 1 const safeVersion = safeVersionDeployed - const provider = await getEip1193Provider(owner1.signer) + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] @@ -430,7 +430,7 @@ describe('Contract utils', () => { const owners = [owner1.address, owner2.address] const threshold = 2 const safeVersion = safeVersionDeployed - const provider = await getEip1193Provider(owner1.signer) + const provider = getEip1193Provider() const safeProvider = new SafeProvider({ providerOrUrl: provider }) const customContracts = contractNetworks[chainId.toString()] @@ -495,7 +495,7 @@ describe('Contract utils', () => { const [owner1] = accounts const owners = [owner1.address] const threshold = 1 - const provider = await getEip1193Provider(owner1.signer) + const provider = getEip1193Provider() const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { diff --git a/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts b/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts index efc0592bd..0687ff031 100644 --- a/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts +++ b/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts @@ -44,7 +44,7 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -73,7 +73,7 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -109,7 +109,7 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -145,7 +145,7 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() const [account1, account2] = accounts - const provider = await getEip1193Provider(account1.signer) + const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, From 960dc27c70258b03852b09f15324fca62ac5f638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 16 Apr 2024 12:11:05 +0200 Subject: [PATCH 013/112] Remove web3-utils --- .../contracts/contractInstancesEthers.ts | 17 ++++++++--------- packages/protocol-kit/src/types/index.ts | 18 +++++++++--------- .../protocol-kit/src/utils/eip-3770/index.ts | 4 ++-- .../src/utils/transactions/utils.ts | 9 ++++----- .../tests/e2e/utils/setupContracts.ts | 19 +++++++++---------- packages/safe-core-sdk-types/package.json | 3 +-- .../src/ethereumLibs/EthAdapter.ts | 4 ++-- yarn.lock | 2 +- 8 files changed, 36 insertions(+), 40 deletions(-) diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts index 3281c76d6..2f8a6ae07 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts @@ -1,5 +1,4 @@ -import { AbstractSigner, Provider } from 'ethers' -import { AbiItem } from 'web3-utils' +import { JsonFragment, AbstractSigner, Provider } from 'ethers' import { Compatibility_fallback_handler__factory as CompatibilityFallbackHandler_V1_3_0 } from '@safe-global/protocol-kit/typechain/src/ethers-v6/v1.3.0/factories/Compatibility_fallback_handler__factory' import { Compatibility_fallback_handler__factory as CompatibilityFallbackHandler_V1_4_1 } from '@safe-global/protocol-kit/typechain/src/ethers-v6/v1.4.1/factories/Compatibility_fallback_handler__factory' import { @@ -56,7 +55,7 @@ export async function getSafeContractInstance( safeVersion: SafeVersion, contractAddress: string, safeProvider: SafeProvider, - customContractAbi?: AbiItem | AbiItem[] | undefined, + customContractAbi?: JsonFragment | JsonFragment[] | undefined, isL1SafeSingleton?: boolean // TODO return type used until Typechain is removed ): Promise { @@ -153,7 +152,7 @@ export async function getMultiSendContractInstance( safeVersion: SafeVersion, contractAddress: string, safeProvider: SafeProvider, - customContractAbi?: AbiItem | AbiItem[] | undefined + customContractAbi?: JsonFragment | JsonFragment[] | undefined ): Promise< | MultiSendContract_V1_4_1_Ethers | MultiSendContract_V1_3_0_Ethers @@ -194,7 +193,7 @@ export async function getMultiSendCallOnlyContractInstance( safeVersion: SafeVersion, contractAddress: string, safeProvider: SafeProvider, - customContractAbi?: AbiItem | AbiItem[] | undefined + customContractAbi?: JsonFragment | JsonFragment[] | undefined ): Promise { const chainId = await safeProvider.getChainId() switch (safeVersion) { @@ -225,7 +224,7 @@ export async function getSafeProxyFactoryContractInstance( contractAddress: string, signerOrProvider: AbstractSigner | Provider, safeProvider: SafeProvider, - customContractAbi?: AbiItem | AbiItem[] | undefined + customContractAbi?: JsonFragment | JsonFragment[] | undefined ) { const chainId = await safeProvider.getChainId() let safeProxyFactoryContract @@ -281,7 +280,7 @@ export async function getSignMessageLibContractInstance( safeVersion: SafeVersion, contractAddress: string, safeProvider: SafeProvider, - customContractAbi?: AbiItem | AbiItem[] | undefined + customContractAbi?: JsonFragment | JsonFragment[] | undefined ): Promise { const chainId = await safeProvider.getChainId() let signMessageLibContract @@ -316,7 +315,7 @@ export async function getCreateCallContractInstance( safeVersion: SafeVersion, contractAddress: string, safeProvider: SafeProvider, - customContractAbi?: AbiItem | AbiItem[] | undefined + customContractAbi?: JsonFragment | JsonFragment[] | undefined ): Promise { const chainId = await safeProvider.getChainId() let createCallContract @@ -353,7 +352,7 @@ export async function getSimulateTxAccessorContractInstance( safeVersion: SafeVersion, contractAddress: string, safeProvider: SafeProvider, - customContractAbi?: AbiItem | AbiItem[] | undefined + customContractAbi?: JsonFragment | JsonFragment[] | undefined ): Promise { const chainId = await safeProvider.getChainId() diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index abc827286..db0122ed0 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -5,7 +5,7 @@ import { SafeTransactionDataPartial, SafeVersion } from '@safe-global/safe-core-sdk-types' -import { AbiItem } from 'web3-utils' +import { JsonFragment } from 'ethers' export interface SafeAccountConfig { owners: string[] @@ -32,35 +32,35 @@ export interface ContractNetworkConfig { /** safeSingletonAddress - Address of the Safe Singleton contract deployed on a specific network */ safeSingletonAddress: string /** safeSingletonAbi - Abi of the Safe Singleton contract deployed on a specific network */ - safeSingletonAbi?: AbiItem | AbiItem[] + safeSingletonAbi?: JsonFragment | JsonFragment[] /** safeProxyFactoryAddress - Address of the SafeProxyFactory contract deployed on a specific network */ safeProxyFactoryAddress: string /** safeProxyFactoryAbi - Abi of the SafeProxyFactory contract deployed on a specific network */ - safeProxyFactoryAbi?: AbiItem | AbiItem[] + safeProxyFactoryAbi?: JsonFragment | JsonFragment[] /** multiSendAddress - Address of the MultiSend contract deployed on a specific network */ multiSendAddress: string /** multiSendAbi - Abi of the MultiSend contract deployed on a specific network */ - multiSendAbi?: AbiItem | AbiItem[] + multiSendAbi?: JsonFragment | JsonFragment[] /** multiSendCallOnlyAddress - Address of the MultiSendCallOnly contract deployed on a specific network */ multiSendCallOnlyAddress: string /** multiSendCallOnlyAbi - Abi of the MultiSendCallOnly contract deployed on a specific network */ - multiSendCallOnlyAbi?: AbiItem | AbiItem[] + multiSendCallOnlyAbi?: JsonFragment | JsonFragment[] /** fallbackHandlerAddress - Address of the Fallback Handler contract deployed on a specific network */ fallbackHandlerAddress: string /** fallbackHandlerAbi - Abi of the Fallback Handler contract deployed on a specific network */ - fallbackHandlerAbi?: AbiItem | AbiItem[] + fallbackHandlerAbi?: JsonFragment | JsonFragment[] /** signMessageLibAddress - Address of the SignMessageLib contract deployed on a specific network */ signMessageLibAddress: string /** signMessageLibAbi - Abi of the SignMessageLib contract deployed on a specific network */ - signMessageLibAbi?: AbiItem | AbiItem[] + signMessageLibAbi?: JsonFragment | JsonFragment[] /** createCallAddress - Address of the CreateCall contract deployed on a specific network */ createCallAddress: string /** createCallAbi - Abi of the CreateCall contract deployed on a specific network */ - createCallAbi?: AbiItem | AbiItem[] + createCallAbi?: JsonFragment | JsonFragment[] /** simulateTxAccessorAddress - Address of the SimulateTxAccessor contract deployed on a specific network */ simulateTxAccessorAddress: string /** simulateTxAccessorAbi - Abi of the SimulateTxAccessor contract deployed on a specific network */ - simulateTxAccessorAbi?: AbiItem | AbiItem[] + simulateTxAccessorAbi?: JsonFragment | JsonFragment[] } export interface ContractNetworksConfig { diff --git a/packages/protocol-kit/src/utils/eip-3770/index.ts b/packages/protocol-kit/src/utils/eip-3770/index.ts index 835a72a5b..ff2319cc4 100644 --- a/packages/protocol-kit/src/utils/eip-3770/index.ts +++ b/packages/protocol-kit/src/utils/eip-3770/index.ts @@ -1,5 +1,5 @@ +import { ethers } from 'ethers' import { Eip3770Address } from '@safe-global/safe-core-sdk-types' -import { isAddress, isHexStrict } from 'web3-utils' import { networks } from './config' export function parseEip3770Address(fullAddress: string): Eip3770Address { @@ -29,7 +29,7 @@ export function validateEip3770NetworkPrefix(prefix: string, currentChainId: big } export function validateEthereumAddress(address: string): void { - const isValidAddress = isHexStrict(address) && isAddress(address) + const isValidAddress = ethers.isHexString(address) && ethers.isAddress(address) if (!isValidAddress) { throw new Error(`Invalid Ethereum address ${address}`) } diff --git a/packages/protocol-kit/src/utils/transactions/utils.ts b/packages/protocol-kit/src/utils/transactions/utils.ts index 3bcd4694c..850f19402 100644 --- a/packages/protocol-kit/src/utils/transactions/utils.ts +++ b/packages/protocol-kit/src/utils/transactions/utils.ts @@ -1,4 +1,4 @@ -import { Interface, getBytes, solidityPacked as solidityPack } from 'ethers' +import { ethers, Interface, getBytes, solidityPacked as solidityPack } from 'ethers' import { DEFAULT_SAFE_VERSION } from '@safe-global/protocol-kit/contracts/config' import { StandardizeSafeTransactionDataProps } from '@safe-global/protocol-kit/types' import { hasSafeFeature, SAFE_FEATURES } from '@safe-global/protocol-kit/utils' @@ -13,7 +13,6 @@ import { SafeVersion } from '@safe-global/safe-core-sdk-types' import semverSatisfies from 'semver/functions/satisfies' -import { hexToNumber, hexToNumberString, toChecksumAddress } from 'web3-utils' import { estimateGas, estimateTxGas } from './gas' import { SafeProvider } from '../..' @@ -143,9 +142,9 @@ export function decodeMultiSendData(encodedData: string): MetaTransactionData[] const data = `0x${decodedData.slice(index, (index += dataLength))}` txs.push({ - operation: hexToNumber(operation) as OperationType, - to: toChecksumAddress(to), - value: hexToNumberString(value), + operation: Number(operation) as OperationType, + to: ethers.getAddress(to), + value: BigInt(value).toString(), data }) } diff --git a/packages/protocol-kit/tests/e2e/utils/setupContracts.ts b/packages/protocol-kit/tests/e2e/utils/setupContracts.ts index 09c79cb0d..f79f6762e 100644 --- a/packages/protocol-kit/tests/e2e/utils/setupContracts.ts +++ b/packages/protocol-kit/tests/e2e/utils/setupContracts.ts @@ -1,4 +1,4 @@ -import { ZeroAddress } from 'ethers' +import { ZeroAddress, JsonFragment } from 'ethers' import { compatibilityFallbackHandlerDeployed, createCallDeployed, @@ -48,11 +48,10 @@ import { import { DebugTransactionGuard } from '@safe-global/protocol-kit/typechain/tests/ethers-v6/v1.3.0' import { deployments, ethers } from 'hardhat' import semverSatisfies from 'semver/functions/satisfies' -import { AbiItem } from 'web3-utils' export const getSafeSingleton = async (): Promise<{ contract: Safe_V1_4_1 | Safe_V1_3_0 | Safe_V1_2_0 | Safe_V1_1_1 | Safe_V1_0_0 - abi: AbiItem | AbiItem[] + abi: JsonFragment | JsonFragment[] }> => { const SafeDeployment = await deployments.get(safeDeployed.name) const Safe = await ethers.getContractFactory(safeDeployed.name) @@ -73,7 +72,7 @@ export const getFactory = async (): Promise<{ | SafeProxyFactory_V1_3_0 | SafeProxyFactory_V1_1_1 | SafeProxyFactory_V1_0_0 - abi: AbiItem | AbiItem[] + abi: JsonFragment | JsonFragment[] }> => { const FactoryDeployment = await deployments.get(proxyFactoryDeployed.name) const Factory = await ethers.getContractFactory(proxyFactoryDeployed.name) @@ -144,7 +143,7 @@ export const getSafeWithOwners = async ( export const getCompatibilityFallbackHandler = async (): Promise<{ contract: CompatibilityFallbackHandler_V1_4_1 | CompatibilityFallbackHandler_V1_3_0 - abi: AbiItem | AbiItem[] + abi: JsonFragment | JsonFragment[] }> => { const CompatibilityFallbackHandlerDeployment = await deployments.get( compatibilityFallbackHandlerDeployed.name @@ -162,7 +161,7 @@ export const getCompatibilityFallbackHandler = async (): Promise<{ export const getMultiSend = async (): Promise<{ contract: MultiSend_V1_4_1 | MultiSend_V1_3_0 | MultiSend_V1_1_1 - abi: AbiItem | AbiItem[] + abi: JsonFragment | JsonFragment[] }> => { const MultiSendDeployment = await deployments.get(multiSendDeployed.name) const MultiSend = await ethers.getContractFactory(multiSendDeployed.name) @@ -177,7 +176,7 @@ export const getMultiSend = async (): Promise<{ export const getMultiSendCallOnly = async (): Promise<{ contract: MultiSendCallOnly_V1_4_1 | MultiSendCallOnly_V1_3_0 - abi: AbiItem | AbiItem[] + abi: JsonFragment | JsonFragment[] }> => { const MultiSendCallOnlyDeployment = await deployments.get(multiSendCallOnlyDeployed.name) const MultiSendCallOnly = await ethers.getContractFactory(multiSendCallOnlyDeployed.name) @@ -191,7 +190,7 @@ export const getMultiSendCallOnly = async (): Promise<{ export const getSignMessageLib = async (): Promise<{ contract: SignMessageLib_V1_4_1 | SignMessageLib_V1_3_0 - abi: AbiItem | AbiItem[] + abi: JsonFragment | JsonFragment[] }> => { const SignMessageLibDeployment = await deployments.get(signMessageLibDeployed.name) const SignMessageLib = await ethers.getContractFactory(signMessageLibDeployed.name) @@ -205,7 +204,7 @@ export const getSignMessageLib = async (): Promise<{ export const getCreateCall = async (): Promise<{ contract: CreateCall_V1_4_1 | CreateCall_V1_3_0 - abi: AbiItem | AbiItem[] + abi: JsonFragment | JsonFragment[] }> => { const CreateCallDeployment = await deployments.get(createCallDeployed.name) const CreateCall = await ethers.getContractFactory(createCallDeployed.name) @@ -219,7 +218,7 @@ export const getCreateCall = async (): Promise<{ export const getSimulateTxAccessor = async (): Promise<{ contract: SimulateTxAccessor_V1_4_1 | SimulateTxAccessor_V1_3_0 - abi: AbiItem | AbiItem[] + abi: JsonFragment | JsonFragment[] }> => { const SimulateTxAccessorDeployment = await deployments.get(simulateTxAccessorDeployed.name) const SimulateTxAccessor = await ethers.getContractFactory(simulateTxAccessorDeployed.name) diff --git a/packages/safe-core-sdk-types/package.json b/packages/safe-core-sdk-types/package.json index 875150c0f..f9f08a1e9 100644 --- a/packages/safe-core-sdk-types/package.json +++ b/packages/safe-core-sdk-types/package.json @@ -31,7 +31,6 @@ "dependencies": { "@safe-global/safe-deployments": "^1.33.0", "ethers": "^6.7.1", - "web3-core": "^1.10.3", - "web3-utils": "^1.10.3" + "web3-core": "^1.10.3" } } diff --git a/packages/safe-core-sdk-types/src/ethereumLibs/EthAdapter.ts b/packages/safe-core-sdk-types/src/ethereumLibs/EthAdapter.ts index 6096fee1b..daaea4f78 100644 --- a/packages/safe-core-sdk-types/src/ethereumLibs/EthAdapter.ts +++ b/packages/safe-core-sdk-types/src/ethereumLibs/EthAdapter.ts @@ -1,3 +1,4 @@ +import { JsonFragment } from 'ethers' import { CompatibilityFallbackHandlerContract } from '@safe-global/safe-core-sdk-types/contracts/CompatibilityFallbackHandlerContract' import { CreateCallContract } from '@safe-global/safe-core-sdk-types/contracts/CreateCallContract' import { MultiSendCallOnlyContract } from '@safe-global/safe-core-sdk-types/contracts/MultiSendCallOnlyContract' @@ -8,7 +9,6 @@ import { SignMessageLibContract } from '@safe-global/safe-core-sdk-types/contrac import { SimulateTxAccessorContract } from '@safe-global/safe-core-sdk-types/contracts/SimulateTxAccessorContract' import { Eip3770Address, SafeEIP712Args, SafeVersion } from '@safe-global/safe-core-sdk-types/types' import { SingletonDeployment } from '@safe-global/safe-deployments' -import { AbiItem } from 'web3-utils' export interface SafeProviderTransaction { to: string @@ -25,7 +25,7 @@ export interface GetContractProps { safeVersion: SafeVersion singletonDeployment?: SingletonDeployment customContractAddress?: string - customContractAbi?: AbiItem | AbiItem[] + customContractAbi?: JsonFragment | JsonFragment[] isL1SafeSingleton?: boolean } diff --git a/yarn.lock b/yarn.lock index 072f8f6e6..76037b3c6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10033,7 +10033,7 @@ web3-types@^1.3.0, web3-types@^1.3.1, web3-types@^1.5.0: resolved "https://registry.yarnpkg.com/web3-types/-/web3-types-1.5.0.tgz#35b5c0ab149b0d566efeaed8ddaa40db159c748e" integrity sha512-geWuMIeegQ8AedKAO6wO4G4j1gyQ1F/AyKLMw2vud4bsfZayyzWJgCMDZtjYMm5uo2a7i8j1W3/4QFmzlSy5cw== -web3-utils@1.10.3, web3-utils@^1.10.3: +web3-utils@1.10.3: version "1.10.3" resolved "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.3.tgz" integrity sha512-OqcUrEE16fDBbGoQtZXWdavsPzbGIDc5v3VrRTZ0XrIpefC/viZ1ZU9bGEemazyS0catk/3rkOOxpzTfY+XsyQ== From 18f1405120e509e558574b08906cf01f4994c6cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 16 Apr 2024 12:51:02 +0200 Subject: [PATCH 014/112] Update api-kit tests --- packages/api-kit/tests/e2e/addMessage.test.ts | 8 ++--- .../tests/e2e/addMessageSignature.test.ts | 28 +++++++-------- .../tests/e2e/confirmTransaction.test.ts | 20 +++++------ packages/api-kit/tests/endpoint/index.test.ts | 14 ++++---- .../api-kit/tests/utils/setupEthAdapter.ts | 34 +++++-------------- .../api-kit/tests/utils/setupServiceClient.ts | 14 ++++---- packages/protocol-kit/src/Safe.ts | 4 +-- .../src/adapters/ethers/SafeProvider.ts | 4 +-- .../protocol-kit/src/safeFactory/index.ts | 4 +-- packages/protocol-kit/src/types/index.ts | 12 ++----- .../tests/e2e/utils/setupEthAdapter.ts | 2 +- .../tests/e2e/utilsContracts.test.ts | 7 ++-- packages/safe-core-sdk-types/src/index.ts | 2 +- .../SafeProvider.ts} | 9 +++++ 14 files changed, 72 insertions(+), 90 deletions(-) rename packages/safe-core-sdk-types/src/{ethereumLibs/EthAdapter.ts => safe-provider/SafeProvider.ts} (95%) diff --git a/packages/api-kit/tests/e2e/addMessage.test.ts b/packages/api-kit/tests/e2e/addMessage.test.ts index 3fe62ee60..8e8452bf9 100644 --- a/packages/api-kit/tests/e2e/addMessage.test.ts +++ b/packages/api-kit/tests/e2e/addMessage.test.ts @@ -1,5 +1,5 @@ import Safe from '@safe-global/protocol-kit' -import { EthAdapter } from '@safe-global/safe-core-sdk-types' +import { Eip1193Provider } from '@safe-global/safe-core-sdk-types' import SafeApiKit from '@safe-global/api-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' @@ -8,7 +8,7 @@ import { getServiceClient } from '../utils/setupServiceClient' chai.use(chaiAsPromised) let safeApiKit: SafeApiKit -let ethAdapter: EthAdapter +let provider: Eip1193Provider let protocolKit: Safe const generateRandomUUID = (): string => { @@ -24,12 +24,12 @@ const safeAddress = '0x3296b3DD454B7c3912F7F477787B503918C50082' describe('addMessage', () => { before(async () => { - ;({ safeApiKit, ethAdapter } = await getServiceClient( + ;({ safeApiKit, provider } = await getServiceClient( '0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d' )) protocolKit = await Safe.create({ - ethAdapter, + provider, safeAddress }) }) diff --git a/packages/api-kit/tests/e2e/addMessageSignature.test.ts b/packages/api-kit/tests/e2e/addMessageSignature.test.ts index 3fc238f4b..b1b82a08b 100644 --- a/packages/api-kit/tests/e2e/addMessageSignature.test.ts +++ b/packages/api-kit/tests/e2e/addMessageSignature.test.ts @@ -5,7 +5,7 @@ import Safe, { SigningMethod, buildContractSignature } from '@safe-global/protocol-kit' -import { EthAdapter, SafeMessage } from '@safe-global/safe-core-sdk-types' +import { Eip1193Provider, SafeMessage } from '@safe-global/safe-core-sdk-types' import SafeApiKit from '@safe-global/api-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' @@ -15,8 +15,8 @@ chai.use(chaiAsPromised) let safeApiKit1: SafeApiKit let protocolKit: Safe -let ethAdapter1: EthAdapter -let ethAdapter2: EthAdapter +let provider1: Eip1193Provider +let provider2: Eip1193Provider const generateRandomUUID = (): string => { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { @@ -32,11 +32,11 @@ const signerSafeAddress = '0x83aB93f078A8fbbe6a677b1C488819e0ae981128' describe('addMessageSignature', () => { before(async () => { - ;({ safeApiKit: safeApiKit1, ethAdapter: ethAdapter1 } = await getServiceClient( + ;({ safeApiKit: safeApiKit1, provider: provider1 } = await getServiceClient( '0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d', 'https://safe-transaction-goerli.staging.5afe.dev/api' )) - ;({ ethAdapter: ethAdapter2 } = await getServiceClient( + ;({ provider: provider2 } = await getServiceClient( '0x6cbed15c793ce57650b9877cf6fa156fbef513c4e6134f022a85b1ffdd59b2a1' )) }) @@ -56,7 +56,7 @@ describe('addMessageSignature', () => { describe('when adding a new message', () => { beforeEach(async () => { protocolKit = await Safe.create({ - ethAdapter: ethAdapter1, + provider: provider1, safeAddress }) }) @@ -66,7 +66,7 @@ describe('addMessageSignature', () => { let safeMessage: SafeMessage = protocolKit.createMessage(rawMessage) safeMessage = await protocolKit.signMessage(safeMessage, 'eth_sign') - let signerAddress = (await ethAdapter1.getSignerAddress()) || '0x' + let signerAddress = (await protocolKit.getSafeProvider().getSignerAddress()) || '0x' await chai.expect( safeApiKit1.addMessage(safeAddress, { @@ -75,11 +75,11 @@ describe('addMessageSignature', () => { }) ).to.be.fulfilled - protocolKit = await protocolKit.connect({ ethAdapter: ethAdapter2 }) + protocolKit = await protocolKit.connect({ provider: provider2 }) safeMessage = await protocolKit.signMessage(safeMessage, 'eth_signTypedData_v4') const safeMessageHash = await protocolKit.getSafeMessageHash(hashSafeMessage(rawMessage)) - signerAddress = (await ethAdapter2.getSignerAddress()) || '0x' + signerAddress = (await protocolKit.getSafeProvider().getSignerAddress()) || '0x' await chai.expect( safeApiKit1.addMessageSignature( @@ -95,7 +95,7 @@ describe('addMessageSignature', () => { it('should allow to add a confirmation signature using a Safe signer', async () => { protocolKit = await protocolKit.connect({ - ethAdapter: ethAdapter1, + provider: provider1, safeAddress }) @@ -105,7 +105,7 @@ describe('addMessageSignature', () => { let safeMessage: SafeMessage = protocolKit.createMessage(rawMessage) safeMessage = await protocolKit.signMessage(safeMessage, 'eth_sign') - const signerAddress = (await ethAdapter1.getSignerAddress()) || '0x' + const signerAddress = (await protocolKit.getSafeProvider().getSignerAddress()) || '0x' const ethSig = safeMessage.getSignature(signerAddress) as EthSafeSignature await chai.expect( @@ -116,7 +116,7 @@ describe('addMessageSignature', () => { ).to.be.fulfilled protocolKit = await protocolKit.connect({ - ethAdapter: ethAdapter1, + provider: provider1, safeAddress: signerSafeAddress }) let signerSafeMessage = protocolKit.createMessage(rawMessage) @@ -127,7 +127,7 @@ describe('addMessageSignature', () => { ) protocolKit = await protocolKit.connect({ - ethAdapter: ethAdapter2, + provider: provider2, safeAddress: signerSafeAddress }) signerSafeMessage = await protocolKit.signMessage( @@ -142,7 +142,7 @@ describe('addMessageSignature', () => { ) protocolKit = await protocolKit.connect({ - ethAdapter: ethAdapter1, + provider: provider1, safeAddress }) diff --git a/packages/api-kit/tests/e2e/confirmTransaction.test.ts b/packages/api-kit/tests/e2e/confirmTransaction.test.ts index 630537cb9..0325f5532 100644 --- a/packages/api-kit/tests/e2e/confirmTransaction.test.ts +++ b/packages/api-kit/tests/e2e/confirmTransaction.test.ts @@ -4,7 +4,7 @@ import Safe, { SigningMethod, buildContractSignature } from '@safe-global/protocol-kit' -import { EthAdapter, SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types' +import { Eip1193Provider, SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types' import SafeApiKit from '@safe-global/api-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' @@ -14,19 +14,19 @@ chai.use(chaiAsPromised) let safeApiKit1: SafeApiKit let protocolKit: Safe -let ethAdapter1: EthAdapter -let ethAdapter2: EthAdapter +let provider1: Eip1193Provider +let provider2: Eip1193Provider const safeAddress = '0x3296b3DD454B7c3912F7F477787B503918C50082' const signerSafeAddress = '0x83aB93f078A8fbbe6a677b1C488819e0ae981128' describe('proposeTransaction', () => { before(async () => { - ;({ safeApiKit: safeApiKit1, ethAdapter: ethAdapter1 } = await getServiceClient( + ;({ safeApiKit: safeApiKit1, provider: provider1 } = await getServiceClient( '0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d', 'https://safe-transaction-goerli.staging.5afe.dev/api' )) - ;({ ethAdapter: ethAdapter2 } = await getServiceClient( + ;({ provider: provider2 } = await getServiceClient( '0x6cbed15c793ce57650b9877cf6fa156fbef513c4e6134f022a85b1ffdd59b2a1', 'https://safe-transaction-goerli.staging.5afe.dev/api' )) @@ -34,7 +34,7 @@ describe('proposeTransaction', () => { beforeEach(async () => { protocolKit = await Safe.create({ - ethAdapter: ethAdapter1, + provider: provider1, safeAddress }) }) @@ -52,7 +52,7 @@ describe('proposeTransaction', () => { // EOA signature tx = await protocolKit.signTransaction(tx) - const signerAddress = (await ethAdapter1.getSignerAddress()) || '0x' + const signerAddress = (await provider1.getSignerAddress()) || '0x' const ethSig = tx.getSignature(signerAddress) as EthSafeSignature const txOptions = { @@ -67,7 +67,7 @@ describe('proposeTransaction', () => { // Signer Safe signature protocolKit = await protocolKit.connect({ - ethAdapter: ethAdapter1, + provider: provider1, safeAddress: signerSafeAddress }) @@ -81,7 +81,7 @@ describe('proposeTransaction', () => { ) protocolKit = await protocolKit.connect({ - ethAdapter: ethAdapter2, + provider: provider2, safeAddress: signerSafeAddress }) signerSafeTx = await protocolKit.signTransaction( @@ -96,7 +96,7 @@ describe('proposeTransaction', () => { ) protocolKit = await protocolKit.connect({ - ethAdapter: ethAdapter1, + provider: provider1, safeAddress }) diff --git a/packages/api-kit/tests/endpoint/index.test.ts b/packages/api-kit/tests/endpoint/index.test.ts index 46206c58d..862352193 100644 --- a/packages/api-kit/tests/endpoint/index.test.ts +++ b/packages/api-kit/tests/endpoint/index.test.ts @@ -7,7 +7,7 @@ import SafeApiKit, { } from '@safe-global/api-kit/index' import * as httpRequests from '@safe-global/api-kit/utils/httpRequests' import Safe from '@safe-global/protocol-kit' -import { EthAdapter } from '@safe-global/safe-core-sdk-types' +import { Eip1193Provider } from '@safe-global/safe-core-sdk-types' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import sinon from 'sinon' @@ -28,19 +28,19 @@ const tokenAddress = '0x210EC22dD6b1c174E5cA1A261DD9791e0755cc6D' const eip3770TokenAddress = `${config.EIP_3770_PREFIX}:${tokenAddress}` const safeTxHash = '0xede78ed72e9a8afd2b7a21f35c86f56cba5fffb2fff0838e253b7a41d19ceb48' const txServiceBaseUrl = 'https://safe-transaction-goerli.safe.global/api' -const provider = getDefaultProvider(config.JSON_RPC) +const defaultProvider = getDefaultProvider(config.JSON_RPC) const signer = new Wallet( '0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d', - provider + defaultProvider ) -let ethAdapter: EthAdapter +let provider: Eip1193Provider let safeApiKit: SafeApiKit let delegatorAddress: string let eip3770DelegatorAddress: string describe('Endpoint tests', () => { before(async () => { - ;({ safeApiKit, ethAdapter } = await getServiceClient( + ;({ safeApiKit, provider } = await getServiceClient( '0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d' )) delegatorAddress = await signer.getAddress() @@ -364,7 +364,7 @@ describe('Endpoint tests', () => { } const origin = 'Safe Core SDK: Safe API Kit' const signerAddress = await signer.getAddress() - const safeSdk = await Safe.create({ ethAdapter, safeAddress }) + const safeSdk = await Safe.create({ provider, safeAddress }) const safeTransaction = await safeSdk.createTransaction({ transactions: [safeTransactionData], options @@ -413,7 +413,7 @@ describe('Endpoint tests', () => { } const origin = 'Safe Core SDK: Safe API Kit' const signerAddress = await signer.getAddress() - const safeSdk = await Safe.create({ ethAdapter, safeAddress }) + const safeSdk = await Safe.create({ provider, safeAddress }) const safeTransaction = await safeSdk.createTransaction({ transactions: [safeTransactionData], options diff --git a/packages/api-kit/tests/utils/setupEthAdapter.ts b/packages/api-kit/tests/utils/setupEthAdapter.ts index 83b7b3132..9724d5339 100644 --- a/packages/api-kit/tests/utils/setupEthAdapter.ts +++ b/packages/api-kit/tests/utils/setupEthAdapter.ts @@ -1,35 +1,17 @@ -import { AbstractSigner, Provider } from 'ethers' -import { EthAdapter } from '@safe-global/safe-core-sdk-types' -import { - EthersAdapter, - EthersAdapterConfig, - Web3Adapter, - Web3AdapterConfig -} from '@safe-global/protocol-kit' import { ethers, web3 } from 'hardhat' +import { Eip1193Provider } from '@safe-global/safe-core-sdk-types' -export async function getEthAdapter( - signerOrProvider: AbstractSigner | Provider -): Promise { - let ethAdapter: EthAdapter +export function getEip1193Provider(): Eip1193Provider { switch (process.env.ETH_LIB) { case 'web3': - const signerAddress = - signerOrProvider instanceof AbstractSigner ? await signerOrProvider.getAddress() : undefined - - const web3AdapterConfig: Web3AdapterConfig = { - web3, - signerAddress - } - - ethAdapter = new Web3Adapter(web3AdapterConfig) - break + return web3.currentProvider as Eip1193Provider case 'ethers': - const ethersAdapterConfig: EthersAdapterConfig = { ethers, signerOrProvider } - ethAdapter = new EthersAdapter(ethersAdapterConfig) - break + return { + request: async (request) => { + return ethers.provider.send(request.method, [...((request.params as unknown[]) ?? [])]) + } + } default: throw new Error('Ethereum library not supported') } - return ethAdapter } diff --git a/packages/api-kit/tests/utils/setupServiceClient.ts b/packages/api-kit/tests/utils/setupServiceClient.ts index a69e5c1bf..9db6c1adb 100644 --- a/packages/api-kit/tests/utils/setupServiceClient.ts +++ b/packages/api-kit/tests/utils/setupServiceClient.ts @@ -1,12 +1,12 @@ import { getDefaultProvider, Wallet } from 'ethers' -import { EthAdapter } from '@safe-global/safe-core-sdk-types' +import { Eip1193Provider } from '@safe-global/safe-core-sdk-types' import SafeApiKit from '@safe-global/api-kit/index' import config from '../utils/config' -import { getEthAdapter } from '../utils/setupEthAdapter' +import { getEip1193Provider } from '../utils/setupEthAdapter' interface ServiceClientConfig { safeApiKit: SafeApiKit - ethAdapter: EthAdapter + provider: Eip1193Provider signer: Wallet } @@ -14,9 +14,9 @@ export async function getServiceClient( signerPk: string, txServiceUrl?: string ): Promise { - const provider = getDefaultProvider(config.JSON_RPC) - const signer = new Wallet(signerPk, provider) - const ethAdapter = await getEthAdapter(signer) + const signer = new Wallet(signerPk, getDefaultProvider(config.JSON_RPC)) + const provider = getEip1193Provider() const safeApiKit = new SafeApiKit({ chainId: config.CHAIN_ID, txServiceUrl }) - return { safeApiKit, ethAdapter, signer } + + return { safeApiKit, provider, signer } } diff --git a/packages/protocol-kit/src/Safe.ts b/packages/protocol-kit/src/Safe.ts index 48bff6e1e..47d3c6fbb 100644 --- a/packages/protocol-kit/src/Safe.ts +++ b/packages/protocol-kit/src/Safe.ts @@ -14,7 +14,8 @@ import { Transaction, CompatibilityFallbackHandlerContract, EIP712TypedData, - SafeTransactionData + SafeTransactionData, + Eip1193Provider } from '@safe-global/safe-core-sdk-types' import { encodeSetupCallData, @@ -31,7 +32,6 @@ import { AddOwnerTxParams, ConnectSafeConfig, CreateTransactionProps, - Eip1193Provider, PredictedSafeProps, RemoveOwnerTxParams, SafeConfig, diff --git a/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts b/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts index acf7a2abc..f42be31a6 100644 --- a/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts +++ b/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts @@ -9,7 +9,8 @@ import { GetContractProps, SafeEIP712Args, SignMessageLibContract, - SimulateTxAccessorContract + SimulateTxAccessorContract, + Eip1193Provider } from '@safe-global/safe-core-sdk-types' import { ethers, @@ -37,7 +38,6 @@ import MultiSendCallOnlyContract_v1_4_1_Ethers from './contracts/MultiSend/v1.4. import MultiSendContract_v1_1_1_Ethers from './contracts/MultiSend/v1.1.1/MultiSendContract_V1_1_1_Ethers' import MultiSendContract_v1_3_0_Ethers from './contracts/MultiSend/v1.3.0/MultiSendContract_V1_3_0_Ethers' import MultiSendContract_v1_4_1_Ethers from './contracts/MultiSend/v1.4.1/MultiSendContract_V1_4_1_Ethers' -import { Eip1193Provider } from '@safe-global/protocol-kit/types' export interface SafeProviderConfig { /** signerOrProvider - Ethers signer or provider */ diff --git a/packages/protocol-kit/src/safeFactory/index.ts b/packages/protocol-kit/src/safeFactory/index.ts index 552ea8044..111a0ec7e 100644 --- a/packages/protocol-kit/src/safeFactory/index.ts +++ b/packages/protocol-kit/src/safeFactory/index.ts @@ -13,7 +13,6 @@ import { } from '@safe-global/protocol-kit/contracts/utils' import { ContractNetworksConfig, - Eip1193Provider, SafeAccountConfig, SafeDeploymentConfig } from '@safe-global/protocol-kit/types' @@ -22,7 +21,8 @@ import { SafeContract, SafeProxyFactoryContract, SafeVersion, - TransactionOptions + TransactionOptions, + Eip1193Provider } from '@safe-global/safe-core-sdk-types' import { SafeProvider } from '../adapters/ethers' diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index db0122ed0..f448ef422 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -3,7 +3,8 @@ import { MetaTransactionData, SafeContract, SafeTransactionDataPartial, - SafeVersion + SafeVersion, + Eip1193Provider } from '@safe-global/safe-core-sdk-types' import { JsonFragment } from 'ethers' @@ -82,15 +83,6 @@ type SafeConfigWithPredictedSafeProps = { predictedSafe: PredictedSafeProps } -interface RequestArguments { - readonly method: string - readonly params?: readonly unknown[] | object -} - -export interface Eip1193Provider { - request: (args: RequestArguments) => Promise -} - export type SafeConfigProps = { /** provider - Compatible EIP-1193 provider */ provider: Eip1193Provider diff --git a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts b/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts index 929d51b6d..fb803a887 100644 --- a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts +++ b/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts @@ -1,7 +1,7 @@ import hre, { ethers } from 'hardhat' import Web3 from 'web3' +import { Eip1193Provider } from '@safe-global/safe-core-sdk-types' import { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers' -import { Eip1193Provider } from '@safe-global/protocol-kit/types' import { SafeProvider } from '@safe-global/protocol-kit/index' import { custom, createWalletClient } from 'viem' diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index c4b65afdc..282b8a5bd 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -1,6 +1,6 @@ import chai from 'chai' import { deployments } from 'hardhat' - +import { Eip1193Provider } from '@safe-global/safe-core-sdk-types' import { getAccounts } from './utils/setupTestNetwork' import { getContractNetworks } from './utils/setupContractNetworks' import { getDefaultCallbackHandler } from './utils/setupContracts' @@ -13,8 +13,7 @@ import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/de import { SafeDeploymentConfig, SafeAccountConfig, - ContractNetworksConfig, - Eip1193Provider + ContractNetworksConfig } from '@safe-global/protocol-kit/types' import Safe, { SafeFactory, DeploySafeProps, SafeProvider } from '@safe-global/protocol-kit/index' import { itif } from './utils/helpers' @@ -295,7 +294,7 @@ describe('Contract utils', () => { }) it('should fail if no owners are present (empty array)', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() + const { contractNetworks, chainId } = await setupTests() // invalid owners 1/0 Safe const invalidOwners: string[] = [] diff --git a/packages/safe-core-sdk-types/src/index.ts b/packages/safe-core-sdk-types/src/index.ts index 119efb939..7239d5d1b 100644 --- a/packages/safe-core-sdk-types/src/index.ts +++ b/packages/safe-core-sdk-types/src/index.ts @@ -6,5 +6,5 @@ export * from './contracts/SafeContract' export * from './contracts/SafeProxyFactoryContract' export * from './contracts/SignMessageLibContract' export * from './contracts/SimulateTxAccessorContract' -export * from './ethereumLibs/EthAdapter' +export * from './safe-provider/SafeProvider' export * from './types' diff --git a/packages/safe-core-sdk-types/src/ethereumLibs/EthAdapter.ts b/packages/safe-core-sdk-types/src/safe-provider/SafeProvider.ts similarity index 95% rename from packages/safe-core-sdk-types/src/ethereumLibs/EthAdapter.ts rename to packages/safe-core-sdk-types/src/safe-provider/SafeProvider.ts index daaea4f78..356a8ea4a 100644 --- a/packages/safe-core-sdk-types/src/ethereumLibs/EthAdapter.ts +++ b/packages/safe-core-sdk-types/src/safe-provider/SafeProvider.ts @@ -10,6 +10,15 @@ import { SimulateTxAccessorContract } from '@safe-global/safe-core-sdk-types/con import { Eip3770Address, SafeEIP712Args, SafeVersion } from '@safe-global/safe-core-sdk-types/types' import { SingletonDeployment } from '@safe-global/safe-deployments' +export type RequestArguments = { + readonly method: string + readonly params?: readonly unknown[] | object +} + +export interface Eip1193Provider { + request: (args: RequestArguments) => Promise +} + export interface SafeProviderTransaction { to: string from: string From a4eefbb2637601cdd48536158a6784fc47ea3a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 18 Apr 2024 12:24:35 +0200 Subject: [PATCH 015/112] Fix issues --- .../SignMessageLibContract_v1_3_0_Ethers.ts | 81 + .../SignMessageLibContract_v1_4_1_Ethers.ts | 78 + .../contracts/contractInstancesEthers.ts | 41 +- packages/protocol-kit/src/contracts/utils.ts | 11 +- packages/safe-core-sdk-types/package.json | 2 +- .../src/contracts/common/BaseContract.ts | 16 +- packages/safe-core-sdk-types/src/types.d.ts | 233 +++ packages/safe-core-sdk-types/src/types.js | 9 + packages/safe-core-sdk-types/src/types.js.map | 1 + yarn.lock | 1514 ++++------------- 10 files changed, 726 insertions(+), 1260 deletions(-) create mode 100644 packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts create mode 100644 packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts create mode 100644 packages/safe-core-sdk-types/src/types.d.ts create mode 100644 packages/safe-core-sdk-types/src/types.js create mode 100644 packages/safe-core-sdk-types/src/types.js.map diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts new file mode 100644 index 000000000..a5cb6fe90 --- /dev/null +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts @@ -0,0 +1,81 @@ +import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' +import SignMessageLibBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers' +import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import { + SafeVersion, + AdapterSpecificContractFunction, + SignMessageLibContract_v1_3_0_Abi, + SignMessageLibContract_v1_3_0_Contract, + SignMessageLibContract_v1_3_0_Function, + signMessageLib_1_3_0_ContractArtifacts, + EthersTransactionOptions, + EncodeFunction, + EstimateGasFunction, + GetAddressFunction +} from '@safe-global/safe-core-sdk-types' + +/** + * SignMessageLibContract_v1_3_0_Ethers is the implementation specific to the SignMessageLib contract version 1.3.0. + * + * This class specializes in handling interactions with the SignMessageLib contract version 1.3.0 using Ethers.js v6. + * + * @extends SignMessageLibBaseContractEthers - Inherits from SignMessageLibBaseContractEthers with ABI specific to SignMessageLib contract version 1.3.0. + * @implements SignMessageLibContract_v1_3_0_Contract - Implements the interface specific to SignMessageLib contract version 1.3.0. + */ +class SignMessageLibContract_v1_3_0_Ethers + extends SignMessageLibBaseContractEthers + implements SignMessageLibContract_v1_3_0_Contract +{ + safeVersion: SafeVersion + + /** + * Constructs an instance of SignMessageLibContract_v1_3_0_Ethers + * + * @param chainId - The chain ID where the contract resides. + * @param ethersAdapter - An instance of EthersAdapter. + * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SignMessageLib deployments based on the chainId and safeVersion. + * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. + */ + constructor( + chainId: bigint, + ethersAdapter: EthersAdapter, + customContractAddress?: string, + customContractAbi?: SignMessageLibContract_v1_3_0_Abi + ) { + const safeVersion = '1.3.0' + const defaultAbi = signMessageLib_1_3_0_ContractArtifacts.abi + + super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + + this.safeVersion = safeVersion + } + encode: EncodeFunction + getAddress: GetAddressFunction + estimateGas: EstimateGasFunction + + /** + * @param args - Array[message] + */ + getMessageHash: SignMessageLibContract_v1_3_0_Function<'getMessageHash'> = async (args) => { + return [await this.contract.getMessageHash(...args)] + } + + /** + * @param args - Array[data] + */ + signMessage: AdapterSpecificContractFunction< + SignMessageLibContract_v1_3_0_Abi, + 'signMessage', + EthersTransactionOptions + > = async (data, options) => { + if (options && !options.gasLimit) { + options.gasLimit = Number(await this.estimateGas('signMessage', data, { ...options })) + } + + const txResponse = await this.contract.signMessage(data, { ...options }) + + return toTxResult(txResponse, options) + } +} + +export default SignMessageLibContract_v1_3_0_Ethers diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts new file mode 100644 index 000000000..1d6f48086 --- /dev/null +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts @@ -0,0 +1,78 @@ +import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' +import SignMessageLibBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers' +import { + SafeVersion, + SignMessageLibContract_v1_4_1_Abi, + SignMessageLibContract_v1_4_1_Contract, + SignMessageLibContract_v1_4_1_Function, + signMessageLib_1_4_1_ContractArtifacts, + EthersTransactionOptions, + EncodeFunction, +} from '@safe-global/safe-core-sdk-types' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' + +/** + * SignMessageLibContract_v1_4_1_Ethers is the implementation specific to the SignMessageLib contract version 1.4.1. + * + * This class specializes in handling interactions with the SignMessageLib contract version 1.4.1 using Ethers.js v6. + * + * @extends SignMessageLibBaseContractEthers - Inherits from SignMessageLibBaseContractEthers with ABI specific to SignMessageLib contract version 1.4.1. + * @implements SignMessageLibContract_v1_4_1_Contract - Implements the interface specific to SignMessageLib contract version 1.4.1. + */ +class SignMessageLibContract_v1_4_1_Ethers + extends SignMessageLibBaseContractEthers + implements SignMessageLibContract_v1_4_1_Contract +{ + safeVersion: SafeVersion + + /** + * Constructs an instance of SignMessageLibContract_v1_4_1_Ethers + * + * @param chainId - The chain ID where the contract resides. + * @param ethersAdapter - An instance of EthersAdapter. + * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SignMessageLib deployments based on the chainId and safeVersion. + * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. + */ + constructor( + chainId: bigint, + safeProvider: SafeProvider, + customContractAddress?: string, + customContractAbi?: SignMessageLibContract_v1_4_1_Abi + ) { + const safeVersion = '1.4.1' + const defaultAbi = signMessageLib_1_4_1_ContractArtifacts.abi + + super(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi) + + this.safeVersion = safeVersion + } + encode: EncodeFunction + getAddress: GetAddressFunction + estimateGas: EstimateGasFunction + + /** + * @param args - Array[message] + */ + getMessageHash: SignMessageLibContract_v1_4_1_Function<'getMessageHash'> = async (args) => { + return [await this.contract.getMessageHash(...args)] + } + + /** + * @param args - Array[data] + */ + signMessage: AdapterSpecificContractFunction< + SignMessageLibContract_v1_4_1_Abi, + 'signMessage', + EthersTransactionOptions + > = async (data, options) => { + if (options && !options.gasLimit) { + options.gasLimit = Number(await this.estimateGas('signMessage', data, { ...options })) + } + + const txResponse = await this.contract.signMessage(data, { ...options }) + + return toTxResult(txResponse, options) + } +} + +export default SignMessageLibContract_v1_4_1_Ethers diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts index 9d80643b9..ddb8ef55d 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts @@ -1,4 +1,3 @@ -import { AbstractSigner, Provider } from 'ethers' import { JsonFragment, AbstractSigner, Provider } from 'ethers' import { DeepWriteable, @@ -69,7 +68,7 @@ export async function getSafeContractInstance( case '1.4.1': return new SafeContract_v1_4_1_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, isL1SafeSingleton, contractAddress, customContractAbi as DeepWriteable @@ -78,7 +77,7 @@ export async function getSafeContractInstance( case '1.3.0': return new SafeContract_v1_3_0_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, isL1SafeSingleton, contractAddress, customContractAbi as DeepWriteable @@ -87,7 +86,7 @@ export async function getSafeContractInstance( case '1.2.0': return new SafeContract_v1_2_0_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, isL1SafeSingleton, contractAddress, customContractAbi as DeepWriteable @@ -96,7 +95,7 @@ export async function getSafeContractInstance( case '1.1.1': return new SafeContract_v1_1_1_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, isL1SafeSingleton, contractAddress, customContractAbi as DeepWriteable @@ -105,7 +104,7 @@ export async function getSafeContractInstance( case '1.0.0': return new SafeContract_v1_0_0_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, isL1SafeSingleton, contractAddress, customContractAbi as DeepWriteable @@ -166,7 +165,7 @@ export async function getMultiSendContractInstance( case '1.4.1': return new MultiSendContract_v1_4_1_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, contractAddress, customContractAbi as DeepWriteable ) @@ -174,7 +173,7 @@ export async function getMultiSendContractInstance( case '1.3.0': return new MultiSendContract_v1_3_0_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, contractAddress, customContractAbi as DeepWriteable ) @@ -184,7 +183,7 @@ export async function getMultiSendContractInstance( case '1.0.0': return new MultiSendContract_v1_1_1_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, contractAddress, customContractAbi as DeepWriteable ) @@ -205,7 +204,7 @@ export async function getMultiSendCallOnlyContractInstance( case '1.4.1': return new MultiSendCallOnlyContract_v1_4_1_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, contractAddress, customContractAbi as DeepWriteable ) @@ -216,7 +215,7 @@ export async function getMultiSendCallOnlyContractInstance( case '1.0.0': return new MultiSendCallOnlyContract_v1_3_0_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, contractAddress, customContractAbi as DeepWriteable ) @@ -243,7 +242,7 @@ export async function getSafeProxyFactoryContractInstance( case '1.4.1': return new SafeProxyFactoryContract_v1_4_1_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, contractAddress, customContractAbi as DeepWriteable, signerOrProvider @@ -252,7 +251,7 @@ export async function getSafeProxyFactoryContractInstance( case '1.3.0': return new SafeProxyFactoryContract_v1_3_0_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, contractAddress, customContractAbi as DeepWriteable, signerOrProvider @@ -262,7 +261,7 @@ export async function getSafeProxyFactoryContractInstance( case '1.1.1': return new SafeProxyFactoryContract_v1_1_1_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, contractAddress, customContractAbi as DeepWriteable, signerOrProvider @@ -271,7 +270,7 @@ export async function getSafeProxyFactoryContractInstance( case '1.0.0': return new SafeProxyFactoryContract_v1_0_0_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, contractAddress, customContractAbi as DeepWriteable, signerOrProvider @@ -294,7 +293,7 @@ export async function getSignMessageLibContractInstance( case '1.4.1': return new SignMessageLibContract_v1_4_1_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, contractAddress, customContractAbi as DeepWriteable ) @@ -302,7 +301,7 @@ export async function getSignMessageLibContractInstance( case '1.3.0': return new SignMessageLibContract_v1_3_0_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, contractAddress, customContractAbi as DeepWriteable ) @@ -324,7 +323,7 @@ export async function getCreateCallContractInstance( case '1.4.1': return new CreateCallContract_v1_4_1_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, contractAddress, customContractAbi as DeepWriteable ) @@ -335,7 +334,7 @@ export async function getCreateCallContractInstance( case '1.0.0': return new CreateCallContract_v1_3_0_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, contractAddress, customContractAbi as DeepWriteable ) @@ -357,7 +356,7 @@ export async function getSimulateTxAccessorContractInstance( case '1.4.1': return new SimulateTxAccessorContract_v1_4_1_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, contractAddress, customContractAbi as DeepWriteable ) @@ -365,7 +364,7 @@ export async function getSimulateTxAccessorContractInstance( case '1.3.0': return new SimulateTxAccessorContract_v1_3_0_Ethers( chainId, - (await safeProvider.getSigner()) as AbstractSigner, + safeProvider, contractAddress, customContractAbi as DeepWriteable ) diff --git a/packages/protocol-kit/src/contracts/utils.ts b/packages/protocol-kit/src/contracts/utils.ts index 5cddcb906..b47529177 100644 --- a/packages/protocol-kit/src/contracts/utils.ts +++ b/packages/protocol-kit/src/contracts/utils.ts @@ -3,11 +3,7 @@ import { keccak_256 } from '@noble/hashes/sha3' import { DEFAULT_SAFE_VERSION } from '@safe-global/protocol-kit/contracts/config' import { EMPTY_DATA, ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' import { createMemoizedFunction } from '@safe-global/protocol-kit/utils/memoized' -import { - SafeContract, - SafeProxyFactoryContract, - SafeVersion -} from '@safe-global/safe-core-sdk-types' +import { SafeProxyFactoryContractType, SafeVersion } from '@safe-global/safe-core-sdk-types' import { generateAddress2, keccak256, toBuffer } from 'ethereumjs-util' import semverSatisfies from 'semver/functions/satisfies' @@ -24,6 +20,7 @@ import { SafeContractImplementationType, SafeDeploymentConfig } from '../types' +import SafeProvider from '../adapters/ethers/SafeProvider' // keccak256(toUtf8Bytes('Safe Account Abstraction')) export const PREDETERMINED_SALT_NONCE = @@ -51,7 +48,7 @@ const ZKSYNC_SAFE_PROXY_DEPLOYED_BYTECODE: { const ZKSYNC_CREATE2_PREFIX = '0x2020dba91b30cc0006188af794c2fb30dd8520db7e2c088b7fc7c103c00ca494' export interface PredictSafeAddressProps { - safeProvider: ISafeProvider + safeProvider: SafeProvider chainId: bigint // required for performance safeAccountConfig: SafeAccountConfig safeDeploymentConfig?: SafeDeploymentConfig @@ -60,7 +57,7 @@ export interface PredictSafeAddressProps { } export interface encodeSetupCallDataProps { - safeProvider: ISafeProvider + safeProvider: SafeProvider safeAccountConfig: SafeAccountConfig safeContract: SafeContractImplementationType customContracts?: ContractNetworkConfig diff --git a/packages/safe-core-sdk-types/package.json b/packages/safe-core-sdk-types/package.json index 5be7c0f41..5135faabb 100644 --- a/packages/safe-core-sdk-types/package.json +++ b/packages/safe-core-sdk-types/package.json @@ -31,7 +31,7 @@ "dependencies": { "@safe-global/safe-deployments": "^1.34.0", "ethers": "^6.7.1", - "web3-core": "^1.10.3", + "web3-core": "^1.10.3" }, "devDependencies": { "abitype": "^1.0.2" diff --git a/packages/safe-core-sdk-types/src/contracts/common/BaseContract.ts b/packages/safe-core-sdk-types/src/contracts/common/BaseContract.ts index c30cba631..e52ed624d 100644 --- a/packages/safe-core-sdk-types/src/contracts/common/BaseContract.ts +++ b/packages/safe-core-sdk-types/src/contracts/common/BaseContract.ts @@ -9,10 +9,6 @@ import { EthersTransactionOptions, EthersTransactionResult } from '@safe-global/safe-core-sdk-types/ethereumLibs/ethers/types' -import { - Web3TransactionOptions, - Web3TransactionResult -} from '@safe-global/safe-core-sdk-types/ethereumLibs/web3/types' /** * Extracts the names of read-only functions (view or pure) from a given contract ABI. @@ -79,9 +75,7 @@ export type EncodeFunction< */ export type EstimateGasFunction< ContractAbi extends Abi, - TransactionOptions extends EthersTransactionOptions | Web3TransactionOptions = - | EthersTransactionOptions - | Web3TransactionOptions, + TransactionOptions extends EthersTransactionOptions = EthersTransactionOptions, ContractFunctionName extends ExtractAbiFunctionNames = ExtractAbiFunctionNames > = ( @@ -124,12 +118,8 @@ export type AdapterSpecificContractFunction< ContractAbi extends Abi, ContractFunctionName extends ExtractAbiFunctionNames = ExtractAbiFunctionNames, - TransactionOptions extends EthersTransactionOptions | Web3TransactionOptions = - | EthersTransactionOptions - | Web3TransactionOptions, - TransactionResult extends EthersTransactionResult | Web3TransactionResult = - | EthersTransactionResult - | Web3TransactionResult + TransactionOptions extends EthersTransactionOptions = EthersTransactionOptions, + TransactionResult extends EthersTransactionResult = EthersTransactionResult > = ( // TODO: remove `DeepWriteable` here when web3 dependency is removed args: DeepWriteable< diff --git a/packages/safe-core-sdk-types/src/types.d.ts b/packages/safe-core-sdk-types/src/types.d.ts new file mode 100644 index 000000000..003eaada5 --- /dev/null +++ b/packages/safe-core-sdk-types/src/types.d.ts @@ -0,0 +1,233 @@ +import { ContractTransactionResponse } from 'ethers'; +import { PromiEvent, TransactionReceipt } from 'web3-core/types'; +export type SafeVersion = '1.4.1' | '1.3.0' | '1.2.0' | '1.1.1' | '1.0.0'; +export declare enum OperationType { + Call = 0,// 0 + DelegateCall = 1 +} +export interface CreateProxyProps { + safeSingletonAddress: string; + initializer: string; + saltNonce: string; + options?: TransactionOptions; + callback?: (txHash: string) => void; +} +export interface SafeSetupConfig { + owners: string[]; + threshold: number; + to?: string; + data?: string; + fallbackHandler?: string; + paymentToken?: string; + payment?: string; + paymentReceiver?: string; +} +export interface MetaTransactionData { + to: string; + value: string; + data: string; + operation?: OperationType; +} +export interface SafeTransactionData extends MetaTransactionData { + operation: OperationType; + safeTxGas: string; + baseGas: string; + gasPrice: string; + gasToken: string; + refundReceiver: string; + nonce: number; +} +export interface SafeTransactionDataPartial extends MetaTransactionData { + safeTxGas?: string; + baseGas?: string; + gasPrice?: string; + gasToken?: string; + refundReceiver?: string; + nonce?: number; +} +export interface SafeSignature { + readonly signer: string; + readonly data: string; + readonly isContractSignature: boolean; + staticPart(dynamicOffset?: string): string; + dynamicPart(): string; +} +export interface SafeTransaction { + readonly data: SafeTransactionData; + readonly signatures: Map; + getSignature(signer: string): SafeSignature | undefined; + addSignature(signature: SafeSignature): void; + encodedSignatures(): string; +} +export interface SafeMessage { + readonly data: EIP712TypedData | string; + readonly signatures: Map; + getSignature(signer: string): SafeSignature | undefined; + addSignature(signature: SafeSignature): void; + encodedSignatures(): string; +} +export type Transaction = TransactionBase & TransactionOptions; +interface TransactionBase { + to: string; + value: string; + data: string; +} +export interface TransactionOptions { + from?: string; + gas?: number | string; + gasLimit?: number | string; + gasPrice?: number | string; + maxFeePerGas?: number | string; + maxPriorityFeePerGas?: number | string; + nonce?: number; +} +export interface BaseTransactionResult { + hash: string; +} +export interface TransactionResult extends BaseTransactionResult { + promiEvent?: PromiEvent; + transactionResponse?: ContractTransactionResponse; + options?: TransactionOptions; +} +export interface Eip3770Address { + prefix: string; + address: string; +} +export interface SafeEIP712Args { + safeAddress: string; + safeVersion: string; + chainId: bigint; + data: SafeTransactionData | EIP712TypedData | string; +} +export interface EIP712TxTypes { + EIP712Domain: { + type: string; + name: string; + }[]; + SafeTx: { + type: string; + name: string; + }[]; +} +export interface EIP712MessageTypes { + EIP712Domain: { + type: string; + name: string; + }[]; + SafeMessage: [ + { + type: 'bytes'; + name: 'message'; + } + ]; +} +export type EIP712Types = EIP712TxTypes | EIP712MessageTypes; +export interface EIP712TypedDataTx { + types: EIP712TxTypes; + domain: { + chainId?: string; + verifyingContract: string; + }; + primaryType: 'SafeTx'; + message: { + to: string; + value: string; + data: string; + operation: OperationType; + safeTxGas: string; + baseGas: string; + gasPrice: string; + gasToken: string; + refundReceiver: string; + nonce: number; + }; +} +export interface EIP712TypedDataMessage { + types: EIP712MessageTypes; + domain: { + chainId?: number; + verifyingContract: string; + }; + primaryType: 'SafeMessage'; + message: { + message: string; + }; +} +interface TypedDataDomain { + name?: string; + version?: string; + chainId?: unknown; + verifyingContract?: string; + salt?: ArrayLike | string; +} +interface TypedDataTypes { + name: string; + type: string; +} +type TypedMessageTypes = { + [key: string]: TypedDataTypes[]; +}; +export interface EIP712TypedData { + domain: TypedDataDomain; + types: TypedMessageTypes; + message: Record; + primaryType?: string; +} +export type SafeMultisigConfirmationResponse = { + readonly owner: string; + readonly submissionDate: string; + readonly transactionHash?: string; + readonly confirmationType?: string; + readonly signature: string; + readonly signatureType?: string; +}; +export type SafeMultisigConfirmationListResponse = { + readonly count: number; + readonly next?: string; + readonly previous?: string; + readonly results: SafeMultisigConfirmationResponse[]; +}; +export type SafeMultisigTransactionResponse = { + readonly safe: string; + readonly to: string; + readonly value: string; + readonly data?: string; + readonly operation: number; + readonly gasToken: string; + readonly safeTxGas: number; + readonly baseGas: number; + readonly gasPrice: string; + readonly refundReceiver?: string; + readonly nonce: number; + readonly executionDate: string; + readonly submissionDate: string; + readonly modified: string; + readonly blockNumber?: number; + readonly transactionHash: string; + readonly safeTxHash: string; + readonly executor?: string; + readonly proposer: string; + readonly isExecuted: boolean; + readonly isSuccessful?: boolean; + readonly ethGasPrice?: string; + readonly gasUsed?: number; + readonly fee?: string; + readonly origin: string; + readonly dataDecoded?: string; + readonly confirmationsRequired: number; + readonly confirmations?: SafeMultisigConfirmationResponse[]; + readonly trusted: boolean; + readonly signatures?: string; +}; +export interface RelayTransaction { + target: string; + encodedTransaction: string; + chainId: bigint; + options?: MetaTransactionOptions; +} +export interface MetaTransactionOptions { + gasLimit?: string; + gasToken?: string; + isSponsored?: boolean; +} +export {}; diff --git a/packages/safe-core-sdk-types/src/types.js b/packages/safe-core-sdk-types/src/types.js new file mode 100644 index 000000000..5243cf064 --- /dev/null +++ b/packages/safe-core-sdk-types/src/types.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.OperationType = void 0; +var OperationType; +(function (OperationType) { + OperationType[OperationType["Call"] = 0] = "Call"; + OperationType[OperationType["DelegateCall"] = 1] = "DelegateCall"; // 1 +})(OperationType || (exports.OperationType = OperationType = {})); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/packages/safe-core-sdk-types/src/types.js.map b/packages/safe-core-sdk-types/src/types.js.map new file mode 100644 index 000000000..ab6177231 --- /dev/null +++ b/packages/safe-core-sdk-types/src/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";;;AAKA,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,iDAAI,CAAA;IACJ,iEAAY,CAAA,CAAC,IAAI;AACnB,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB"} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index b09af4a32..90ec4876a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17,6 +17,11 @@ resolved "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz" integrity sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg== +"@adraffy/ens-normalize@^1.8.8": + version "1.10.1" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" + integrity sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw== + "@ampproject/remapping@^2.2.0": version "2.2.1" resolved "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz" @@ -397,14 +402,6 @@ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.56.0.tgz#ef20350fec605a7f7035a01764731b2de0f3782b" integrity sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A== -"@ethereumjs/common@2.6.5", "@ethereumjs/common@^2.6.4": - version "2.6.5" - resolved "https://registry.npmjs.org/@ethereumjs/common/-/common-2.6.5.tgz" - integrity sha512-lRyVQOeCDaIVtgfbowla32pzeDv2Obr8oR8Put5RdUBNRGr1VGPGQNGP6elWIpgK3YdpzqTOh4GyUGOureVeeA== - dependencies: - crc-32 "^1.2.0" - ethereumjs-util "^7.1.5" - "@ethereumjs/common@^3.2.0": version "3.2.0" resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-3.2.0.tgz#b71df25845caf5456449163012074a55f048e0a0" @@ -431,14 +428,6 @@ resolved "https://registry.yarnpkg.com/@ethereumjs/rlp/-/rlp-5.0.1.tgz#56c5433b9242f956e354fd7e4ce3523815e24854" integrity sha512-Ab/Hfzz+T9Zl+65Nkg+9xAmwKPLicsnQ4NW49pgvJp9ovefuic95cgOS9CbPc9izIEgsqm1UitV0uNveCvud9w== -"@ethereumjs/tx@3.5.2": - version "3.5.2" - resolved "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.5.2.tgz" - integrity sha512-gQDNJWKrSDGu2w7w0PzVXVBNMzb7wwdDOmOqczmhNjqFxFuIbhVJDwiGEnxFNC2/b8ifcZzY7MLcluizohRzNw== - dependencies: - "@ethereumjs/common" "^2.6.4" - ethereumjs-util "^7.1.5" - "@ethereumjs/tx@^4.2.0": version "4.2.0" resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-4.2.0.tgz#5988ae15daf5a3b3c815493bc6b495e76009e853" @@ -476,7 +465,7 @@ "@ethereumjs/rlp" "^5.0.1" ethereum-cryptography "^2.1.2" -"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.6.3", "@ethersproject/abi@^5.7.0": +"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz" integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== @@ -1275,7 +1264,7 @@ dependencies: "@noble/hashes" "1.3.1" -"@noble/curves@1.2.0": +"@noble/curves@1.2.0", "@noble/curves@~1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== @@ -1302,7 +1291,7 @@ resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz" integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== -"@noble/hashes@^1.3.1", "@noble/hashes@^1.3.3", "@noble/hashes@~1.3.0", "@noble/hashes@~1.3.1": +"@noble/hashes@^1.3.1", "@noble/hashes@^1.3.3", "@noble/hashes@~1.3.0", "@noble/hashes@~1.3.1", "@noble/hashes@~1.3.2": version "1.3.3" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.3.tgz#39908da56a4adc270147bb07968bf3b16cfe1699" integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA== @@ -1859,6 +1848,11 @@ resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.3.tgz#8584115565228290a6c6c4961973e0903bb3df2f" integrity sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q== +"@scure/base@~1.1.2": + version "1.1.6" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.6.tgz#8ce5d304b436e4c84f896e0550c83e4d88cb917d" + integrity sha512-ok9AWwhcgYuGG3Zfhyqg+zwl+Wn5uE+dwC0NV/2qQkx4dABbb/bx96vWu8NSj+BNjjSjno+JRYRjle1jV08k3g== + "@scure/bip32@1.1.5": version "1.1.5" resolved "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.5.tgz" @@ -1877,6 +1871,15 @@ "@noble/hashes" "~1.3.1" "@scure/base" "~1.1.0" +"@scure/bip32@1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.2.tgz#90e78c027d5e30f0b22c1f8d50ff12f3fb7559f8" + integrity sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA== + dependencies: + "@noble/curves" "~1.2.0" + "@noble/hashes" "~1.3.2" + "@scure/base" "~1.1.2" + "@scure/bip39@1.1.1": version "1.1.1" resolved "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.1.tgz" @@ -1995,11 +1998,6 @@ resolved "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz" integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== -"@sindresorhus/is@^4.0.0", "@sindresorhus/is@^4.6.0": - version "4.6.0" - resolved "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz" - integrity sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw== - "@sinonjs/commons@^1.7.0": version "1.8.6" resolved "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz" @@ -2057,20 +2055,6 @@ resolved "https://registry.npmjs.org/@stripe/stripe-js/-/stripe-js-1.54.2.tgz" integrity sha512-R1PwtDvUfs99cAjfuQ/WpwJ3c92+DAMy9xGApjqlWQMj0FKQabUAys2swfTRNzuYAYJh7NqK2dzcYVNkKLEKUg== -"@szmarczak/http-timer@^4.0.5": - version "4.0.6" - resolved "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz" - integrity sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w== - dependencies: - defer-to-connect "^2.0.0" - -"@szmarczak/http-timer@^5.0.1": - version "5.0.1" - resolved "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-5.0.1.tgz" - integrity sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw== - dependencies: - defer-to-connect "^2.0.1" - "@tootallnate/once@2": version "2.0.0" resolved "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz" @@ -2268,16 +2252,6 @@ dependencies: "@types/node" "*" -"@types/cacheable-request@^6.0.1", "@types/cacheable-request@^6.0.2": - version "6.0.3" - resolved "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz" - integrity sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw== - dependencies: - "@types/http-cache-semantics" "*" - "@types/keyv" "^3.1.4" - "@types/node" "*" - "@types/responselike" "^1.0.0" - "@types/chai-as-promised@^7.1.8": version "7.1.8" resolved "https://registry.npmjs.org/@types/chai-as-promised/-/chai-as-promised-7.1.8.tgz" @@ -2304,11 +2278,6 @@ dependencies: "@types/node" "*" -"@types/http-cache-semantics@*": - version "4.0.1" - resolved "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz" - integrity sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ== - "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.4" resolved "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz" @@ -2350,13 +2319,6 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== -"@types/keyv@^3.1.4": - version "3.1.4" - resolved "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz" - integrity sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg== - dependencies: - "@types/node" "*" - "@types/lru-cache@^5.1.0": version "5.1.1" resolved "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.1.tgz" @@ -2432,13 +2394,6 @@ "@types/node" "*" safe-buffer "~5.1.1" -"@types/responselike@^1.0.0": - version "1.0.0" - resolved "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz" - integrity sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA== - dependencies: - "@types/node" "*" - "@types/secp256k1@^4.0.1": version "4.0.3" resolved "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz" @@ -2494,6 +2449,13 @@ "@types/bn.js" "*" "@types/underscore" "*" +"@types/ws@8.5.3": + version "8.5.3" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.3.tgz#7d25a1ffbecd3c4f2d35068d0b283c037003274d" + integrity sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w== + dependencies: + "@types/node" "*" + "@types/yargs-parser@*": version "21.0.0" resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz" @@ -2655,6 +2617,16 @@ abbrev@^1.0.0: resolved "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz" integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== +abitype@0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.7.1.tgz#16db20abe67de80f6183cf75f3de1ff86453b745" + integrity sha512-VBkRHTDZf9Myaek/dO3yMmOzB/y2s3Zo6nVU7yaw1G+TvCHAjwaJzNGN9yo4K5D8bU/VZXKP1EJpRhFr862PlQ== + +abitype@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.0.tgz#237176dace81d90d018bebf3a45cb42f2a2d9e97" + integrity sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ== + abitype@^0.1.6: version "0.1.8" resolved "https://registry.npmjs.org/abitype/-/abitype-0.1.8.tgz" @@ -2690,14 +2662,6 @@ abstract-level@^1.0.0, abstract-level@^1.0.2, abstract-level@^1.0.3: module-error "^1.0.1" queue-microtask "^1.2.3" -accepts@~1.3.8: - version "1.3.8" - resolved "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz" - integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== - dependencies: - mime-types "~2.1.34" - negotiator "0.6.3" - acorn-globals@^7.0.0: version "7.0.1" resolved "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz" @@ -2765,7 +2729,7 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" -ajv@^6.12.3, ajv@^6.12.4: +ajv@^6.12.4: version "6.12.6" resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -2888,11 +2852,6 @@ array-differ@^3.0.0: resolved "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz" integrity sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg== -array-flatten@1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz" - integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== - array-ify@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz" @@ -2913,28 +2872,11 @@ arrify@^2.0.1: resolved "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz" integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== -asn1@~0.2.3: - version "0.2.6" - resolved "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz" - integrity sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ== - dependencies: - safer-buffer "~2.1.0" - -assert-plus@1.0.0, assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz" - integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw== - assertion-error@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz" integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== -async-limiter@~1.0.0: - version "1.0.1" - resolved "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz" - integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== - async-mutex@^0.4.0: version "0.4.0" resolved "https://registry.npmjs.org/async-mutex/-/async-mutex-0.4.0.tgz" @@ -2957,16 +2899,6 @@ available-typed-arrays@^1.0.5: resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz" - integrity sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA== - -aws4@^1.8.0: - version "1.12.0" - resolved "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz" - integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg== - axios@0.27.2: version "0.27.2" resolved "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz" @@ -3056,7 +2988,7 @@ balanced-match@^1.0.0: resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -base-x@^3.0.2, base-x@^3.0.8: +base-x@^3.0.2: version "3.0.9" resolved "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz" integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ== @@ -3073,13 +3005,6 @@ base64url@^3.0.1: resolved "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz" integrity sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A== -bcrypt-pbkdf@^1.0.0: - version "1.0.2" - resolved "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz" - integrity sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w== - dependencies: - tweetnacl "^0.14.3" - bech32@1.1.4: version "1.1.4" resolved "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz" @@ -3124,17 +3049,12 @@ blakejs@^1.1.0: resolved "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz" integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== -bluebird@^3.5.0: - version "3.7.2" - resolved "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz" - integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== - bn.js@4.11.6: version "4.11.6" resolved "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz" integrity sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA== -bn.js@^4.11.0, bn.js@^4.11.6, bn.js@^4.11.8, bn.js@^4.11.9: +bn.js@^4.11.0, bn.js@^4.11.8, bn.js@^4.11.9: version "4.12.0" resolved "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== @@ -3144,24 +3064,6 @@ bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1: resolved "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== -body-parser@1.20.2, body-parser@^1.16.0: - version "1.20.2" - resolved "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz" - integrity sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA== - dependencies: - bytes "3.1.2" - content-type "~1.0.5" - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - http-errors "2.0.0" - iconv-lite "0.4.24" - on-finished "2.4.1" - qs "6.11.0" - raw-body "2.5.2" - type-is "~1.6.18" - unpipe "1.0.0" - bowser@^2.11.0: version "2.11.0" resolved "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz" @@ -3273,17 +3175,12 @@ buffer-from@^1.0.0: resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -buffer-to-arraybuffer@^0.0.5: - version "0.0.5" - resolved "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz" - integrity sha512-3dthu5CYiVB1DEJp61FtApNnNndTckcqe4pFcLdvHtrpG+kcyekCJKg4MRiDcFW7A6AODnXB9U4dwQiCW5kzJQ== - buffer-xor@^1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz" integrity sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ== -buffer@^5.0.5, buffer@^5.5.0, buffer@^5.6.0: +buffer@^5.5.0: version "5.7.1" resolved "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz" integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== @@ -3378,29 +3275,6 @@ cacache@^17.0.0: tar "^6.1.11" unique-filename "^3.0.0" -cacheable-lookup@^5.0.3: - version "5.0.4" - resolved "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz" - integrity sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA== - -cacheable-lookup@^6.0.4: - version "6.1.0" - resolved "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-6.1.0.tgz" - integrity sha512-KJ/Dmo1lDDhmW2XDPMo+9oiy/CeqosPguPCrgcVzKyZrL6pM1gU2GmPY/xo6OQPTUaA/c0kwHuywB4E6nmT9ww== - -cacheable-request@^7.0.2: - version "7.0.2" - resolved "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz" - integrity sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew== - dependencies: - clone-response "^1.0.2" - get-stream "^5.1.0" - http-cache-semantics "^4.0.0" - keyv "^4.0.0" - lowercase-keys "^2.0.0" - normalize-url "^6.0.1" - responselike "^2.0.0" - caching-transform@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz" @@ -3454,11 +3328,6 @@ case@^1.6.3: resolved "https://registry.npmjs.org/case/-/case-1.6.3.tgz" integrity sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ== -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz" - integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== - catering@^2.1.0, catering@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/catering/-/catering-2.1.1.tgz" @@ -3546,11 +3415,6 @@ chokidar@3.5.3, chokidar@^3.4.0, chokidar@^3.5.2, chokidar@^3.5.3: optionalDependencies: fsevents "~2.3.2" -chownr@^1.1.4: - version "1.1.4" - resolved "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz" - integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== - chownr@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz" @@ -3566,17 +3430,6 @@ ci-info@^3.2.0, ci-info@^3.6.1: resolved "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz" integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== -cids@^0.7.1: - version "0.7.5" - resolved "https://registry.npmjs.org/cids/-/cids-0.7.5.tgz" - integrity sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA== - dependencies: - buffer "^5.5.0" - class-is "^1.1.0" - multibase "~0.6.0" - multicodec "^1.0.0" - multihashes "~0.4.15" - cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: version "1.0.4" resolved "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz" @@ -3590,11 +3443,6 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz" integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== -class-is@^1.1.0: - version "1.1.0" - resolved "https://registry.npmjs.org/class-is/-/class-is-1.1.0.tgz" - integrity sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw== - classic-level@^1.2.0: version "1.3.0" resolved "https://registry.npmjs.org/classic-level/-/classic-level-1.3.0.tgz" @@ -3684,13 +3532,6 @@ clone-deep@4.0.1: kind-of "^6.0.2" shallow-clone "^3.0.0" -clone-response@^1.0.2: - version "1.0.3" - resolved "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz" - integrity sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA== - dependencies: - mimic-response "^1.0.0" - clone@^1.0.2: version "1.0.4" resolved "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz" @@ -3753,7 +3594,7 @@ columnify@1.6.0: strip-ansi "^6.0.1" wcwidth "^1.0.0" -combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: +combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== @@ -3813,27 +3654,6 @@ console-control-strings@^1.1.0: resolved "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz" integrity sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ== -content-disposition@0.5.4: - version "0.5.4" - resolved "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz" - integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== - dependencies: - safe-buffer "5.2.1" - -content-hash@^2.5.2: - version "2.5.2" - resolved "https://registry.npmjs.org/content-hash/-/content-hash-2.5.2.tgz" - integrity sha512-FvIQKy0S1JaWV10sMsA7TRx8bpU+pqPkhbsfvOJAdjRXvYxEckAwQWGwtRjiaJfh+E0DvcWUGqcdjwMGFjsSdw== - dependencies: - cids "^0.7.1" - multicodec "^0.5.5" - multihashes "^0.4.15" - -content-type@~1.0.4, content-type@~1.0.5: - version "1.0.5" - resolved "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz" - integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== - conventional-changelog-angular@7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz#5eec8edbff15aa9b1680a8dcfbd53e2d7eb2ba7a" @@ -3917,39 +3737,16 @@ convert-source-map@^2.0.0: resolved "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== -cookie-signature@1.0.6: - version "1.0.6" - resolved "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz" - integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== - -cookie@0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051" - integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw== - cookie@^0.4.1: version "0.4.2" resolved "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz" integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA== -core-util-is@1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz" - integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ== - core-util-is@~1.0.0: version "1.0.3" resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz" integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== -cors@^2.8.1: - version "2.8.5" - resolved "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz" - integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g== - dependencies: - object-assign "^4" - vary "^1" - cosmiconfig@^8.2.0: version "8.3.6" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-8.3.6.tgz#060a2b871d66dba6c8538ea1118ba1ac16f5fae3" @@ -3960,7 +3757,7 @@ cosmiconfig@^8.2.0: parse-json "^5.2.0" path-type "^4.0.0" -crc-32@^1.2.0: +crc-32@^1.2.0, crc-32@^1.2.2: version "1.2.2" resolved "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz" integrity sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ== @@ -4062,13 +3859,6 @@ dargs@^7.0.0: resolved "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz" integrity sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg== -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz" - integrity sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g== - dependencies: - assert-plus "^1.0.0" - data-urls@^3.0.2: version "3.0.2" resolved "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz" @@ -4083,13 +3873,6 @@ dateformat@^3.0.3: resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== -debug@2.6.9, debug@^2.2.0: - version "2.6.9" - resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - debug@4, debug@4.3.4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4, debug@~4.3.1, debug@~4.3.2: version "4.3.4" resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" @@ -4097,6 +3880,13 @@ debug@4, debug@4.3.4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3, de dependencies: ms "2.1.2" +debug@^2.2.0: + version "2.6.9" + resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + decamelize-keys@^1.1.0: version "1.1.1" resolved "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz" @@ -4120,25 +3910,6 @@ decimal.js@^10.4.2: resolved "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz" integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== -decode-uri-component@^0.2.0: - version "0.2.2" - resolved "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz" - integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ== - -decompress-response@^3.3.0: - version "3.3.0" - resolved "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz" - integrity sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA== - dependencies: - mimic-response "^1.0.0" - -decompress-response@^6.0.0: - version "6.0.0" - resolved "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz" - integrity sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ== - dependencies: - mimic-response "^3.1.0" - dedent@0.7.0: version "0.7.0" resolved "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz" @@ -4198,11 +3969,6 @@ defaults@^1.0.3: dependencies: clone "^1.0.2" -defer-to-connect@^2.0.0, defer-to-connect@^2.0.1: - version "2.0.1" - resolved "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz" - integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== - define-data-property@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz" @@ -4242,11 +4008,6 @@ deprecation@^2.0.0: resolved "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz" integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ== -destroy@1.2.0: - version "1.2.0" - resolved "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz" - integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== - detect-indent@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz" @@ -4291,11 +4052,6 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -dom-walk@^0.1.0: - version "0.1.2" - resolved "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz" - integrity sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w== - domexception@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz" @@ -4330,19 +4086,6 @@ eastasianwidth@^0.2.0: resolved "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz" integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== -ecc-jsbn@~0.1.1: - version "0.1.2" - resolved "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz" - integrity sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw== - dependencies: - jsbn "~0.1.0" - safer-buffer "^2.1.0" - -ee-first@1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz" - integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== - ejs@^3.1.7: version "3.1.9" resolved "https://registry.npmjs.org/ejs/-/ejs-3.1.9.tgz" @@ -4355,7 +4098,7 @@ electron-to-chromium@^1.4.535: resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.589.tgz" integrity sha512-zF6y5v/YfoFIgwf2dDfAqVlPPsyQeWNpEWXbAlDUS8Ax4Z2VoiiZpAPC0Jm9hXEkJm2vIZpwB6rc4KnLTQffbQ== -elliptic@6.5.4, elliptic@^6.4.0, elliptic@^6.5.2, elliptic@^6.5.4: +elliptic@6.5.4, elliptic@^6.5.2, elliptic@^6.5.4: version "6.5.4" resolved "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz" integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== @@ -4388,11 +4131,6 @@ encode-utf8@^1.0.2: resolved "https://registry.npmjs.org/encode-utf8/-/encode-utf8-1.0.3.tgz" integrity sha512-ucAnuBEhUK4boH2HjVYG5Q2mQyPorvv0u/ocS+zhdw0S8AlHYY+GOFhP1Gio5z4icpP2ivFSvhtFjQi8+T9ppw== -encodeurl@~1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz" - integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== - encoding@^0.1.13: version "0.1.13" resolved "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz" @@ -4498,11 +4236,6 @@ escalade@^3.1.1: resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz" integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== -escape-html@~1.0.3: - version "1.0.3" - resolved "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz" - integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== - escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz" @@ -4638,40 +4371,6 @@ esutils@^2.0.2: resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -etag@~1.8.1: - version "1.8.1" - resolved "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz" - integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== - -eth-ens-namehash@2.0.8: - version "2.0.8" - resolved "https://registry.npmjs.org/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz" - integrity sha512-VWEI1+KJfz4Km//dadyvBBoBeSQ0MHTXPvr8UIXiLW6IanxvAV+DmlZAijZwAyggqGUfwQBeHf7tc9wzc1piSw== - dependencies: - idna-uts46-hx "^2.3.1" - js-sha3 "^0.5.7" - -eth-lib@0.2.8: - version "0.2.8" - resolved "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz" - integrity sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw== - dependencies: - bn.js "^4.11.6" - elliptic "^6.4.0" - xhr-request-promise "^0.1.2" - -eth-lib@^0.1.26: - version "0.1.29" - resolved "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.29.tgz" - integrity sha512-bfttrr3/7gG4E02HoWTDUcDDslN003OlOoBxk9virpAZQ1ja/jDgwkWB8QfJF7ojuEowrqy+lzp9VcJG7/k5bQ== - dependencies: - bn.js "^4.11.6" - elliptic "^6.4.0" - nano-json-stream-parser "^0.1.2" - servify "^0.1.12" - ws "^3.0.0" - xhr-request-promise "^0.1.2" - eth-testing@^1.14.0: version "1.14.0" resolved "https://registry.npmjs.org/eth-testing/-/eth-testing-1.14.0.tgz" @@ -4932,43 +4631,6 @@ expect@^29.0.0, expect@^29.7.0: jest-message-util "^29.7.0" jest-util "^29.7.0" -express@^4.14.0: - version "4.19.2" - resolved "https://registry.yarnpkg.com/express/-/express-4.19.2.tgz#e25437827a3aa7f2a827bc8171bbbb664a356465" - integrity sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q== - dependencies: - accepts "~1.3.8" - array-flatten "1.1.1" - body-parser "1.20.2" - content-disposition "0.5.4" - content-type "~1.0.4" - cookie "0.6.0" - cookie-signature "1.0.6" - debug "2.6.9" - depd "2.0.0" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - finalhandler "1.2.0" - fresh "0.5.2" - http-errors "2.0.0" - merge-descriptors "1.0.1" - methods "~1.1.2" - on-finished "2.4.1" - parseurl "~1.3.3" - path-to-regexp "0.1.7" - proxy-addr "~2.0.7" - qs "6.11.0" - range-parser "~1.2.1" - safe-buffer "5.2.1" - send "0.18.0" - serve-static "1.15.0" - setprototypeof "1.2.0" - statuses "2.0.1" - type-is "~1.6.18" - utils-merge "1.0.1" - vary "~1.1.2" - ext@^1.1.2: version "1.7.0" resolved "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz" @@ -4976,11 +4638,6 @@ ext@^1.1.2: dependencies: type "^2.7.2" -extend@~3.0.2: - version "3.0.2" - resolved "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz" - integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== - external-editor@^3.0.3: version "3.1.0" resolved "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz" @@ -4990,16 +4647,6 @@ external-editor@^3.0.3: iconv-lite "^0.4.24" tmp "^0.0.33" -extsprintf@1.3.0: - version "1.3.0" - resolved "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz" - integrity sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g== - -extsprintf@^1.2.0: - version "1.4.1" - resolved "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.1.tgz" - integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA== - fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" @@ -5083,19 +4730,6 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" -finalhandler@1.2.0: - version "1.2.0" - resolved "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz" - integrity sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg== - dependencies: - debug "2.6.9" - encodeurl "~1.0.2" - escape-html "~1.0.3" - on-finished "2.4.1" - parseurl "~1.3.3" - statuses "2.0.1" - unpipe "~1.0.0" - find-cache-dir@^3.2.0: version "3.3.2" resolved "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz" @@ -5181,16 +4815,6 @@ foreground-child@^3.1.0: cross-spawn "^7.0.0" signal-exit "^4.0.1" -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz" - integrity sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw== - -form-data-encoder@1.7.1: - version "1.7.1" - resolved "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.1.tgz" - integrity sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg== - form-data@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz" @@ -5200,20 +4824,6 @@ form-data@^4.0.0: combined-stream "^1.0.8" mime-types "^2.1.12" -form-data@~2.3.2: - version "2.3.3" - resolved "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz" - integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.6" - mime-types "^2.1.12" - -forwarded@0.2.0: - version "0.2.0" - resolved "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz" - integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== - fp-ts@1.19.3: version "1.19.3" resolved "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.3.tgz" @@ -5224,11 +4834,6 @@ fp-ts@^1.0.0: resolved "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.5.tgz" integrity sha512-wDNqTimnzs8QqpldiId9OavWK2NptormjXnRJTQecNjzwfyp6P/8s/zG8e4h3ja3oqkKaY72UlTjQYt/1yXf9A== -fresh@0.5.2: - version "0.5.2" - resolved "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz" - integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== - fromentries@^1.2.0: version "1.3.2" resolved "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz" @@ -5268,15 +4873,6 @@ fs-extra@^11.1.0, fs-extra@^11.1.1: jsonfile "^6.0.1" universalify "^2.0.0" -fs-extra@^4.0.2: - version "4.0.3" - resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz" - integrity sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg== - dependencies: - graceful-fs "^4.1.2" - jsonfile "^4.0.0" - universalify "^0.1.0" - fs-extra@^7.0.1: version "7.0.1" resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz" @@ -5286,13 +4882,6 @@ fs-extra@^7.0.1: jsonfile "^4.0.0" universalify "^0.1.0" -fs-minipass@^1.2.7: - version "1.2.7" - resolved "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz" - integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== - dependencies: - minipass "^2.6.0" - fs-minipass@^2.0.0, fs-minipass@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz" @@ -5391,25 +4980,11 @@ get-stream@6.0.0: resolved "https://registry.npmjs.org/get-stream/-/get-stream-6.0.0.tgz" integrity sha512-A1B3Bh1UmL0bidM/YX2NsCOTnGJePL9rO/M+Mw3m9f2gUpfokS0hi5Eah0WSUEWZdZhIZtMjkIYS7mDfOqNHbg== -get-stream@^5.1.0: - version "5.2.0" - resolved "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz" - integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== - dependencies: - pump "^3.0.0" - get-stream@^6.0.0, get-stream@^6.0.1: version "6.0.1" resolved "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz" - integrity sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng== - dependencies: - assert-plus "^1.0.0" - git-raw-commits@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-3.0.0.tgz#5432f053a9744f67e8db03dbc48add81252cfdeb" @@ -5539,14 +5114,6 @@ glob@^9.2.0, glob@^9.3.1: minipass "^4.2.4" path-scurry "^1.6.1" -global@~4.4.0: - version "4.4.0" - resolved "https://registry.npmjs.org/global/-/global-4.4.0.tgz" - integrity sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w== - dependencies: - min-document "^2.19.0" - process "^0.11.10" - globals@^11.1.0: version "11.12.0" resolved "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz" @@ -5578,42 +5145,6 @@ gopd@^1.0.1: dependencies: get-intrinsic "^1.1.3" -got@12.1.0: - version "12.1.0" - resolved "https://registry.npmjs.org/got/-/got-12.1.0.tgz" - integrity sha512-hBv2ty9QN2RdbJJMK3hesmSkFTjVIHyIDDbssCKnSmq62edGgImJWD10Eb1k77TiV1bxloxqcFAVK8+9pkhOig== - dependencies: - "@sindresorhus/is" "^4.6.0" - "@szmarczak/http-timer" "^5.0.1" - "@types/cacheable-request" "^6.0.2" - "@types/responselike" "^1.0.0" - cacheable-lookup "^6.0.4" - cacheable-request "^7.0.2" - decompress-response "^6.0.0" - form-data-encoder "1.7.1" - get-stream "^6.0.1" - http2-wrapper "^2.1.10" - lowercase-keys "^3.0.0" - p-cancelable "^3.0.0" - responselike "^2.0.0" - -got@^11.8.5: - version "11.8.6" - resolved "https://registry.npmjs.org/got/-/got-11.8.6.tgz" - integrity sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g== - dependencies: - "@sindresorhus/is" "^4.0.0" - "@szmarczak/http-timer" "^4.0.5" - "@types/cacheable-request" "^6.0.1" - "@types/responselike" "^1.0.0" - cacheable-lookup "^5.0.3" - cacheable-request "^7.0.2" - decompress-response "^6.0.0" - http2-wrapper "^1.0.0-beta.5.2" - lowercase-keys "^2.0.0" - p-cancelable "^2.0.0" - responselike "^2.0.0" - graceful-fs@4.2.11, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.6, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" @@ -5636,19 +5167,6 @@ handlebars@^4.7.7: optionalDependencies: uglify-js "^3.1.4" -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz" - integrity sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q== - -har-validator@~5.1.3: - version "5.1.5" - resolved "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz" - integrity sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w== - dependencies: - ajv "^6.12.3" - har-schema "^2.0.0" - hard-rejection@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz" @@ -5873,7 +5391,7 @@ html-escaper@^2.0.0: resolved "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== -http-cache-semantics@^4.0.0, http-cache-semantics@^4.1.0, http-cache-semantics@^4.1.1: +http-cache-semantics@^4.1.0, http-cache-semantics@^4.1.1: version "4.1.1" resolved "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz" integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ== @@ -5903,31 +5421,6 @@ http-proxy-agent@^5.0.0: agent-base "6" debug "4" -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz" - integrity sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ== - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - -http2-wrapper@^1.0.0-beta.5.2: - version "1.0.3" - resolved "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz" - integrity sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg== - dependencies: - quick-lru "^5.1.1" - resolve-alpn "^1.0.0" - -http2-wrapper@^2.1.10: - version "2.2.0" - resolved "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.0.tgz" - integrity sha512-kZB0wxMo0sh1PehyjJUWRFEd99KC5TLjZ2cULC4f9iqJBAmKQQXEICjxl5iPJRwP40dpeHFqqhm7tYCvODpqpQ== - dependencies: - quick-lru "^5.1.1" - resolve-alpn "^1.2.0" - https-proxy-agent@^5.0.0, https-proxy-agent@^5.0.1: version "5.0.1" resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz" @@ -5972,13 +5465,6 @@ iconv-lite@0.6.3, iconv-lite@^0.6.2: dependencies: safer-buffer ">= 2.1.2 < 3.0.0" -idna-uts46-hx@^2.3.1: - version "2.3.1" - resolved "https://registry.npmjs.org/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz" - integrity sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA== - dependencies: - punycode "2.1.0" - ieee754@^1.1.13, ieee754@^1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz" @@ -6108,11 +5594,6 @@ ip@^2.0.0: resolved "https://registry.yarnpkg.com/ip/-/ip-2.0.1.tgz#e8f3595d33a3ea66490204234b77636965307105" integrity sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ== -ipaddr.js@1.9.1: - version "1.9.1" - resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz" - integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== - is-arguments@^1.0.4: version "1.1.1" resolved "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz" @@ -6182,11 +5663,6 @@ is-fullwidth-code-point@^4.0.0: resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz" integrity sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ== -is-function@^1.0.1: - version "1.0.2" - resolved "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz" - integrity sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ== - is-generator-fn@^2.0.0: version "2.1.0" resolved "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz" @@ -6310,7 +5786,7 @@ is-typed-array@^1.1.10, is-typed-array@^1.1.3: gopd "^1.0.1" has-tostringtag "^1.0.0" -is-typedarray@^1.0.0, is-typedarray@~1.0.0: +is-typedarray@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz" integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== @@ -6362,10 +5838,10 @@ isomorphic-ws@^5.0.0: resolved "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz" integrity sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw== -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz" - integrity sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g== +isows@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.3.tgz#93c1cf0575daf56e7120bab5c8c448b0809d0d74" + integrity sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg== istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: version "3.2.0" @@ -6850,11 +6326,6 @@ js-sha3@0.8.0, js-sha3@^0.8.0: resolved "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz" integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== -js-sha3@^0.5.7: - version "0.5.7" - resolved "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz" - integrity sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g== - "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" @@ -6875,11 +6346,6 @@ js-yaml@^3.10.0, js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz" - integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== - jsdom@^20.0.0: version "20.0.3" resolved "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz" @@ -6917,11 +6383,6 @@ jsesc@^2.5.1: resolved "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== -json-buffer@3.0.1: - version "3.0.1" - resolved "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz" - integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== - json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz" @@ -6942,11 +6403,6 @@ json-schema-traverse@^0.4.1: resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== -json-schema@0.4.0: - version "0.4.0" - resolved "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz" - integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA== - json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" @@ -6962,7 +6418,7 @@ json-stable-stringify@^1.0.2: jsonify "^0.0.1" object-keys "^1.1.1" -json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: +json-stringify-safe@^5.0.1: version "5.0.1" resolved "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== @@ -7015,16 +6471,6 @@ jsonschema@^1.4.1: resolved "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.1.tgz" integrity sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ== -jsprim@^1.2.2: - version "1.4.2" - resolved "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz" - integrity sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw== - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.4.0" - verror "1.10.0" - just-extend@^4.0.2: version "4.2.1" resolved "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz" @@ -7039,13 +6485,6 @@ keccak@^3.0.0, keccak@^3.0.2: node-gyp-build "^4.2.0" readable-stream "^3.6.0" -keyv@^4.0.0: - version "4.5.2" - resolved "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz" - integrity sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g== - dependencies: - json-buffer "3.0.1" - kind-of@^6.0.2, kind-of@^6.0.3: version "6.0.3" resolved "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz" @@ -7366,16 +6805,6 @@ loupe@^2.3.6: dependencies: get-func-name "^2.0.0" -lowercase-keys@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz" - integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== - -lowercase-keys@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz" - integrity sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ== - lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz" @@ -7511,11 +6940,6 @@ md5.js@^1.3.4: inherits "^2.0.1" safe-buffer "^5.1.2" -media-typer@0.3.0: - version "0.3.0" - resolved "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz" - integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== - memory-level@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/memory-level/-/memory-level-1.0.0.tgz" @@ -7547,11 +6971,6 @@ meow@^8.1.2: type-fest "^0.18.0" yargs-parser "^20.2.3" -merge-descriptors@1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz" - integrity sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w== - merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz" @@ -7562,11 +6981,6 @@ merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -methods@~1.1.2: - version "1.1.2" - resolved "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz" - integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== - micro-ftch@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/micro-ftch/-/micro-ftch-0.3.1.tgz#6cb83388de4c1f279a034fb0cf96dfc050853c5f" @@ -7585,18 +6999,13 @@ mime-db@1.52.0: resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12, mime-types@^2.1.16, mime-types@~2.1.19, mime-types@~2.1.24, mime-types@~2.1.34: +mime-types@^2.1.12: version "2.1.35" resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== dependencies: mime-db "1.52.0" -mime@1.6.0: - version "1.6.0" - resolved "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz" - integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== - mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz" @@ -7607,23 +7016,6 @@ mimic-fn@^4.0.0: resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz" integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw== -mimic-response@^1.0.0: - version "1.0.1" - resolved "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz" - integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== - -mimic-response@^3.1.0: - version "3.1.0" - resolved "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz" - integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== - -min-document@^2.19.0: - version "2.19.0" - resolved "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz" - integrity sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ== - dependencies: - dom-walk "^0.1.0" - min-indent@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz" @@ -7760,14 +7152,6 @@ minipass-sized@^1.0.3: dependencies: minipass "^3.0.0" -minipass@^2.6.0, minipass@^2.9.0: - version "2.9.0" - resolved "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz" - integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== - dependencies: - safe-buffer "^5.1.2" - yallist "^3.0.0" - minipass@^3.0.0, minipass@^3.1.1, minipass@^3.1.6: version "3.3.6" resolved "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz" @@ -7790,13 +7174,6 @@ minipass@^5.0.0: resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.4.tgz#dbce03740f50a4786ba994c1fb908844d27b038c" integrity sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ== -minizlib@^1.3.3: - version "1.3.3" - resolved "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz" - integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== - dependencies: - minipass "^2.9.0" - minizlib@^2.1.1, minizlib@^2.1.2: version "2.1.2" resolved "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz" @@ -7805,25 +7182,6 @@ minizlib@^2.1.1, minizlib@^2.1.2: minipass "^3.0.0" yallist "^4.0.0" -mkdirp-promise@^5.0.1: - version "5.0.1" - resolved "https://registry.npmjs.org/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz" - integrity sha512-Hepn5kb1lJPtVW84RFT40YG1OddBNTOVUZR2bzQUHc+Z03en8/3uX0+060JDhcEzyO08HmipsN9DcnFMxhIL9w== - dependencies: - mkdirp "*" - -mkdirp@*: - version "3.0.0" - resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.0.tgz" - integrity sha512-7+JDnNsyCvZXoUJdkMR0oUE2AmAdsNXGTmRbiOjYIwQ6q+bL6NwrozGQdPcmYaNcrhH37F50HHBUzoaBV6FITQ== - -mkdirp@^0.5.5: - version "0.5.6" - resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz" - integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== - dependencies: - minimist "^1.2.6" - mkdirp@^1.0.3, mkdirp@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz" @@ -7863,11 +7221,6 @@ mocha@^10.0.0, mocha@^10.2.0: yargs-parser "20.2.4" yargs-unparser "2.0.0" -mock-fs@^4.1.0: - version "4.14.0" - resolved "https://registry.npmjs.org/mock-fs/-/mock-fs-4.14.0.tgz" - integrity sha512-qYvlv/exQ4+svI3UOvPUpLDF0OMX5euvUH0Ny4N5QyRyhNdgAgUrVH3iUINSzEPLvx0kbo/Bp28GJKIqvE7URw== - modify-values@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" @@ -7893,46 +7246,6 @@ ms@2.1.3, ms@^2.0.0: resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -multibase@^0.7.0: - version "0.7.0" - resolved "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz" - integrity sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg== - dependencies: - base-x "^3.0.8" - buffer "^5.5.0" - -multibase@~0.6.0: - version "0.6.1" - resolved "https://registry.npmjs.org/multibase/-/multibase-0.6.1.tgz" - integrity sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw== - dependencies: - base-x "^3.0.8" - buffer "^5.5.0" - -multicodec@^0.5.5: - version "0.5.7" - resolved "https://registry.npmjs.org/multicodec/-/multicodec-0.5.7.tgz" - integrity sha512-PscoRxm3f+88fAtELwUnZxGDkduE2HD9Q6GHUOywQLjOGT/HAdhjLDYNZ1e7VR0s0TP0EwZ16LNUTFpoBGivOA== - dependencies: - varint "^5.0.0" - -multicodec@^1.0.0: - version "1.0.4" - resolved "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz" - integrity sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg== - dependencies: - buffer "^5.6.0" - varint "^5.0.0" - -multihashes@^0.4.15, multihashes@~0.4.15: - version "0.4.21" - resolved "https://registry.npmjs.org/multihashes/-/multihashes-0.4.21.tgz" - integrity sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw== - dependencies: - buffer "^5.5.0" - multibase "^0.7.0" - varint "^5.0.0" - multimatch@5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/multimatch/-/multimatch-5.0.0.tgz" @@ -7968,11 +7281,6 @@ mylas@^2.1.9: resolved "https://registry.npmjs.org/mylas/-/mylas-2.1.13.tgz" integrity sha512-+MrqnJRtxdF+xngFfUUkIMQrUUL0KsxbADUkn23Z/4ibGg192Q+z+CQyiYwvWTsYjJygmMR8+w3ZDa98Zh6ESg== -nano-json-stream-parser@^0.1.2: - version "0.1.2" - resolved "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz" - integrity sha512-9MqxMH/BSJC7dnLsEMPyfN5Dvoo49IsPFYMcHw3Bcfc2kN0lpHRBSzlMSVx4HGyJ7s9B31CyBTVehWJoQ8Ctew== - nanoid@3.3.3: version "3.3.3" resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz" @@ -7988,7 +7296,7 @@ natural-compare@^1.4.0: resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -negotiator@0.6.3, negotiator@^0.6.3: +negotiator@^0.6.3: version "0.6.3" resolved "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz" integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== @@ -8123,11 +7431,6 @@ normalize-path@^3.0.0, normalize-path@~3.0.0: resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== -normalize-url@^6.0.1: - version "6.1.0" - resolved "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz" - integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== - npm-bundled@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.2.tgz" @@ -8341,16 +7644,6 @@ nyc@^15.1.0: test-exclude "^6.0.0" yargs "^15.0.2" -oauth-sign@~0.9.0: - version "0.9.0" - resolved "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz" - integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== - -object-assign@^4, object-assign@^4.1.0, object-assign@^4.1.1: - version "4.1.1" - resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz" - integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== - object-inspect@^1.9.0: version "1.12.3" resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz" @@ -8378,13 +7671,6 @@ oboe@2.1.5: dependencies: http-https "^1.0.0" -on-finished@2.4.1: - version "2.4.1" - resolved "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz" - integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== - dependencies: - ee-first "1.1.1" - once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" @@ -8469,16 +7755,6 @@ os-tmpdir@~1.0.2: resolved "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz" integrity sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g== -p-cancelable@^2.0.0: - version "2.1.1" - resolved "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz" - integrity sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg== - -p-cancelable@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/p-cancelable/-/p-cancelable-3.0.0.tgz" - integrity sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw== - p-finally@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz" @@ -8628,11 +7904,6 @@ parent-module@^1.0.0: dependencies: callsites "^3.0.0" -parse-headers@^2.0.0: - version "2.0.5" - resolved "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz" - integrity sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA== - parse-json@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz" @@ -8672,11 +7943,6 @@ parse5@^7.0.0, parse5@^7.1.1: dependencies: entities "^4.4.0" -parseurl@~1.3.3: - version "1.3.3" - resolved "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz" - integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== - path-exists@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz" @@ -8715,11 +7981,6 @@ path-scurry@^1.10.1, path-scurry@^1.6.1: lru-cache "^9.1.1 || ^10.0.0" minipass "^5.0.0 || ^6.0.2 || ^7.0.0" -path-to-regexp@0.1.7: - version "0.1.7" - resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz" - integrity sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ== - path-to-regexp@^1.7.0: version "1.8.0" resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz" @@ -8755,11 +8016,6 @@ pbkdf2@^3.0.17: safe-buffer "^5.0.1" sha.js "^2.4.8" -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz" - integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== - picocolors@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz" @@ -8905,20 +8161,12 @@ protocols@^2.0.0, protocols@^2.0.1: resolved "https://registry.npmjs.org/protocols/-/protocols-2.0.1.tgz" integrity sha512-/XJ368cyBJ7fzLMwLKv1e4vLxOju2MNAIokcr7meSaNcVbWz/CPcW22cP04mwxOErdA5mwjA8Q6w/cdAQxVn7Q== -proxy-addr@~2.0.7: - version "2.0.7" - resolved "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz" - integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg== - dependencies: - forwarded "0.2.0" - ipaddr.js "1.9.1" - proxy-from-env@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz" integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== -psl@^1.1.28, psl@^1.1.33: +psl@^1.1.33: version "1.9.0" resolved "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz" integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== @@ -8931,11 +8179,6 @@ pump@^3.0.0: end-of-stream "^1.1.0" once "^1.3.1" -punycode@2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz" - integrity sha512-Yxz2kRwT90aPiWEMHVYnEf4+rhwF1tBmmZ4KepCP+Wkium9JxtWnUm1nqGwpiAHr/tnTSeHqr3wb++jgSkXjhA== - punycode@^2.1.0, punycode@^2.1.1: version "2.3.0" resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz" @@ -8946,13 +8189,6 @@ pure-rand@^6.0.0: resolved "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.1.tgz" integrity sha512-t+x1zEHDjBwkDGY5v5ApnZ/utcd4XYDiJsaQQoptTXgUXX95sDg1elCdJghzicm7n2mbCBJ3uYWr6M22SO19rg== -qs@6.11.0: - version "6.11.0" - resolved "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz" - integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== - dependencies: - side-channel "^1.0.4" - qs@^6.9.4: version "6.11.1" resolved "https://registry.npmjs.org/qs/-/qs-6.11.1.tgz" @@ -8960,20 +8196,6 @@ qs@^6.9.4: dependencies: side-channel "^1.0.4" -qs@~6.5.2: - version "6.5.3" - resolved "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz" - integrity sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA== - -query-string@^5.0.1: - version "5.1.1" - resolved "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz" - integrity sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw== - dependencies: - decode-uri-component "^0.2.0" - object-assign "^4.1.0" - strict-uri-encode "^1.0.0" - querystringify@^2.1.1: version "2.2.0" resolved "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz" @@ -8994,11 +8216,6 @@ quick-lru@^4.0.1: resolved "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz" integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== -quick-lru@^5.1.1: - version "5.1.1" - resolved "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz" - integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== - randombytes@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz" @@ -9006,12 +8223,7 @@ randombytes@^2.1.0: dependencies: safe-buffer "^5.1.0" -range-parser@~1.2.1: - version "1.2.1" - resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz" - integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== - -raw-body@2.5.2, raw-body@^2.4.1: +raw-body@^2.4.1: version "2.5.2" resolved "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz" integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== @@ -9167,32 +8379,6 @@ release-zalgo@^1.0.0: dependencies: es6-error "^4.0.1" -request@^2.79.0: - version "2.88.2" - resolved "https://registry.npmjs.org/request/-/request-2.88.2.tgz" - integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.8.0" - caseless "~0.12.0" - combined-stream "~1.0.6" - extend "~3.0.2" - forever-agent "~0.6.1" - form-data "~2.3.2" - har-validator "~5.1.3" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.19" - oauth-sign "~0.9.0" - performance-now "^2.1.0" - qs "~6.5.2" - safe-buffer "^5.1.2" - tough-cookie "~2.5.0" - tunnel-agent "^0.6.0" - uuid "^3.3.2" - require-directory@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" @@ -9213,11 +8399,6 @@ requires-port@^1.0.0: resolved "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz" integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== -resolve-alpn@^1.0.0, resolve-alpn@^1.2.0: - version "1.2.1" - resolved "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz" - integrity sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g== - resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz" @@ -9256,13 +8437,6 @@ resolve@^1.10.0, resolve@^1.20.0: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -responselike@^2.0.0: - version "2.0.1" - resolved "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz" - integrity sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw== - dependencies: - lowercase-keys "^2.0.0" - restore-cursor@^3.1.0: version "3.1.0" resolved "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz" @@ -9368,7 +8542,7 @@ rxjs@^7.5.5: dependencies: tslib "^2.1.0" -safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -9378,7 +8552,7 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: +"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== @@ -9397,7 +8571,7 @@ scheduler@^0.23.0: dependencies: loose-envify "^1.1.0" -scrypt-js@3.0.1, scrypt-js@^3.0.0, scrypt-js@^3.0.1: +scrypt-js@3.0.1, scrypt-js@^3.0.0: version "3.0.1" resolved "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz" integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== @@ -9435,25 +8609,6 @@ semver@^7.0.0, semver@^7.1.1, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semve dependencies: lru-cache "^6.0.0" -send@0.18.0: - version "0.18.0" - resolved "https://registry.npmjs.org/send/-/send-0.18.0.tgz" - integrity sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg== - dependencies: - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - fresh "0.5.2" - http-errors "2.0.0" - mime "1.6.0" - ms "2.1.3" - on-finished "2.4.1" - range-parser "~1.2.1" - statuses "2.0.1" - serialize-javascript@6.0.0: version "6.0.0" resolved "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz" @@ -9461,27 +8616,6 @@ serialize-javascript@6.0.0: dependencies: randombytes "^2.1.0" -serve-static@1.15.0: - version "1.15.0" - resolved "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz" - integrity sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g== - dependencies: - encodeurl "~1.0.2" - escape-html "~1.0.3" - parseurl "~1.3.3" - send "0.18.0" - -servify@^0.1.12: - version "0.1.12" - resolved "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz" - integrity sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw== - dependencies: - body-parser "^1.16.0" - cors "^2.8.1" - express "^4.14.0" - request "^2.79.0" - xhr "^2.3.3" - set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz" @@ -9564,20 +8698,6 @@ sigstore@^1.3.0, sigstore@^1.4.0: "@sigstore/tuf" "^1.0.3" make-fetch-happen "^11.0.1" -simple-concat@^1.0.0: - version "1.0.1" - resolved "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz" - integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== - -simple-get@^2.7.0: - version "2.8.2" - resolved "https://registry.npmjs.org/simple-get/-/simple-get-2.8.2.tgz" - integrity sha512-Ijd/rV5o+mSBBs4F/x9oDPtTx9Zb6X9brmnXvMW4J7IR15ngi9q5xxqWBKU744jTZiaXtxaPL7uHG6vtN8kUkw== - dependencies: - decompress-response "^3.3.0" - once "^1.3.1" - simple-concat "^1.0.0" - sinon-chai@^3.7.0: version "3.7.0" resolved "https://registry.npmjs.org/sinon-chai/-/sinon-chai-3.7.0.tgz" @@ -9753,21 +8873,6 @@ sprintf-js@~1.0.2: resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== -sshpk@^1.7.0: - version "1.17.0" - resolved "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz" - integrity sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ== - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - bcrypt-pbkdf "^1.0.0" - dashdash "^1.12.0" - ecc-jsbn "~0.1.1" - getpass "^0.1.1" - jsbn "~0.1.0" - safer-buffer "^2.0.2" - tweetnacl "~0.14.0" - ssri@^10.0.0, ssri@^10.0.1: version "10.0.3" resolved "https://registry.npmjs.org/ssri/-/ssri-10.0.3.tgz" @@ -9801,11 +8906,6 @@ statuses@2.0.1: resolved "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== -strict-uri-encode@^1.0.0: - version "1.1.0" - resolved "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz" - integrity sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ== - string-argv@0.3.2: version "0.3.2" resolved "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz" @@ -9960,23 +9060,6 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -swarm-js@^0.1.40: - version "0.1.42" - resolved "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.42.tgz" - integrity sha512-BV7c/dVlA3R6ya1lMlSSNPLYrntt0LUq4YMgy3iwpCIc6rZnS5W2wUoctarZ5pXlpKtxDDf9hNziEkcfrxdhqQ== - dependencies: - bluebird "^3.5.0" - buffer "^5.0.5" - eth-lib "^0.1.26" - fs-extra "^4.0.2" - got "^11.8.5" - mime-types "^2.1.16" - mkdirp-promise "^5.0.1" - mock-fs "^4.1.0" - setimmediate "^1.0.5" - tar "^4.0.2" - xhr-request "^1.0.1" - symbol-tree@^3.2.4: version "3.2.4" resolved "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz" @@ -10013,19 +9096,6 @@ tar@6.1.11: mkdirp "^1.0.3" yallist "^4.0.0" -tar@^4.0.2: - version "4.4.19" - resolved "https://registry.npmjs.org/tar/-/tar-4.4.19.tgz" - integrity sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA== - dependencies: - chownr "^1.1.4" - fs-minipass "^1.2.7" - minipass "^2.9.0" - minizlib "^1.3.3" - mkdirp "^0.5.5" - safe-buffer "^5.2.1" - yallist "^3.1.1" - tar@^6.1.11, tar@^6.1.2: version "6.1.13" resolved "https://registry.npmjs.org/tar/-/tar-6.1.13.tgz" @@ -10075,11 +9145,6 @@ through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6: resolved "https://registry.npmjs.org/through/-/through-2.3.8.tgz" integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== -timed-out@^4.0.1: - version "4.0.1" - resolved "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz" - integrity sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA== - titleize@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/titleize/-/titleize-3.0.0.tgz#71c12eb7fdd2558aa8a44b0be83b8a76694acd53" @@ -10131,14 +9196,6 @@ tough-cookie@^4.1.2: universalify "^0.2.0" url-parse "^1.5.3" -tough-cookie@~2.5.0: - version "2.5.0" - resolved "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== - dependencies: - psl "^1.1.28" - punycode "^2.1.1" - tr46@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz" @@ -10244,23 +9301,11 @@ tuf-js@^1.1.7: debug "^4.3.4" make-fetch-happen "^11.1.1" -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz" - integrity sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w== - dependencies: - safe-buffer "^5.0.1" - tweetnacl-util@^0.15.1: version "0.15.1" resolved "https://registry.npmjs.org/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz" integrity sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw== -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz" - integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== - tweetnacl@^1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz" @@ -10325,14 +9370,6 @@ type-fest@^1.0.2: resolved "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz" integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA== -type-is@~1.6.18: - version "1.6.18" - resolved "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz" - integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== - dependencies: - media-typer "0.3.0" - mime-types "~2.1.24" - type@^1.0.1: version "1.2.0" resolved "https://registry.npmjs.org/type/-/type-1.2.0.tgz" @@ -10365,11 +9402,6 @@ uglify-js@^3.1.4: resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz" integrity sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g== -ultron@~1.1.0: - version "1.1.1" - resolved "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz" - integrity sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og== - undici-types@~5.26.4: version "5.26.5" resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz" @@ -10435,7 +9467,7 @@ unload@^2.4.1: resolved "https://registry.npmjs.org/unload/-/unload-2.4.1.tgz" integrity sha512-IViSAm8Z3sRBYA+9wc0fLQmU9Nrxb16rcDmIiR6Y9LJSZzI7QY5QsDhqPpKOjAn0O9/kfK1TfNEMMAGPTIraPw== -unpipe@1.0.0, unpipe@~1.0.0: +unpipe@1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== @@ -10473,11 +9505,6 @@ url-parse@^1.5.3: querystringify "^2.1.1" requires-port "^1.0.0" -url-set-query@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz" - integrity sha512-3AChu4NiXquPfeckE5R5cGdiHCMWJx1dwCWOmWIL4KHAziJNOFIYJlpGFeKDvwLPHovZRCxK3cYlwzqI9Vp+Gg== - utf-8-validate@^5.0.2: version "5.0.10" resolved "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz" @@ -10506,16 +9533,6 @@ util@^0.12.5: is-typed-array "^1.1.3" which-typed-array "^1.1.2" -utils-merge@1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz" - integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== - -uuid@^3.3.2: - version "3.4.0" - resolved "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz" - integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== - uuid@^8.3.2: version "8.3.2" resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz" @@ -10567,24 +9584,19 @@ validate-npm-package-name@^3.0.0: dependencies: builtins "^1.0.3" -varint@^5.0.0: - version "5.0.2" - resolved "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz" - integrity sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow== - -vary@^1, vary@~1.1.2: - version "1.1.2" - resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz" - integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== - -verror@1.10.0: - version "1.10.0" - resolved "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz" - integrity sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw== +viem@^2.9.19: + version "2.9.21" + resolved "https://registry.yarnpkg.com/viem/-/viem-2.9.21.tgz#a7dd3d4c827088e5336e5a6b35ec0283d2938595" + integrity sha512-8GtxPjPGpiN5cmr19zSX9mb1LX/eON3MPxxAd3QmyUFn69Rp566zlREOqE7zM35y5yX59fXwnz6O3X7e9+C9zg== dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" + "@adraffy/ens-normalize" "1.10.0" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@scure/bip32" "1.3.2" + "@scure/bip39" "1.2.1" + abitype "1.0.0" + isows "1.0.3" + ws "8.13.0" w3c-xmlserializer@^4.0.0: version "4.0.0" @@ -10607,15 +9619,6 @@ wcwidth@^1.0.0, wcwidth@^1.0.1: dependencies: defaults "^1.0.3" -web3-bzz@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.10.3.tgz" - integrity sha512-XDIRsTwekdBXtFytMpHBuun4cK4x0ZMIDXSoo1UVYp+oMyZj07c7gf7tNQY5qZ/sN+CJIas4ilhN25VJcjSijQ== - dependencies: - "@types/node" "^12.12.6" - got "12.1.0" - swarm-js "^0.1.40" - web3-core-helpers@1.10.3: version "1.10.3" resolved "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.10.3.tgz" @@ -10661,7 +9664,7 @@ web3-core-subscriptions@1.10.3: eventemitter3 "4.0.4" web3-core-helpers "1.10.3" -web3-core@1.10.3, web3-core@^1.10.3: +web3-core@^1.10.3: version "1.10.3" resolved "https://registry.npmjs.org/web3-core/-/web3-core-1.10.3.tgz" integrity sha512-Vbk0/vUNZxJlz3RFjAhNNt7qTpX8yE3dn3uFxfX5OHbuon5u65YEOd3civ/aQNW745N0vGUlHFNxxmn+sG9DIw== @@ -10674,57 +9677,80 @@ web3-core@1.10.3, web3-core@^1.10.3: web3-core-requestmanager "1.10.3" web3-utils "1.10.3" -web3-eth-abi@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.10.3.tgz" - integrity sha512-O8EvV67uhq0OiCMekqYsDtb6FzfYzMXT7VMHowF8HV6qLZXCGTdB/NH4nJrEh2mFtEwVdS6AmLFJAQd2kVyoMQ== - dependencies: - "@ethersproject/abi" "^5.6.3" - web3-utils "1.10.3" +web3-core@^4.3.0, web3-core@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-4.3.2.tgz#f24b11d6a57dee527de8d42c89de2a439f0c4bed" + integrity sha512-uIMVd/j4BgOnwfpY8ZT+QKubOyM4xohEhFZXz9xB8wimXWMMlYVlIK/TbfHqFolS9uOerdSGhsMbcK9lETae8g== + dependencies: + web3-errors "^1.1.4" + web3-eth-accounts "^4.1.0" + web3-eth-iban "^4.0.7" + web3-providers-http "^4.1.0" + web3-providers-ws "^4.0.7" + web3-types "^1.3.1" + web3-utils "^4.1.0" + web3-validator "^2.0.3" + optionalDependencies: + web3-providers-ipc "^4.0.7" -web3-eth-accounts@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.10.3.tgz" - integrity sha512-8MipGgwusDVgn7NwKOmpeo3gxzzd+SmwcWeBdpXknuyDiZSQy9tXe+E9LeFGrmys/8mLLYP79n3jSbiTyv+6pQ== +web3-errors@^1.1.3, web3-errors@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/web3-errors/-/web3-errors-1.1.4.tgz#5667a0a5f66fc936e101ef32032ccc1e8ca4d5a1" + integrity sha512-WahtszSqILez+83AxGecVroyZsMuuRT+KmQp4Si5P4Rnqbczno1k748PCrZTS1J4UCPmXMG2/Vt+0Bz2zwXkwQ== dependencies: - "@ethereumjs/common" "2.6.5" - "@ethereumjs/tx" "3.5.2" - "@ethereumjs/util" "^8.1.0" - eth-lib "0.2.8" - scrypt-js "^3.0.1" - uuid "^9.0.0" - web3-core "1.10.3" - web3-core-helpers "1.10.3" - web3-core-method "1.10.3" - web3-utils "1.10.3" + web3-types "^1.3.1" -web3-eth-contract@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.10.3.tgz" - integrity sha512-Y2CW61dCCyY4IoUMD4JsEQWrILX4FJWDWC/Txx/pr3K/+fGsBGvS9kWQN5EsVXOp4g7HoFOfVh9Lf7BmVVSRmg== +web3-eth-abi@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-4.2.1.tgz#b1260dace8380221f12f4274af240c1dfed1045c" + integrity sha512-IE91WUhhiDpBtbkl/DHUoZz7z7T5FXvl3zPLkrxT+dNlOT+wni+US/67jQCLvJRbqf9ApQ26lVYry0bovFgyqA== dependencies: - "@types/bn.js" "^5.1.1" - web3-core "1.10.3" - web3-core-helpers "1.10.3" - web3-core-method "1.10.3" - web3-core-promievent "1.10.3" - web3-core-subscriptions "1.10.3" - web3-eth-abi "1.10.3" - web3-utils "1.10.3" + abitype "0.7.1" + web3-errors "^1.1.4" + web3-types "^1.6.0" + web3-utils "^4.2.3" + web3-validator "^2.0.5" -web3-eth-ens@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.10.3.tgz" - integrity sha512-hR+odRDXGqKemw1GFniKBEXpjYwLgttTES+bc7BfTeoUyUZXbyDHe5ifC+h+vpzxh4oS0TnfcIoarK0Z9tFSiQ== +web3-eth-accounts@^4.1.0, web3-eth-accounts@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-4.1.2.tgz#652d6e3daf4d6cb3fe67cec6a878e768f6e8b8e8" + integrity sha512-y0JynDeTDnclyuE9mShXLeEj+BCrPHxPHOyPCgTchUBQsALF9+0OhP7WiS3IqUuu0Hle5bjG2f5ddeiPtNEuLg== dependencies: - content-hash "^2.5.2" - eth-ens-namehash "2.0.8" - web3-core "1.10.3" - web3-core-helpers "1.10.3" - web3-core-promievent "1.10.3" - web3-eth-abi "1.10.3" - web3-eth-contract "1.10.3" - web3-utils "1.10.3" + "@ethereumjs/rlp" "^4.0.1" + crc-32 "^1.2.2" + ethereum-cryptography "^2.0.0" + web3-errors "^1.1.4" + web3-types "^1.6.0" + web3-utils "^4.2.3" + web3-validator "^2.0.5" + +web3-eth-contract@^4.3.0, web3-eth-contract@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-4.4.0.tgz#21760ef39ab95b34c55e7eaee316e0632e56cd21" + integrity sha512-pZ/w6Lb6ZDUUs7f5GCKXiHDAGGvt2tdwiHkvgmQTRnq9b0MEsUpteDyPYspHxKzQWLgbeK37jPb8zbQe4kE/Hg== + dependencies: + web3-core "^4.3.2" + web3-errors "^1.1.4" + web3-eth "^4.6.0" + web3-eth-abi "^4.2.1" + web3-types "^1.6.0" + web3-utils "^4.2.3" + web3-validator "^2.0.5" + +web3-eth-ens@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/web3-eth-ens/-/web3-eth-ens-4.2.0.tgz#8734b034efd48a735f7052fef0205653a78b84cb" + integrity sha512-qYj34te2UctoObt8rlEIY/t2MuTMiMiiHhO2JAHRGqSLCQ7b8DM3RpvkiiSB0N0ZyEn+CetZqJCTYb8DNKBS/g== + dependencies: + "@adraffy/ens-normalize" "^1.8.8" + web3-core "^4.3.2" + web3-errors "^1.1.4" + web3-eth "^4.5.0" + web3-eth-contract "^4.3.0" + web3-net "^4.0.7" + web3-types "^1.5.0" + web3-utils "^4.2.2" + web3-validator "^2.0.5" web3-eth-iban@1.10.3: version "1.10.3" @@ -10734,44 +9760,54 @@ web3-eth-iban@1.10.3: bn.js "^5.2.1" web3-utils "1.10.3" -web3-eth-personal@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.10.3.tgz" - integrity sha512-avrQ6yWdADIvuNQcFZXmGLCEzulQa76hUOuVywN7O3cklB4nFc/Gp3yTvD3bOAaE7DhjLQfhUTCzXL7WMxVTsw== +web3-eth-iban@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-4.0.7.tgz#ee504f845d7b6315f0be78fcf070ccd5d38e4aaf" + integrity sha512-8weKLa9KuKRzibC87vNLdkinpUE30gn0IGY027F8doeJdcPUfsa4IlBgNC4k4HLBembBB2CTU0Kr/HAOqMeYVQ== dependencies: - "@types/node" "^12.12.6" - web3-core "1.10.3" - web3-core-helpers "1.10.3" - web3-core-method "1.10.3" - web3-net "1.10.3" - web3-utils "1.10.3" + web3-errors "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-validator "^2.0.3" -web3-eth@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-eth/-/web3-eth-1.10.3.tgz" - integrity sha512-Uk1U2qGiif2mIG8iKu23/EQJ2ksB1BQXy3wF3RvFuyxt8Ft9OEpmGlO7wOtAyJdoKzD5vcul19bJpPcWSAYZhA== +web3-eth-personal@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-4.0.8.tgz#b51628c560de550ca8b354fa784f9556aae6065c" + integrity sha512-sXeyLKJ7ddQdMxz1BZkAwImjqh7OmKxhXoBNF3isDmD4QDpMIwv/t237S3q4Z0sZQamPa/pHebJRWVuvP8jZdw== dependencies: - web3-core "1.10.3" - web3-core-helpers "1.10.3" - web3-core-method "1.10.3" - web3-core-subscriptions "1.10.3" - web3-eth-abi "1.10.3" - web3-eth-accounts "1.10.3" - web3-eth-contract "1.10.3" - web3-eth-ens "1.10.3" - web3-eth-iban "1.10.3" - web3-eth-personal "1.10.3" - web3-net "1.10.3" - web3-utils "1.10.3" + web3-core "^4.3.0" + web3-eth "^4.3.1" + web3-rpc-methods "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-validator "^2.0.3" -web3-net@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-net/-/web3-net-1.10.3.tgz" - integrity sha512-IoSr33235qVoI1vtKssPUigJU9Fc/Ph0T9CgRi15sx+itysmvtlmXMNoyd6Xrgm9LuM4CIhxz7yDzH93B79IFg== +web3-eth@^4.3.1, web3-eth@^4.5.0, web3-eth@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/web3-eth/-/web3-eth-4.6.0.tgz#75c177e2bde88a613a6996fab515f104e16921da" + integrity sha512-8KtxlGsomovoFULqEpfixgmCpaJ2YIJGxbXUfezh2coXHjVgEopQhARYtKGClyV5kkdCIqwHS8Gvsm6TVNqH6Q== dependencies: - web3-core "1.10.3" - web3-core-method "1.10.3" - web3-utils "1.10.3" + setimmediate "^1.0.5" + web3-core "^4.3.2" + web3-errors "^1.1.4" + web3-eth-abi "^4.2.1" + web3-eth-accounts "^4.1.2" + web3-net "^4.0.7" + web3-providers-ws "^4.0.7" + web3-rpc-methods "^1.2.0" + web3-types "^1.6.0" + web3-utils "^4.2.3" + web3-validator "^2.0.5" + +web3-net@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/web3-net/-/web3-net-4.0.7.tgz#ed2c1bd700cf94be93a6dbd8bd8aa413d8681942" + integrity sha512-SzEaXFrBjY25iQGk5myaOfO9ZyfTwQEa4l4Ps4HDNVMibgZji3WPzpjq8zomVHMwi8bRp6VV7YS71eEsX7zLow== + dependencies: + web3-core "^4.3.0" + web3-rpc-methods "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" web3-providers-http@1.10.3: version "1.10.3" @@ -10783,6 +9819,16 @@ web3-providers-http@1.10.3: es6-promise "^4.2.8" web3-core-helpers "1.10.3" +web3-providers-http@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-4.1.0.tgz#8d7afda67d1d8542ca85b30f60a3d1fe1993b561" + integrity sha512-6qRUGAhJfVQM41E5t+re5IHYmb5hSaLc02BE2MaRQsz2xKA6RjmHpOA5h/+ojJxEpI9NI2CrfDKOAgtJfoUJQg== + dependencies: + cross-fetch "^4.0.0" + web3-errors "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-providers-ipc@1.10.3: version "1.10.3" resolved "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.10.3.tgz" @@ -10791,6 +9837,15 @@ web3-providers-ipc@1.10.3: oboe "2.1.5" web3-core-helpers "1.10.3" +web3-providers-ipc@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-4.0.7.tgz#9ec4c8565053af005a5170ba80cddeb40ff3e3d3" + integrity sha512-YbNqY4zUvIaK2MHr1lQFE53/8t/ejHtJchrWn9zVbFMGXlTsOAbNoIoZWROrg1v+hCBvT2c9z8xt7e/+uz5p1g== + dependencies: + web3-errors "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-providers-ws@1.10.3: version "1.10.3" resolved "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.10.3.tgz" @@ -10800,17 +9855,33 @@ web3-providers-ws@1.10.3: web3-core-helpers "1.10.3" websocket "^1.0.32" -web3-shh@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-shh/-/web3-shh-1.10.3.tgz" - integrity sha512-cAZ60CPvs9azdwMSQ/PSUdyV4PEtaW5edAZhu3rCXf6XxQRliBboic+AvwUvB6j3eswY50VGa5FygfVmJ1JVng== +web3-providers-ws@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-4.0.7.tgz#7a78a0dcf077e0e802da524fbb37d080b356c14b" + integrity sha512-n4Dal9/rQWjS7d6LjyEPM2R458V8blRm0eLJupDEJOOIBhGYlxw5/4FthZZ/cqB7y/sLVi7K09DdYx2MeRtU5w== dependencies: - web3-core "1.10.3" - web3-core-method "1.10.3" - web3-core-subscriptions "1.10.3" - web3-net "1.10.3" + "@types/ws" "8.5.3" + isomorphic-ws "^5.0.0" + web3-errors "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + ws "^8.8.1" -web3-utils@1.10.3, web3-utils@^1.10.3: +web3-rpc-methods@^1.1.3, web3-rpc-methods@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/web3-rpc-methods/-/web3-rpc-methods-1.2.0.tgz#761dcb036ab16edb2b03e80c11e3f5df24690345" + integrity sha512-CWJ/g4I4WyYvLkf21wCZAehdhU/VjX/OAPHnqF5/FPDJlogOsOnGXHqi1Z5AP+ocdt395PNubd8jyMMJoYGSBA== + dependencies: + web3-core "^4.3.2" + web3-types "^1.5.0" + web3-validator "^2.0.4" + +web3-types@^1.3.0, web3-types@^1.3.1, web3-types@^1.5.0, web3-types@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-types/-/web3-types-1.6.0.tgz#ebe7f140c31f7cc0ad15f238ad7e7ac72797ff3b" + integrity sha512-qgOtADqlD5hw+KPKBUGaXAcdNLL0oh6qTeVgXwewCfbL/lG9R+/GrgMQB1gbTJ3cit8hMwtH8KX2Em6OwO0HRw== + +web3-utils@1.10.3: version "1.10.3" resolved "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.3.tgz" integrity sha512-OqcUrEE16fDBbGoQtZXWdavsPzbGIDc5v3VrRTZ0XrIpefC/viZ1ZU9bGEemazyS0catk/3rkOOxpzTfY+XsyQ== @@ -10824,18 +9895,49 @@ web3-utils@1.10.3, web3-utils@^1.10.3: randombytes "^2.1.0" utf8 "3.0.0" -web3@^1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3/-/web3-1.10.3.tgz" - integrity sha512-DgUdOOqC/gTqW+VQl1EdPxrVRPB66xVNtuZ5KD4adVBtko87hkgM8BTZ0lZ8IbUfnQk6DyjcDujMiH3oszllAw== - dependencies: - web3-bzz "1.10.3" - web3-core "1.10.3" - web3-eth "1.10.3" - web3-eth-personal "1.10.3" - web3-net "1.10.3" - web3-shh "1.10.3" - web3-utils "1.10.3" +web3-utils@^4.0.7, web3-utils@^4.1.0, web3-utils@^4.2.2, web3-utils@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-4.2.3.tgz#e1d30c4b087cd95f4307baeb80e3160f174e1cfd" + integrity sha512-m5plKTC2YtQntHITQRyIePw52UVP1IrShhmA2FACtn4zmc5ADmrXOlQWiPzxFP/18eRJsAaUAw2+CQn1u4WPxQ== + dependencies: + ethereum-cryptography "^2.0.0" + eventemitter3 "^5.0.1" + web3-errors "^1.1.4" + web3-types "^1.6.0" + web3-validator "^2.0.5" + +web3-validator@^2.0.3, web3-validator@^2.0.4, web3-validator@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/web3-validator/-/web3-validator-2.0.5.tgz#de1984bdb34f292251b86400dba7169700db0849" + integrity sha512-2gLOSW8XqEN5pw5jVUm20EB7A8SbQiekpAtiI0JBmCIV0a2rp97v8FgWY5E3UEqnw5WFfEqvcDVW92EyynDTyQ== + dependencies: + ethereum-cryptography "^2.0.0" + util "^0.12.5" + web3-errors "^1.1.4" + web3-types "^1.5.0" + zod "^3.21.4" + +web3@^4.7.0: + version "4.8.0" + resolved "https://registry.yarnpkg.com/web3/-/web3-4.8.0.tgz#c7c7d2a7616ae387f8b2e3a3e416153a4bff479a" + integrity sha512-kQSF2NlHk8yjS3SRiJW3S+U5ibkEmVRhB4/GYsVwGvdAkFC2b+EIE1Ob7J56OmqW9VBZgkx1+SuWqo5JTIJSYQ== + dependencies: + web3-core "^4.3.2" + web3-errors "^1.1.4" + web3-eth "^4.6.0" + web3-eth-abi "^4.2.1" + web3-eth-accounts "^4.1.2" + web3-eth-contract "^4.4.0" + web3-eth-ens "^4.2.0" + web3-eth-iban "^4.0.7" + web3-eth-personal "^4.0.8" + web3-net "^4.0.7" + web3-providers-http "^4.1.0" + web3-providers-ws "^4.0.7" + web3-rpc-methods "^1.2.0" + web3-types "^1.6.0" + web3-utils "^4.2.3" + web3-validator "^2.0.5" webidl-conversions@^3.0.0: version "3.0.1" @@ -11042,20 +10144,16 @@ ws@7.4.6: resolved "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz" integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== +ws@8.13.0: + version "8.13.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" + integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== + ws@8.5.0: version "8.5.0" resolved "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz" integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== -ws@^3.0.0: - version "3.3.3" - resolved "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz" - integrity sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA== - dependencies: - async-limiter "~1.0.0" - safe-buffer "~5.1.0" - ultron "~1.1.0" - ws@^7.4.6: version "7.5.9" resolved "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz" @@ -11066,41 +10164,16 @@ ws@^8.11.0, ws@^8.5.0: resolved "https://registry.yarnpkg.com/ws/-/ws-8.14.2.tgz#6c249a806eb2db7a20d26d51e7709eab7b2e6c7f" integrity sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g== +ws@^8.8.1: + version "8.16.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.16.0.tgz#d1cd774f36fbc07165066a60e40323eab6446fd4" + integrity sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ== + ws@~8.11.0: version "8.11.0" resolved "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz" integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg== -xhr-request-promise@^0.1.2: - version "0.1.3" - resolved "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz" - integrity sha512-YUBytBsuwgitWtdRzXDDkWAXzhdGB8bYm0sSzMPZT7Z2MBjMSTHFsyCT1yCRATY+XC69DUrQraRAEgcoCRaIPg== - dependencies: - xhr-request "^1.1.0" - -xhr-request@^1.0.1, xhr-request@^1.1.0: - version "1.1.0" - resolved "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz" - integrity sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA== - dependencies: - buffer-to-arraybuffer "^0.0.5" - object-assign "^4.1.1" - query-string "^5.0.1" - simple-get "^2.7.0" - timed-out "^4.0.1" - url-set-query "^1.0.0" - xhr "^2.0.4" - -xhr@^2.0.4, xhr@^2.3.3: - version "2.6.0" - resolved "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz" - integrity sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA== - dependencies: - global "~4.4.0" - is-function "^1.0.1" - parse-headers "^2.0.0" - xtend "^4.0.0" - xml-name-validator@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz" @@ -11116,7 +10189,7 @@ xmlhttprequest-ssl@~2.0.0: resolved "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz" integrity sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A== -xtend@^4.0.0, xtend@~4.0.1: +xtend@~4.0.1: version "4.0.2" resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== @@ -11136,7 +10209,7 @@ yaeti@^0.0.6: resolved "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz" integrity sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug== -yallist@^3.0.0, yallist@^3.0.2, yallist@^3.1.1: +yallist@^3.0.2: version "3.1.1" resolved "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== @@ -11241,3 +10314,8 @@ zksync-web3@^0.14.3: version "0.14.3" resolved "https://registry.npmjs.org/zksync-web3/-/zksync-web3-0.14.3.tgz" integrity sha512-hT72th4AnqyLW1d5Jlv8N2B/qhEnl2NePK2A3org7tAa24niem/UAaHMkEvmWI3SF9waYUPtqAtjpf+yvQ9zvQ== + +zod@^3.21.4: + version "3.22.4" + resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.4.tgz#f31c3a9386f61b1f228af56faa9255e845cf3fff" + integrity sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg== From 18592e78fc6aeaf3727a6bbfd005bca1a07f209c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 18 Apr 2024 12:36:25 +0200 Subject: [PATCH 016/112] Fix issues --- .../protocol-kit/src/adapters/BaseContract.ts | 3 +- .../ethers/contracts/BaseContractEthers.ts | 12 +-- ...bilityFallbackHandlerBaseContractEthers.ts | 8 +- ...tyFallbackHandlerContract_v1_3_0_Ethers.ts | 8 +- ...tyFallbackHandlerContract_v1_4_1_Ethers.ts | 8 +- .../CreateCallBaseContractEthers.ts | 4 +- .../MultiSend/MultiSendBaseContractEthers.ts | 8 +- .../MultiSendCallOnlyBaseContractEthers.ts | 8 +- .../v1.1.1/MultiSendContract_v1_1_1_Ethers.ts | 6 +- ...MultiSendCallOnlyContract_v1_3_0_Ethers.ts | 8 +- .../v1.3.0/MultiSendContract_v1_3_0_Ethers.ts | 2 +- ...MultiSendCallOnlyContract_v1_4_1_Ethers.ts | 8 +- .../v1.4.1/MultiSendContract_v1_4_1_Ethers.ts | 8 +- .../contracts/Safe/SafeBaseContractEthers.ts | 8 +- .../Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts | 8 +- .../Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts | 8 +- .../Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts | 8 +- .../Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts | 8 +- .../Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts | 8 +- .../SafeProxyFactoryBaseContractEthers.ts | 8 +- .../SafeProxyFactoryContract_v1_0_0_Ethers.ts | 8 +- .../SafeProxyFactoryContract_v1_1_1_Ethers.ts | 8 +- .../SafeProxyFactoryContract_v1_3_0_Ethers.ts | 8 +- .../SafeProxyFactoryContract_v1_4_1_Ethers.ts | 7 +- .../SignMessageLibBaseContractEthers.ts | 8 +- .../SignMessageLibContract_v1_3_0_Ethers.ts | 16 ++-- .../SignMessageLibContract_v1_4_1_Ethers.ts | 11 +-- .../SimulateTxAccessorBaseContractEthers.ts | 8 +- ...imulateTxAccessorContract_v1_3_0_Ethers.ts | 8 +- ...imulateTxAccessorContract_v1_4_1_Ethers.ts | 8 +- .../web3/contracts/BaseContractWeb3.ts | 84 ------------------- ...tibilityFallbackHandlerBaseContractWeb3.ts | 62 -------------- ...lityFallbackHandlerContract_v1_3_0_Web3.ts | 51 ----------- ...lityFallbackHandlerContract_v1_4_1_Web3.ts | 51 ----------- .../SignMessageLibContract_v1_3_0_Web3.ts | 77 ----------------- .../SignMessageLibContract_v1_4_1_Web3.ts | 77 ----------------- .../protocol-kit/src/safeFactory/index.ts | 4 +- 37 files changed, 116 insertions(+), 527 deletions(-) delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/BaseContractWeb3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractWeb3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Web3.ts delete mode 100644 packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Web3.ts diff --git a/packages/protocol-kit/src/adapters/BaseContract.ts b/packages/protocol-kit/src/adapters/BaseContract.ts index 0767683d8..f57656aa0 100644 --- a/packages/protocol-kit/src/adapters/BaseContract.ts +++ b/packages/protocol-kit/src/adapters/BaseContract.ts @@ -1,5 +1,6 @@ import { contractName, getContractDeployment } from '@safe-global/protocol-kit/contracts/config' import { SafeVersion } from '@safe-global/safe-core-sdk-types' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' /** * Abstract class BaseContract serves as a base for creating a contract for a specific adapter (Ethers.js, Web3.js, or viem.js) @@ -21,7 +22,7 @@ abstract class BaseContract { abstract safeVersion: SafeVersion abstract contract: unknown // This needs to be implemented for each adapter. - abstract adapter: unknown // This needs to be implemented for each adapter. + abstract safeProvider: SafeProvider // This needs to be implemented for each adapter. /** * Constructs a new BaseContract instance. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/BaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/BaseContractEthers.ts index 50963d29f..a26f947fa 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/BaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/BaseContractEthers.ts @@ -3,7 +3,7 @@ import { Contract, ContractRunner, InterfaceAbi } from 'ethers' import { contractName } from '@safe-global/protocol-kit/contracts/config' import BaseContract from '@safe-global/protocol-kit/adapters/BaseContract' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { EncodeFunction, EstimateGasFunction, @@ -32,7 +32,7 @@ abstract class BaseContractEthers< ContractAbiType extends InterfaceAbi & Abi > extends BaseContract { contract: Contract - adapter: EthersAdapter + safeProvider: SafeProvider /** * @constructor @@ -40,7 +40,7 @@ abstract class BaseContractEthers< * * @param contractName - The contract name. * @param chainId - The chain ID of the contract. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param defaultAbi - The default ABI for the contract. It should be compatible with the specific version of the contract. * @param safeVersion - The version of the Safe contract. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. @@ -49,7 +49,7 @@ abstract class BaseContractEthers< constructor( contractName: contractName, chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, defaultAbi: ContractAbiType, safeVersion: SafeVersion, customContractAddress?: string, @@ -58,11 +58,11 @@ abstract class BaseContractEthers< ) { super(contractName, chainId, defaultAbi, safeVersion, customContractAddress, customContractAbi) - this.adapter = ethersAdapter + this.safeProvider = safeProvider this.contract = new Contract( this.contractAddress, this.contractAbi, - runner || this.adapter.getSigner() + runner || this.safeProvider.getSigner() ) } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts index 8dab8970f..890072ffe 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts @@ -1,7 +1,7 @@ import { Abi } from 'abitype' import { ContractRunner, InterfaceAbi } from 'ethers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import BaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContractEthers' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import { contractName } from '@safe-global/protocol-kit/contracts/config' @@ -29,7 +29,7 @@ abstract class CompatibilityFallbackHandlerBaseContractEthers< * Constructs an instance of CompatibilityFallbackHandlerBaseContractEthers. * * @param chainId - The chain ID of the contract. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param defaultAbi - The default ABI for the CompatibilityFallbackHandler contract. It should be compatible with the specific version of the contract. * @param safeVersion - The version of the Safe contract. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. @@ -37,7 +37,7 @@ abstract class CompatibilityFallbackHandlerBaseContractEthers< */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, defaultAbi: CompatibilityFallbackHandlerContractAbiType, safeVersion: SafeVersion, customContractAddress?: string, @@ -49,7 +49,7 @@ abstract class CompatibilityFallbackHandlerBaseContractEthers< super( contractName, chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, customContractAddress, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers.ts index e44ea6764..e53f12f09 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers.ts @@ -1,5 +1,5 @@ import CompatibilityFallbackHandlerBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion, CompatibilityFallbackHandlerContract_v1_3_0_Abi, @@ -25,20 +25,20 @@ class CompatibilityFallbackHandlerContract_v1_3_0_Ethers * Constructs an instance of CompatibilityFallbackHandlerContract_v1_3_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the CompatibilityFallbackHandler deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAddress?: string, customContractAbi?: CompatibilityFallbackHandlerContract_v1_3_0_Abi ) { const safeVersion = '1.3.0' const defaultAbi = compatibilityFallbackHandler_1_3_0_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers.ts index 9c224ad1d..2b3b9c017 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers.ts @@ -1,5 +1,5 @@ import CompatibilityFallbackHandlerBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { compatibilityFallbackHandler_1_4_1_ContractArtifacts, CompatibilityFallbackHandlerContract_v1_4_1_Abi, @@ -25,20 +25,20 @@ class CompatibilityFallbackHandlerContract_v1_4_1_Ethers * Constructs an instance of CompatibilityFallbackHandlerContract_v1_4_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the CompatibilityFallbackHandler deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAddress?: string, customContractAbi?: CompatibilityFallbackHandlerContract_v1_4_1_Abi ) { const safeVersion = '1.4.1' const defaultAbi = compatibilityFallbackHandler_1_4_1_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts index 93e3c0176..5bd546c2c 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts @@ -1,7 +1,7 @@ import { Abi } from 'abitype' import { ContractRunner, InterfaceAbi } from 'ethers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import BaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContractEthers' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import { contractName } from '@safe-global/protocol-kit/contracts/config' @@ -49,7 +49,7 @@ abstract class CreateCallBaseContractEthers< super( contractName, chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, customContractAddress, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts index a03e1a621..85116286c 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts @@ -1,7 +1,7 @@ import { Abi } from 'abitype' import { InterfaceAbi } from 'ethers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import BaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContractEthers' import { contractName } from '@safe-global/protocol-kit/contracts/config' @@ -29,7 +29,7 @@ abstract class MultiSendBaseContractEthers< * Constructs an instance of MultiSendBaseContractEthers. * * @param chainId - The chain ID of the contract. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param defaultAbi - The default ABI for the MultiSend contract. It should be compatible with the specific version of the MultiSend contract. * @param safeVersion - The version of the MultiSend contract. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSend deployments based on the chainId and safeVersion. @@ -37,7 +37,7 @@ abstract class MultiSendBaseContractEthers< */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, defaultAbi: MultiSendContractAbiType, safeVersion: SafeVersion, customContractAddress?: string, @@ -48,7 +48,7 @@ abstract class MultiSendBaseContractEthers< super( contractName, chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, customContractAddress, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts index af007b4ad..18287e8e2 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts @@ -1,7 +1,7 @@ import { Abi } from 'abitype' import { InterfaceAbi } from 'ethers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import BaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContractEthers' import { contractName } from '@safe-global/protocol-kit/contracts/config' @@ -29,7 +29,7 @@ abstract class MultiSendCallOnlyBaseContractEthers< * Constructs an instance of MultiSendCallOnlyBaseContractEthers. * * @param chainId - The chain ID of the contract. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param defaultAbi - The default ABI for the MultiSendCallOnly contract. It should be compatible with the specific version of the MultiSendCallOnly contract. * @param safeVersion - The version of the MultiSendCallOnly contract. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSendCallOnly deployments based on the chainId and safeVersion. @@ -37,7 +37,7 @@ abstract class MultiSendCallOnlyBaseContractEthers< */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, defaultAbi: MultiSendCallOnlyContractAbiType, safeVersion: SafeVersion, customContractAddress?: string, @@ -48,7 +48,7 @@ abstract class MultiSendCallOnlyBaseContractEthers< super( contractName, chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, customContractAddress, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers.ts index f2f69df0b..3f18eb789 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers.ts @@ -1,5 +1,5 @@ import MultiSendBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion, multisend_1_1_1_ContractArtifacts, @@ -31,14 +31,14 @@ class MultiSendContract_v1_1_1_Ethers */ constructor( chainId: bigint, - signer: AbstractSigner, + safeProvider: SafeProvider, customContractAddress?: string, customContractAbi?: MultiSendContract_v1_1_1_Abi ) { const safeVersion = '1.1.1' const defaultAbi = multisend_1_1_1_ContractArtifacts.abi - super(chainId, signer, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers.ts index 912e8b9b0..8731b467f 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers.ts @@ -1,5 +1,5 @@ import MultiSendCallOnlyBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion, MultiSendCallOnlyContract_v1_3_0_Abi, @@ -25,20 +25,20 @@ class MultiSendCallOnlyContract_v1_3_0_Ethers * Constructs an instance of MultiSendCallOnlyContract_v1_3_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSendCallOnly deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAddress?: string, customContractAbi?: MultiSendCallOnlyContract_v1_3_0_Abi ) { const safeVersion = '1.3.0' const defaultAbi = multiSendCallOnly_1_3_0_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts index aef96a319..c45cc6858 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts @@ -1,5 +1,5 @@ import MultiSendBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion, multisend_1_3_0_ContractArtifacts, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers.ts index 6f5d93f02..14b26e2c3 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers.ts @@ -1,5 +1,5 @@ import MultiSendCallOnlyBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion, multiSendCallOnly_1_4_1_ContractArtifacts, @@ -25,20 +25,20 @@ class MultiSendCallOnlyContract_v1_4_1_Ethers * Constructs an instance of MultiSendCallOnlyContract_v1_4_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSendCallOnly deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAddress?: string, customContractAbi?: MultiSendCallOnlyContract_v1_4_1_Abi ) { const safeVersion = '1.4.1' const defaultAbi = multiSendCallOnly_1_4_1_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers.ts index ba5bbdab6..f37c262b9 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers.ts @@ -1,5 +1,5 @@ import MultiSendBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion, MultiSendContract_v1_4_1_Abi, @@ -25,20 +25,20 @@ class MultiSendContract_v1_4_1_Ethers * Constructs an instance of MultiSendContract_v1_4_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the MultiSend deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAddress?: string, customContractAbi?: MultiSendContract_v1_4_1_Abi ) { const safeVersion = '1.4.1' const defaultAbi = multisend_1_4_1_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts index 02ac88eb9..a36b3df0a 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts @@ -1,7 +1,7 @@ import { Abi } from 'abitype' import { InterfaceAbi } from 'ethers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import BaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContractEthers' import { contractName, safeDeploymentsL1ChainIds } from '@safe-global/protocol-kit/contracts/config' @@ -32,7 +32,7 @@ abstract class SafeBaseContractEthers< * Constructs an instance of SafeBaseContractEthers. * * @param chainId - The chain ID of the contract. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param defaultAbi - The default ABI for the Safe contract. It should be compatible with the specific version of the Safe contract. * @param safeVersion - The version of the Safe contract. * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. @@ -41,7 +41,7 @@ abstract class SafeBaseContractEthers< */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, defaultAbi: SafeContractAbiType, safeVersion: SafeVersion, isL1SafeSingleton = false, @@ -54,7 +54,7 @@ abstract class SafeBaseContractEthers< super( contractName, chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, customContractAddress, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts index bb6652443..aeb0a9ec5 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts @@ -1,5 +1,5 @@ import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' import { sameString } from '@safe-global/protocol-kit/utils' import { @@ -31,14 +31,14 @@ class SafeContract_v1_0_0_Ethers * Constructs an instance of SafeContract_v1_0_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.0.0 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, isL1SafeSingleton = false, customContractAddress?: string, customContractAbi?: SafeContract_v1_0_0_Abi @@ -48,7 +48,7 @@ class SafeContract_v1_0_0_Ethers super( chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, isL1SafeSingleton, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts index 3668a760c..981f5b48c 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts @@ -1,5 +1,5 @@ import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' import { sameString } from '@safe-global/protocol-kit/utils' import { @@ -31,14 +31,14 @@ class SafeContract_v1_1_1_Ethers * Constructs an instance of SafeContract_v1_1_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.1.1 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, isL1SafeSingleton = false, customContractAddress?: string, customContractAbi?: SafeContract_v1_1_1_Abi @@ -48,7 +48,7 @@ class SafeContract_v1_1_1_Ethers super( chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, isL1SafeSingleton, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts index ff4fd7f9e..646daee79 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts @@ -1,5 +1,5 @@ import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' import { SafeVersion, @@ -30,14 +30,14 @@ class SafeContract_v1_2_0_Ethers * Constructs an instance of SafeContract_v1_2_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.2.0 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, isL1SafeSingleton = false, customContractAddress?: string, customContractAbi?: SafeContract_v1_2_0_Abi @@ -47,7 +47,7 @@ class SafeContract_v1_2_0_Ethers super( chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, isL1SafeSingleton, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts index 959892cdf..7062e25e8 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts @@ -1,5 +1,5 @@ import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/adapters/ethers/utils/constants' import { @@ -30,14 +30,14 @@ class SafeContract_v1_3_0_Ethers * Constructs an instance of SafeContract_v1_3_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, isL1SafeSingleton = false, customContractAddress?: string, customContractAbi?: SafeContract_v1_3_0_Abi @@ -47,7 +47,7 @@ class SafeContract_v1_3_0_Ethers super( chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, isL1SafeSingleton, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts index 38b7a21a8..75b08ff37 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts @@ -1,5 +1,5 @@ import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/adapters/ethers/utils/constants' import { @@ -31,14 +31,14 @@ class SafeContract_v1_4_1_Ethers * Constructs an instance of SafeContract_v1_4_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, isL1SafeSingleton = false, customContractAddress?: string, customContractAbi?: SafeContract_v1_4_1_Abi @@ -48,7 +48,7 @@ class SafeContract_v1_4_1_Ethers super( chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, isL1SafeSingleton, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts index d2538b20c..4fd669288 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts @@ -1,6 +1,6 @@ import { Abi } from 'abitype' import { ContractRunner, InterfaceAbi } from 'ethers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import BaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContractEthers' import { SafeVersion, @@ -39,7 +39,7 @@ abstract class SafeProxyFactoryBaseContractEthers< * Constructs an instance of SafeProxyFactoryBaseContractEthers. * * @param chainId - The chain ID of the contract. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param defaultAbi - The default ABI for the Safe contract. It should be compatible with the specific version of the contract. * @param safeVersion - The version of the Safe contract. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. @@ -47,7 +47,7 @@ abstract class SafeProxyFactoryBaseContractEthers< */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, defaultAbi: SafeProxyFactoryContractAbiType, safeVersion: SafeVersion, customContractAddress?: string, @@ -59,7 +59,7 @@ abstract class SafeProxyFactoryBaseContractEthers< super( contractName, chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, customContractAddress, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts index 7b3ba97cd..beeb03b98 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts @@ -2,7 +2,7 @@ import { ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers, { CreateProxyProps } from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion, SafeProxyFactoryContract_v1_0_0_Abi, @@ -29,13 +29,13 @@ class SafeProxyFactoryContract_v1_0_0_Ethers * Constructs an instance of SafeProxyFactoryContract_v1_0_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.0.0 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAddress?: string, customContractAbi?: SafeProxyFactoryContract_v1_0_0_Abi, runner?: ContractRunner | null @@ -45,7 +45,7 @@ class SafeProxyFactoryContract_v1_0_0_Ethers super( chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, customContractAddress, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts index f466f8d0c..b6eb4626a 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts @@ -2,7 +2,7 @@ import { ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers, { CreateProxyProps } from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion, SafeProxyFactoryContract_v1_1_1_Abi, @@ -29,13 +29,13 @@ class SafeProxyFactoryContract_v1_1_1_Ethers * Constructs an instance of SafeProxyFactoryContract_v1_1_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.1.1 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAddress?: string, customContractAbi?: SafeProxyFactoryContract_v1_1_1_Abi, runner?: ContractRunner | null @@ -45,7 +45,7 @@ class SafeProxyFactoryContract_v1_1_1_Ethers super( chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, customContractAddress, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts index 84b1650da..4802391cc 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts @@ -2,7 +2,7 @@ import { ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers, { CreateProxyProps } from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion, SafeProxyFactoryContract_v1_3_0_Abi, @@ -29,13 +29,13 @@ class SafeProxyFactoryContract_v1_3_0_Ethers * Constructs an instance of SafeProxyFactoryContract_v1_3_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAddress?: string, customContractAbi?: SafeProxyFactoryContract_v1_3_0_Abi, runner?: ContractRunner | null @@ -45,7 +45,7 @@ class SafeProxyFactoryContract_v1_3_0_Ethers super( chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, customContractAddress, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts index 32edc278f..88055b5a8 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts @@ -2,7 +2,6 @@ import { ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers, { CreateProxyProps } from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' import { SafeVersion, SafeProxyFactoryContract_v1_4_1_Abi, @@ -29,13 +28,13 @@ class SafeProxyFactoryContract_v1_4_1_Ethers * Constructs an instance of SafeProxyFactoryContract_v1_4_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAddress?: string, customContractAbi?: SafeProxyFactoryContract_v1_4_1_Abi, runner?: ContractRunner | null @@ -45,7 +44,7 @@ class SafeProxyFactoryContract_v1_4_1_Ethers super( chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, customContractAddress, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts index 5c17e91da..ddef94104 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts @@ -1,7 +1,7 @@ import { Abi } from 'abitype' import { InterfaceAbi } from 'ethers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import BaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContractEthers' import { contractName } from '@safe-global/protocol-kit/contracts/config' @@ -29,7 +29,7 @@ abstract class SignMessageLibBaseContractEthers< * Constructs an instance of SignMessageLibBaseContractEthers. * * @param chainId - The chain ID of the contract. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param defaultAbi - The default ABI for the SignMessageLib contract. It should be compatible with the specific version of the SignMessageLib contract. * @param safeVersion - The version of the SignMessageLib contract. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SignMessageLib deployments based on the chainId and safeVersion. @@ -37,7 +37,7 @@ abstract class SignMessageLibBaseContractEthers< */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, defaultAbi: SignMessageLibContractAbiType, safeVersion: SafeVersion, customContractAddress?: string, @@ -48,7 +48,7 @@ abstract class SignMessageLibBaseContractEthers< super( contractName, chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, customContractAddress, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts index a5cb6fe90..c930c3fc2 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts @@ -1,6 +1,6 @@ import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' import SignMessageLibBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion, AdapterSpecificContractFunction, @@ -8,10 +8,7 @@ import { SignMessageLibContract_v1_3_0_Contract, SignMessageLibContract_v1_3_0_Function, signMessageLib_1_3_0_ContractArtifacts, - EthersTransactionOptions, - EncodeFunction, - EstimateGasFunction, - GetAddressFunction + EthersTransactionOptions } from '@safe-global/safe-core-sdk-types' /** @@ -32,26 +29,23 @@ class SignMessageLibContract_v1_3_0_Ethers * Constructs an instance of SignMessageLibContract_v1_3_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SignMessageLib deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAddress?: string, customContractAbi?: SignMessageLibContract_v1_3_0_Abi ) { const safeVersion = '1.3.0' const defaultAbi = signMessageLib_1_3_0_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } - encode: EncodeFunction - getAddress: GetAddressFunction - estimateGas: EstimateGasFunction /** * @param args - Array[message] diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts index 1d6f48086..aabeaae2a 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts @@ -1,15 +1,15 @@ import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' import SignMessageLibBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion, + AdapterSpecificContractFunction, SignMessageLibContract_v1_4_1_Abi, SignMessageLibContract_v1_4_1_Contract, SignMessageLibContract_v1_4_1_Function, signMessageLib_1_4_1_ContractArtifacts, - EthersTransactionOptions, - EncodeFunction, + EthersTransactionOptions } from '@safe-global/safe-core-sdk-types' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' /** * SignMessageLibContract_v1_4_1_Ethers is the implementation specific to the SignMessageLib contract version 1.4.1. @@ -29,7 +29,7 @@ class SignMessageLibContract_v1_4_1_Ethers * Constructs an instance of SignMessageLibContract_v1_4_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SignMessageLib deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. */ @@ -46,9 +46,6 @@ class SignMessageLibContract_v1_4_1_Ethers this.safeVersion = safeVersion } - encode: EncodeFunction - getAddress: GetAddressFunction - estimateGas: EstimateGasFunction /** * @param args - Array[message] diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts index 63ab75f51..cdeb1643c 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts @@ -2,7 +2,7 @@ import { Abi } from 'abitype' import { ContractRunner, InterfaceAbi } from 'ethers' import BaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import { contractName } from '@safe-global/protocol-kit/contracts/config' @@ -29,7 +29,7 @@ abstract class SimulateTxAccessorBaseContractEthers< * Constructs an instance of SimulateTxAccessorBaseContractEthers. * * @param chainId - The chain ID of the contract. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param defaultAbi - The default ABI for the SimulateTxAccessor contract. It should be compatible with the specific version of the contract. * @param safeVersion - The version of the Safe contract. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. @@ -37,7 +37,7 @@ abstract class SimulateTxAccessorBaseContractEthers< */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, defaultAbi: SimulateTxAccessorContractAbiType, safeVersion: SafeVersion, customContractAddress?: string, @@ -49,7 +49,7 @@ abstract class SimulateTxAccessorBaseContractEthers< super( contractName, chainId, - ethersAdapter, + safeProvider, defaultAbi, safeVersion, customContractAddress, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts index db78db111..9c38263dd 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts @@ -1,5 +1,5 @@ import SimulateTxAccessorBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion, simulateTxAccessor_1_3_0_ContractArtifacts, @@ -26,20 +26,20 @@ class SimulateTxAccessorContract_v1_3_0_Ethers * Constructs an instance of SimulateTxAccessorContract_v1_3_0_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SimulateTxAccessor deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAddress?: string, customContractAbi?: SimulateTxAccessorContract_v1_3_0_Abi ) { const safeVersion = '1.3.0' const defaultAbi = simulateTxAccessor_1_3_0_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts index 7746a78f1..b171a0491 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts @@ -1,5 +1,5 @@ import SimulateTxAccessorBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers' -import EthersAdapter from '@safe-global/protocol-kit/adapters/ethers/EthersAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion, simulateTxAccessor_1_4_1_ContractArtifacts, @@ -25,20 +25,20 @@ class SimulateTxAccessorContract_v1_4_1_Ethers * Constructs an instance of SimulateTxAccessorContract_v1_4_1_Ethers * * @param chainId - The chain ID where the contract resides. - * @param ethersAdapter - An instance of EthersAdapter. + * @param safeProvider - An instance of SafeProvider. * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SimulateTxAccessor deployments based on the chainId and safeVersion. * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. */ constructor( chainId: bigint, - ethersAdapter: EthersAdapter, + safeProvider: SafeProvider, customContractAddress?: string, customContractAbi?: SimulateTxAccessorContract_v1_4_1_Abi ) { const safeVersion = '1.4.1' const defaultAbi = simulateTxAccessor_1_4_1_ContractArtifacts.abi - super(chainId, ethersAdapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/web3/contracts/BaseContractWeb3.ts b/packages/protocol-kit/src/adapters/web3/contracts/BaseContractWeb3.ts deleted file mode 100644 index 516b8c5de..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/BaseContractWeb3.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { Abi } from 'abitype' -import Contract from 'web3-eth-contract' -import { AbiItem } from 'web3-utils' - -import { contractName } from '@safe-global/protocol-kit/contracts/config' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { - EncodeFunction, - EstimateGasFunction, - GetAddressFunction, - SafeVersion, - Web3TransactionOptions -} from '@safe-global/safe-core-sdk-types' -import BaseContract from '@safe-global/protocol-kit/adapters/BaseContract' - -/** - * Abstract class BaseContractWeb3 extends BaseContract to specifically integrate with the Web3.js library. - * It is designed to be instantiated for different contracts. - * - * This abstract class sets up the Web3 Contract object that interacts with the smart contract. - * - * Subclasses of BaseContractWeb3 are expected to represent specific contracts. - * - * @template ContractAbiType - The ABI type specific to the version of the contract, extending InterfaceAbi from Web3. - * @extends BaseContract - Extends the generic BaseContract with Web3-specific implementation. - * - * Example subclasses: - * - SafeBaseContractWeb3 extends BaseContractWeb3 - * - CreateCallBaseContractWeb3 extends BaseContractWeb3 - * - SafeProxyFactoryBaseContractWeb3 extends BaseContractWeb3 - */ -abstract class BaseContractWeb3< - ContractAbiType extends AbiItem[] & Abi -> extends BaseContract { - contract: Contract - adapter: Web3Adapter - - /** - * @constructor - * Constructs an instance of BaseContractWeb3. - * - * @param contractName - The contract name. - * @param chainId - The chain ID of the contract. - * @param web3Adapter - An instance of Web3Adapter. - * @param defaultAbi - The default ABI for the contract. It should be compatible with the specific version of the contract. - * @param safeVersion - The version of the Safe contract. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the ABI is derived from the Safe deployments or the defaultAbi is used. - */ - constructor( - contractName: contractName, - chainId: bigint, - web3Adapter: Web3Adapter, - defaultAbi: ContractAbiType, - safeVersion: SafeVersion, - customContractAddress?: string, - customContractAbi?: ContractAbiType - ) { - super(contractName, chainId, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.adapter = web3Adapter - this.contract = web3Adapter.getContract(this.contractAddress, this.contractAbi) - } - - getAddress: GetAddressFunction = () => { - return Promise.resolve(this.contract.options.address) - } - - encode: EncodeFunction = (functionToEncode, args) => { - return this.contract.methods[functionToEncode](...(args as Array<[]>)).encodeABI() - } - - estimateGas: EstimateGasFunction = ( - functionToEstimate, - args, - options = {} - ) => { - return this.contract.methods[functionToEstimate](...(args as Array<[]>)) - .estimateGas(options) - .then(BigInt) - } -} - -export default BaseContractWeb3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractWeb3.ts b/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractWeb3.ts deleted file mode 100644 index b65623ffc..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractWeb3.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { Abi } from 'abitype' -import { AbiItem } from 'web3-utils' - -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import BaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/BaseContractWeb3' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import { contractName } from '@safe-global/protocol-kit/contracts/config' - -/** - * Abstract class CompatibilityFallbackHandlerBaseContractWeb3 extends BaseContractWeb3 to specifically integrate with the CompatibilityFallbackHandler contract. - * It is designed to be instantiated for different versions of the Safe contract. - * - * Subclasses of CompatibilityFallbackHandlerBaseContractWeb3 are expected to represent specific versions of the contract. - * - * @template CompatibilityFallbackHandlerContractAbiType - The ABI type specific to the version of the CompatibilityFallbackHandler contract, extending InterfaceAbi from Web3. - * @extends BaseContractWeb3 - Extends the generic BaseContractWeb3. - * - * Example subclasses: - * - CompatibilityFallbackHandlerContract_v1_4_1_Web3 extends CompatibilityFallbackHandlerBaseContractWeb3 - * - CompatibilityFallbackHandlerContract_v1_3_0_Web3 extends CompatibilityFallbackHandlerBaseContractWeb3 - */ -abstract class CompatibilityFallbackHandlerBaseContractWeb3< - CompatibilityFallbackHandlerContractAbiType extends AbiItem[] & Abi -> extends BaseContractWeb3 { - contractName: contractName - - /** - * @constructor - * Constructs an instance of CompatibilityFallbackHandlerBaseContractWeb3. - * - * @param chainId - The chain ID of the contract. - * @param web3Adapter - An instance of Web3Adapter. - * @param defaultAbi - The default ABI for the CompatibilityFallbackHandler contract. It should be compatible with the specific version of the contract. - * @param safeVersion - The version of the Safe contract. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the ABI is derived from the Safe deployments or the defaultAbi is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - defaultAbi: CompatibilityFallbackHandlerContractAbiType, - safeVersion: SafeVersion, - customContractAddress?: string, - customContractAbi?: CompatibilityFallbackHandlerContractAbiType - ) { - const contractName = 'compatibilityFallbackHandler' - - super( - contractName, - chainId, - web3Adapter, - defaultAbi, - safeVersion, - customContractAddress, - customContractAbi - ) - - this.contractName = contractName - } -} - -export default CompatibilityFallbackHandlerBaseContractWeb3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Web3.ts deleted file mode 100644 index 202b8b06e..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Web3.ts +++ /dev/null @@ -1,51 +0,0 @@ -import CompatibilityFallbackHandlerBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractWeb3' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { - DeepWriteable, - SafeVersion, - CompatibilityFallbackHandlerContract_v1_3_0_Abi, - CompatibilityFallbackHandlerContract_v1_3_0_Contract, - compatibilityFallbackHandler_1_3_0_ContractArtifacts -} from '@safe-global/safe-core-sdk-types' - -/** - * CompatibilityFallbackHandlerContract_v1_3_0_Web3 is the implementation specific to the CompatibilityFallbackHandler contract version 1.3.0. - * - * This class specializes in handling interactions with the CompatibilityFallbackHandler contract version 1.3.0 using Web3.js. - * - * @extends CompatibilityFallbackHandlerBaseContractWeb3 - Inherits from CompatibilityFallbackHandlerBaseContractWeb3 with ABI specific to CompatibilityFallbackHandler contract version 1.3.0. - * @implements CompatibilityFallbackHandlerContract_v1_3_0_Contract - Implements the interface specific to CompatibilityFallbackHandler contract version 1.3.0. - */ -class CompatibilityFallbackHandlerContract_v1_3_0_Web3 - extends CompatibilityFallbackHandlerBaseContractWeb3< - DeepWriteable - > - implements CompatibilityFallbackHandlerContract_v1_3_0_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of CompatibilityFallbackHandlerContract_v1_3_0_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the CompatibilityFallbackHandler deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: DeepWriteable - ) { - const safeVersion = '1.3.0' - const defaultAbi = - compatibilityFallbackHandler_1_3_0_ContractArtifacts.abi as DeepWriteable - - super(chainId, web3Adapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.safeVersion = safeVersion - } -} - -export default CompatibilityFallbackHandlerContract_v1_3_0_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Web3.ts deleted file mode 100644 index 67636ab87..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Web3.ts +++ /dev/null @@ -1,51 +0,0 @@ -import CompatibilityFallbackHandlerBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractWeb3' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { - DeepWriteable, - SafeVersion, - CompatibilityFallbackHandlerContract_v1_4_1_Abi, - CompatibilityFallbackHandlerContract_v1_4_1_Contract, - compatibilityFallbackHandler_1_4_1_ContractArtifacts -} from '@safe-global/safe-core-sdk-types' - -/** - * CompatibilityFallbackHandlerContract_v1_4_1_Web3 is the implementation specific to the CompatibilityFallbackHandler contract version 1.4.1. - * - * This class specializes in handling interactions with the CompatibilityFallbackHandler contract version 1.4.1 using Web3.js. - * - * @extends CompatibilityFallbackHandlerBaseContractWeb3 - Inherits from CompatibilityFallbackHandlerBaseContractWeb3 with ABI specific to CompatibilityFallbackHandler contract version 1.4.1. - * @implements CompatibilityFallbackHandlerContract_v1_4_1_Contract - Implements the interface specific to CompatibilityFallbackHandler contract version 1.4.1. - */ -class CompatibilityFallbackHandlerContract_v1_4_1_Web3 - extends CompatibilityFallbackHandlerBaseContractWeb3< - DeepWriteable - > - implements CompatibilityFallbackHandlerContract_v1_4_1_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of CompatibilityFallbackHandlerContract_v1_4_1_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the CompatibilityFallbackHandler deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: DeepWriteable - ) { - const safeVersion = '1.4.1' - const defaultAbi = - compatibilityFallbackHandler_1_4_1_ContractArtifacts.abi as DeepWriteable - - super(chainId, web3Adapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.safeVersion = safeVersion - } -} - -export default CompatibilityFallbackHandlerContract_v1_4_1_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Web3.ts deleted file mode 100644 index 4af50966f..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Web3.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { toTxResult } from '@safe-global/protocol-kit/adapters/web3/utils' -import SignMessageLibBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/SignMessageLib/SignMessageLibBaseContractWeb3' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { - DeepWriteable, - AdapterSpecificContractFunction, - SafeVersion, - SignMessageLibContract_v1_3_0_Abi, - SignMessageLibContract_v1_3_0_Contract, - SignMessageLibContract_v1_3_0_Function, - Web3TransactionOptions, - signMessageLib_1_3_0_ContractArtifacts -} from '@safe-global/safe-core-sdk-types' - -/** - * SignMessageLibContract_v1_3_0_Web3 is the implementation specific to the SignMessageLib contract version 1.3.0. - * - * This class specializes in handling interactions with the SignMessageLib contract version 1.3.0 using Web3.js v6. - * - * @extends SignMessageLibBaseContractWeb3 - Inherits from SignMessageLibBaseContractWeb3 with ABI specific to SignMessageLib contract version 1.3.0. - * @implements SignMessageLibContract_v1_3_0_Contract - Implements the interface specific to SignMessageLib contract version 1.3.0. - */ -class SignMessageLibContract_v1_3_0_Web3 - extends SignMessageLibBaseContractWeb3> - implements SignMessageLibContract_v1_3_0_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SignMessageLibContract_v1_3_0_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SignMessageLib deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: DeepWriteable - ) { - const safeVersion = '1.3.0' - const defaultAbi = - signMessageLib_1_3_0_ContractArtifacts.abi as DeepWriteable - - super(chainId, web3Adapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.safeVersion = safeVersion - } - - /** - * @param args - Array[message] - */ - getMessageHash: SignMessageLibContract_v1_3_0_Function<'getMessageHash'> = async (args) => { - return [await this.contract.methods.getMessageHash(...args).call()] - } - - /** - * @param args - Array[data] - */ - signMessage: AdapterSpecificContractFunction< - SignMessageLibContract_v1_3_0_Abi, - 'signMessage', - Web3TransactionOptions - > = async (data, options) => { - if (options && !options.gas) { - options.gas = Number(await this.estimateGas('signMessage', data, { ...options })) - } - - const txResponse = this.contract.methods.signMessage(data).send(options) - - return toTxResult(txResponse, options) - } -} - -export default SignMessageLibContract_v1_3_0_Web3 diff --git a/packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Web3.ts b/packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Web3.ts deleted file mode 100644 index 92ece8403..000000000 --- a/packages/protocol-kit/src/adapters/web3/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Web3.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { toTxResult } from '@safe-global/protocol-kit/adapters/web3/utils' -import SignMessageLibBaseContractWeb3 from '@safe-global/protocol-kit/adapters/web3/contracts/SignMessageLib/SignMessageLibBaseContractWeb3' -import Web3Adapter from '@safe-global/protocol-kit/adapters/web3/Web3Adapter' -import { - DeepWriteable, - SafeVersion, - AdapterSpecificContractFunction, - SignMessageLibContract_v1_4_1_Abi, - SignMessageLibContract_v1_4_1_Contract, - SignMessageLibContract_v1_4_1_Function, - Web3TransactionOptions, - signMessageLib_1_4_1_ContractArtifacts -} from '@safe-global/safe-core-sdk-types' - -/** - * SignMessageLibContract_v1_4_1_Web3 is the implementation specific to the SignMessageLib contract version 1.4.1. - * - * This class specializes in handling interactions with the SignMessageLib contract version 1.4.1 using Web3.js v6. - * - * @extends SignMessageLibBaseContractWeb3 - Inherits from SignMessageLibBaseContractWeb3 with ABI specific to SignMessageLib contract version 1.4.1. - * @implements SignMessageLibContract_v1_4_1_Contract - Implements the interface specific to SignMessageLib contract version 1.4.1. - */ -class SignMessageLibContract_v1_4_1_Web3 - extends SignMessageLibBaseContractWeb3> - implements SignMessageLibContract_v1_4_1_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SignMessageLibContract_v1_4_1_Web3 - * - * @param chainId - The chain ID where the contract resides. - * @param web3Adapter - An instance of Web3Adapter. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the SignMessageLib deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.4.1 is used. - */ - constructor( - chainId: bigint, - web3Adapter: Web3Adapter, - customContractAddress?: string, - customContractAbi?: DeepWriteable - ) { - const safeVersion = '1.4.1' - const defaultAbi = - signMessageLib_1_4_1_ContractArtifacts.abi as DeepWriteable - - super(chainId, web3Adapter, defaultAbi, safeVersion, customContractAddress, customContractAbi) - - this.safeVersion = safeVersion - } - - /** - * @param args - Array[message] - */ - getMessageHash: SignMessageLibContract_v1_4_1_Function<'getMessageHash'> = async (args) => { - return [await this.contract.methods.getMessageHash(...args).call()] - } - - /** - * @param args - Array[data] - */ - signMessage: AdapterSpecificContractFunction< - SignMessageLibContract_v1_4_1_Abi, - 'signMessage', - Web3TransactionOptions - > = async (data, options) => { - if (options && !options.gas) { - options.gas = Number(await this.estimateGas('signMessage', data, { ...options })) - } - - const txResponse = this.contract.methods.signMessage(data).send(options) - - return toTxResult(txResponse, options) - } -} - -export default SignMessageLibContract_v1_4_1_Web3 diff --git a/packages/protocol-kit/src/safeFactory/index.ts b/packages/protocol-kit/src/safeFactory/index.ts index b35db5ee3..0da00a772 100644 --- a/packages/protocol-kit/src/safeFactory/index.ts +++ b/packages/protocol-kit/src/safeFactory/index.ts @@ -29,7 +29,7 @@ export interface DeploySafeProps { } export interface SafeFactoryConfig { - /** safeProvider - Ethereum adapter */ + /** provider - Ethereum EIP-1193 compatible provider */ provider: Eip1193Provider signerAddress?: string privateKeyOrMnemonic?: string @@ -42,7 +42,7 @@ export interface SafeFactoryConfig { } interface SafeFactoryInitConfig { - /** safeProvider - Ethereum adapter */ + /** provider - Ethereum EIP-1193 compatible provider */ provider: Eip1193Provider signerAddress?: string privateKeyOrMnemonic?: string From 39b4bcc30a0b9a911b25897c5505a92fea32451b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 18 Apr 2024 12:41:21 +0200 Subject: [PATCH 017/112] Fix issues --- packages/protocol-kit/src/adapters/ethers/SafeProvider.ts | 5 ++--- .../contracts/CreateCall/CreateCallBaseContractEthers.ts | 2 +- .../CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts | 6 +++--- .../CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts | 5 ++--- .../MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts | 4 ++-- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts b/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts index 49507211f..558d7b464 100644 --- a/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts +++ b/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts @@ -11,8 +11,7 @@ import { EIP712TypedDataMessage, EIP712TypedDataTx, Eip3770Address, - SafeEIP712Args, - Eip1193Provider + SafeEIP712Args } from '@safe-global/safe-core-sdk-types' import { getCompatibilityFallbackHandlerContractInstance, @@ -25,7 +24,7 @@ import { getSimulateTxAccessorContractInstance } from './contracts/contractInstancesEthers' import { isTypedDataSigner } from './utils' -import { SafeProviderTransaction, GetContractProps } from '../ethAdapter' +import { SafeProviderTransaction, GetContractProps, Eip1193Provider } from '../ethAdapter' export interface SafeProviderConfig { /** signerOrProvider - Ethers signer or provider */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts index 5bd546c2c..4d4028545 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts @@ -37,7 +37,7 @@ abstract class CreateCallBaseContractEthers< */ constructor( chainId: bigint, - signer: AbstractSigner, + safeProvider: SafeProvider, defaultAbi: CreateCallContractAbiType, safeVersion: SafeVersion, customContractAddress?: string, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts index 44ee45e83..7613bda83 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts @@ -8,7 +8,7 @@ import { EthersTransactionOptions } from '@safe-global/safe-core-sdk-types' import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' -import { AbstractSigner } from 'ethers' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' /** * CreateCallContract_v1_3_0_Ethers is the implementation specific to the CreateCall contract version 1.3.0. @@ -34,14 +34,14 @@ class CreateCallContract_v1_3_0_Ethers */ constructor( chainId: bigint, - signer: AbstractSigner, + safeProvider: SafeProvider, customContractAddress?: string, customContractAbi?: CreateCallContract_v1_3_0_Abi ) { const safeVersion = '1.3.0' const defaultAbi = createCall_1_3_0_ContractArtifacts.abi - super(chainId, signer, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts index b6585700e..a0c91d682 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts @@ -9,7 +9,6 @@ import { EthersTransactionOptions } from '@safe-global/safe-core-sdk-types' import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' -import { AbstractSigner } from 'ethers' /** * CreateCallContract_v1_4_1_Ethers is the implementation specific to the CreateCall contract version 1.4.1. @@ -35,14 +34,14 @@ class CreateCallContract_v1_4_1_Ethers */ constructor( chainId: bigint, - signer: AbstractSigner, + safeProvider: SafeProvider, customContractAddress?: string, customContractAbi?: CreateCallContract_v1_4_1_Abi ) { const safeVersion = '1.4.1' const defaultAbi = createCall_1_4_1_ContractArtifacts.abi - super(chainId, signer, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts index c45cc6858..94f479733 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts @@ -31,14 +31,14 @@ class MultiSendContract_v1_3_0_Ethers */ constructor( chainId: bigint, - signer: AbstractSigner, + safeProvider: SafeProvider, customContractAddress?: string, customContractAbi?: MultiSendContract_v1_3_0_Abi ) { const safeVersion = '1.3.0' const defaultAbi = multisend_1_3_0_ContractArtifacts.abi - super(chainId, signer, defaultAbi, safeVersion, customContractAddress, customContractAbi) + super(chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi) this.safeVersion = safeVersion } From b839dc543730f683aeafae748335a6f5c281aa20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 18 Apr 2024 13:29:43 +0200 Subject: [PATCH 018/112] Fix issues --- packages/protocol-kit/src/Safe.ts | 6 +- .../protocol-kit/src/adapters/ethAdapter.ts | 2 +- .../ethers/contracts/BaseContractEthers.ts | 9 +- .../SafeProxyFactoryContract_v1_4_1_Ethers.ts | 1 + .../contracts/contractInstancesEthers.ts | 129 ++++++++++++------ .../src/managers/contractManager.ts | 2 +- .../src/utils/signatures/utils.ts | 6 +- 7 files changed, 103 insertions(+), 52 deletions(-) diff --git a/packages/protocol-kit/src/Safe.ts b/packages/protocol-kit/src/Safe.ts index fdc06a159..4ba8fd771 100644 --- a/packages/protocol-kit/src/Safe.ts +++ b/packages/protocol-kit/src/Safe.ts @@ -13,7 +13,6 @@ import { Transaction, EIP712TypedData, SafeTransactionData, - Eip1193Provider CompatibilityFallbackHandlerContractType } from '@safe-global/safe-core-sdk-types' import { @@ -71,6 +70,7 @@ import { import SafeMessage from './utils/messages/SafeMessage' import semverSatisfies from 'semver/functions/satisfies' import { SafeProvider } from './adapters/ethers' +import { Eip1193Provider } from './adapters/ethAdapter' const EQ_OR_GT_1_4_1 = '>=1.4.1' const EQ_OR_GT_1_3_0 = '>=1.3.0' @@ -78,7 +78,7 @@ const EQ_OR_GT_1_3_0 = '>=1.3.0' class Safe { #predictedSafe?: PredictedSafeProps #provider!: Eip1193Provider - #safeProvider!: ISafeProvider + #safeProvider!: SafeProvider #contractManager!: ContractManager #ownerManager!: OwnerManager #moduleManager!: ModuleManager @@ -252,7 +252,7 @@ class Safe { * * @returns The current SafeProvider */ - getSafeProvider(): ISafeProvider { + getSafeProvider(): SafeProvider { return this.#safeProvider } diff --git a/packages/protocol-kit/src/adapters/ethAdapter.ts b/packages/protocol-kit/src/adapters/ethAdapter.ts index 56adb4906..92f0b3313 100644 --- a/packages/protocol-kit/src/adapters/ethAdapter.ts +++ b/packages/protocol-kit/src/adapters/ethAdapter.ts @@ -1,5 +1,5 @@ import { JsonFragment } from 'ethers' -import { Eip3770Address, SafeEIP712Args, SafeVersion } from '@safe-global/safe-core-sdk-types/types' +import { Eip3770Address, SafeEIP712Args, SafeVersion } from '@safe-global/safe-core-sdk-types' import { CompatibilityFallbackHandlerContractImplementationType, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/BaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/BaseContractEthers.ts index a26f947fa..d969d88fa 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/BaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/BaseContractEthers.ts @@ -31,8 +31,9 @@ import { abstract class BaseContractEthers< ContractAbiType extends InterfaceAbi & Abi > extends BaseContract { - contract: Contract + contract!: Contract safeProvider: SafeProvider + runner?: ContractRunner | null /** * @constructor @@ -58,11 +59,15 @@ abstract class BaseContractEthers< ) { super(contractName, chainId, defaultAbi, safeVersion, customContractAddress, customContractAbi) + this.runner = runner this.safeProvider = safeProvider + } + + async init() { this.contract = new Contract( this.contractAddress, this.contractAbi, - runner || this.safeProvider.getSigner() + this.runner || (await this.safeProvider.getSigner()) ) } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts index 88055b5a8..321ae9b4e 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts @@ -9,6 +9,7 @@ import { SafeProxyFactoryContract_v1_4_1_Function, safeProxyFactory_1_4_1_ContractArtifacts } from '@safe-global/safe-core-sdk-types' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' /** * SafeProxyFactoryContract_v1_4_1_Ethers is the implementation specific to the Safe Proxy Factory contract version 1.4.1. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts index ddb8ef55d..f455c28fa 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts @@ -63,56 +63,61 @@ export async function getSafeContractInstance( | SafeContract_v1_0_0_Ethers > { const chainId = await safeProvider.getChainId() + let safeContractInstance switch (safeVersion) { case '1.4.1': - return new SafeContract_v1_4_1_Ethers( + safeContractInstance = new SafeContract_v1_4_1_Ethers( chainId, safeProvider, isL1SafeSingleton, contractAddress, customContractAbi as DeepWriteable ) - + break case '1.3.0': - return new SafeContract_v1_3_0_Ethers( + safeContractInstance = new SafeContract_v1_3_0_Ethers( chainId, safeProvider, isL1SafeSingleton, contractAddress, customContractAbi as DeepWriteable ) - + break case '1.2.0': - return new SafeContract_v1_2_0_Ethers( + safeContractInstance = new SafeContract_v1_2_0_Ethers( chainId, safeProvider, isL1SafeSingleton, contractAddress, customContractAbi as DeepWriteable ) - + break case '1.1.1': - return new SafeContract_v1_1_1_Ethers( + safeContractInstance = new SafeContract_v1_1_1_Ethers( chainId, safeProvider, isL1SafeSingleton, contractAddress, customContractAbi as DeepWriteable ) - + break case '1.0.0': - return new SafeContract_v1_0_0_Ethers( + safeContractInstance = new SafeContract_v1_0_0_Ethers( chainId, safeProvider, isL1SafeSingleton, contractAddress, customContractAbi as DeepWriteable ) - + break default: throw new Error('Invalid Safe version') } + + await safeContractInstance.init() + + return safeContractInstance } export async function getCompatibilityFallbackHandlerContractInstance( @@ -125,28 +130,34 @@ export async function getCompatibilityFallbackHandlerContractInstance( | CompatibilityFallbackHandlerContract_v1_3_0_Ethers > { const chainId = await safeProvider.getChainId() + let compatibilityFallbackHandlerInstance + switch (safeVersion) { case '1.4.1': - return new CompatibilityFallbackHandlerContract_v1_4_1_Ethers( + compatibilityFallbackHandlerInstance = new CompatibilityFallbackHandlerContract_v1_4_1_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable ) - + break case '1.3.0': case '1.2.0': case '1.1.1': - return new CompatibilityFallbackHandlerContract_v1_3_0_Ethers( + compatibilityFallbackHandlerInstance = new CompatibilityFallbackHandlerContract_v1_3_0_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable ) - + break default: throw new Error('Invalid Safe version') } + + await compatibilityFallbackHandlerInstance.init() + + return compatibilityFallbackHandlerInstance } export async function getMultiSendContractInstance( @@ -160,37 +171,42 @@ export async function getMultiSendContractInstance( | MultiSendContract_v1_1_1_Ethers > { const chainId = await safeProvider.getChainId() + let multiSendContractInstance switch (safeVersion) { case '1.4.1': - return new MultiSendContract_v1_4_1_Ethers( + multiSendContractInstance = new MultiSendContract_v1_4_1_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable ) - + break case '1.3.0': - return new MultiSendContract_v1_3_0_Ethers( + multiSendContractInstance = new MultiSendContract_v1_3_0_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable ) - + break case '1.2.0': case '1.1.1': case '1.0.0': - return new MultiSendContract_v1_1_1_Ethers( + multiSendContractInstance = new MultiSendContract_v1_1_1_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable ) - + break default: throw new Error('Invalid Safe version') } + + await multiSendContractInstance.init() + + return multiSendContractInstance } export async function getMultiSendCallOnlyContractInstance( @@ -200,28 +216,35 @@ export async function getMultiSendCallOnlyContractInstance( customContractAbi?: JsonFragment | JsonFragment[] | undefined ): Promise { const chainId = await safeProvider.getChainId() + let multiSendCallOnlyContractInstance + switch (safeVersion) { case '1.4.1': - return new MultiSendCallOnlyContract_v1_4_1_Ethers( + multiSendCallOnlyContractInstance = new MultiSendCallOnlyContract_v1_4_1_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable ) - + break case '1.3.0': case '1.2.0': case '1.1.1': case '1.0.0': - return new MultiSendCallOnlyContract_v1_3_0_Ethers( + multiSendCallOnlyContractInstance = new MultiSendCallOnlyContract_v1_3_0_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable ) + break default: throw new Error('Invalid Safe version') } + + await multiSendCallOnlyContractInstance.init() + + return multiSendCallOnlyContractInstance } export async function getSafeProxyFactoryContractInstance( @@ -238,47 +261,53 @@ export async function getSafeProxyFactoryContractInstance( | SafeProxyFactoryContract_v1_0_0_Ethers > { const chainId = await safeProvider.getChainId() + let safeProxyFactoryContractInstance + switch (safeVersion) { case '1.4.1': - return new SafeProxyFactoryContract_v1_4_1_Ethers( + safeProxyFactoryContractInstance = new SafeProxyFactoryContract_v1_4_1_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable, signerOrProvider ) - + break case '1.3.0': - return new SafeProxyFactoryContract_v1_3_0_Ethers( + safeProxyFactoryContractInstance = new SafeProxyFactoryContract_v1_3_0_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable, signerOrProvider ) - + break case '1.2.0': case '1.1.1': - return new SafeProxyFactoryContract_v1_1_1_Ethers( + safeProxyFactoryContractInstance = new SafeProxyFactoryContract_v1_1_1_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable, signerOrProvider ) - + break case '1.0.0': - return new SafeProxyFactoryContract_v1_0_0_Ethers( + safeProxyFactoryContractInstance = new SafeProxyFactoryContract_v1_0_0_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable, signerOrProvider ) - + break default: throw new Error('Invalid Safe version') } + + await safeProxyFactoryContractInstance.init() + + return safeProxyFactoryContractInstance } export async function getSignMessageLibContractInstance( @@ -288,27 +317,32 @@ export async function getSignMessageLibContractInstance( customContractAbi?: JsonFragment | JsonFragment[] | undefined ): Promise { const chainId = await safeProvider.getChainId() + let signMessageLibContractInstance switch (safeVersion) { case '1.4.1': - return new SignMessageLibContract_v1_4_1_Ethers( + signMessageLibContractInstance = new SignMessageLibContract_v1_4_1_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable ) - + break case '1.3.0': - return new SignMessageLibContract_v1_3_0_Ethers( + signMessageLibContractInstance = new SignMessageLibContract_v1_3_0_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable ) - + break default: throw new Error('Invalid Safe version') } + + await signMessageLibContractInstance.init() + + return signMessageLibContractInstance } export async function getCreateCallContractInstance( @@ -318,30 +352,35 @@ export async function getCreateCallContractInstance( customContractAbi?: JsonFragment | JsonFragment[] | undefined ): Promise { const chainId = await safeProvider.getChainId() + let createCallContractInstance switch (safeVersion) { case '1.4.1': - return new CreateCallContract_v1_4_1_Ethers( + createCallContractInstance = new CreateCallContract_v1_4_1_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable ) - + break case '1.3.0': case '1.2.0': case '1.1.1': case '1.0.0': - return new CreateCallContract_v1_3_0_Ethers( + createCallContractInstance = new CreateCallContract_v1_3_0_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable ) - + break default: throw new Error('Invalid Safe version') } + + await createCallContractInstance.init() + + return createCallContractInstance } export async function getSimulateTxAccessorContractInstance( @@ -351,24 +390,30 @@ export async function getSimulateTxAccessorContractInstance( customContractAbi?: JsonFragment | JsonFragment[] | undefined ): Promise { const chainId = await safeProvider.getChainId() + let simulateTxAccessorContractInstance switch (safeVersion) { case '1.4.1': - return new SimulateTxAccessorContract_v1_4_1_Ethers( + simulateTxAccessorContractInstance = new SimulateTxAccessorContract_v1_4_1_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable ) - + break case '1.3.0': - return new SimulateTxAccessorContract_v1_3_0_Ethers( + simulateTxAccessorContractInstance = new SimulateTxAccessorContract_v1_3_0_Ethers( chainId, safeProvider, contractAddress, customContractAbi as DeepWriteable ) + break default: throw new Error('Invalid Safe version') } + + await simulateTxAccessorContractInstance.init() + + return simulateTxAccessorContractInstance } diff --git a/packages/protocol-kit/src/managers/contractManager.ts b/packages/protocol-kit/src/managers/contractManager.ts index d09ccd865..c8fc08679 100644 --- a/packages/protocol-kit/src/managers/contractManager.ts +++ b/packages/protocol-kit/src/managers/contractManager.ts @@ -22,7 +22,7 @@ class ContractManager { #multiSendContract!: MultiSendContractImplementationType #multiSendCallOnlyContract!: MultiSendCallOnlyContractImplementationType - static async create(config: SafeConfig, safeProvider: ISafeProvider): Promise { + static async create(config: SafeConfig, safeProvider: SafeProvider): Promise { const contractManager = new ContractManager() await contractManager.init(config, safeProvider) return contractManager diff --git a/packages/protocol-kit/src/utils/signatures/utils.ts b/packages/protocol-kit/src/utils/signatures/utils.ts index 23360bdbc..61fc93831 100644 --- a/packages/protocol-kit/src/utils/signatures/utils.ts +++ b/packages/protocol-kit/src/utils/signatures/utils.ts @@ -1,5 +1,5 @@ import { ethers } from 'ethers' -import { EthAdapter } from '@safe-global/protocol-kit/adapters/ethAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeSignature, SafeEIP712Args, @@ -106,7 +106,7 @@ export const adjustVInSignature: AdjustVOverload = ( } export async function generateSignature( - safeProvider: ISafeProvider, + safeProvider: SafeProvider, hash: string ): Promise { const signerAddress = await safeProvider.getSignerAddress() @@ -121,7 +121,7 @@ export async function generateSignature( } export async function generateEIP712Signature( - safeProvider: ISafeProvider, + safeProvider: SafeProvider, safeEIP712Args: SafeEIP712Args, methodVersion?: 'v3' | 'v4' ): Promise { From c4744c31f2e358d1c29b896bbaa61434d78e63f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 18 Apr 2024 16:58:21 +0200 Subject: [PATCH 019/112] Fix issues --- packages/protocol-kit/src/contracts/utils.ts | 2 +- .../src/managers/fallbackHandlerManager.ts | 1 - packages/protocol-kit/src/safeFactory/index.ts | 3 ++- packages/protocol-kit/src/types/index.ts | 4 ++-- packages/protocol-kit/src/utils/signatures/utils.ts | 5 +++-- packages/protocol-kit/src/utils/transactions/gas.ts | 11 ++--------- 6 files changed, 10 insertions(+), 16 deletions(-) diff --git a/packages/protocol-kit/src/contracts/utils.ts b/packages/protocol-kit/src/contracts/utils.ts index b47529177..dbf6a41cf 100644 --- a/packages/protocol-kit/src/contracts/utils.ts +++ b/packages/protocol-kit/src/contracts/utils.ts @@ -20,7 +20,7 @@ import { SafeContractImplementationType, SafeDeploymentConfig } from '../types' -import SafeProvider from '../adapters/ethers/SafeProvider' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' // keccak256(toUtf8Bytes('Safe Account Abstraction')) export const PREDETERMINED_SALT_NONCE = diff --git a/packages/protocol-kit/src/managers/fallbackHandlerManager.ts b/packages/protocol-kit/src/managers/fallbackHandlerManager.ts index 95cf0c2be..01ec41f96 100644 --- a/packages/protocol-kit/src/managers/fallbackHandlerManager.ts +++ b/packages/protocol-kit/src/managers/fallbackHandlerManager.ts @@ -69,7 +69,6 @@ class FallbackHandlerManager { const currentFallbackHandler = await this.getFallbackHandler() this.validateFallbackHandlerIsNotEnabled(currentFallbackHandler, fallbackHandlerAddress) - // @ts-expect-error Expression produces a union type that is too complex to represent return safeContract.encode('setFallbackHandler', [fallbackHandlerAddress]) } diff --git a/packages/protocol-kit/src/safeFactory/index.ts b/packages/protocol-kit/src/safeFactory/index.ts index 0da00a772..52f491437 100644 --- a/packages/protocol-kit/src/safeFactory/index.ts +++ b/packages/protocol-kit/src/safeFactory/index.ts @@ -18,8 +18,9 @@ import { SafeDeploymentConfig, SafeProxyFactoryContractImplementationType } from '@safe-global/protocol-kit/types' -import { SafeVersion, TransactionOptions, Eip1193Provider } from '@safe-global/safe-core-sdk-types' +import { SafeVersion, TransactionOptions } from '@safe-global/safe-core-sdk-types' import { SafeProvider } from '../adapters/ethers' +import { Eip1193Provider } from '../adapters/ethAdapter' export interface DeploySafeProps { safeAccountConfig: SafeAccountConfig diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index e1af9f59b..a08a40828 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -3,8 +3,7 @@ import { SafeTransactionOptionalProps } from '@safe-global/protocol-kit/utils/tr import { MetaTransactionData, SafeTransactionDataPartial, - SafeVersion, - Eip1193Provider + SafeVersion } from '@safe-global/safe-core-sdk-types' import SafeContract_v1_0_0_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers' import SafeContract_v1_1_1_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers' @@ -28,6 +27,7 @@ import SimulateTxAccessorContract_v1_3_0_Ethers from '../adapters/ethers/contrac import SimulateTxAccessorContract_v1_4_1_Ethers from '../adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers' import CreateCallContract_v1_3_0_Ethers from '../adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers' import CreateCallContract_v1_4_1_Ethers from '../adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers' +import { Eip1193Provider } from '../adapters/ethAdapter' export interface SafeAccountConfig { owners: string[] diff --git a/packages/protocol-kit/src/utils/signatures/utils.ts b/packages/protocol-kit/src/utils/signatures/utils.ts index 61fc93831..d22affece 100644 --- a/packages/protocol-kit/src/utils/signatures/utils.ts +++ b/packages/protocol-kit/src/utils/signatures/utils.ts @@ -111,7 +111,7 @@ export async function generateSignature( ): Promise { const signerAddress = await safeProvider.getSignerAddress() if (!signerAddress) { - throw new Error('ISafeProvider must be initialized with a signer to use this method') + throw new Error('SafeProvider must be initialized with a signer to use this method') } let signature = await safeProvider.signMessage(hash) @@ -127,9 +127,10 @@ export async function generateEIP712Signature( ): Promise { const signerAddress = await safeProvider.getSignerAddress() if (!signerAddress) { - throw new Error('ISafeProvider must be initialized with a signer to use this method') + throw new Error('SafeProvider must be initialized with a signer to use this method') } + //@ts-expect-error: Evaluate removal of methodVersion and use v4 let signature = await safeProvider.signTypedData(safeEIP712Args, methodVersion) signature = adjustVInSignature(SigningMethod.ETH_SIGN_TYPED_DATA, signature) diff --git a/packages/protocol-kit/src/utils/transactions/gas.ts b/packages/protocol-kit/src/utils/transactions/gas.ts index d9dfdd14b..9cbf094b1 100644 --- a/packages/protocol-kit/src/utils/transactions/gas.ts +++ b/packages/protocol-kit/src/utils/transactions/gas.ts @@ -1,12 +1,7 @@ -import { - SafeProvider, - SafeContract, - OperationType, - SafeVersion, - SafeTransaction -} from '@safe-global/safe-core-sdk-types' +import { OperationType, SafeVersion, SafeTransaction } from '@safe-global/safe-core-sdk-types' import semverSatisfies from 'semver/functions/satisfies' import Safe from '@safe-global/protocol-kit/Safe' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { ContractNetworksConfig, SafeContractImplementationType @@ -127,7 +122,6 @@ export async function estimateTxGas( const safeContractCompatibleWithRequiredTxGas = await isSafeContractCompatibleWithRequiredTxGas(safeContract) - // @ts-expect-error Expression produces a union type that is too complex to represent const estimateData = safeContractCompatibleWithRequiredTxGas.encode('requiredTxGas', [ to, BigInt(valueInWei), @@ -231,7 +225,6 @@ export async function estimateTxBaseGas( customContracts }) - // @ts-expect-error Expression produces a union type that is too complex to represent const execTransactionData = safeSingletonContract.encode('execTransaction', [ to, BigInt(value), From 6ec87c6bca9e958ce8cef6461bc74987c3968ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 18 Apr 2024 17:11:40 +0200 Subject: [PATCH 020/112] Fix issues --- packages/protocol-kit/src/types/index.ts | 2 +- .../v1.3.0/SafeContract_v1_3_0_Ethers.ts | 339 ++++++++++++++++++ packages/safe-core-sdk-types/src/types.d.ts | 233 ------------ packages/safe-core-sdk-types/src/types.js | 9 - packages/safe-core-sdk-types/src/types.js.map | 1 - 5 files changed, 340 insertions(+), 244 deletions(-) create mode 100644 packages/protocol-kit/v1.3.0/SafeContract_v1_3_0_Ethers.ts delete mode 100644 packages/safe-core-sdk-types/src/types.d.ts delete mode 100644 packages/safe-core-sdk-types/src/types.js delete mode 100644 packages/safe-core-sdk-types/src/types.js.map diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index a08a40828..66590c443 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -8,7 +8,7 @@ import { import SafeContract_v1_0_0_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers' import SafeContract_v1_1_1_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers' import SafeContract_v1_2_0_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers' -import SafeContract_v1_3_0_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers' +import SafeContract_v1_3_0_Ethers from '@safe-global/protocol-kit/v1.3.0/SafeContract_v1_3_0_Ethers' import SafeContract_v1_4_1_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers' import MultiSendContract_v1_1_1_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers' import MultiSendContract_v1_3_0_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers' diff --git a/packages/protocol-kit/v1.3.0/SafeContract_v1_3_0_Ethers.ts b/packages/protocol-kit/v1.3.0/SafeContract_v1_3_0_Ethers.ts new file mode 100644 index 000000000..7062e25e8 --- /dev/null +++ b/packages/protocol-kit/v1.3.0/SafeContract_v1_3_0_Ethers.ts @@ -0,0 +1,339 @@ +import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' +import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/adapters/ethers/utils/constants' +import { + SafeVersion, + SafeContract_v1_3_0_Abi, + SafeContract_v1_3_0_Contract, + SafeContract_v1_3_0_Function, + SafeTransaction, + safe_1_3_0_ContractArtifacts, + EthersTransactionOptions, + EthersTransactionResult +} from '@safe-global/safe-core-sdk-types' +/** + * SafeContract_v1_3_0_Ethers is the implementation specific to the Safe contract version 1.3.0. + * + * This class specializes in handling interactions with the Safe contract version 1.3.0 using Ethers.js v6. + * + * @extends SafeBaseContractEthers - Inherits from SafeBaseContractEthers with ABI specific to Safe contract version 1.3.0. + * @implements SafeContract_v1_3_0_Contract - Implements the interface specific to Safe contract version 1.3.0. + */ +class SafeContract_v1_3_0_Ethers + extends SafeBaseContractEthers + implements SafeContract_v1_3_0_Contract +{ + safeVersion: SafeVersion + + /** + * Constructs an instance of SafeContract_v1_3_0_Ethers + * + * @param chainId - The chain ID where the contract resides. + * @param safeProvider - An instance of SafeProvider. + * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. + * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. + * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. + */ + constructor( + chainId: bigint, + safeProvider: SafeProvider, + isL1SafeSingleton = false, + customContractAddress?: string, + customContractAbi?: SafeContract_v1_3_0_Abi + ) { + const safeVersion = '1.3.0' + const defaultAbi = safe_1_3_0_ContractArtifacts.abi + + super( + chainId, + safeProvider, + defaultAbi, + safeVersion, + isL1SafeSingleton, + customContractAddress, + customContractAbi + ) + + this.safeVersion = safeVersion + } + + /** + * @returns Array[safeContractVersion] + */ + VERSION: SafeContract_v1_3_0_Function<'VERSION'> = async () => { + return [await this.contract.VERSION()] + } + + /** + * @param args - Array[owner, txHash] + * @returns Array[approvedHashes] + */ + approvedHashes: SafeContract_v1_3_0_Function<'approvedHashes'> = async (args) => { + return [await this.contract.approvedHashes(...args)] + } + + /** + * Checks whether the signature provided is valid for the provided data, hash and number of required signatures. + * Will revert otherwise. + * @param args - Array[dataHash, data, signatures, requiredSignatures] + * @returns Empty array + */ + checkNSignatures: SafeContract_v1_3_0_Function<'checkNSignatures'> = async (args) => { + await this.contract.checkNSignatures(...args) + return [] + } + + /** + * Checks whether the signature provided is valid for the provided data and hash. Will revert otherwise. + * @param args - Array[dataHash, data, signatures] + * @returns Empty array + */ + checkSignatures: SafeContract_v1_3_0_Function<'checkSignatures'> = async (args) => { + await this.contract.checkSignatures(...args) + return [] + } + + /** + * @returns Array[domainSeparator] + */ + domainSeparator: SafeContract_v1_3_0_Function<'domainSeparator'> = async () => { + return [await this.contract.domainSeparator()] + } + + /** + * Encodes the data for a transaction to the Safe contract. + * @param args - Array[to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce] + * @returns Array[encodedData] + */ + encodeTransactionData: SafeContract_v1_3_0_Function<'encodeTransactionData'> = async (args) => { + return [await this.contract.encodeTransactionData(...args)] + } + + /** + * Returns array of modules. + * @param args - Array[start, pageSize] + * @returns Array[Array[modules], next] + */ + getModulesPaginated: SafeContract_v1_3_0_Function<'getModulesPaginated'> = async (args) => { + const res = await this.contract.getModulesPaginated(...args) + return [res.array, res.next] + } + + /** + * Returns the list of Safe owner accounts. + * @returns Array[Array[owners]] + */ + getOwners: SafeContract_v1_3_0_Function<'getOwners'> = async () => { + return [await this.contract.getOwners()] + } + + /** + * Reads `length` bytes of storage in the currents contract + * @param args - Array[offset, length] + * @returns Array[storage] + */ + getStorageAt: SafeContract_v1_3_0_Function<'getStorageAt'> = async (args) => { + return [await this.contract.getStorageAt(...args)] + } + + /** + * Returns the Safe threshold. + * @returns Array[threshold] + */ + getThreshold: SafeContract_v1_3_0_Function<'getThreshold'> = async () => { + return [await this.contract.getThreshold()] + } + + /** + * Returns hash to be signed by owners. + * @param args - Array[to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce] + * @returns Array[transactionHash] + */ + getTransactionHash: SafeContract_v1_3_0_Function<'getTransactionHash'> = async (args) => { + return [await this.contract.getTransactionHash(...args)] + } + + /** + * Checks if a specific Safe module is enabled for the current Safe. + * @param args - Array[moduleAddress] + * @returns Array[isEnabled] + */ + isModuleEnabled: SafeContract_v1_3_0_Function<'isModuleEnabled'> = async (args) => { + return [await this.contract.isModuleEnabled(...args)] + } + + /** + * Checks if a specific address is an owner of the current Safe. + * @param args - Array[address] + * @returns Array[isOwner] + */ + isOwner: SafeContract_v1_3_0_Function<'isOwner'> = async (args) => { + return [await this.contract.isOwner(...args)] + } + + /** + * Returns the Safe nonce. + * @returns Array[nonce] + */ + nonce: SafeContract_v1_3_0_Function<'nonce'> = async () => { + return [await this.contract.nonce()] + } + + /** + * @param args - Array[messageHash] + * @returns Array[signedMessages] + */ + signedMessages: SafeContract_v1_3_0_Function<'signedMessages'> = async (args) => { + return [await this.contract.signedMessages(...args)] + } + + /** + * Checks whether a given Safe transaction can be executed successfully with no errors. + * @param safeTransaction - The Safe transaction to check. + * @param options - Optional transaction options. + * @returns True, if the given transactions is valid. + */ + async isValidTransaction( + safeTransaction: SafeTransaction, + options: EthersTransactionOptions = {} + ) { + try { + const gasLimit = + options?.gasLimit || + (await this.estimateGas( + 'execTransaction', + [ + safeTransaction.data.to, + BigInt(safeTransaction.data.value), + safeTransaction.data.data, + safeTransaction.data.operation, + BigInt(safeTransaction.data.safeTxGas), + BigInt(safeTransaction.data.baseGas), + BigInt(safeTransaction.data.gasPrice), + safeTransaction.data.gasToken, + safeTransaction.data.refundReceiver, + safeTransaction.encodedSignatures() + ], + options + )) + + return await this.contract.execTransaction.staticCall( + safeTransaction.data.to, + BigInt(safeTransaction.data.value), + safeTransaction.data.data, + safeTransaction.data.operation, + BigInt(safeTransaction.data.safeTxGas), + BigInt(safeTransaction.data.baseGas), + BigInt(safeTransaction.data.gasPrice), + safeTransaction.data.gasToken, + safeTransaction.data.refundReceiver, + safeTransaction.encodedSignatures(), + { ...options, gasLimit } + ) + } catch (error) { + return false + } + } + + /** + * Executes a transaction. + * @param safeTransaction - The Safe transaction to execute. + * @param options - Transaction options. + * @returns Transaction result. + */ + async execTransaction( + safeTransaction: SafeTransaction, + options?: EthersTransactionOptions + ): Promise { + const gasLimit = + options?.gasLimit || + (await this.estimateGas( + 'execTransaction', + [ + safeTransaction.data.to, + BigInt(safeTransaction.data.value), + safeTransaction.data.data, + safeTransaction.data.operation, + BigInt(safeTransaction.data.safeTxGas), + BigInt(safeTransaction.data.baseGas), + BigInt(safeTransaction.data.gasPrice), + safeTransaction.data.gasToken, + safeTransaction.data.refundReceiver, + safeTransaction.encodedSignatures() + ], + options + )) + + const txResponse = await this.contract.execTransaction( + safeTransaction.data.to, + safeTransaction.data.value, + safeTransaction.data.data, + safeTransaction.data.operation, + safeTransaction.data.safeTxGas, + safeTransaction.data.baseGas, + safeTransaction.data.gasPrice, + safeTransaction.data.gasToken, + safeTransaction.data.refundReceiver, + safeTransaction.encodedSignatures(), + { ...options, gasLimit } + ) + + return toTxResult(txResponse, options) + } + + /** + * Returns array of first 10 modules. + * @returns Array[modules] + */ + async getModules(): Promise { + const [modules] = await this.getModulesPaginated([SENTINEL_ADDRESS, BigInt(10)]) + return [...modules] + } + + /** + * Marks a hash as approved. This can be used to validate a hash that is used by a signature. + * @param hash - The hash that should be marked as approved for signatures that are verified by this contract. + * @param options - Optional transaction options. + * @returns Transaction result. + */ + async approveHash( + hash: string, + options?: EthersTransactionOptions + ): Promise { + const gasLimit = options?.gasLimit || (await this.estimateGas('approveHash', [hash], options)) + const txResponse = await this.contract.approveHash(hash, { ...options, gasLimit }) + + return toTxResult(txResponse, options) + } + + /** + * Returns the chain id of the Safe contract. (Custom method - not defined in the Safe Contract) + * @returns Array[chainId] + */ + async getChainId(): Promise<[bigint]> { + return [await this.contract.getChainId()] + } + + /** + * returns the version of the Safe contract. + * + * @returns {Promise} A promise that resolves to the version of the Safe contract as string. + */ + async getVersion(): Promise { + const [safeVersion] = await this.VERSION() + return safeVersion as SafeVersion + } + + /** + * returns the nonce of the Safe contract. + * + * @returns {Promise} A promise that resolves to the nonce of the Safe contract. + */ + async getNonce(): Promise { + const [nonce] = await this.nonce() + return nonce + } +} + +export default SafeContract_v1_3_0_Ethers diff --git a/packages/safe-core-sdk-types/src/types.d.ts b/packages/safe-core-sdk-types/src/types.d.ts deleted file mode 100644 index 003eaada5..000000000 --- a/packages/safe-core-sdk-types/src/types.d.ts +++ /dev/null @@ -1,233 +0,0 @@ -import { ContractTransactionResponse } from 'ethers'; -import { PromiEvent, TransactionReceipt } from 'web3-core/types'; -export type SafeVersion = '1.4.1' | '1.3.0' | '1.2.0' | '1.1.1' | '1.0.0'; -export declare enum OperationType { - Call = 0,// 0 - DelegateCall = 1 -} -export interface CreateProxyProps { - safeSingletonAddress: string; - initializer: string; - saltNonce: string; - options?: TransactionOptions; - callback?: (txHash: string) => void; -} -export interface SafeSetupConfig { - owners: string[]; - threshold: number; - to?: string; - data?: string; - fallbackHandler?: string; - paymentToken?: string; - payment?: string; - paymentReceiver?: string; -} -export interface MetaTransactionData { - to: string; - value: string; - data: string; - operation?: OperationType; -} -export interface SafeTransactionData extends MetaTransactionData { - operation: OperationType; - safeTxGas: string; - baseGas: string; - gasPrice: string; - gasToken: string; - refundReceiver: string; - nonce: number; -} -export interface SafeTransactionDataPartial extends MetaTransactionData { - safeTxGas?: string; - baseGas?: string; - gasPrice?: string; - gasToken?: string; - refundReceiver?: string; - nonce?: number; -} -export interface SafeSignature { - readonly signer: string; - readonly data: string; - readonly isContractSignature: boolean; - staticPart(dynamicOffset?: string): string; - dynamicPart(): string; -} -export interface SafeTransaction { - readonly data: SafeTransactionData; - readonly signatures: Map; - getSignature(signer: string): SafeSignature | undefined; - addSignature(signature: SafeSignature): void; - encodedSignatures(): string; -} -export interface SafeMessage { - readonly data: EIP712TypedData | string; - readonly signatures: Map; - getSignature(signer: string): SafeSignature | undefined; - addSignature(signature: SafeSignature): void; - encodedSignatures(): string; -} -export type Transaction = TransactionBase & TransactionOptions; -interface TransactionBase { - to: string; - value: string; - data: string; -} -export interface TransactionOptions { - from?: string; - gas?: number | string; - gasLimit?: number | string; - gasPrice?: number | string; - maxFeePerGas?: number | string; - maxPriorityFeePerGas?: number | string; - nonce?: number; -} -export interface BaseTransactionResult { - hash: string; -} -export interface TransactionResult extends BaseTransactionResult { - promiEvent?: PromiEvent; - transactionResponse?: ContractTransactionResponse; - options?: TransactionOptions; -} -export interface Eip3770Address { - prefix: string; - address: string; -} -export interface SafeEIP712Args { - safeAddress: string; - safeVersion: string; - chainId: bigint; - data: SafeTransactionData | EIP712TypedData | string; -} -export interface EIP712TxTypes { - EIP712Domain: { - type: string; - name: string; - }[]; - SafeTx: { - type: string; - name: string; - }[]; -} -export interface EIP712MessageTypes { - EIP712Domain: { - type: string; - name: string; - }[]; - SafeMessage: [ - { - type: 'bytes'; - name: 'message'; - } - ]; -} -export type EIP712Types = EIP712TxTypes | EIP712MessageTypes; -export interface EIP712TypedDataTx { - types: EIP712TxTypes; - domain: { - chainId?: string; - verifyingContract: string; - }; - primaryType: 'SafeTx'; - message: { - to: string; - value: string; - data: string; - operation: OperationType; - safeTxGas: string; - baseGas: string; - gasPrice: string; - gasToken: string; - refundReceiver: string; - nonce: number; - }; -} -export interface EIP712TypedDataMessage { - types: EIP712MessageTypes; - domain: { - chainId?: number; - verifyingContract: string; - }; - primaryType: 'SafeMessage'; - message: { - message: string; - }; -} -interface TypedDataDomain { - name?: string; - version?: string; - chainId?: unknown; - verifyingContract?: string; - salt?: ArrayLike | string; -} -interface TypedDataTypes { - name: string; - type: string; -} -type TypedMessageTypes = { - [key: string]: TypedDataTypes[]; -}; -export interface EIP712TypedData { - domain: TypedDataDomain; - types: TypedMessageTypes; - message: Record; - primaryType?: string; -} -export type SafeMultisigConfirmationResponse = { - readonly owner: string; - readonly submissionDate: string; - readonly transactionHash?: string; - readonly confirmationType?: string; - readonly signature: string; - readonly signatureType?: string; -}; -export type SafeMultisigConfirmationListResponse = { - readonly count: number; - readonly next?: string; - readonly previous?: string; - readonly results: SafeMultisigConfirmationResponse[]; -}; -export type SafeMultisigTransactionResponse = { - readonly safe: string; - readonly to: string; - readonly value: string; - readonly data?: string; - readonly operation: number; - readonly gasToken: string; - readonly safeTxGas: number; - readonly baseGas: number; - readonly gasPrice: string; - readonly refundReceiver?: string; - readonly nonce: number; - readonly executionDate: string; - readonly submissionDate: string; - readonly modified: string; - readonly blockNumber?: number; - readonly transactionHash: string; - readonly safeTxHash: string; - readonly executor?: string; - readonly proposer: string; - readonly isExecuted: boolean; - readonly isSuccessful?: boolean; - readonly ethGasPrice?: string; - readonly gasUsed?: number; - readonly fee?: string; - readonly origin: string; - readonly dataDecoded?: string; - readonly confirmationsRequired: number; - readonly confirmations?: SafeMultisigConfirmationResponse[]; - readonly trusted: boolean; - readonly signatures?: string; -}; -export interface RelayTransaction { - target: string; - encodedTransaction: string; - chainId: bigint; - options?: MetaTransactionOptions; -} -export interface MetaTransactionOptions { - gasLimit?: string; - gasToken?: string; - isSponsored?: boolean; -} -export {}; diff --git a/packages/safe-core-sdk-types/src/types.js b/packages/safe-core-sdk-types/src/types.js deleted file mode 100644 index 5243cf064..000000000 --- a/packages/safe-core-sdk-types/src/types.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.OperationType = void 0; -var OperationType; -(function (OperationType) { - OperationType[OperationType["Call"] = 0] = "Call"; - OperationType[OperationType["DelegateCall"] = 1] = "DelegateCall"; // 1 -})(OperationType || (exports.OperationType = OperationType = {})); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/packages/safe-core-sdk-types/src/types.js.map b/packages/safe-core-sdk-types/src/types.js.map deleted file mode 100644 index ab6177231..000000000 --- a/packages/safe-core-sdk-types/src/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";;;AAKA,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,iDAAI,CAAA;IACJ,iEAAY,CAAA,CAAC,IAAI;AACnB,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB"} \ No newline at end of file From dbd721c8d32f451f39507e1c20e4660c1147bd53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 18 Apr 2024 17:17:51 +0200 Subject: [PATCH 021/112] Fix issues --- packages/protocol-kit/src/index.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/packages/protocol-kit/src/index.ts b/packages/protocol-kit/src/index.ts index e2a62d263..a545c5c84 100644 --- a/packages/protocol-kit/src/index.ts +++ b/packages/protocol-kit/src/index.ts @@ -3,8 +3,6 @@ import { CreateCallBaseContractEthers, SafeProvider, SafeProviderConfig, - EthersTransactionOptions, - EthersTransactionResult, MultiSendBaseContractEthers, MultiSendCallOnlyBaseContractEthers, SafeBaseContractEthers, @@ -79,7 +77,6 @@ import { hashSafeMessage, generateTypedData } from './utils/eip-712' -import { EthAdapter } from './adapters/ethAdapter' export { AddOwnerTxParams, @@ -97,12 +94,9 @@ export { CreateTransactionProps, DEFAULT_SAFE_VERSION, DeploySafeProps, - EthAdapter, EthSafeSignature, SafeProvider, SafeProviderConfig, - EthersTransactionOptions, - EthersTransactionResult, MultiSendCallOnlyBaseContractEthers, MultiSendBaseContractEthers, PREDETERMINED_SALT_NONCE, From 784fa1984675b439d3549702a6ad31dacdaf41fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 18 Apr 2024 17:28:00 +0200 Subject: [PATCH 022/112] Fix issues --- .../contracts/contractInstancesEthers.ts | 45 +++++++++---------- .../src/contracts/common/BaseContract.ts | 26 +++-------- 2 files changed, 27 insertions(+), 44 deletions(-) diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts index f455c28fa..99e3d61f5 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts @@ -1,6 +1,5 @@ import { JsonFragment, AbstractSigner, Provider } from 'ethers' import { - DeepWriteable, SafeVersion, SafeContract_v1_3_0_Abi, SafeContract_v1_4_1_Abi, @@ -72,7 +71,7 @@ export async function getSafeContractInstance( safeProvider, isL1SafeSingleton, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as SafeContract_v1_4_1_Abi ) break case '1.3.0': @@ -81,7 +80,7 @@ export async function getSafeContractInstance( safeProvider, isL1SafeSingleton, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as SafeContract_v1_3_0_Abi ) break case '1.2.0': @@ -90,7 +89,7 @@ export async function getSafeContractInstance( safeProvider, isL1SafeSingleton, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as SafeContract_v1_2_0_Abi ) break case '1.1.1': @@ -99,7 +98,7 @@ export async function getSafeContractInstance( safeProvider, isL1SafeSingleton, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as SafeContract_v1_1_1_Abi ) break case '1.0.0': @@ -108,7 +107,7 @@ export async function getSafeContractInstance( safeProvider, isL1SafeSingleton, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as SafeContract_v1_0_0_Abi ) break default: @@ -138,7 +137,7 @@ export async function getCompatibilityFallbackHandlerContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as CompatibilityFallbackHandlerContract_v1_4_1_Abi ) break case '1.3.0': @@ -148,7 +147,7 @@ export async function getCompatibilityFallbackHandlerContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as CompatibilityFallbackHandlerContract_v1_3_0_Abi ) break default: @@ -179,7 +178,7 @@ export async function getMultiSendContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as MultiSendContract_v1_4_1_Abi ) break case '1.3.0': @@ -187,7 +186,7 @@ export async function getMultiSendContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as MultiSendContract_v1_3_0_Abi ) break case '1.2.0': @@ -197,7 +196,7 @@ export async function getMultiSendContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as MultiSendContract_v1_1_1_Abi ) break default: @@ -224,7 +223,7 @@ export async function getMultiSendCallOnlyContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as MultiSendCallOnlyContract_v1_4_1_Abi ) break case '1.3.0': @@ -235,7 +234,7 @@ export async function getMultiSendCallOnlyContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as MultiSendCallOnlyContract_v1_3_0_Abi ) break default: @@ -269,7 +268,7 @@ export async function getSafeProxyFactoryContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable, + customContractAbi as SafeProxyFactoryContract_v1_4_1_Abi, signerOrProvider ) break @@ -278,7 +277,7 @@ export async function getSafeProxyFactoryContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable, + customContractAbi as SafeProxyFactoryContract_v1_3_0_Abi, signerOrProvider ) break @@ -288,7 +287,7 @@ export async function getSafeProxyFactoryContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable, + customContractAbi as SafeProxyFactoryContract_v1_1_1_Abi, signerOrProvider ) break @@ -297,7 +296,7 @@ export async function getSafeProxyFactoryContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable, + customContractAbi as SafeProxyFactoryContract_v1_0_0_Abi, signerOrProvider ) break @@ -325,7 +324,7 @@ export async function getSignMessageLibContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as SignMessageLibContract_v1_4_1_Abi ) break case '1.3.0': @@ -333,7 +332,7 @@ export async function getSignMessageLibContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as SignMessageLibContract_v1_3_0_Abi ) break default: @@ -360,7 +359,7 @@ export async function getCreateCallContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as CreateCallContract_v1_4_1_Abi ) break case '1.3.0': @@ -371,7 +370,7 @@ export async function getCreateCallContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as CreateCallContract_v1_3_0_Abi ) break default: @@ -398,7 +397,7 @@ export async function getSimulateTxAccessorContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as SimulateTxAccessorContract_v1_4_1_Abi ) break case '1.3.0': @@ -406,7 +405,7 @@ export async function getSimulateTxAccessorContractInstance( chainId, safeProvider, contractAddress, - customContractAbi as DeepWriteable + customContractAbi as SimulateTxAccessorContract_v1_3_0_Abi ) break default: diff --git a/packages/safe-core-sdk-types/src/contracts/common/BaseContract.ts b/packages/safe-core-sdk-types/src/contracts/common/BaseContract.ts index e52ed624d..2b4cec1ba 100644 --- a/packages/safe-core-sdk-types/src/contracts/common/BaseContract.ts +++ b/packages/safe-core-sdk-types/src/contracts/common/BaseContract.ts @@ -62,8 +62,7 @@ export type EncodeFunction< ExtractAbiFunctionNames = ExtractAbiFunctionNames > = ( functionToEncode: ContractFunctionName, - // TODO: remove `DeepWriteable` here when web3 dependency is removed - args: DeepWriteable> + args: ExtractFunctionArgs ) => string /** @@ -80,8 +79,7 @@ export type EstimateGasFunction< ExtractAbiFunctionNames = ExtractAbiFunctionNames > = ( functionToEncode: ContractFunctionName, - // TODO: remove `DeepWriteable` here when web3 dependency is removed - args: DeepWriteable>, + args: ExtractFunctionArgs, options?: TransactionOptions ) => Promise @@ -101,8 +99,7 @@ export type ContractFunction< // input parameters (only if function has inputs, otherwise no parameters) ...args: ExtractFunctionArgs['length'] extends 0 ? [] - : // TODO: remove `DeepWriteable` here when web3 dependency is removed - [DeepWriteable>] + : [ExtractFunctionArgs] // returned values as a Promise ) => Promise> @@ -121,9 +118,8 @@ export type AdapterSpecificContractFunction< TransactionOptions extends EthersTransactionOptions = EthersTransactionOptions, TransactionResult extends EthersTransactionResult = EthersTransactionResult > = ( - // TODO: remove `DeepWriteable` here when web3 dependency is removed - args: DeepWriteable< - AbiParametersToPrimitiveTypes['inputs']> + args: AbiParametersToPrimitiveTypes< + ExtractAbiFunction['inputs'] >, options?: TransactionOptions ) => Promise @@ -148,16 +144,4 @@ type BaseContract< getAddress: GetAddressFunction } -/** - * Removes `readonly` modifier from all properties in T recursively. - * - * @template T - The type to make writable. - */ -export type DeepWriteable = T extends object & NotFunction - ? { -readonly [K in keyof T]: DeepWriteable } - : T - -type Not = T extends U ? never : T -type NotFunction = Not any> - export default BaseContract From 12611fc1f67ca992c01c7616d6212b8f45504183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 18 Apr 2024 17:40:06 +0200 Subject: [PATCH 023/112] Remove file --- .../v1.3.0/SafeContract_v1_3_0_Ethers.ts | 339 ------------------ 1 file changed, 339 deletions(-) delete mode 100644 packages/protocol-kit/v1.3.0/SafeContract_v1_3_0_Ethers.ts diff --git a/packages/protocol-kit/v1.3.0/SafeContract_v1_3_0_Ethers.ts b/packages/protocol-kit/v1.3.0/SafeContract_v1_3_0_Ethers.ts deleted file mode 100644 index 7062e25e8..000000000 --- a/packages/protocol-kit/v1.3.0/SafeContract_v1_3_0_Ethers.ts +++ /dev/null @@ -1,339 +0,0 @@ -import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' -import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' -import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/adapters/ethers/utils/constants' -import { - SafeVersion, - SafeContract_v1_3_0_Abi, - SafeContract_v1_3_0_Contract, - SafeContract_v1_3_0_Function, - SafeTransaction, - safe_1_3_0_ContractArtifacts, - EthersTransactionOptions, - EthersTransactionResult -} from '@safe-global/safe-core-sdk-types' -/** - * SafeContract_v1_3_0_Ethers is the implementation specific to the Safe contract version 1.3.0. - * - * This class specializes in handling interactions with the Safe contract version 1.3.0 using Ethers.js v6. - * - * @extends SafeBaseContractEthers - Inherits from SafeBaseContractEthers with ABI specific to Safe contract version 1.3.0. - * @implements SafeContract_v1_3_0_Contract - Implements the interface specific to Safe contract version 1.3.0. - */ -class SafeContract_v1_3_0_Ethers - extends SafeBaseContractEthers - implements SafeContract_v1_3_0_Contract -{ - safeVersion: SafeVersion - - /** - * Constructs an instance of SafeContract_v1_3_0_Ethers - * - * @param chainId - The chain ID where the contract resides. - * @param safeProvider - An instance of SafeProvider. - * @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton. - * @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion. - * @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used. - */ - constructor( - chainId: bigint, - safeProvider: SafeProvider, - isL1SafeSingleton = false, - customContractAddress?: string, - customContractAbi?: SafeContract_v1_3_0_Abi - ) { - const safeVersion = '1.3.0' - const defaultAbi = safe_1_3_0_ContractArtifacts.abi - - super( - chainId, - safeProvider, - defaultAbi, - safeVersion, - isL1SafeSingleton, - customContractAddress, - customContractAbi - ) - - this.safeVersion = safeVersion - } - - /** - * @returns Array[safeContractVersion] - */ - VERSION: SafeContract_v1_3_0_Function<'VERSION'> = async () => { - return [await this.contract.VERSION()] - } - - /** - * @param args - Array[owner, txHash] - * @returns Array[approvedHashes] - */ - approvedHashes: SafeContract_v1_3_0_Function<'approvedHashes'> = async (args) => { - return [await this.contract.approvedHashes(...args)] - } - - /** - * Checks whether the signature provided is valid for the provided data, hash and number of required signatures. - * Will revert otherwise. - * @param args - Array[dataHash, data, signatures, requiredSignatures] - * @returns Empty array - */ - checkNSignatures: SafeContract_v1_3_0_Function<'checkNSignatures'> = async (args) => { - await this.contract.checkNSignatures(...args) - return [] - } - - /** - * Checks whether the signature provided is valid for the provided data and hash. Will revert otherwise. - * @param args - Array[dataHash, data, signatures] - * @returns Empty array - */ - checkSignatures: SafeContract_v1_3_0_Function<'checkSignatures'> = async (args) => { - await this.contract.checkSignatures(...args) - return [] - } - - /** - * @returns Array[domainSeparator] - */ - domainSeparator: SafeContract_v1_3_0_Function<'domainSeparator'> = async () => { - return [await this.contract.domainSeparator()] - } - - /** - * Encodes the data for a transaction to the Safe contract. - * @param args - Array[to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce] - * @returns Array[encodedData] - */ - encodeTransactionData: SafeContract_v1_3_0_Function<'encodeTransactionData'> = async (args) => { - return [await this.contract.encodeTransactionData(...args)] - } - - /** - * Returns array of modules. - * @param args - Array[start, pageSize] - * @returns Array[Array[modules], next] - */ - getModulesPaginated: SafeContract_v1_3_0_Function<'getModulesPaginated'> = async (args) => { - const res = await this.contract.getModulesPaginated(...args) - return [res.array, res.next] - } - - /** - * Returns the list of Safe owner accounts. - * @returns Array[Array[owners]] - */ - getOwners: SafeContract_v1_3_0_Function<'getOwners'> = async () => { - return [await this.contract.getOwners()] - } - - /** - * Reads `length` bytes of storage in the currents contract - * @param args - Array[offset, length] - * @returns Array[storage] - */ - getStorageAt: SafeContract_v1_3_0_Function<'getStorageAt'> = async (args) => { - return [await this.contract.getStorageAt(...args)] - } - - /** - * Returns the Safe threshold. - * @returns Array[threshold] - */ - getThreshold: SafeContract_v1_3_0_Function<'getThreshold'> = async () => { - return [await this.contract.getThreshold()] - } - - /** - * Returns hash to be signed by owners. - * @param args - Array[to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce] - * @returns Array[transactionHash] - */ - getTransactionHash: SafeContract_v1_3_0_Function<'getTransactionHash'> = async (args) => { - return [await this.contract.getTransactionHash(...args)] - } - - /** - * Checks if a specific Safe module is enabled for the current Safe. - * @param args - Array[moduleAddress] - * @returns Array[isEnabled] - */ - isModuleEnabled: SafeContract_v1_3_0_Function<'isModuleEnabled'> = async (args) => { - return [await this.contract.isModuleEnabled(...args)] - } - - /** - * Checks if a specific address is an owner of the current Safe. - * @param args - Array[address] - * @returns Array[isOwner] - */ - isOwner: SafeContract_v1_3_0_Function<'isOwner'> = async (args) => { - return [await this.contract.isOwner(...args)] - } - - /** - * Returns the Safe nonce. - * @returns Array[nonce] - */ - nonce: SafeContract_v1_3_0_Function<'nonce'> = async () => { - return [await this.contract.nonce()] - } - - /** - * @param args - Array[messageHash] - * @returns Array[signedMessages] - */ - signedMessages: SafeContract_v1_3_0_Function<'signedMessages'> = async (args) => { - return [await this.contract.signedMessages(...args)] - } - - /** - * Checks whether a given Safe transaction can be executed successfully with no errors. - * @param safeTransaction - The Safe transaction to check. - * @param options - Optional transaction options. - * @returns True, if the given transactions is valid. - */ - async isValidTransaction( - safeTransaction: SafeTransaction, - options: EthersTransactionOptions = {} - ) { - try { - const gasLimit = - options?.gasLimit || - (await this.estimateGas( - 'execTransaction', - [ - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ], - options - )) - - return await this.contract.execTransaction.staticCall( - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures(), - { ...options, gasLimit } - ) - } catch (error) { - return false - } - } - - /** - * Executes a transaction. - * @param safeTransaction - The Safe transaction to execute. - * @param options - Transaction options. - * @returns Transaction result. - */ - async execTransaction( - safeTransaction: SafeTransaction, - options?: EthersTransactionOptions - ): Promise { - const gasLimit = - options?.gasLimit || - (await this.estimateGas( - 'execTransaction', - [ - safeTransaction.data.to, - BigInt(safeTransaction.data.value), - safeTransaction.data.data, - safeTransaction.data.operation, - BigInt(safeTransaction.data.safeTxGas), - BigInt(safeTransaction.data.baseGas), - BigInt(safeTransaction.data.gasPrice), - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures() - ], - options - )) - - const txResponse = await this.contract.execTransaction( - safeTransaction.data.to, - safeTransaction.data.value, - safeTransaction.data.data, - safeTransaction.data.operation, - safeTransaction.data.safeTxGas, - safeTransaction.data.baseGas, - safeTransaction.data.gasPrice, - safeTransaction.data.gasToken, - safeTransaction.data.refundReceiver, - safeTransaction.encodedSignatures(), - { ...options, gasLimit } - ) - - return toTxResult(txResponse, options) - } - - /** - * Returns array of first 10 modules. - * @returns Array[modules] - */ - async getModules(): Promise { - const [modules] = await this.getModulesPaginated([SENTINEL_ADDRESS, BigInt(10)]) - return [...modules] - } - - /** - * Marks a hash as approved. This can be used to validate a hash that is used by a signature. - * @param hash - The hash that should be marked as approved for signatures that are verified by this contract. - * @param options - Optional transaction options. - * @returns Transaction result. - */ - async approveHash( - hash: string, - options?: EthersTransactionOptions - ): Promise { - const gasLimit = options?.gasLimit || (await this.estimateGas('approveHash', [hash], options)) - const txResponse = await this.contract.approveHash(hash, { ...options, gasLimit }) - - return toTxResult(txResponse, options) - } - - /** - * Returns the chain id of the Safe contract. (Custom method - not defined in the Safe Contract) - * @returns Array[chainId] - */ - async getChainId(): Promise<[bigint]> { - return [await this.contract.getChainId()] - } - - /** - * returns the version of the Safe contract. - * - * @returns {Promise} A promise that resolves to the version of the Safe contract as string. - */ - async getVersion(): Promise { - const [safeVersion] = await this.VERSION() - return safeVersion as SafeVersion - } - - /** - * returns the nonce of the Safe contract. - * - * @returns {Promise} A promise that resolves to the nonce of the Safe contract. - */ - async getNonce(): Promise { - const [nonce] = await this.nonce() - return nonce - } -} - -export default SafeContract_v1_3_0_Ethers From 8a4813659c6ebb9ba9b681181364fdd9f97da5df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 18 Apr 2024 17:48:14 +0200 Subject: [PATCH 024/112] Fix issues --- .../ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts | 2 +- .../ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts | 2 +- packages/protocol-kit/src/types/index.ts | 2 +- packages/protocol-kit/src/utils/transactions/gas.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts index aeb0a9ec5..6e6220b91 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts @@ -254,7 +254,7 @@ class SafeContract_v1_0_0_Ethers * @param moduleAddress - The module address to check. * @returns True, if the module with the given address is enabled. */ - async isModuleEnabled(moduleAddress: string[]): Promise { + async isModuleEnabled([moduleAddress]: [string]): Promise<[boolean]> { const [modules] = await this.getModules() const isModuleEnabled = modules.some((enabledModuleAddress) => sameString(enabledModuleAddress, moduleAddress[0]) diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts index 981f5b48c..43088c682 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts @@ -241,7 +241,7 @@ class SafeContract_v1_1_1_Ethers * @param moduleAddress - The module address to check. * @returns True, if the module with the given address is enabled. */ - async isModuleEnabled(moduleAddress: string[]): Promise { + async isModuleEnabled([moduleAddress]: [string]): Promise<[boolean]> { const [modules] = await this.getModules() const isModuleEnabled = modules.some((enabledModuleAddress) => sameString(enabledModuleAddress, moduleAddress[0]) diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index 66590c443..a08a40828 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -8,7 +8,7 @@ import { import SafeContract_v1_0_0_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers' import SafeContract_v1_1_1_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers' import SafeContract_v1_2_0_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers' -import SafeContract_v1_3_0_Ethers from '@safe-global/protocol-kit/v1.3.0/SafeContract_v1_3_0_Ethers' +import SafeContract_v1_3_0_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers' import SafeContract_v1_4_1_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers' import MultiSendContract_v1_1_1_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers' import MultiSendContract_v1_3_0_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers' diff --git a/packages/protocol-kit/src/utils/transactions/gas.ts b/packages/protocol-kit/src/utils/transactions/gas.ts index 9cbf094b1..0af84b5aa 100644 --- a/packages/protocol-kit/src/utils/transactions/gas.ts +++ b/packages/protocol-kit/src/utils/transactions/gas.ts @@ -342,7 +342,7 @@ async function estimateSafeTxGasWithRequiredTxGas( 'requiredTxGas', [ safeTransaction.data.to, - safeTransaction.data.value, + BigInt(safeTransaction.data.value), safeTransaction.data.data, safeTransaction.data.operation ] From 152de8ac115e04a515c029542e23056abe233635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 18 Apr 2024 17:57:26 +0200 Subject: [PATCH 025/112] Fix issues --- packages/protocol-kit/src/utils/transactions/gas.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/protocol-kit/src/utils/transactions/gas.ts b/packages/protocol-kit/src/utils/transactions/gas.ts index 0af84b5aa..df70faa9e 100644 --- a/packages/protocol-kit/src/utils/transactions/gas.ts +++ b/packages/protocol-kit/src/utils/transactions/gas.ts @@ -225,6 +225,8 @@ export async function estimateTxBaseGas( customContracts }) + //@ts-expect-error: Type too complex to represent. + //TODO: We should explore contract versions and map to the correct types const execTransactionData = safeSingletonContract.encode('execTransaction', [ to, BigInt(value), From bf3d422d5b1f1821eae6bb2ee0e07dccf73c61a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 19 Apr 2024 09:39:13 +0200 Subject: [PATCH 026/112] Fix imports --- packages/protocol-kit/tests/e2e/utils/transactions.ts | 2 +- packages/protocol-kit/tests/e2e/utilsContracts.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/protocol-kit/tests/e2e/utils/transactions.ts b/packages/protocol-kit/tests/e2e/utils/transactions.ts index e5da498a5..807791c79 100644 --- a/packages/protocol-kit/tests/e2e/utils/transactions.ts +++ b/packages/protocol-kit/tests/e2e/utils/transactions.ts @@ -1,6 +1,6 @@ import { ContractTransactionReceipt } from 'ethers' import { TransactionResult } from '@safe-global/safe-core-sdk-types' -import { SafeProvider } from '@safe-global/protocol-kit/adapters/ethAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { TransactionReceipt } from 'web3-core/types' export async function waitSafeTxReceipt( diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index bf91a0129..c8980fcf8 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -16,7 +16,7 @@ import { ContractNetworksConfig } from '@safe-global/protocol-kit/types' import Safe, { SafeFactory, DeploySafeProps } from '@safe-global/protocol-kit/index' -import { SafeProvider } from '@safe-global/protocol-kit/adapters/ethAdapter' +import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { itif } from './utils/helpers' // test util funcion to deploy a safe (needed to check the expected Safe Address) From b3cfc6a03b0339fa4f51335470f9780b1ead2370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 19 Apr 2024 10:21:33 +0200 Subject: [PATCH 027/112] Fix moduleManager --- .../ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts | 2 +- .../ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts | 2 +- .../ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts | 2 +- .../ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts index 6e6220b91..5e5dfc3d1 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts @@ -257,7 +257,7 @@ class SafeContract_v1_0_0_Ethers async isModuleEnabled([moduleAddress]: [string]): Promise<[boolean]> { const [modules] = await this.getModules() const isModuleEnabled = modules.some((enabledModuleAddress) => - sameString(enabledModuleAddress, moduleAddress[0]) + sameString(enabledModuleAddress, moduleAddress) ) return [isModuleEnabled] } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts index 43088c682..7b47d2551 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts @@ -244,7 +244,7 @@ class SafeContract_v1_1_1_Ethers async isModuleEnabled([moduleAddress]: [string]): Promise<[boolean]> { const [modules] = await this.getModules() const isModuleEnabled = modules.some((enabledModuleAddress) => - sameString(enabledModuleAddress, moduleAddress[0]) + sameString(enabledModuleAddress, moduleAddress) ) return [isModuleEnabled] } diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts index 7062e25e8..f9a45f14a 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts @@ -288,7 +288,7 @@ class SafeContract_v1_3_0_Ethers */ async getModules(): Promise { const [modules] = await this.getModulesPaginated([SENTINEL_ADDRESS, BigInt(10)]) - return [...modules] + return [modules] } /** diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts index 75b08ff37..67f828c0b 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts @@ -289,7 +289,7 @@ class SafeContract_v1_4_1_Ethers */ async getModules(): Promise { const [modules] = await this.getModulesPaginated([SENTINEL_ADDRESS, BigInt(10)]) - return [...modules] + return [modules] } /** From 403a1920c398d99110bb0a708943b6957209bbfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 19 Apr 2024 11:01:39 +0200 Subject: [PATCH 028/112] Fix build --- .../Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts | 4 ++-- .../Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts | 4 ++-- .../tests/e2e/moduleManager.test.ts | 21 ++++++++++++++----- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts index f9a45f14a..8e9ff9aa1 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts @@ -286,9 +286,9 @@ class SafeContract_v1_3_0_Ethers * Returns array of first 10 modules. * @returns Array[modules] */ - async getModules(): Promise { + async getModules(): Promise<[string[]]> { const [modules] = await this.getModulesPaginated([SENTINEL_ADDRESS, BigInt(10)]) - return [modules] + return [modules.map((module) => module)] } /** diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts index 67f828c0b..232e990ef 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts @@ -287,9 +287,9 @@ class SafeContract_v1_4_1_Ethers * Returns array of first 10 modules. * @returns Array[modules] */ - async getModules(): Promise { + async getModules(): Promise<[string[]]> { const [modules] = await this.getModulesPaginated([SENTINEL_ADDRESS, BigInt(10)]) - return [modules] + return [modules.map((module) => module)] } /** diff --git a/packages/protocol-kit/tests/e2e/moduleManager.test.ts b/packages/protocol-kit/tests/e2e/moduleManager.test.ts index 0a287aecc..cb42f7b8b 100644 --- a/packages/protocol-kit/tests/e2e/moduleManager.test.ts +++ b/packages/protocol-kit/tests/e2e/moduleManager.test.ts @@ -57,7 +57,7 @@ describe('Safe modules manager', () => { }) it('should return all the enabled modules', async () => { - const { safe, dailyLimitModule, contractNetworks } = await setupTests() + const { safe, dailyLimitModule, socialRecoveryModule, contractNetworks } = await setupTests() const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ @@ -66,10 +66,21 @@ describe('Safe modules manager', () => { contractNetworks }) chai.expect((await safeSdk.getModules()).length).to.be.eq(0) - const tx = await safeSdk.createEnableModuleTx(await dailyLimitModule.getAddress()) - const txResponse = await safeSdk.executeTransaction(tx) - await waitSafeTxReceipt(txResponse) - chai.expect((await safeSdk.getModules()).length).to.be.eq(1) + const enableDailyLimitModuleTx = await safeSdk.createEnableModuleTx( + await dailyLimitModule.getAddress() + ) + const enableDailyLimitModuleTxResponse = + await safeSdk.executeTransaction(enableDailyLimitModuleTx) + const socialRecoveryModuleTx = await safeSdk.createEnableModuleTx( + await socialRecoveryModule.getAddress() + ) + const socialRecoveryModuleTxResponse = + await safeSdk.executeTransaction(socialRecoveryModuleTx) + await Promise.all([ + waitSafeTxReceipt(enableDailyLimitModuleTxResponse), + waitSafeTxReceipt(socialRecoveryModuleTxResponse) + ]) + chai.expect((await safeSdk.getModules()).length).to.be.eq(2) }) }) From 1086e7ac9091e64ceb597e5c7c506372de003b4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 19 Apr 2024 11:40:33 +0200 Subject: [PATCH 029/112] Remove ISafeProvider --- .../protocol-kit/src/adapters/ethAdapter.ts | 78 +------------------ .../protocol-kit/src/safeFactory/index.ts | 2 +- packages/protocol-kit/tests/e2e/core.test.ts | 2 +- .../tests/e2e/safeFactory.test.ts | 2 +- .../tests/e2e/utilsContracts.test.ts | 2 +- 5 files changed, 5 insertions(+), 81 deletions(-) diff --git a/packages/protocol-kit/src/adapters/ethAdapter.ts b/packages/protocol-kit/src/adapters/ethAdapter.ts index 92f0b3313..811e9cf1b 100644 --- a/packages/protocol-kit/src/adapters/ethAdapter.ts +++ b/packages/protocol-kit/src/adapters/ethAdapter.ts @@ -1,16 +1,5 @@ import { JsonFragment } from 'ethers' -import { Eip3770Address, SafeEIP712Args, SafeVersion } from '@safe-global/safe-core-sdk-types' - -import { - CompatibilityFallbackHandlerContractImplementationType, - CreateCallContractImplementationType, - MultiSendCallOnlyContractImplementationType, - MultiSendContractImplementationType, - SafeContractImplementationType, - SafeProxyFactoryContractImplementationType, - SignMessageLibContractImplementationType, - SimulateTxAccessorContractImplementationType -} from '../types' +import { SafeVersion } from '@safe-global/safe-core-sdk-types' export type RequestArguments = { readonly method: string @@ -38,68 +27,3 @@ export interface GetContractProps { customContractAbi?: JsonFragment | JsonFragment[] isL1SafeSingleton?: boolean } - -export interface ISafeProvider { - isAddress(address: string): boolean - getEip3770Address(fullAddress: string): Promise - getBalance(address: string, defaultBlock?: string | number): Promise - getNonce(address: string, defaultBlock?: string | number): Promise - getChainId(): Promise - getChecksummedAddress(address: string): string - getSafeContract({ - safeVersion, - customContractAddress, - customContractAbi, - isL1SafeSingleton - }: GetContractProps): Promise - getMultiSendContract({ - safeVersion, - customContractAddress, - customContractAbi - }: GetContractProps): Promise - getMultiSendCallOnlyContract({ - safeVersion, - customContractAddress, - customContractAbi - }: GetContractProps): Promise - getCompatibilityFallbackHandlerContract({ - safeVersion, - customContractAddress, - customContractAbi - }: GetContractProps): Promise - getSafeProxyFactoryContract({ - safeVersion, - customContractAddress, - customContractAbi - }: GetContractProps): Promise - getSignMessageLibContract({ - safeVersion, - customContractAddress, - customContractAbi - }: GetContractProps): Promise - getCreateCallContract({ - safeVersion, - customContractAddress, - customContractAbi - }: GetContractProps): Promise - getSimulateTxAccessorContract({ - safeVersion, - customContractAddress, - customContractAbi - }: GetContractProps): Promise - getContractCode(address: string, defaultBlock?: string | number): Promise - isContractDeployed(address: string, defaultBlock?: string | number): Promise - getStorageAt(address: string, position: string): Promise - // TODO: review all any here - getTransaction(transactionHash: string): Promise - getSignerAddress(): Promise - signMessage(message: string): Promise - signTypedData(safeEIP712Args: SafeEIP712Args, signTypedDataVersion?: string): Promise - estimateGas( - transaction: SafeProviderTransaction, - callback?: (error: Error, gas: number) => void - ): Promise - call(transaction: SafeProviderTransaction, defaultBlock?: string | number): Promise - encodeParameters(types: string[], values: any[]): string - decodeParameters(types: any[], values: string): { [key: string]: any } -} diff --git a/packages/protocol-kit/src/safeFactory/index.ts b/packages/protocol-kit/src/safeFactory/index.ts index 52f491437..a3e02d5a8 100644 --- a/packages/protocol-kit/src/safeFactory/index.ts +++ b/packages/protocol-kit/src/safeFactory/index.ts @@ -151,7 +151,7 @@ class SafeFactory { const signerAddress = await this.#safeProvider.getSignerAddress() if (!signerAddress) { - throw new Error('ISafeProvider must be initialized with a signer to use this method') + throw new Error('SafeProvider must be initialized with a signer to use this method') } const chainId = await this.getChainId() diff --git a/packages/protocol-kit/tests/e2e/core.test.ts b/packages/protocol-kit/tests/e2e/core.test.ts index e08903e60..035d7eb96 100644 --- a/packages/protocol-kit/tests/e2e/core.test.ts +++ b/packages/protocol-kit/tests/e2e/core.test.ts @@ -219,7 +219,7 @@ describe('Safe Info', () => { }) describe('getEip1193Provider', async () => { - it('should return the connected ISafeProvider', async () => { + it('should return the connected SafeProvider', async () => { const { safe, accounts, contractNetworks } = await setupTests() const [account1] = accounts const provider = getEip1193Provider() diff --git a/packages/protocol-kit/tests/e2e/safeFactory.test.ts b/packages/protocol-kit/tests/e2e/safeFactory.test.ts index a766d2512..79ff0f853 100644 --- a/packages/protocol-kit/tests/e2e/safeFactory.test.ts +++ b/packages/protocol-kit/tests/e2e/safeFactory.test.ts @@ -92,7 +92,7 @@ describe('SafeProxyFactory', () => { }) describe('getEip1193Provider', async () => { - it('should return the connected ISafeProvider', async () => { + it('should return the connected SafeProvider', async () => { const { accounts, contractNetworks } = await setupTests() const [account1] = accounts const provider = getEip1193Provider() diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index c8980fcf8..ba4c6891e 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -536,7 +536,7 @@ describe('Contract utils', () => { const { contractNetworks } = await setupTests() const safeVersion = safeVersionDeployed - // Create ISafeProvider instance + // Create SafeProvider instance const safeProvider = getSafeProviderFromNetwork('zksync') const chainId = await safeProvider.getChainId() const customContracts = contractNetworks[chainId.toString()] From 0896cf6648cb1c8e569f4ac1c8dc4c2b99e2c5bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 19 Apr 2024 12:04:43 +0200 Subject: [PATCH 030/112] Merge BaseContract and BaseContractEthers features --- .../protocol-kit/src/adapters/BaseContract.ts | 62 ------------------- ...{BaseContractEthers.ts => BaseContract.ts} | 44 ++++++++----- ...bilityFallbackHandlerBaseContractEthers.ts | 8 +-- .../CreateCallBaseContractEthers.ts | 8 +-- .../MultiSend/MultiSendBaseContractEthers.ts | 8 +-- .../MultiSendCallOnlyBaseContractEthers.ts | 8 +-- .../contracts/Safe/SafeBaseContractEthers.ts | 8 +-- .../SafeProxyFactoryBaseContractEthers.ts | 8 +-- .../SignMessageLibBaseContractEthers.ts | 8 +-- .../SimulateTxAccessorBaseContractEthers.ts | 8 +-- 10 files changed, 61 insertions(+), 109 deletions(-) delete mode 100644 packages/protocol-kit/src/adapters/BaseContract.ts rename packages/protocol-kit/src/adapters/ethers/contracts/{BaseContractEthers.ts => BaseContract.ts} (68%) diff --git a/packages/protocol-kit/src/adapters/BaseContract.ts b/packages/protocol-kit/src/adapters/BaseContract.ts deleted file mode 100644 index f57656aa0..000000000 --- a/packages/protocol-kit/src/adapters/BaseContract.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { contractName, getContractDeployment } from '@safe-global/protocol-kit/contracts/config' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' - -/** - * Abstract class BaseContract serves as a base for creating a 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 as BaseContractEthers, BaseContractWeb3, and BaseContractViem. - * It includes the core logic for selecting the appropriate ABI and the address from contract deployments. - * - * @template ContractAbiType - The ABI associated with the contract. - * - * Example subclasses extending this base class: - * - BaseContractEthers extends BaseContract - * - BaseContractWeb3 extends BaseContract - * - BaseContractViem extends BaseContract - */ -abstract class BaseContract { - contractAbi: ContractAbiType - contractAddress: string - - abstract contractName: contractName - abstract safeVersion: SafeVersion - - abstract contract: unknown // This needs to be implemented for each adapter. - abstract safeProvider: SafeProvider // This needs to be implemented for each adapter. - - /** - * Constructs a new BaseContract instance. - * - * @param contractName - The contract name. - * @param chainId - The chain ID of the contract. - * @param defaultAbi - The hardcoded ABI of the contract. - * @param safeVersion - The version of the contract. - * @param customContractAddress - Optional custom address for the contract. - * @param customContractAbi - Optional custom ABI for the contract. - * @throws Will throw an error if the contract address is invalid. - */ - constructor( - contractName: contractName, - chainId: bigint, - defaultAbi: ContractAbiType, - safeVersion: SafeVersion, - customContractAddress?: string, - customContractAbi?: ContractAbiType - ) { - const deployment = getContractDeployment(safeVersion, chainId, contractName) - - const contractAddress = customContractAddress || deployment?.defaultAddress - - if (!contractAddress) { - throw new Error(`Invalid ${contractName.replace('Version', '')} contract address`) - } - - this.contractAddress = contractAddress - this.contractAbi = - customContractAbi || - (deployment?.abi as ContractAbiType) || // this cast is required because abi is set as any[] in safe-deployments - defaultAbi // if no customAbi and no abi is present in the safe-deployments we use our hardcoded abi - } -} - -export default BaseContract diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/BaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/BaseContract.ts similarity index 68% rename from packages/protocol-kit/src/adapters/ethers/contracts/BaseContractEthers.ts rename to packages/protocol-kit/src/adapters/ethers/contracts/BaseContract.ts index d969d88fa..a4c42d532 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/BaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/BaseContract.ts @@ -1,8 +1,7 @@ import { Abi } from 'abitype' import { Contract, ContractRunner, InterfaceAbi } from 'ethers' -import { contractName } from '@safe-global/protocol-kit/contracts/config' -import BaseContract from '@safe-global/protocol-kit/adapters/BaseContract' +import { contractName, getContractDeployment } from '@safe-global/protocol-kit/contracts/config' import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { EncodeFunction, @@ -13,31 +12,32 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * Abstract class BaseContractEthers extends BaseContract to specifically integrate with the Ethers.js v6 library. + * Abstract class BaseContract * It is designed to be instantiated for different contracts. * * This abstract class sets up the Ethers v6 Contract object that interacts with the smart contract. * - * Subclasses of BaseContractEthers are expected to represent specific contracts. + * Subclasses of BaseContract are expected to represent specific contracts. * * @template ContractAbiType - The ABI type specific to the version of the contract, extending InterfaceAbi from Ethers. - * @extends BaseContract - Extends the generic BaseContract with Ethers-specific implementation. * * Example subclasses: - * - SafeBaseContractEthers extends BaseContractEthers - * - CreateCallBaseContractEthers extends BaseContractEthers - * - SafeProxyFactoryBaseContractEthers extends BaseContractEthers + * - SafeBaseContractEthers extends BaseContract + * - CreateCallBaseContractEthers extends BaseContract + * - SafeProxyFactoryBaseContractEthers extends BaseContract */ -abstract class BaseContractEthers< - ContractAbiType extends InterfaceAbi & Abi -> extends BaseContract { - contract!: Contract +class BaseContract { + contractAbi: ContractAbiType + contractAddress: string + contractName: contractName + safeVersion: SafeVersion safeProvider: SafeProvider + contract!: Contract runner?: ContractRunner | null /** * @constructor - * Constructs an instance of BaseContractEthers. + * Constructs an instance of BaseContract. * * @param contractName - The contract name. * @param chainId - The chain ID of the contract. @@ -57,7 +57,21 @@ abstract class BaseContractEthers< customContractAbi?: ContractAbiType, runner?: ContractRunner | null ) { - super(contractName, chainId, defaultAbi, safeVersion, customContractAddress, customContractAbi) + const deployment = getContractDeployment(safeVersion, chainId, contractName) + + const contractAddress = customContractAddress || deployment?.defaultAddress + + if (!contractAddress) { + throw new Error(`Invalid ${contractName.replace('Version', '')} contract address`) + } + + this.contractName = contractName + this.safeVersion = safeVersion + this.contractAddress = contractAddress + this.contractAbi = + customContractAbi || + (deployment?.abi as unknown as ContractAbiType) || // this cast is required because abi is set as any[] in safe-deployments + defaultAbi // if no customAbi and no abi is present in the safe-deployments we use our hardcoded abi this.runner = runner this.safeProvider = safeProvider @@ -89,4 +103,4 @@ abstract class BaseContractEthers< } } -export default BaseContractEthers +export default BaseContract diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts index 890072ffe..0a90fb1a3 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts @@ -2,18 +2,18 @@ import { Abi } from 'abitype' import { ContractRunner, InterfaceAbi } from 'ethers' import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' -import BaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContractEthers' +import BaseContract from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContract' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import { contractName } from '@safe-global/protocol-kit/contracts/config' /** - * Abstract class CompatibilityFallbackHandlerBaseContractEthers extends BaseContractEthers to specifically integrate with the CompatibilityFallbackHandler contract. + * Abstract class CompatibilityFallbackHandlerBaseContractEthers extends BaseContract to specifically integrate with the CompatibilityFallbackHandler contract. * It is designed to be instantiated for different versions of the Safe contract. * * Subclasses of CompatibilityFallbackHandlerBaseContractEthers are expected to represent specific versions of the contract. * * @template CompatibilityFallbackHandlerContractAbiType - The ABI type specific to the version of the CompatibilityFallbackHandler contract, extending InterfaceAbi from Ethers. - * @extends BaseContractEthers - Extends the generic BaseContractEthers. + * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: * - CompatibilityFallbackHandlerContract_v1_4_1_Ethers extends CompatibilityFallbackHandlerBaseContractEthers @@ -21,7 +21,7 @@ import { contractName } from '@safe-global/protocol-kit/contracts/config' */ abstract class CompatibilityFallbackHandlerBaseContractEthers< CompatibilityFallbackHandlerContractAbiType extends InterfaceAbi & Abi -> extends BaseContractEthers { +> extends BaseContract { contractName: contractName /** diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts index 4d4028545..107ffc298 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts @@ -2,18 +2,18 @@ import { Abi } from 'abitype' import { ContractRunner, InterfaceAbi } from 'ethers' import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' -import BaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContractEthers' +import BaseContract from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContract' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import { contractName } from '@safe-global/protocol-kit/contracts/config' /** - * Abstract class CreateCallBaseContractEthers extends BaseContractEthers to specifically integrate with the CreateCall contract. + * Abstract class CreateCallBaseContractEthers extends BaseContract to specifically integrate with the CreateCall contract. * It is designed to be instantiated for different versions of the Safe contract. * * Subclasses of CreateCallBaseContractEthers are expected to represent specific versions of the contract. * * @template CreateCallContractAbiType - The ABI type specific to the version of the CreateCall contract, extending InterfaceAbi from Ethers. - * @extends BaseContractEthers - Extends the generic BaseContractEthers. + * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: * - CreateCallContract_v1_4_1_Ethers extends CreateCallBaseContractEthers @@ -21,7 +21,7 @@ import { contractName } from '@safe-global/protocol-kit/contracts/config' */ abstract class CreateCallBaseContractEthers< CreateCallContractAbiType extends InterfaceAbi & Abi -> extends BaseContractEthers { +> extends BaseContract { contractName: contractName /** diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts index 85116286c..6ab9d10af 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts @@ -3,17 +3,17 @@ import { InterfaceAbi } from 'ethers' import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import BaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContractEthers' +import BaseContract from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContract' import { contractName } from '@safe-global/protocol-kit/contracts/config' /** - * Abstract class MultiSendBaseContractEthers extends BaseContractEthers to specifically integrate with the MultiSend contract. + * Abstract class MultiSendBaseContractEthers extends BaseContract to specifically integrate with the MultiSend contract. * It is designed to be instantiated for different versions of the MultiSend contract. * * Subclasses of MultiSendBaseContractEthers are expected to represent specific versions of the MultiSend contract. * * @template MultiSendContractAbiType - The ABI type specific to the version of the MultiSend contract, extending InterfaceAbi from Ethers. - * @extends BaseContractEthers - Extends the generic BaseContractEthers. + * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: * - MultiSendContract_v1_4_1_Ethers extends MultiSendBaseContractEthers @@ -21,7 +21,7 @@ import { contractName } from '@safe-global/protocol-kit/contracts/config' */ abstract class MultiSendBaseContractEthers< MultiSendContractAbiType extends InterfaceAbi & Abi -> extends BaseContractEthers { +> extends BaseContract { contractName: contractName /** diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts index 18287e8e2..d2dcbd219 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts @@ -3,17 +3,17 @@ import { InterfaceAbi } from 'ethers' import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import BaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContractEthers' +import BaseContract from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContract' import { contractName } from '@safe-global/protocol-kit/contracts/config' /** - * Abstract class MultiSendCallOnlyBaseContractEthers extends BaseContractEthers to specifically integrate with the MultiSendCallOnly contract. + * Abstract class MultiSendCallOnlyBaseContractEthers extends BaseContract to specifically integrate with the MultiSendCallOnly contract. * It is designed to be instantiated for different versions of the MultiSendCallOnly contract. * * Subclasses of MultiSendCallOnlyBaseContractEthers are expected to represent specific versions of the MultiSendCallOnly contract. * * @template MultiSendCallOnlyContractAbiType - The ABI type specific to the version of the MultiSendCallOnly contract, extending InterfaceAbi from Ethers. - * @extends BaseContractEthers - Extends the generic BaseContractEthers. + * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: * - MultiSendCallOnlyContract_v1_4_1_Ethers extends MultiSendCallOnlyBaseContractEthers @@ -21,7 +21,7 @@ import { contractName } from '@safe-global/protocol-kit/contracts/config' */ abstract class MultiSendCallOnlyBaseContractEthers< MultiSendCallOnlyContractAbiType extends InterfaceAbi & Abi -> extends BaseContractEthers { +> extends BaseContract { contractName: contractName /** diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts index a36b3df0a..465350337 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts @@ -3,17 +3,17 @@ import { InterfaceAbi } from 'ethers' import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import BaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContractEthers' +import BaseContract from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContract' import { contractName, safeDeploymentsL1ChainIds } from '@safe-global/protocol-kit/contracts/config' /** - * Abstract class SafeBaseContractEthers extends BaseContractEthers to specifically integrate with the Safe contract. + * Abstract class SafeBaseContractEthers extends BaseContract to specifically integrate with the Safe contract. * It is designed to be instantiated for different versions of the Safe contract. * * Subclasses of SafeBaseContractEthers are expected to represent specific versions of the Safe contract. * * @template SafeContractAbiType - The ABI type specific to the version of the Safe contract, extending InterfaceAbi from Ethers. - * @extends BaseContractEthers - Extends the generic BaseContractEthers. + * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: * - SafeContract_v1_4_1_Ethers extends SafeBaseContractEthers @@ -24,7 +24,7 @@ import { contractName, safeDeploymentsL1ChainIds } from '@safe-global/protocol-k */ abstract class SafeBaseContractEthers< SafeContractAbiType extends InterfaceAbi & Abi -> extends BaseContractEthers { +> extends BaseContract { contractName: contractName /** diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts index 4fd669288..dc475f84f 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts @@ -1,7 +1,7 @@ import { Abi } from 'abitype' import { ContractRunner, InterfaceAbi } from 'ethers' import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' -import BaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContractEthers' +import BaseContract from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContract' import { SafeVersion, EthersTransactionOptions, @@ -14,13 +14,13 @@ export interface CreateProxyProps extends CreateProxyPropsGeneral { } /** - * Abstract class SafeProxyFactoryBaseContractEthers extends BaseContractEthers to specifically integrate with the SafeProxyFactory contract. + * Abstract class SafeProxyFactoryBaseContractEthers extends BaseContract to specifically integrate with the SafeProxyFactory contract. * It is designed to be instantiated for different versions of the Safe contract. * * Subclasses of SafeProxyFactoryBaseContractEthers are expected to represent specific versions of the contract. * * @template SafeProxyFactoryContractAbiType - The ABI type specific to the version of the Safe Proxy Factory contract, extending InterfaceAbi from Ethers. - * @extends BaseContractEthers - Extends the generic BaseContractEthers. + * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: * - SafeProxyFactoryContract_v1_4_1_Ethers extends SafeProxyFactoryBaseContractEthers @@ -31,7 +31,7 @@ export interface CreateProxyProps extends CreateProxyPropsGeneral { */ abstract class SafeProxyFactoryBaseContractEthers< SafeProxyFactoryContractAbiType extends InterfaceAbi & Abi -> extends BaseContractEthers { +> extends BaseContract { contractName: contractName /** diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts index ddef94104..0f5e047fc 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts @@ -3,17 +3,17 @@ import { InterfaceAbi } from 'ethers' import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import BaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContractEthers' +import BaseContract from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContract' import { contractName } from '@safe-global/protocol-kit/contracts/config' /** - * Abstract class SignMessageLibBaseContractEthers extends BaseContractEthers to specifically integrate with the SignMessageLib contract. + * Abstract class SignMessageLibBaseContractEthers extends BaseContract to specifically integrate with the SignMessageLib contract. * It is designed to be instantiated for different versions of the SignMessageLib contract. * * Subclasses of SignMessageLibBaseContractEthers are expected to represent specific versions of the SignMessageLib contract. * * @template SignMessageLibContractAbiType - The ABI type specific to the version of the SignMessageLib contract, extending InterfaceAbi from Ethers. - * @extends BaseContractEthers - Extends the generic BaseContractEthers. + * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: * - SignMessageLibContract_v1_4_1_Ethers extends SignMessageLibBaseContractEthers @@ -21,7 +21,7 @@ import { contractName } from '@safe-global/protocol-kit/contracts/config' */ abstract class SignMessageLibBaseContractEthers< SignMessageLibContractAbiType extends InterfaceAbi & Abi -> extends BaseContractEthers { +> extends BaseContract { contractName: contractName /** diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts index cdeb1643c..7db27c019 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts +++ b/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts @@ -1,19 +1,19 @@ import { Abi } from 'abitype' import { ContractRunner, InterfaceAbi } from 'ethers' -import BaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContractEthers' +import BaseContract from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContract' import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import { contractName } from '@safe-global/protocol-kit/contracts/config' /** - * Abstract class SimulateTxAccessorBaseContractEthers extends BaseContractEthers to specifically integrate with the SimulateTxAccessor contract. + * Abstract class SimulateTxAccessorBaseContractEthers extends BaseContract to specifically integrate with the SimulateTxAccessor contract. * It is designed to be instantiated for different versions of the Safe contract. * * Subclasses of SimulateTxAccessorBaseContractEthers are expected to represent specific versions of the contract. * * @template SimulateTxAccessorContractAbiType - The ABI type specific to the version of the SimulateTxAccessor contract, extending InterfaceAbi from Ethers. - * @extends BaseContractEthers - Extends the generic BaseContractEthers. + * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: * - SimulateTxAccessorContract_v1_4_1_Ethers extends SimulateTxAccessorBaseContractEthers @@ -21,7 +21,7 @@ import { contractName } from '@safe-global/protocol-kit/contracts/config' */ abstract class SimulateTxAccessorBaseContractEthers< SimulateTxAccessorContractAbiType extends InterfaceAbi & Abi -> extends BaseContractEthers { +> extends BaseContract { contractName: contractName /** From 1dd2b16e1c96093f3db2ecf37e8c24ac90a6e62a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 19 Apr 2024 12:09:37 +0200 Subject: [PATCH 031/112] Merge types in the same file --- packages/protocol-kit/src/Safe.ts | 2 +- .../protocol-kit/src/adapters/ethAdapter.ts | 29 ------------------- .../src/adapters/ethers/SafeProvider.ts | 6 +++- .../protocol-kit/src/safeFactory/index.ts | 2 +- packages/protocol-kit/src/types/index.ts | 28 +++++++++++++++++- 5 files changed, 34 insertions(+), 33 deletions(-) diff --git a/packages/protocol-kit/src/Safe.ts b/packages/protocol-kit/src/Safe.ts index 4ba8fd771..35d4fe578 100644 --- a/packages/protocol-kit/src/Safe.ts +++ b/packages/protocol-kit/src/Safe.ts @@ -30,6 +30,7 @@ import { AddOwnerTxParams, ConnectSafeConfig, CreateTransactionProps, + Eip1193Provider, PredictedSafeProps, RemoveOwnerTxParams, SafeConfig, @@ -70,7 +71,6 @@ import { import SafeMessage from './utils/messages/SafeMessage' import semverSatisfies from 'semver/functions/satisfies' import { SafeProvider } from './adapters/ethers' -import { Eip1193Provider } from './adapters/ethAdapter' const EQ_OR_GT_1_4_1 = '>=1.4.1' const EQ_OR_GT_1_3_0 = '>=1.3.0' diff --git a/packages/protocol-kit/src/adapters/ethAdapter.ts b/packages/protocol-kit/src/adapters/ethAdapter.ts index 811e9cf1b..e69de29bb 100644 --- a/packages/protocol-kit/src/adapters/ethAdapter.ts +++ b/packages/protocol-kit/src/adapters/ethAdapter.ts @@ -1,29 +0,0 @@ -import { JsonFragment } from 'ethers' -import { SafeVersion } from '@safe-global/safe-core-sdk-types' - -export type RequestArguments = { - readonly method: string - readonly params?: readonly unknown[] | object -} - -export interface Eip1193Provider { - request: (args: RequestArguments) => Promise -} - -export interface SafeProviderTransaction { - to: string - from: string - data: string - value?: string - gasPrice?: number | string - gasLimit?: number | string - maxFeePerGas?: number | string - maxPriorityFeePerGas?: number | string -} - -export interface GetContractProps { - safeVersion: SafeVersion - customContractAddress?: string - customContractAbi?: JsonFragment | JsonFragment[] - isL1SafeSingleton?: boolean -} diff --git a/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts b/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts index 558d7b464..cee828a43 100644 --- a/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts +++ b/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts @@ -24,7 +24,11 @@ import { getSimulateTxAccessorContractInstance } from './contracts/contractInstancesEthers' import { isTypedDataSigner } from './utils' -import { SafeProviderTransaction, GetContractProps, Eip1193Provider } from '../ethAdapter' +import { + SafeProviderTransaction, + GetContractProps, + Eip1193Provider +} from '@safe-global/protocol-kit/types' export interface SafeProviderConfig { /** signerOrProvider - Ethers signer or provider */ diff --git a/packages/protocol-kit/src/safeFactory/index.ts b/packages/protocol-kit/src/safeFactory/index.ts index a3e02d5a8..79135c1e7 100644 --- a/packages/protocol-kit/src/safeFactory/index.ts +++ b/packages/protocol-kit/src/safeFactory/index.ts @@ -20,7 +20,7 @@ import { } from '@safe-global/protocol-kit/types' import { SafeVersion, TransactionOptions } from '@safe-global/safe-core-sdk-types' import { SafeProvider } from '../adapters/ethers' -import { Eip1193Provider } from '../adapters/ethAdapter' +import { Eip1193Provider } from '@safe-global/protocol-kit/types' export interface DeploySafeProps { safeAccountConfig: SafeAccountConfig diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index a08a40828..e57d0617a 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -27,7 +27,6 @@ import SimulateTxAccessorContract_v1_3_0_Ethers from '../adapters/ethers/contrac import SimulateTxAccessorContract_v1_4_1_Ethers from '../adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers' import CreateCallContract_v1_3_0_Ethers from '../adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers' import CreateCallContract_v1_4_1_Ethers from '../adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers' -import { Eip1193Provider } from '../adapters/ethAdapter' export interface SafeAccountConfig { owners: string[] @@ -332,3 +331,30 @@ export type CreateCallContract_v1_4_1_ImplementationType = CreateCallContract_v1 export type CreateCallContractImplementationType = | CreateCallContract_v1_3_0_ImplementationType | CreateCallContract_v1_4_1_ImplementationType + +export type RequestArguments = { + readonly method: string + readonly params?: readonly unknown[] | object +} + +export interface Eip1193Provider { + request: (args: RequestArguments) => Promise +} + +export interface SafeProviderTransaction { + to: string + from: string + data: string + value?: string + gasPrice?: number | string + gasLimit?: number | string + maxFeePerGas?: number | string + maxPriorityFeePerGas?: number | string +} + +export interface GetContractProps { + safeVersion: SafeVersion + customContractAddress?: string + customContractAbi?: JsonFragment | JsonFragment[] + isL1SafeSingleton?: boolean +} From 22fcd6993fc014521aad3cf9e49bb17b7aa1aa53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 19 Apr 2024 12:11:11 +0200 Subject: [PATCH 032/112] Remove file --- packages/protocol-kit/src/adapters/ethAdapter.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 packages/protocol-kit/src/adapters/ethAdapter.ts diff --git a/packages/protocol-kit/src/adapters/ethAdapter.ts b/packages/protocol-kit/src/adapters/ethAdapter.ts deleted file mode 100644 index e69de29bb..000000000 From bd1272d8a3bd14e35fd49b8ed9e348fe8bf2393a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 19 Apr 2024 12:11:56 +0200 Subject: [PATCH 033/112] Remove unnecessary README --- .../src/adapters/ethers/README.md | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 packages/protocol-kit/src/adapters/ethers/README.md diff --git a/packages/protocol-kit/src/adapters/ethers/README.md b/packages/protocol-kit/src/adapters/ethers/README.md deleted file mode 100644 index 9c0429941..000000000 --- a/packages/protocol-kit/src/adapters/ethers/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Ethers Adapter - -Ethers.js wrapper that contains some utilities and the Safe contracts types. It is used to initialize the [Protocol Kit](https://github.com/safe-global/safe-core-sdk/tree/main/packages/protocol-kit). - -## How to use - -If the app integrating the SDK is using `ethers`, create an instance of the `EthersAdapter`, where `signer` is the Ethereum account we are connecting and the one who will sign the transactions. - -> :warning: **NOTE**: Currently only `ethers` `v6` is supported. - -```js -import { ethers } from 'ethers' -import { EthersAdapter } from '@safe-global/protocol-kit' - -const web3Provider = // ... -const provider = new ethers.BrowserProvider(web3Provider) -const safeOwner = provider.getSigner(0) - -const ethAdapter = new EthersAdapter({ - ethers, - signerOrProvider: safeOwner -}) -``` - -Depending on whether the `ethAdapter` instance is used to sign/execute transactions or just call read-only methods, the `signerOrProvider` property can be a `Signer` or a `Provider`. From ea8de961f902f157bbbb42ba1faa8f4b02c0940c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 19 Apr 2024 13:01:15 +0200 Subject: [PATCH 034/112] Merge some directories --- packages/protocol-kit/src/Safe.ts | 2 +- .../src/{adapters/ethers => }/SafeProvider.ts | 3 +- .../protocol-kit/src/adapters/ethers/index.ts | 18 ------- .../src/adapters/ethers/utils/index.ts | 35 ------------- .../ethers => }/contracts/BaseContract.ts | 2 +- ...bilityFallbackHandlerBaseContractEthers.ts | 4 +- ...tyFallbackHandlerContract_v1_3_0_Ethers.ts | 4 +- ...tyFallbackHandlerContract_v1_4_1_Ethers.ts | 4 +- .../CreateCallBaseContractEthers.ts | 4 +- .../CreateCallContract_v1_3_0_Ethers.ts | 6 +-- .../CreateCallContract_v1_4_1_Ethers.ts | 6 +-- .../MultiSend/MultiSendBaseContractEthers.ts | 4 +- .../MultiSendCallOnlyBaseContractEthers.ts | 4 +- .../v1.1.1/MultiSendContract_v1_1_1_Ethers.ts | 4 +- ...MultiSendCallOnlyContract_v1_3_0_Ethers.ts | 4 +- .../v1.3.0/MultiSendContract_v1_3_0_Ethers.ts | 4 +- ...MultiSendCallOnlyContract_v1_4_1_Ethers.ts | 4 +- .../v1.4.1/MultiSendContract_v1_4_1_Ethers.ts | 4 +- .../contracts/Safe/SafeBaseContractEthers.ts | 4 +- .../Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts | 6 +-- .../Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts | 6 +-- .../Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts | 6 +-- .../Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts | 8 +-- .../Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts | 8 +-- .../SafeProxyFactoryBaseContractEthers.ts | 4 +- .../SafeProxyFactoryContract_v1_0_0_Ethers.ts | 4 +- .../SafeProxyFactoryContract_v1_1_1_Ethers.ts | 4 +- .../SafeProxyFactoryContract_v1_3_0_Ethers.ts | 4 +- .../SafeProxyFactoryContract_v1_4_1_Ethers.ts | 4 +- .../SignMessageLibBaseContractEthers.ts | 4 +- .../SignMessageLibContract_v1_3_0_Ethers.ts | 7 ++- .../SignMessageLibContract_v1_4_1_Ethers.ts | 6 +-- .../SimulateTxAccessorBaseContractEthers.ts | 4 +- ...imulateTxAccessorContract_v1_3_0_Ethers.ts | 4 +- ...imulateTxAccessorContract_v1_4_1_Ethers.ts | 4 +- .../ethers/utils => contracts}/constants.ts | 0 .../contracts/contractInstancesEthers.ts | 0 packages/protocol-kit/src/contracts/index.ts | 18 +++++++ .../src/contracts/safeDeploymentContracts.ts | 2 +- packages/protocol-kit/src/contracts/utils.ts | 51 +++++++++++++++++-- packages/protocol-kit/src/index.ts | 2 +- .../src/managers/contractManager.ts | 2 +- .../src/managers/fallbackHandlerManager.ts | 2 +- .../protocol-kit/src/managers/guardManager.ts | 2 +- .../src/managers/moduleManager.ts | 2 +- .../protocol-kit/src/managers/ownerManager.ts | 2 +- .../protocol-kit/src/safeFactory/index.ts | 2 +- packages/protocol-kit/src/types/index.ts | 44 ++++++++-------- .../src/utils/signatures/utils.ts | 2 +- .../src/utils/transactions/gas.ts | 2 +- .../tests/e2e/utils/transactions.ts | 2 +- .../tests/e2e/utilsContracts.test.ts | 2 +- 52 files changed, 175 insertions(+), 165 deletions(-) rename packages/protocol-kit/src/{adapters/ethers => }/SafeProvider.ts (98%) delete mode 100644 packages/protocol-kit/src/adapters/ethers/index.ts delete mode 100644 packages/protocol-kit/src/adapters/ethers/utils/index.ts rename packages/protocol-kit/src/{adapters/ethers => }/contracts/BaseContract.ts (97%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts (94%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers.ts (91%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers.ts (91%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/CreateCall/CreateCallBaseContractEthers.ts (93%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts (93%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts (93%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/MultiSend/MultiSendBaseContractEthers.ts (93%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts (93%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers.ts (92%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers.ts (92%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts (92%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers.ts (92%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers.ts (92%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/Safe/SafeBaseContractEthers.ts (94%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts (97%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts (97%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts (97%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts (96%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts (96%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts (94%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts (96%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts (96%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts (96%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts (96%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts (93%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts (92%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts (92%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts (93%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts (93%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts (93%) rename packages/protocol-kit/src/{adapters/ethers/utils => contracts}/constants.ts (100%) rename packages/protocol-kit/src/{adapters/ethers => }/contracts/contractInstancesEthers.ts (100%) create mode 100644 packages/protocol-kit/src/contracts/index.ts diff --git a/packages/protocol-kit/src/Safe.ts b/packages/protocol-kit/src/Safe.ts index 35d4fe578..1ea0eb617 100644 --- a/packages/protocol-kit/src/Safe.ts +++ b/packages/protocol-kit/src/Safe.ts @@ -70,7 +70,7 @@ import { } from './contracts/safeDeploymentContracts' import SafeMessage from './utils/messages/SafeMessage' import semverSatisfies from 'semver/functions/satisfies' -import { SafeProvider } from './adapters/ethers' +import SafeProvider from './SafeProvider' const EQ_OR_GT_1_4_1 = '>=1.4.1' const EQ_OR_GT_1_3_0 = '>=1.3.0' diff --git a/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts b/packages/protocol-kit/src/SafeProvider.ts similarity index 98% rename from packages/protocol-kit/src/adapters/ethers/SafeProvider.ts rename to packages/protocol-kit/src/SafeProvider.ts index cee828a43..e04bc171c 100644 --- a/packages/protocol-kit/src/adapters/ethers/SafeProvider.ts +++ b/packages/protocol-kit/src/SafeProvider.ts @@ -7,6 +7,8 @@ import { JsonRpcProvider } from 'ethers' import { generateTypedData, validateEip3770Address } from '@safe-global/protocol-kit/utils' +import { isTypedDataSigner } from '@safe-global/protocol-kit/contracts/utils' + import { EIP712TypedDataMessage, EIP712TypedDataTx, @@ -23,7 +25,6 @@ import { getSignMessageLibContractInstance, getSimulateTxAccessorContractInstance } from './contracts/contractInstancesEthers' -import { isTypedDataSigner } from './utils' import { SafeProviderTransaction, GetContractProps, diff --git a/packages/protocol-kit/src/adapters/ethers/index.ts b/packages/protocol-kit/src/adapters/ethers/index.ts deleted file mode 100644 index 3495d3d8c..000000000 --- a/packages/protocol-kit/src/adapters/ethers/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -import SafeProvider, { SafeProviderConfig } from './SafeProvider' -import CreateCallBaseContractEthers from './contracts/CreateCall/CreateCallBaseContractEthers' -import MultiSendBaseContractEthers from './contracts/MultiSend/MultiSendBaseContractEthers' -import MultiSendCallOnlyBaseContractEthers from './contracts/MultiSend/MultiSendCallOnlyBaseContractEthers' -import SafeBaseContractEthers from './contracts/Safe/SafeBaseContractEthers' -import SafeProxyFactoryBaseContractEthers from './contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' -import SignMessageLibBaseContractEthers from './contracts/SignMessageLib/SignMessageLibBaseContractEthers' - -export { - CreateCallBaseContractEthers, - SafeProvider, - SafeProviderConfig, - MultiSendCallOnlyBaseContractEthers, - MultiSendBaseContractEthers, - SafeBaseContractEthers, - SafeProxyFactoryBaseContractEthers, - SignMessageLibBaseContractEthers -} diff --git a/packages/protocol-kit/src/adapters/ethers/utils/index.ts b/packages/protocol-kit/src/adapters/ethers/utils/index.ts deleted file mode 100644 index bb5990898..000000000 --- a/packages/protocol-kit/src/adapters/ethers/utils/index.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { ContractTransactionResponse, Provider, AbstractSigner } from 'ethers' -import { EthersTransactionOptions, EthersTransactionResult } from '@safe-global/safe-core-sdk-types' -export function sameString(str1: string, str2: string): boolean { - return str1.toLowerCase() === str2.toLowerCase() -} - -export function toTxResult( - transactionResponse: ContractTransactionResponse, - options?: EthersTransactionOptions -): EthersTransactionResult { - return { - hash: transactionResponse.hash, - options, - transactionResponse - } -} - -export function isTypedDataSigner(signer: any): signer is AbstractSigner { - return (signer as unknown as AbstractSigner).signTypedData !== undefined -} - -/** - * Check if the signerOrProvider is compatible with `Signer` - * @param signerOrProvider - Signer or provider - * @returns true if the parameter is compatible with `Signer` - */ -export function isSignerCompatible(signerOrProvider: AbstractSigner | Provider): boolean { - const candidate = signerOrProvider as AbstractSigner - - const isSigntransactionCompatible = typeof candidate.signTransaction === 'function' - const isSignMessageCompatible = typeof candidate.signMessage === 'function' - const isGetAddressCompatible = typeof candidate.getAddress === 'function' - - return isSigntransactionCompatible && isSignMessageCompatible && isGetAddressCompatible -} diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/BaseContract.ts b/packages/protocol-kit/src/contracts/BaseContract.ts similarity index 97% rename from packages/protocol-kit/src/adapters/ethers/contracts/BaseContract.ts rename to packages/protocol-kit/src/contracts/BaseContract.ts index a4c42d532..32545b27e 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/BaseContract.ts +++ b/packages/protocol-kit/src/contracts/BaseContract.ts @@ -2,7 +2,7 @@ import { Abi } from 'abitype' import { Contract, ContractRunner, InterfaceAbi } from 'ethers' import { contractName, getContractDeployment } from '@safe-global/protocol-kit/contracts/config' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { EncodeFunction, EstimateGasFunction, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts similarity index 94% rename from packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts rename to packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts index 0a90fb1a3..da2a48f50 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts +++ b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts @@ -1,8 +1,8 @@ import { Abi } from 'abitype' import { ContractRunner, InterfaceAbi } from 'ethers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' -import BaseContract from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContract' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' +import BaseContract from '@safe-global/protocol-kit/contracts/BaseContract' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import { contractName } from '@safe-global/protocol-kit/contracts/config' diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers.ts similarity index 91% rename from packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers.ts rename to packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers.ts index e53f12f09..fd5bc6955 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers.ts @@ -1,5 +1,5 @@ -import CompatibilityFallbackHandlerBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import CompatibilityFallbackHandlerBaseContractEthers from '@safe-global/protocol-kit/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, CompatibilityFallbackHandlerContract_v1_3_0_Abi, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers.ts similarity index 91% rename from packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers.ts rename to packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers.ts index 2b3b9c017..fc1ce0a61 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers.ts @@ -1,5 +1,5 @@ -import CompatibilityFallbackHandlerBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import CompatibilityFallbackHandlerBaseContractEthers from '@safe-global/protocol-kit/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { compatibilityFallbackHandler_1_4_1_ContractArtifacts, CompatibilityFallbackHandlerContract_v1_4_1_Abi, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts b/packages/protocol-kit/src/contracts/CreateCall/CreateCallBaseContractEthers.ts similarity index 93% rename from packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts rename to packages/protocol-kit/src/contracts/CreateCall/CreateCallBaseContractEthers.ts index 107ffc298..31fb81293 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers.ts +++ b/packages/protocol-kit/src/contracts/CreateCall/CreateCallBaseContractEthers.ts @@ -1,8 +1,8 @@ import { Abi } from 'abitype' import { ContractRunner, InterfaceAbi } from 'ethers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' -import BaseContract from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContract' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' +import BaseContract from '@safe-global/protocol-kit/contracts/BaseContract' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import { contractName } from '@safe-global/protocol-kit/contracts/config' diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts similarity index 93% rename from packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts rename to packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts index 7613bda83..737a3f498 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts @@ -1,4 +1,4 @@ -import CreateCallBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers' +import CreateCallBaseContractEthers from '@safe-global/protocol-kit/contracts/CreateCall/CreateCallBaseContractEthers' import { SafeVersion, CreateCallContract_v1_3_0_Abi, @@ -7,8 +7,8 @@ import { AdapterSpecificContractFunction, EthersTransactionOptions } from '@safe-global/safe-core-sdk-types' -import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' /** * CreateCallContract_v1_3_0_Ethers is the implementation specific to the CreateCall contract version 1.3.0. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts similarity index 93% rename from packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts rename to packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts index a0c91d682..eef986748 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts @@ -1,5 +1,5 @@ -import CreateCallBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/CreateCall/CreateCallBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import CreateCallBaseContractEthers from '@safe-global/protocol-kit/contracts/CreateCall/CreateCallBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, CreateCallContract_v1_4_1_Abi, @@ -8,7 +8,7 @@ import { AdapterSpecificContractFunction, EthersTransactionOptions } from '@safe-global/safe-core-sdk-types' -import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' +import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' /** * CreateCallContract_v1_4_1_Ethers is the implementation specific to the CreateCall contract version 1.4.1. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts b/packages/protocol-kit/src/contracts/MultiSend/MultiSendBaseContractEthers.ts similarity index 93% rename from packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts rename to packages/protocol-kit/src/contracts/MultiSend/MultiSendBaseContractEthers.ts index 6ab9d10af..3858f79de 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/MultiSendBaseContractEthers.ts @@ -1,9 +1,9 @@ import { Abi } from 'abitype' import { InterfaceAbi } from 'ethers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import BaseContract from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContract' +import BaseContract from '@safe-global/protocol-kit/contracts/BaseContract' import { contractName } from '@safe-global/protocol-kit/contracts/config' /** diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts b/packages/protocol-kit/src/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts similarity index 93% rename from packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts rename to packages/protocol-kit/src/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts index d2dcbd219..8a6d68e46 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts @@ -1,9 +1,9 @@ import { Abi } from 'abitype' import { InterfaceAbi } from 'ethers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import BaseContract from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContract' +import BaseContract from '@safe-global/protocol-kit/contracts/BaseContract' import { contractName } from '@safe-global/protocol-kit/contracts/config' /** diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers.ts similarity index 92% rename from packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers.ts rename to packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers.ts index 3f18eb789..226c30cb0 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers.ts @@ -1,5 +1,5 @@ -import MultiSendBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import MultiSendBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, multisend_1_1_1_ContractArtifacts, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers.ts similarity index 92% rename from packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers.ts rename to packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers.ts index 8731b467f..66148b4bd 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers.ts @@ -1,5 +1,5 @@ -import MultiSendCallOnlyBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import MultiSendCallOnlyBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, MultiSendCallOnlyContract_v1_3_0_Abi, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts similarity index 92% rename from packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts rename to packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts index 94f479733..449f6721c 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts @@ -1,5 +1,5 @@ -import MultiSendBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import MultiSendBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, multisend_1_3_0_ContractArtifacts, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers.ts similarity index 92% rename from packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers.ts rename to packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers.ts index 14b26e2c3..71786388d 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers.ts @@ -1,5 +1,5 @@ -import MultiSendCallOnlyBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import MultiSendCallOnlyBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, multiSendCallOnly_1_4_1_ContractArtifacts, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers.ts similarity index 92% rename from packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers.ts rename to packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers.ts index f37c262b9..9c9c2b31e 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers.ts @@ -1,5 +1,5 @@ -import MultiSendBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/MultiSendBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import MultiSendBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, MultiSendContract_v1_4_1_Abi, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts b/packages/protocol-kit/src/contracts/Safe/SafeBaseContractEthers.ts similarity index 94% rename from packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts rename to packages/protocol-kit/src/contracts/Safe/SafeBaseContractEthers.ts index 465350337..d3bd73168 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/SafeBaseContractEthers.ts +++ b/packages/protocol-kit/src/contracts/Safe/SafeBaseContractEthers.ts @@ -1,9 +1,9 @@ import { Abi } from 'abitype' import { InterfaceAbi } from 'ethers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import BaseContract from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContract' +import BaseContract from '@safe-global/protocol-kit/contracts/BaseContract' import { contractName, safeDeploymentsL1ChainIds } from '@safe-global/protocol-kit/contracts/config' /** diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts b/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts similarity index 97% rename from packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts rename to packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts index 5e5dfc3d1..e83b2d9e9 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts @@ -1,6 +1,6 @@ -import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' -import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' +import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' +import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' import { sameString } from '@safe-global/protocol-kit/utils' import { SafeVersion, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts b/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts similarity index 97% rename from packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts rename to packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts index 7b47d2551..f112a1930 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts @@ -1,6 +1,6 @@ -import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' -import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' +import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' +import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' import { sameString } from '@safe-global/protocol-kit/utils' import { SafeVersion, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts b/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts similarity index 97% rename from packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts rename to packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts index 646daee79..394625928 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts @@ -1,6 +1,6 @@ -import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' -import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' +import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' +import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' import { SafeVersion, SafeContract_v1_2_0_Abi, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts similarity index 96% rename from packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts rename to packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts index 8e9ff9aa1..681b526a9 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts @@ -1,7 +1,7 @@ -import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' -import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' -import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/adapters/ethers/utils/constants' +import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' +import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' +import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/utils/constants' import { SafeVersion, SafeContract_v1_3_0_Abi, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts similarity index 96% rename from packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts rename to packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts index 232e990ef..e761e0822 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts @@ -1,7 +1,7 @@ -import SafeBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/SafeBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' -import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' -import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/adapters/ethers/utils/constants' +import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' +import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' +import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/utils/constants' import { SafeVersion, SafeContract_v1_4_1_Abi, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts similarity index 94% rename from packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts rename to packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts index dc475f84f..c5b7368ac 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts @@ -1,7 +1,7 @@ import { Abi } from 'abitype' import { ContractRunner, InterfaceAbi } from 'ethers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' -import BaseContract from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContract' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' +import BaseContract from '@safe-global/protocol-kit/contracts/BaseContract' import { SafeVersion, EthersTransactionOptions, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts similarity index 96% rename from packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts rename to packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts index beeb03b98..8b47d18a1 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts @@ -1,8 +1,8 @@ import { ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers, { CreateProxyProps -} from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +} from '@safe-global/protocol-kit/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, SafeProxyFactoryContract_v1_0_0_Abi, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts similarity index 96% rename from packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts rename to packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts index b6eb4626a..5c006910f 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts @@ -1,8 +1,8 @@ import { ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers, { CreateProxyProps -} from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +} from '@safe-global/protocol-kit/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, SafeProxyFactoryContract_v1_1_1_Abi, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts similarity index 96% rename from packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts rename to packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts index 4802391cc..8d86733df 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts @@ -1,8 +1,8 @@ import { ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers, { CreateProxyProps -} from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +} from '@safe-global/protocol-kit/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, SafeProxyFactoryContract_v1_3_0_Abi, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts similarity index 96% rename from packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts rename to packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts index 321ae9b4e..cfb65d15b 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts @@ -1,7 +1,7 @@ import { ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers, { CreateProxyProps -} from '@safe-global/protocol-kit/adapters/ethers/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' +} from '@safe-global/protocol-kit/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' import { SafeVersion, SafeProxyFactoryContract_v1_4_1_Abi, @@ -9,7 +9,7 @@ import { SafeProxyFactoryContract_v1_4_1_Function, safeProxyFactory_1_4_1_ContractArtifacts } from '@safe-global/safe-core-sdk-types' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' /** * SafeProxyFactoryContract_v1_4_1_Ethers is the implementation specific to the Safe Proxy Factory contract version 1.4.1. diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts b/packages/protocol-kit/src/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts similarity index 93% rename from packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts rename to packages/protocol-kit/src/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts index 0f5e047fc..c25a069f9 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts +++ b/packages/protocol-kit/src/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts @@ -1,9 +1,9 @@ import { Abi } from 'abitype' import { InterfaceAbi } from 'ethers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import BaseContract from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContract' +import BaseContract from '@safe-global/protocol-kit/contracts/BaseContract' import { contractName } from '@safe-global/protocol-kit/contracts/config' /** diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts similarity index 92% rename from packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts rename to packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts index c930c3fc2..1fd7804ef 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts @@ -1,6 +1,6 @@ -import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' -import SignMessageLibBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' +import SignMessageLibBaseContractEthers from '@safe-global/protocol-kit/contracts/SignMessageLib/SignMessageLibBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, AdapterSpecificContractFunction, @@ -46,7 +46,6 @@ class SignMessageLibContract_v1_3_0_Ethers this.safeVersion = safeVersion } - /** * @param args - Array[message] */ diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts similarity index 92% rename from packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts rename to packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts index aabeaae2a..e6b259abd 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts @@ -1,6 +1,6 @@ -import { toTxResult } from '@safe-global/protocol-kit/adapters/ethers/utils' -import SignMessageLibBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SignMessageLib/SignMessageLibBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' +import SignMessageLibBaseContractEthers from '@safe-global/protocol-kit/contracts/SignMessageLib/SignMessageLibBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, AdapterSpecificContractFunction, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts b/packages/protocol-kit/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts similarity index 93% rename from packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts rename to packages/protocol-kit/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts index 7db27c019..b85054c31 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts +++ b/packages/protocol-kit/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts @@ -1,8 +1,8 @@ import { Abi } from 'abitype' import { ContractRunner, InterfaceAbi } from 'ethers' -import BaseContract from '@safe-global/protocol-kit/adapters/ethers/contracts/BaseContract' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import BaseContract from '@safe-global/protocol-kit/contracts/BaseContract' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import { contractName } from '@safe-global/protocol-kit/contracts/config' diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts similarity index 93% rename from packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts rename to packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts index 9c38263dd..0c8381c4e 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts @@ -1,5 +1,5 @@ -import SimulateTxAccessorBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import SimulateTxAccessorBaseContractEthers from '@safe-global/protocol-kit/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, simulateTxAccessor_1_3_0_ContractArtifacts, diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts similarity index 93% rename from packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts rename to packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts index b171a0491..799b3266f 100644 --- a/packages/protocol-kit/src/adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts @@ -1,5 +1,5 @@ -import SimulateTxAccessorBaseContractEthers from '@safe-global/protocol-kit/adapters/ethers/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import SimulateTxAccessorBaseContractEthers from '@safe-global/protocol-kit/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, simulateTxAccessor_1_4_1_ContractArtifacts, diff --git a/packages/protocol-kit/src/adapters/ethers/utils/constants.ts b/packages/protocol-kit/src/contracts/constants.ts similarity index 100% rename from packages/protocol-kit/src/adapters/ethers/utils/constants.ts rename to packages/protocol-kit/src/contracts/constants.ts diff --git a/packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts b/packages/protocol-kit/src/contracts/contractInstancesEthers.ts similarity index 100% rename from packages/protocol-kit/src/adapters/ethers/contracts/contractInstancesEthers.ts rename to packages/protocol-kit/src/contracts/contractInstancesEthers.ts diff --git a/packages/protocol-kit/src/contracts/index.ts b/packages/protocol-kit/src/contracts/index.ts new file mode 100644 index 000000000..8f77aa03f --- /dev/null +++ b/packages/protocol-kit/src/contracts/index.ts @@ -0,0 +1,18 @@ +import SafeProvider, { SafeProviderConfig } from '../SafeProvider' +import CreateCallBaseContractEthers from './CreateCall/CreateCallBaseContractEthers' +import MultiSendBaseContractEthers from './MultiSend/MultiSendBaseContractEthers' +import MultiSendCallOnlyBaseContractEthers from './MultiSend/MultiSendCallOnlyBaseContractEthers' +import SafeBaseContractEthers from './Safe/SafeBaseContractEthers' +import SafeProxyFactoryBaseContractEthers from './SafeProxyFactory/SafeProxyFactoryBaseContractEthers' +import SignMessageLibBaseContractEthers from './SignMessageLib/SignMessageLibBaseContractEthers' + +export { + CreateCallBaseContractEthers, + SafeProvider, + SafeProviderConfig, + MultiSendCallOnlyBaseContractEthers, + MultiSendBaseContractEthers, + SafeBaseContractEthers, + SafeProxyFactoryBaseContractEthers, + SignMessageLibBaseContractEthers +} diff --git a/packages/protocol-kit/src/contracts/safeDeploymentContracts.ts b/packages/protocol-kit/src/contracts/safeDeploymentContracts.ts index 2a1332029..cff605dca 100644 --- a/packages/protocol-kit/src/contracts/safeDeploymentContracts.ts +++ b/packages/protocol-kit/src/contracts/safeDeploymentContracts.ts @@ -1,4 +1,4 @@ -import SafeProvider from '../adapters/ethers/SafeProvider' +import SafeProvider from '../SafeProvider' import { CompatibilityFallbackHandlerContractImplementationType, ContractNetworkConfig, diff --git a/packages/protocol-kit/src/contracts/utils.ts b/packages/protocol-kit/src/contracts/utils.ts index dbf6a41cf..878ec9585 100644 --- a/packages/protocol-kit/src/contracts/utils.ts +++ b/packages/protocol-kit/src/contracts/utils.ts @@ -1,9 +1,20 @@ -import { isAddress, zeroPadValue } from 'ethers' +import { + ContractTransactionResponse, + Provider, + AbstractSigner, + isAddress, + zeroPadValue +} from 'ethers' import { keccak_256 } from '@noble/hashes/sha3' import { DEFAULT_SAFE_VERSION } from '@safe-global/protocol-kit/contracts/config' import { EMPTY_DATA, ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' import { createMemoizedFunction } from '@safe-global/protocol-kit/utils/memoized' -import { SafeProxyFactoryContractType, SafeVersion } from '@safe-global/safe-core-sdk-types' +import { + SafeProxyFactoryContractType, + SafeVersion, + EthersTransactionOptions, + EthersTransactionResult +} from '@safe-global/safe-core-sdk-types' import { generateAddress2, keccak256, toBuffer } from 'ethereumjs-util' import semverSatisfies from 'semver/functions/satisfies' @@ -20,7 +31,7 @@ import { SafeContractImplementationType, SafeDeploymentConfig } from '../types' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' // keccak256(toUtf8Bytes('Safe Account Abstraction')) export const PREDETERMINED_SALT_NONCE = @@ -306,3 +317,37 @@ export function zkSyncEraCreate2Address( return addressBytes } + +export function sameString(str1: string, str2: string): boolean { + return str1.toLowerCase() === str2.toLowerCase() +} + +export function toTxResult( + transactionResponse: ContractTransactionResponse, + options?: EthersTransactionOptions +): EthersTransactionResult { + return { + hash: transactionResponse.hash, + options, + transactionResponse + } +} + +export function isTypedDataSigner(signer: any): signer is AbstractSigner { + return (signer as unknown as AbstractSigner).signTypedData !== undefined +} + +/** + * Check if the signerOrProvider is compatible with `Signer` + * @param signerOrProvider - Signer or provider + * @returns true if the parameter is compatible with `Signer` + */ +export function isSignerCompatible(signerOrProvider: AbstractSigner | Provider): boolean { + const candidate = signerOrProvider as AbstractSigner + + const isSigntransactionCompatible = typeof candidate.signTransaction === 'function' + const isSignMessageCompatible = typeof candidate.signMessage === 'function' + const isGetAddressCompatible = typeof candidate.getAddress === 'function' + + return isSigntransactionCompatible && isSignMessageCompatible && isGetAddressCompatible +} diff --git a/packages/protocol-kit/src/index.ts b/packages/protocol-kit/src/index.ts index a545c5c84..1dcc90b26 100644 --- a/packages/protocol-kit/src/index.ts +++ b/packages/protocol-kit/src/index.ts @@ -8,7 +8,7 @@ import { SafeBaseContractEthers, SafeProxyFactoryBaseContractEthers, SignMessageLibBaseContractEthers -} from './adapters/ethers' +} from './contracts' import { DEFAULT_SAFE_VERSION } from './contracts/config' import { getCompatibilityFallbackHandlerContract, diff --git a/packages/protocol-kit/src/managers/contractManager.ts b/packages/protocol-kit/src/managers/contractManager.ts index c8fc08679..26388e07b 100644 --- a/packages/protocol-kit/src/managers/contractManager.ts +++ b/packages/protocol-kit/src/managers/contractManager.ts @@ -13,7 +13,7 @@ import { } from '@safe-global/protocol-kit/types' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import { isSafeConfigWithPredictedSafe } from '../utils/types' -import SafeProvider from '../adapters/ethers/SafeProvider' +import SafeProvider from '../SafeProvider' class ContractManager { #contractNetworks?: ContractNetworksConfig diff --git a/packages/protocol-kit/src/managers/fallbackHandlerManager.ts b/packages/protocol-kit/src/managers/fallbackHandlerManager.ts index 01ec41f96..088581747 100644 --- a/packages/protocol-kit/src/managers/fallbackHandlerManager.ts +++ b/packages/protocol-kit/src/managers/fallbackHandlerManager.ts @@ -7,7 +7,7 @@ import { } from '@safe-global/protocol-kit/utils' import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' import { SafeContractImplementationType } from '@safe-global/protocol-kit/types' -import SafeProvider from '../adapters/ethers/SafeProvider' +import SafeProvider from '../SafeProvider' class FallbackHandlerManager { #safeProvider: SafeProvider diff --git a/packages/protocol-kit/src/managers/guardManager.ts b/packages/protocol-kit/src/managers/guardManager.ts index fe034bb78..9f82e96ac 100644 --- a/packages/protocol-kit/src/managers/guardManager.ts +++ b/packages/protocol-kit/src/managers/guardManager.ts @@ -7,7 +7,7 @@ import { } from '@safe-global/protocol-kit/utils' import { ZERO_ADDRESS } from '@safe-global/protocol-kit/utils/constants' import { SafeContractImplementationType } from '@safe-global/protocol-kit/types' -import SafeProvider from '../adapters/ethers/SafeProvider' +import SafeProvider from '../SafeProvider' class GuardManager { #safeProvider: SafeProvider diff --git a/packages/protocol-kit/src/managers/moduleManager.ts b/packages/protocol-kit/src/managers/moduleManager.ts index 7fb7c142b..e2a1525d5 100644 --- a/packages/protocol-kit/src/managers/moduleManager.ts +++ b/packages/protocol-kit/src/managers/moduleManager.ts @@ -1,7 +1,7 @@ import { isRestrictedAddress, sameString } from '@safe-global/protocol-kit/utils/address' import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/utils/constants' import { SafeContractImplementationType } from '@safe-global/protocol-kit/types' -import SafeProvider from '../adapters/ethers/SafeProvider' +import SafeProvider from '../SafeProvider' class ModuleManager { #safeProvider: SafeProvider diff --git a/packages/protocol-kit/src/managers/ownerManager.ts b/packages/protocol-kit/src/managers/ownerManager.ts index fe010abbf..4b40270d2 100644 --- a/packages/protocol-kit/src/managers/ownerManager.ts +++ b/packages/protocol-kit/src/managers/ownerManager.ts @@ -1,7 +1,7 @@ import { isRestrictedAddress, sameString } from '@safe-global/protocol-kit/utils/address' import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/utils/constants' import { SafeContractImplementationType } from '../types' -import SafeProvider from '../adapters/ethers/SafeProvider' +import SafeProvider from '../SafeProvider' class OwnerManager { #safeProvider: SafeProvider diff --git a/packages/protocol-kit/src/safeFactory/index.ts b/packages/protocol-kit/src/safeFactory/index.ts index 79135c1e7..5dad33aac 100644 --- a/packages/protocol-kit/src/safeFactory/index.ts +++ b/packages/protocol-kit/src/safeFactory/index.ts @@ -19,7 +19,7 @@ import { SafeProxyFactoryContractImplementationType } from '@safe-global/protocol-kit/types' import { SafeVersion, TransactionOptions } from '@safe-global/safe-core-sdk-types' -import { SafeProvider } from '../adapters/ethers' +import SafeProvider from '../SafeProvider' import { Eip1193Provider } from '@safe-global/protocol-kit/types' export interface DeploySafeProps { diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index e57d0617a..5eed026ab 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -5,28 +5,28 @@ import { SafeTransactionDataPartial, SafeVersion } from '@safe-global/safe-core-sdk-types' -import SafeContract_v1_0_0_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers' -import SafeContract_v1_1_1_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers' -import SafeContract_v1_2_0_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers' -import SafeContract_v1_3_0_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers' -import SafeContract_v1_4_1_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers' -import MultiSendContract_v1_1_1_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers' -import MultiSendContract_v1_3_0_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers' -import MultiSendContract_v1_4_1_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers' -import MultiSendCallOnlyContract_v1_4_1_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers' -import MultiSendCallOnlyContract_v1_3_0_Ethers from '@safe-global/protocol-kit/adapters/ethers/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers' -import CompatibilityFallbackHandlerContract_v1_3_0_Ethers from '../adapters/ethers/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers' -import CompatibilityFallbackHandlerContract_v1_4_1_Ethers from '../adapters/ethers/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers' -import SafeProxyFactoryContract_v1_0_0_Ethers from '../adapters/ethers/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers' -import SafeProxyFactoryContract_v1_1_1_Ethers from '../adapters/ethers/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers' -import SafeProxyFactoryContract_v1_3_0_Ethers from '../adapters/ethers/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers' -import SafeProxyFactoryContract_v1_4_1_Ethers from '../adapters/ethers/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers' -import SignMessageLibContract_v1_3_0_Ethers from '../adapters/ethers/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers' -import SignMessageLibContract_v1_4_1_Ethers from '../adapters/ethers/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers' -import SimulateTxAccessorContract_v1_3_0_Ethers from '../adapters/ethers/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers' -import SimulateTxAccessorContract_v1_4_1_Ethers from '../adapters/ethers/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers' -import CreateCallContract_v1_3_0_Ethers from '../adapters/ethers/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers' -import CreateCallContract_v1_4_1_Ethers from '../adapters/ethers/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers' +import SafeContract_v1_0_0_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers' +import SafeContract_v1_1_1_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers' +import SafeContract_v1_2_0_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers' +import SafeContract_v1_3_0_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers' +import SafeContract_v1_4_1_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers' +import MultiSendContract_v1_1_1_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers' +import MultiSendContract_v1_3_0_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers' +import MultiSendContract_v1_4_1_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers' +import MultiSendCallOnlyContract_v1_4_1_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers' +import MultiSendCallOnlyContract_v1_3_0_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers' +import CompatibilityFallbackHandlerContract_v1_3_0_Ethers from '../contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers' +import CompatibilityFallbackHandlerContract_v1_4_1_Ethers from '../contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers' +import SafeProxyFactoryContract_v1_0_0_Ethers from '../contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers' +import SafeProxyFactoryContract_v1_1_1_Ethers from '../contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers' +import SafeProxyFactoryContract_v1_3_0_Ethers from '../contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers' +import SafeProxyFactoryContract_v1_4_1_Ethers from '../contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers' +import SignMessageLibContract_v1_3_0_Ethers from '../contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers' +import SignMessageLibContract_v1_4_1_Ethers from '../contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers' +import SimulateTxAccessorContract_v1_3_0_Ethers from '../contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers' +import SimulateTxAccessorContract_v1_4_1_Ethers from '../contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers' +import CreateCallContract_v1_3_0_Ethers from '../contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers' +import CreateCallContract_v1_4_1_Ethers from '../contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers' export interface SafeAccountConfig { owners: string[] diff --git a/packages/protocol-kit/src/utils/signatures/utils.ts b/packages/protocol-kit/src/utils/signatures/utils.ts index d22affece..dcc26c477 100644 --- a/packages/protocol-kit/src/utils/signatures/utils.ts +++ b/packages/protocol-kit/src/utils/signatures/utils.ts @@ -1,5 +1,5 @@ import { ethers } from 'ethers' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeSignature, SafeEIP712Args, diff --git a/packages/protocol-kit/src/utils/transactions/gas.ts b/packages/protocol-kit/src/utils/transactions/gas.ts index df70faa9e..420d673be 100644 --- a/packages/protocol-kit/src/utils/transactions/gas.ts +++ b/packages/protocol-kit/src/utils/transactions/gas.ts @@ -1,7 +1,7 @@ import { OperationType, SafeVersion, SafeTransaction } from '@safe-global/safe-core-sdk-types' import semverSatisfies from 'semver/functions/satisfies' import Safe from '@safe-global/protocol-kit/Safe' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { ContractNetworksConfig, SafeContractImplementationType diff --git a/packages/protocol-kit/tests/e2e/utils/transactions.ts b/packages/protocol-kit/tests/e2e/utils/transactions.ts index 807791c79..c3f9a7a62 100644 --- a/packages/protocol-kit/tests/e2e/utils/transactions.ts +++ b/packages/protocol-kit/tests/e2e/utils/transactions.ts @@ -1,6 +1,6 @@ import { ContractTransactionReceipt } from 'ethers' import { TransactionResult } from '@safe-global/safe-core-sdk-types' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { TransactionReceipt } from 'web3-core/types' export async function waitSafeTxReceipt( diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index ba4c6891e..1f67400bd 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -16,7 +16,7 @@ import { ContractNetworksConfig } from '@safe-global/protocol-kit/types' import Safe, { SafeFactory, DeploySafeProps } from '@safe-global/protocol-kit/index' -import SafeProvider from '@safe-global/protocol-kit/adapters/ethers/SafeProvider' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { itif } from './utils/helpers' // test util funcion to deploy a safe (needed to check the expected Safe Address) From a36d0d4f0676109a5e0a6f848c4e3c1d57c6de83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 19 Apr 2024 13:03:48 +0200 Subject: [PATCH 035/112] Move SafeFactory to the root level --- .../protocol-kit/src/{safeFactory/index.ts => SafeFactory.ts} | 2 +- packages/protocol-kit/src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename packages/protocol-kit/src/{safeFactory/index.ts => SafeFactory.ts} (98%) diff --git a/packages/protocol-kit/src/safeFactory/index.ts b/packages/protocol-kit/src/SafeFactory.ts similarity index 98% rename from packages/protocol-kit/src/safeFactory/index.ts rename to packages/protocol-kit/src/SafeFactory.ts index 5dad33aac..875b6f6f6 100644 --- a/packages/protocol-kit/src/safeFactory/index.ts +++ b/packages/protocol-kit/src/SafeFactory.ts @@ -19,7 +19,7 @@ import { SafeProxyFactoryContractImplementationType } from '@safe-global/protocol-kit/types' import { SafeVersion, TransactionOptions } from '@safe-global/safe-core-sdk-types' -import SafeProvider from '../SafeProvider' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { Eip1193Provider } from '@safe-global/protocol-kit/types' export interface DeploySafeProps { diff --git a/packages/protocol-kit/src/index.ts b/packages/protocol-kit/src/index.ts index 1dcc90b26..0f9e03713 100644 --- a/packages/protocol-kit/src/index.ts +++ b/packages/protocol-kit/src/index.ts @@ -26,7 +26,7 @@ import { predictSafeAddress } from './contracts/utils' import ContractManager from './managers/contractManager' -import SafeFactory, { DeploySafeProps, SafeFactoryConfig } from './safeFactory' +import SafeFactory, { DeploySafeProps, SafeFactoryConfig } from './SafeFactory' import { AddOwnerTxParams, ConnectSafeConfig, From 3ef058074c01f545575d6418d0970e4c97180be0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 19 Apr 2024 13:19:32 +0200 Subject: [PATCH 036/112] Rename signerAddress to signer --- packages/protocol-kit/src/Safe.ts | 18 +++++------------- packages/protocol-kit/src/SafeProvider.ts | 19 +++++++++---------- packages/protocol-kit/src/types/index.ts | 9 +++------ 3 files changed, 17 insertions(+), 29 deletions(-) diff --git a/packages/protocol-kit/src/Safe.ts b/packages/protocol-kit/src/Safe.ts index 1ea0eb617..c0ff64743 100644 --- a/packages/protocol-kit/src/Safe.ts +++ b/packages/protocol-kit/src/Safe.ts @@ -112,14 +112,12 @@ class Safe { * @throws "MultiSendCallOnly contract is not deployed on the current network" */ private async init(config: SafeConfig): Promise { - const { provider, signerAddress, privateKeyOrMnemonic, isL1SafeSingleton, contractNetworks } = - config + const { provider, signer, isL1SafeSingleton, contractNetworks } = config this.#provider = provider this.#safeProvider = new SafeProvider({ providerOrUrl: provider, - signerAddress, - privateKeyOrMnemonic + signer }) if (isSafeConfigWithPredictedSafe(config)) { this.#predictedSafe = config.predictedSafe @@ -162,17 +160,11 @@ class Safe { * @throws "MultiSendCallOnly contract is not deployed on the current network" */ async connect(config: ConnectSafeConfig): Promise { - const { - provider, - signerAddress, - safeAddress, - predictedSafe, - isL1SafeSingleton, - contractNetworks - } = config + const { provider, signer, safeAddress, predictedSafe, isL1SafeSingleton, contractNetworks } = + config const configProps: SafeConfigProps = { provider: provider || this.#provider, - signerAddress, + signer, isL1SafeSingleton: isL1SafeSingleton || this.#contractManager.isL1SafeSingleton, contractNetworks: contractNetworks || this.#contractManager.contractNetworks } diff --git a/packages/protocol-kit/src/SafeProvider.ts b/packages/protocol-kit/src/SafeProvider.ts index e04bc171c..99ac5a99e 100644 --- a/packages/protocol-kit/src/SafeProvider.ts +++ b/packages/protocol-kit/src/SafeProvider.ts @@ -34,24 +34,22 @@ import { export interface SafeProviderConfig { /** signerOrProvider - Ethers signer or provider */ providerOrUrl: Eip1193Provider | string - signerAddress?: string + signer?: string privateKeyOrMnemonic?: string } class SafeProvider { #provider: BrowserProvider | JsonRpcProvider - #signerAddress?: string - #privateKeyOrMnemonic?: string + #signer?: string - constructor({ providerOrUrl, signerAddress, privateKeyOrMnemonic }: SafeProviderConfig) { + constructor({ providerOrUrl, signer }: SafeProviderConfig) { if (typeof providerOrUrl === 'string') { this.#provider = new JsonRpcProvider(providerOrUrl) } else { this.#provider = new BrowserProvider(providerOrUrl) } - this.#privateKeyOrMnemonic = privateKeyOrMnemonic - this.#signerAddress = signerAddress + this.#signer = signer } getProvider(): Provider { @@ -59,13 +57,14 @@ class SafeProvider { } async getSigner(): Promise { - if (this.#privateKeyOrMnemonic) { - const privateKeySigner = new ethers.Wallet(this.#privateKeyOrMnemonic, this.#provider) + // If the signer is not an Ethereum address, it should be a private key + if (this.#signer && !ethers.isAddress(this.#signer)) { + const privateKeySigner = new ethers.Wallet(this.#signer, this.#provider) return privateKeySigner } - if (this.#signerAddress) { - return this.#provider.getSigner(this.#signerAddress) + if (this.#signer) { + return this.#provider.getSigner(this.#signer) } if (this.#provider instanceof BrowserProvider) { diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index 5eed026ab..27c75edbe 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -106,8 +106,7 @@ type SafeConfigWithPredictedSafeProps = { export type SafeConfigProps = { /** provider - Compatible EIP-1193 provider */ provider: Eip1193Provider - signerAddress?: string - privateKeyOrMnemonic?: string + signer?: string /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ isL1SafeSingleton?: boolean /** contractNetworks - Contract network configuration */ @@ -135,8 +134,7 @@ type ConnectSafeConfigWithPredictedSafeProps = { type ConnectSafeConfigProps = { /** provider - Compatible EIP-1193 provider */ provider?: Eip1193Provider - signerAddress?: string - privateKeyOrMnemonic?: string + signer?: string /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ isL1SafeSingleton?: boolean /** contractNetworks - Contract network configuration */ @@ -198,8 +196,7 @@ type StandardizeSafeTxDataWithPredictedSafeProps = { interface StandardizeSafeTransactionData { /** provider - Compatible EIP-1193 provider */ provider: Eip1193Provider - signerAddress?: string - privateKeyOrMnemonic?: string + signer?: string /** tx - Safe transaction */ tx: SafeTransactionDataPartial /** contractNetworks - Contract network configuration */ From 7992141818d7fbba04fc93bb9d832e48f577c6bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 19 Apr 2024 14:34:02 +0200 Subject: [PATCH 037/112] Rename SafeProvider properties --- packages/protocol-kit/src/Safe.ts | 2 +- packages/protocol-kit/src/SafeFactory.ts | 2 +- packages/protocol-kit/src/SafeProvider.ts | 18 ++++--- .../src/utils/transactions/utils.ts | 2 +- packages/protocol-kit/tests/e2e/core.test.ts | 6 +-- .../createSafeDeploymentTransaction.test.ts | 4 +- .../e2e/eip1271-contract-signatures.test.ts | 20 ++++---- .../protocol-kit/tests/e2e/eip1271.test.ts | 4 +- .../tests/e2e/ethAdapters.test.ts | 17 ++++--- .../protocol-kit/tests/e2e/execution.test.ts | 48 +++++++++---------- .../tests/e2e/offChainSignatures.test.ts | 2 +- .../tests/e2e/onChainSignatures.test.ts | 6 +-- .../tests/e2e/ownerManager.test.ts | 22 ++++----- .../tests/e2e/safeFactory.test.ts | 2 +- .../tests/e2e/utils/setupEthAdapter.ts | 2 +- .../tests/e2e/utilsContracts.test.ts | 20 ++++---- 16 files changed, 91 insertions(+), 86 deletions(-) diff --git a/packages/protocol-kit/src/Safe.ts b/packages/protocol-kit/src/Safe.ts index c0ff64743..061ef2870 100644 --- a/packages/protocol-kit/src/Safe.ts +++ b/packages/protocol-kit/src/Safe.ts @@ -116,7 +116,7 @@ class Safe { this.#provider = provider this.#safeProvider = new SafeProvider({ - providerOrUrl: provider, + provider, signer }) if (isSafeConfigWithPredictedSafe(config)) { diff --git a/packages/protocol-kit/src/SafeFactory.ts b/packages/protocol-kit/src/SafeFactory.ts index 875b6f6f6..66a697150 100644 --- a/packages/protocol-kit/src/SafeFactory.ts +++ b/packages/protocol-kit/src/SafeFactory.ts @@ -82,7 +82,7 @@ class SafeFactory { contractNetworks }: SafeFactoryInitConfig): Promise { this.#provider = provider - this.#safeProvider = new SafeProvider({ providerOrUrl: provider }) + this.#safeProvider = new SafeProvider({ provider }) this.#safeVersion = safeVersion this.#isL1SafeSingleton = isL1SafeSingleton this.#contractNetworks = contractNetworks diff --git a/packages/protocol-kit/src/SafeProvider.ts b/packages/protocol-kit/src/SafeProvider.ts index 99ac5a99e..6c183a17f 100644 --- a/packages/protocol-kit/src/SafeProvider.ts +++ b/packages/protocol-kit/src/SafeProvider.ts @@ -31,10 +31,16 @@ import { Eip1193Provider } from '@safe-global/protocol-kit/types' +export type HexAddress = `0x${string}` +export type PrivateKey = string +export type HttpTransport = `http${string}` +export type SocketTransport = `ws${string}` +export type SafeSigner = HexAddress | PrivateKey + export interface SafeProviderConfig { /** signerOrProvider - Ethers signer or provider */ - providerOrUrl: Eip1193Provider | string - signer?: string + provider: Eip1193Provider | HttpTransport | SocketTransport + signer?: HexAddress | PrivateKey privateKeyOrMnemonic?: string } @@ -42,11 +48,11 @@ class SafeProvider { #provider: BrowserProvider | JsonRpcProvider #signer?: string - constructor({ providerOrUrl, signer }: SafeProviderConfig) { - if (typeof providerOrUrl === 'string') { - this.#provider = new JsonRpcProvider(providerOrUrl) + constructor({ provider, signer }: SafeProviderConfig) { + if (typeof provider === 'string') { + this.#provider = new JsonRpcProvider(provider) } else { - this.#provider = new BrowserProvider(providerOrUrl) + this.#provider = new BrowserProvider(provider) } this.#signer = signer diff --git a/packages/protocol-kit/src/utils/transactions/utils.ts b/packages/protocol-kit/src/utils/transactions/utils.ts index 27b15ee70..f371b1c4f 100644 --- a/packages/protocol-kit/src/utils/transactions/utils.ts +++ b/packages/protocol-kit/src/utils/transactions/utils.ts @@ -79,7 +79,7 @@ export async function standardizeSafeTransactionData({ let safeTxGas - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) if (semverSatisfies(safeVersion, '>=1.3.0')) { safeTxGas = await estimateGas( safeVersion, diff --git a/packages/protocol-kit/tests/e2e/core.test.ts b/packages/protocol-kit/tests/e2e/core.test.ts index 035d7eb96..7ff2e9536 100644 --- a/packages/protocol-kit/tests/e2e/core.test.ts +++ b/packages/protocol-kit/tests/e2e/core.test.ts @@ -95,7 +95,7 @@ describe('Safe Info', () => { const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk.connect({ provider: provider2, - signerAddress: account2.address, + signer: account2.address, contractNetworks }) chai.expect(await safeSdk2.getAddress()).to.be.eq(safeAddress) @@ -109,7 +109,7 @@ describe('Safe Info', () => { const safeSdk3 = await safeSdk2.connect({ safeAddress: safe2Address, provider: provider3, - signerAddress: account3.address + signer: account3.address }) chai.expect(await safeSdk3.getAddress()).to.be.eq(safe2Address) chai @@ -349,7 +349,7 @@ describe('Safe Info', () => { const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, - signerAddress: account1.address, + signer: account1.address, safeAddress, contractNetworks }) diff --git a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts index bb1599de2..2b434e3a4 100644 --- a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts @@ -193,7 +193,7 @@ describe('createSafeDeploymentTransaction', () => { const { contractNetworks, predictedSafe, chainId } = await setupTests() const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const safeSdk = await Safe.create({ provider, predictedSafe, @@ -217,7 +217,7 @@ describe('createSafeDeploymentTransaction', () => { const { contractNetworks, predictedSafe } = await setupTests() const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const safeSdk = await Safe.create({ provider, predictedSafe, diff --git a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts index d41858101..516fcb980 100644 --- a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts @@ -104,14 +104,14 @@ describe('The EIP1271 implementation', () => { tx = await protocolKit.signTransaction(tx) // Owner 1 signature protocolKit = await protocolKit.connect({ provider: provider2, - signerAddress: account2.address + signer: account2.address }) // Connect another owner tx = await protocolKit.signTransaction(tx) // Owner 2 signature // 1/1 Signer Safe signature protocolKit = await protocolKit.connect({ provider: provider3, - signerAddress: account3.address, + signer: account3.address, safeAddress: signerSafeAddress1_1 }) let signerSafeTx1_1 = await protocolKit.createTransaction({ @@ -131,7 +131,7 @@ describe('The EIP1271 implementation', () => { // 2/3 Signer Safe signature protocolKit = await protocolKit.connect({ provider: provider4, - signerAddress: account4.address, + signer: account4.address, safeAddress: signerSafeAddress2_3 }) let signerSafeTx2_3 = await protocolKit.createTransaction({ @@ -144,7 +144,7 @@ describe('The EIP1271 implementation', () => { ) protocolKit = await protocolKit.connect({ provider: provider5, - signerAddress: account5.address + signer: account5.address }) signerSafeTx2_3 = await protocolKit.signTransaction( signerSafeTx2_3, @@ -164,7 +164,7 @@ describe('The EIP1271 implementation', () => { }) protocolKit = await protocolKit.connect({ provider: provider1, - signerAddress: account1.address, + signer: account1.address, safeAddress }) const execResponse = await protocolKit.executeTransaction(tx) @@ -256,14 +256,14 @@ describe('The EIP1271 implementation', () => { message = await protocolKit.signMessage(message) // Owner 1 signature protocolKit = await protocolKit.connect({ provider: provider2, - signerAddress: account2.address + signer: account2.address }) // Connect another owner message = await protocolKit.signMessage(message) // Owner 2 signature // 1/1 Signer Safe signature protocolKit = await protocolKit.connect({ provider: provider3, - signerAddress: account3.address, + signer: account3.address, safeAddress: signerSafeAddress1_1 }) let signerSafeMessage1_1 = protocolKit.createMessage(MESSAGE) @@ -281,7 +281,7 @@ describe('The EIP1271 implementation', () => { // 2/3 Signer Safe signature protocolKit = await protocolKit.connect({ provider: provider4, - signerAddress: account4.address, + signer: account4.address, safeAddress: signerSafeAddress2_3 }) let signerSafeMessage2_3 = protocolKit.createMessage(MESSAGE) @@ -292,7 +292,7 @@ describe('The EIP1271 implementation', () => { ) protocolKit = await protocolKit.connect({ provider: provider5, - signerAddress: account5.address + signer: account5.address }) signerSafeMessage2_3 = await protocolKit.signMessage( signerSafeMessage2_3, @@ -308,7 +308,7 @@ describe('The EIP1271 implementation', () => { // Connect the original Safe protocolKit = await protocolKit.connect({ provider: provider1, - signerAddress: account1.address, + signer: account1.address, safeAddress }) diff --git a/packages/protocol-kit/tests/e2e/eip1271.test.ts b/packages/protocol-kit/tests/e2e/eip1271.test.ts index 98a475007..30f449792 100644 --- a/packages/protocol-kit/tests/e2e/eip1271.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271.test.ts @@ -77,7 +77,7 @@ describe('The EIP1271 implementation', () => { const provider2 = getEip1193Provider() const safeSdk2 = await Safe.create({ provider: provider2, - signerAddress: account2.address, + signer: account2.address, safeAddress, contractNetworks }) @@ -85,7 +85,7 @@ describe('The EIP1271 implementation', () => { // Adapter and Safe instance for owner 3 const safeSdk3 = await Safe.create({ provider: provider1, - signerAddress: account1.address, + signer: account1.address, safeAddress: signerSafeAddress, contractNetworks }) diff --git a/packages/protocol-kit/tests/e2e/ethAdapters.test.ts b/packages/protocol-kit/tests/e2e/ethAdapters.test.ts index 2d7a3fcef..4bbfe448a 100644 --- a/packages/protocol-kit/tests/e2e/ethAdapters.test.ts +++ b/packages/protocol-kit/tests/e2e/ethAdapters.test.ts @@ -70,7 +70,7 @@ describe('Safe contracts', () => { it('should return a Safe contract from the custom addresses', async () => { const { contractNetworks, chainId } = await setupTests() const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const safeContract = await safeProvider.getSafeContract({ @@ -99,7 +99,7 @@ describe('Safe contracts', () => { it('should return a MultiSend contract from the custom addresses', async () => { const { contractNetworks, chainId } = await setupTests() const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const multiSendContract = await safeProvider.getMultiSendContract({ @@ -128,7 +128,7 @@ describe('Safe contracts', () => { it('should return a MultiSendCallOnly contract from the custom addresses', async () => { const { contractNetworks, chainId } = await setupTests() const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const multiSendCallOnlyContract = await safeProvider.getMultiSendCallOnlyContract({ @@ -158,7 +158,7 @@ describe('Safe contracts', () => { it('should return a CompatibilityFallbackHandler contract from the custom addresses', async () => { const { contractNetworks, chainId } = await setupTests() const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const compatibilityFallbackHandlerContract = @@ -186,10 +186,9 @@ describe('Safe contracts', () => { }) it('should return a SafeProxyFactory contract from the custom addresses', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() - const [account1] = accounts + const { contractNetworks, chainId } = await setupTests() const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const factoryContract = await safeProvider.getSafeProxyFactoryContract({ @@ -218,7 +217,7 @@ describe('Safe contracts', () => { it('should return a SignMessageLib contract from the custom addresses', async () => { const { contractNetworks, chainId } = await setupTests() const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const signMessageLibContract = await safeProvider.getSignMessageLibContract({ @@ -247,7 +246,7 @@ describe('Safe contracts', () => { it('should return a SafeProxyFactory contract from the custom addresses', async () => { const { contractNetworks, chainId } = await setupTests() const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] const createCallContract = await safeProvider.getCreateCallContract({ diff --git a/packages/protocol-kit/tests/e2e/execution.test.ts b/packages/protocol-kit/tests/e2e/execution.test.ts index 1b08ad20b..89399b717 100644 --- a/packages/protocol-kit/tests/e2e/execution.test.ts +++ b/packages/protocol-kit/tests/e2e/execution.test.ts @@ -46,7 +46,7 @@ describe('Transactions execution', () => { const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, - signerAddress: account2.address, + signer: account2.address, contractNetworks }) await account1.signer.sendTransaction({ @@ -139,7 +139,7 @@ describe('Transactions execution', () => { const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, - signerAddress: account2.address + signer: account2.address }) const safeTransactionData = { to: safeAddress, @@ -192,7 +192,7 @@ describe('Transactions execution', () => { const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, - signerAddress: account2.address, + signer: account2.address, contractNetworks }) await account1.signer.sendTransaction({ @@ -321,11 +321,11 @@ describe('Transactions execution', () => { }) const safeSdk2 = await safeSdk1.connect({ provider: provider2, - signerAddress: account2.address + signer: account2.address }) const safeSdk3 = await safeSdk1.connect({ provider: provider3, - signerAddress: account3.address + signer: account3.address }) const safeInitialBalance = await safeSdk1.getBalance() const safeTransactionData = { @@ -380,15 +380,15 @@ describe('Transactions execution', () => { }) const safeSdk2 = await safeSdk1.connect({ provider: provider2, - signerAddress: account2.address + signer: account2.address }) const safeSdk3 = await safeSdk1.connect({ provider: provider3, - signerAddress: account3.address + signer: account3.address }) const safeSdk4 = await safeSdk1.connect({ provider: provider4, - signerAddress: account4.address + signer: account4.address }) const safeInitialBalance = await safeSdk1.getBalance() const safeTransactionData = { @@ -448,19 +448,19 @@ describe('Transactions execution', () => { }) const safeSdk2 = await safeSdk1.connect({ provider: provider2, - signerAddress: account2.address + signer: account2.address }) const safeSdk3 = await safeSdk1.connect({ provider: provider3, - signerAddress: account3.address + signer: account3.address }) const safeSdk4 = await safeSdk1.connect({ provider: provider4, - signerAddress: account4.address + signer: account4.address }) const safeSdk5 = await safeSdk1.connect({ provider: provider5, - signerAddress: account5.address + signer: account5.address }) const safeInitialBalance = await safeSdk1.getBalance() const safeTransactionData = { @@ -525,23 +525,23 @@ describe('Transactions execution', () => { }) const safeSdk2 = await safeSdk1.connect({ provider: provider2, - signerAddress: account2.address + signer: account2.address }) const safeSdk3 = await safeSdk1.connect({ provider: provider3, - signerAddress: account3.address + signer: account3.address }) const safeSdk4 = await safeSdk1.connect({ provider: provider4, - signerAddress: account4.address + signer: account4.address }) const safeSdk5 = await safeSdk1.connect({ provider: provider5, - signerAddress: account5.address + signer: account5.address }) const safeSdk6 = await safeSdk1.connect({ provider: provider6, - signerAddress: account6.address + signer: account6.address }) const safeInitialBalance = await safeSdk1.getBalance() const safeTransactionData = { @@ -580,7 +580,7 @@ describe('Transactions execution', () => { it('should execute a transaction when is not submitted by an owner', async () => { const { safe, accounts, contractNetworks } = await setupTests() - const [account1, account2, account3] = accounts + const [, account2, account3] = accounts const provider1 = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ @@ -591,12 +591,12 @@ describe('Transactions execution', () => { const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, - signerAddress: account2.address + signer: account2.address }) const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ provider: provider3, - signerAddress: account3.address + signer: account3.address }) await account2.signer.sendTransaction({ to: safeAddress, @@ -870,12 +870,12 @@ describe('Transactions execution', () => { const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, - signerAddress: account2.address + signer: account2.address }) const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ provider: provider3, - signerAddress: account3.address + signer: account3.address }) await account1.signer.sendTransaction({ to: safeAddress, @@ -921,12 +921,12 @@ describe('Transactions execution', () => { const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, - signerAddress: account2.address + signer: account2.address }) const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ provider: provider3, - signerAddress: account3.address + signer: account3.address }) await erc20Mintable.mint(safeAddress, '1200000000000000000') // 1.2 ERC20 diff --git a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts index d612dfd9f..91e671e0f 100644 --- a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts @@ -136,7 +136,7 @@ describe('Off-chain signatures', () => { const safeSdk = await Safe.create({ provider, safeAddress, - signerAddress: account3.address, + signer: account3.address, contractNetworks }) const safeTransactionData = { diff --git a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts index 37b59f16c..0144049ee 100644 --- a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts @@ -56,7 +56,7 @@ describe('On-chain signatures', () => { const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ provider, - signerAddress: account3.address, + signer: account3.address, safeAddress, contractNetworks }) @@ -137,7 +137,7 @@ describe('On-chain signatures', () => { it('should return the list of owners who approved a transaction hash', async () => { const { safe, accounts, contractNetworks } = await setupTests() - const [account1, account2] = accounts + const [, account2] = accounts const provider1 = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ @@ -148,7 +148,7 @@ describe('On-chain signatures', () => { const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, - signerAddress: account2.address + signer: account2.address }) const safeTransactionData = { to: safeAddress, diff --git a/packages/protocol-kit/tests/e2e/ownerManager.test.ts b/packages/protocol-kit/tests/e2e/ownerManager.test.ts index 127677c31..6cbf937d8 100644 --- a/packages/protocol-kit/tests/e2e/ownerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/ownerManager.test.ts @@ -116,7 +116,7 @@ describe('Safe owners manager', () => { describe('createAddOwnerTx', async () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1, account2] = accounts + const [, account2] = accounts const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -300,7 +300,7 @@ describe('Safe owners manager', () => { describe('createRemoveOwnerTx', async () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1, account2] = accounts + const [, account2] = accounts const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -349,7 +349,7 @@ describe('Safe owners manager', () => { it('should fail if address is not an owner', async () => { const { safe, accounts, contractNetworks } = await setupTests() - const [account1, , , account4] = accounts + const [, , , account4] = accounts const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -430,12 +430,12 @@ describe('Safe owners manager', () => { const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, - signerAddress: account2.address + signer: account2.address }) const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ provider: provider3, - signerAddress: account3.address + signer: account3.address }) const initialThreshold = await safeSdk1.getThreshold() const initialOwners = await safeSdk1.getOwners() @@ -468,12 +468,12 @@ describe('Safe owners manager', () => { const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, - signerAddress: account2.address + signer: account2.address }) const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ provider: provider3, - signerAddress: account3.address, + signer: account3.address, contractNetworks }) const initialThreshold = await safeSdk1.getThreshold() @@ -507,12 +507,12 @@ describe('Safe owners manager', () => { const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, - signerAddress: account2.address + signer: account2.address }) const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ provider: provider3, - signerAddress: account3.address + signer: account3.address }) const newThreshold = 1 const initialOwners = await safeSdk1.getOwners() @@ -755,12 +755,12 @@ describe('Safe owners manager', () => { const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ provider: provider2, - signerAddress: account2.address + signer: account2.address }) const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ provider: provider3, - signerAddress: account3.address + signer: account3.address }) const initialOwners = await safeSdk1.getOwners() chai.expect(initialOwners.length).to.be.eq(3) diff --git a/packages/protocol-kit/tests/e2e/safeFactory.test.ts b/packages/protocol-kit/tests/e2e/safeFactory.test.ts index 79ff0f853..833fec159 100644 --- a/packages/protocol-kit/tests/e2e/safeFactory.test.ts +++ b/packages/protocol-kit/tests/e2e/safeFactory.test.ts @@ -82,7 +82,7 @@ describe('SafeProxyFactory', () => { it('should instantiate the SafeProxyFactory', async () => { const { contractNetworks } = await setupTests() const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const networkId = await safeProvider.getChainId() chai diff --git a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts b/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts index fb803a887..218b736a4 100644 --- a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts +++ b/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts @@ -59,5 +59,5 @@ export function getSafeProviderFromNetwork( throw new Error('Chain not supported') } - return new SafeProvider({ providerOrUrl: rpcUrl, signerAddress: signer?.address }) + return new SafeProvider({ provider: rpcUrl, signer: signer?.address }) } diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index 1f67400bd..855b87ccb 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -60,7 +60,7 @@ describe('Contract utils', () => { const threshold = 1 const safeVersion = safeVersionDeployed const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -106,7 +106,7 @@ describe('Contract utils', () => { const threshold = 1 const safeVersion = safeVersionDeployed const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -152,7 +152,7 @@ describe('Contract utils', () => { const threshold = 2 const safeVersion = safeVersionDeployed const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -198,7 +198,7 @@ describe('Contract utils', () => { const invalidThreshold = 3 const safeVersion = safeVersionDeployed const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -233,7 +233,7 @@ describe('Contract utils', () => { const invalidThreshold = 0 const safeVersion = safeVersionDeployed const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -268,7 +268,7 @@ describe('Contract utils', () => { const invalidThreshold = -2 const safeVersion = safeVersionDeployed const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -302,7 +302,7 @@ describe('Contract utils', () => { const threshold = 1 const safeVersion = safeVersionDeployed const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -337,7 +337,7 @@ describe('Contract utils', () => { const threshold = 1 const safeVersion = safeVersionDeployed const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -431,7 +431,7 @@ describe('Contract utils', () => { const threshold = 2 const safeVersion = safeVersionDeployed const provider = getEip1193Provider() - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { @@ -503,7 +503,7 @@ describe('Contract utils', () => { threshold } - const safeProvider = new SafeProvider({ providerOrUrl: provider }) + const safeProvider = new SafeProvider({ provider }) const predictedSafeAddress = await predictSafeAddress({ safeProvider, From 5a2b60af7bf984f7fb4b6b7eb2d9e71629b43583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 19 Apr 2024 14:38:44 +0200 Subject: [PATCH 038/112] Rename files with EthAdapter suffix --- .../tests/utils/{setupEthAdapter.ts => setupProvider.ts} | 2 +- packages/api-kit/tests/utils/setupServiceClient.ts | 4 ++-- packages/protocol-kit/tests/e2e/contractManager.test.ts | 2 +- packages/protocol-kit/tests/e2e/core.test.ts | 2 +- .../tests/e2e/createSafeDeploymentTransaction.test.ts | 2 +- packages/protocol-kit/tests/e2e/createTransaction.test.ts | 4 ++-- .../protocol-kit/tests/e2e/createTransactionBatch.test.ts | 2 +- .../tests/e2e/eip1271-contract-signatures.test.ts | 2 +- packages/protocol-kit/tests/e2e/eip1271.test.ts | 2 +- packages/protocol-kit/tests/e2e/erc-20.test.ts | 6 ++---- packages/protocol-kit/tests/e2e/execution.test.ts | 2 +- .../protocol-kit/tests/e2e/fallbackHandlerManager.test.ts | 2 +- .../protocol-kit/tests/e2e/getEncodedTransaction.test.ts | 2 +- packages/protocol-kit/tests/e2e/guardManager.test.ts | 2 +- packages/protocol-kit/tests/e2e/moduleManager.test.ts | 2 +- .../protocol-kit/tests/e2e/offChainSignatures.test.ts | 2 +- packages/protocol-kit/tests/e2e/onChainSignatures.test.ts | 2 +- packages/protocol-kit/tests/e2e/ownerManager.test.ts | 2 +- packages/protocol-kit/tests/e2e/safeFactory.test.ts | 2 +- .../e2e/{ethAdapters.test.ts => safeProvider.test.ts} | 2 +- packages/protocol-kit/tests/e2e/threshold.test.ts | 2 +- .../e2e/utils/{setupEthAdapter.ts => setupProvider.ts} | 2 +- packages/protocol-kit/tests/e2e/utilsContracts.test.ts | 2 +- .../e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts | 8 ++++---- 24 files changed, 30 insertions(+), 32 deletions(-) rename packages/api-kit/tests/utils/{setupEthAdapter.ts => setupProvider.ts} (87%) rename packages/protocol-kit/tests/e2e/{ethAdapters.test.ts => safeProvider.test.ts} (99%) rename packages/protocol-kit/tests/e2e/utils/{setupEthAdapter.ts => setupProvider.ts} (96%) diff --git a/packages/api-kit/tests/utils/setupEthAdapter.ts b/packages/api-kit/tests/utils/setupProvider.ts similarity index 87% rename from packages/api-kit/tests/utils/setupEthAdapter.ts rename to packages/api-kit/tests/utils/setupProvider.ts index 9724d5339..c9a95f41b 100644 --- a/packages/api-kit/tests/utils/setupEthAdapter.ts +++ b/packages/api-kit/tests/utils/setupProvider.ts @@ -1,5 +1,5 @@ import { ethers, web3 } from 'hardhat' -import { Eip1193Provider } from '@safe-global/safe-core-sdk-types' +import { Eip1193Provider } from '@safe-global/protocol-kit/types' export function getEip1193Provider(): Eip1193Provider { switch (process.env.ETH_LIB) { diff --git a/packages/api-kit/tests/utils/setupServiceClient.ts b/packages/api-kit/tests/utils/setupServiceClient.ts index 9db6c1adb..fb302f7c9 100644 --- a/packages/api-kit/tests/utils/setupServiceClient.ts +++ b/packages/api-kit/tests/utils/setupServiceClient.ts @@ -1,8 +1,8 @@ import { getDefaultProvider, Wallet } from 'ethers' -import { Eip1193Provider } from '@safe-global/safe-core-sdk-types' import SafeApiKit from '@safe-global/api-kit/index' import config from '../utils/config' -import { getEip1193Provider } from '../utils/setupEthAdapter' +import { getEip1193Provider } from '../utils/setupProvider' +import { Eip1193Provider } from '@safe-global/protocol-kit/types' interface ServiceClientConfig { safeApiKit: SafeApiKit diff --git a/packages/protocol-kit/tests/e2e/contractManager.test.ts b/packages/protocol-kit/tests/e2e/contractManager.test.ts index 008cb2b5d..a800b7604 100644 --- a/packages/protocol-kit/tests/e2e/contractManager.test.ts +++ b/packages/protocol-kit/tests/e2e/contractManager.test.ts @@ -16,7 +16,7 @@ import { getSignMessageLib, getSimulateTxAccessor } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) diff --git a/packages/protocol-kit/tests/e2e/core.test.ts b/packages/protocol-kit/tests/e2e/core.test.ts index 7ff2e9536..4cc58b942 100644 --- a/packages/protocol-kit/tests/e2e/core.test.ts +++ b/packages/protocol-kit/tests/e2e/core.test.ts @@ -7,7 +7,7 @@ import { deployments } from 'hardhat' import { itif } from './utils/helpers' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' diff --git a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts index 2b434e3a4..50c482b19 100644 --- a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts @@ -11,7 +11,7 @@ import Safe, { } from '@safe-global/protocol-kit/index' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners, getFactory } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' import { itif } from './utils/helpers' diff --git a/packages/protocol-kit/tests/e2e/createTransaction.test.ts b/packages/protocol-kit/tests/e2e/createTransaction.test.ts index 3ef1c353b..1f20bbcb8 100644 --- a/packages/protocol-kit/tests/e2e/createTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createTransaction.test.ts @@ -11,7 +11,7 @@ import { deployments } from 'hardhat' import { itif } from './utils/helpers' import { getContractNetworks } from './utils/setupContractNetworks' import { getERC20Mintable, getSafeWithOwners } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) @@ -230,7 +230,7 @@ describe('Transactions creation', () => { describe('createTransaction', async () => { it('should create a single transaction with gasPrice=0', async () => { const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1, account2] = accounts + const [, account2] = accounts const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, diff --git a/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts b/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts index 74020dc82..58a8f847f 100644 --- a/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts +++ b/packages/protocol-kit/tests/e2e/createTransactionBatch.test.ts @@ -5,7 +5,7 @@ import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/de import Safe, { PredictedSafeProps } from '@safe-global/protocol-kit/index' import { getContractNetworks } from './utils/setupContractNetworks' import { getERC20Mintable, getSafeWithOwners, getMultiSendCallOnly } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' import { OperationType } from '@safe-global/safe-core-sdk-types' diff --git a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts index 516fcb980..bcb5ff3d6 100644 --- a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts @@ -7,7 +7,7 @@ import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' import { itif } from './utils/helpers' diff --git a/packages/protocol-kit/tests/e2e/eip1271.test.ts b/packages/protocol-kit/tests/e2e/eip1271.test.ts index 30f449792..2c08dbf7a 100644 --- a/packages/protocol-kit/tests/e2e/eip1271.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271.test.ts @@ -14,7 +14,7 @@ import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' import { itif } from './utils/helpers' diff --git a/packages/protocol-kit/tests/e2e/erc-20.test.ts b/packages/protocol-kit/tests/e2e/erc-20.test.ts index eea7100af..e58367c91 100644 --- a/packages/protocol-kit/tests/e2e/erc-20.test.ts +++ b/packages/protocol-kit/tests/e2e/erc-20.test.ts @@ -12,7 +12,7 @@ import sinonChai from 'sinon-chai' import { deployments } from 'hardhat' import { itif } from './utils/helpers' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' import { getAccounts } from './utils/setupTestNetwork' @@ -119,11 +119,9 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return true if it is the Native token', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, contractNetworks } = await setupTests() const safeAddress = await safe.getAddress() - const [account1] = accounts - const provider = getEip1193Provider() const safeSdk = await Safe.create({ diff --git a/packages/protocol-kit/tests/e2e/execution.test.ts b/packages/protocol-kit/tests/e2e/execution.test.ts index 89399b717..ea4322f92 100644 --- a/packages/protocol-kit/tests/e2e/execution.test.ts +++ b/packages/protocol-kit/tests/e2e/execution.test.ts @@ -11,7 +11,7 @@ import { deployments } from 'hardhat' import { itif } from './utils/helpers' import { getContractNetworks } from './utils/setupContractNetworks' import { getERC20Mintable, getSafeWithOwners } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' diff --git a/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts b/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts index 100ebc3cd..145dd168c 100644 --- a/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts @@ -14,7 +14,7 @@ import { getDefaultCallbackHandler, getSafeWithOwners } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' diff --git a/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts b/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts index 22f8efbfb..c7b133192 100644 --- a/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts @@ -4,7 +4,7 @@ import chai from 'chai' import { deployments } from 'hardhat' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' import { itif } from './utils/helpers' diff --git a/packages/protocol-kit/tests/e2e/guardManager.test.ts b/packages/protocol-kit/tests/e2e/guardManager.test.ts index 7f8859bc0..022dc64ba 100644 --- a/packages/protocol-kit/tests/e2e/guardManager.test.ts +++ b/packages/protocol-kit/tests/e2e/guardManager.test.ts @@ -10,7 +10,7 @@ import { deployments } from 'hardhat' import { itif } from './utils/helpers' import { getContractNetworks } from './utils/setupContractNetworks' import { getDebugTransactionGuard, getSafeWithOwners } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' diff --git a/packages/protocol-kit/tests/e2e/moduleManager.test.ts b/packages/protocol-kit/tests/e2e/moduleManager.test.ts index cb42f7b8b..217b1c403 100644 --- a/packages/protocol-kit/tests/e2e/moduleManager.test.ts +++ b/packages/protocol-kit/tests/e2e/moduleManager.test.ts @@ -13,7 +13,7 @@ import { getSafeWithOwners, getSocialRecoveryModule } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' diff --git a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts index 91e671e0f..316bdc7be 100644 --- a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts @@ -7,7 +7,7 @@ import { deployments } from 'hardhat' import { itif } from './utils/helpers' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) diff --git a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts index 0144049ee..92bf943ef 100644 --- a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts @@ -5,7 +5,7 @@ import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' diff --git a/packages/protocol-kit/tests/e2e/ownerManager.test.ts b/packages/protocol-kit/tests/e2e/ownerManager.test.ts index 6cbf937d8..3074a4779 100644 --- a/packages/protocol-kit/tests/e2e/ownerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/ownerManager.test.ts @@ -9,7 +9,7 @@ import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' diff --git a/packages/protocol-kit/tests/e2e/safeFactory.test.ts b/packages/protocol-kit/tests/e2e/safeFactory.test.ts index 833fec159..372c3f7eb 100644 --- a/packages/protocol-kit/tests/e2e/safeFactory.test.ts +++ b/packages/protocol-kit/tests/e2e/safeFactory.test.ts @@ -24,7 +24,7 @@ import { getSignMessageLib, getSimulateTxAccessor } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) diff --git a/packages/protocol-kit/tests/e2e/ethAdapters.test.ts b/packages/protocol-kit/tests/e2e/safeProvider.test.ts similarity index 99% rename from packages/protocol-kit/tests/e2e/ethAdapters.test.ts rename to packages/protocol-kit/tests/e2e/safeProvider.test.ts index 4bbfe448a..d8bc6e50b 100644 --- a/packages/protocol-kit/tests/e2e/ethAdapters.test.ts +++ b/packages/protocol-kit/tests/e2e/safeProvider.test.ts @@ -12,7 +12,7 @@ import { getSafeSingleton, getSignMessageLib } from './utils/setupContracts' -import { getEip1193Provider, getSafeProviderFromNetwork } from './utils/setupEthAdapter' +import { getEip1193Provider, getSafeProviderFromNetwork } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' import { SafeProvider } from '@safe-global/protocol-kit/index' diff --git a/packages/protocol-kit/tests/e2e/threshold.test.ts b/packages/protocol-kit/tests/e2e/threshold.test.ts index 17a814654..fb5148798 100644 --- a/packages/protocol-kit/tests/e2e/threshold.test.ts +++ b/packages/protocol-kit/tests/e2e/threshold.test.ts @@ -8,7 +8,7 @@ import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' import { getContractNetworks } from './utils/setupContractNetworks' import { getSafeWithOwners } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' diff --git a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts b/packages/protocol-kit/tests/e2e/utils/setupProvider.ts similarity index 96% rename from packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts rename to packages/protocol-kit/tests/e2e/utils/setupProvider.ts index 218b736a4..65847b7a8 100644 --- a/packages/protocol-kit/tests/e2e/utils/setupEthAdapter.ts +++ b/packages/protocol-kit/tests/e2e/utils/setupProvider.ts @@ -1,9 +1,9 @@ import hre, { ethers } from 'hardhat' import Web3 from 'web3' -import { Eip1193Provider } from '@safe-global/safe-core-sdk-types' import { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers' import { SafeProvider } from '@safe-global/protocol-kit/index' import { custom, createWalletClient } from 'viem' +import { Eip1193Provider } from '@safe-global/protocol-kit/types' type Network = 'mainnet' | 'gnosis' | 'zksync' | 'goerli' | 'sepolia' diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index 855b87ccb..330f95f67 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -4,7 +4,7 @@ import { Eip1193Provider } from '@safe-global/safe-core-sdk-types' import { getAccounts } from './utils/setupTestNetwork' import { getContractNetworks } from './utils/setupContractNetworks' import { getDefaultCallbackHandler } from './utils/setupContracts' -import { getEip1193Provider, getSafeProviderFromNetwork } from './utils/setupEthAdapter' +import { getEip1193Provider, getSafeProviderFromNetwork } from './utils/setupProvider' import { PREDETERMINED_SALT_NONCE, predictSafeAddress diff --git a/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts b/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts index 0687ff031..d37acb91b 100644 --- a/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts +++ b/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts @@ -6,7 +6,7 @@ import Safe, { PredictedSafeProps } from '@safe-global/protocol-kit/index' import { getContractNetworks } from './utils/setupContractNetworks' import { itif } from './utils/helpers' import { getSafeWithOwners, getMultiSendCallOnly } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupEthAdapter' +import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' chai.use(chaiAsPromised) @@ -71,7 +71,7 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { 'should return a batch transaction with the Safe deployment Transaction and the Safe Transaction', async () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() - const [account1, account2] = accounts + const [, account2] = accounts const provider = getEip1193Provider() @@ -107,7 +107,7 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { 'should return a batch transaction with the Safe deployment Transaction and the Safe Transaction', async () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() - const [account1, account2] = accounts + const [, account2] = accounts const provider = getEip1193Provider() @@ -143,7 +143,7 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { 'should include the custom salt nonce in the Safe deployment data', async () => { const { accounts, contractNetworks, predictedSafe } = await setupTests() - const [account1, account2] = accounts + const [, account2] = accounts const provider = getEip1193Provider() From a6f2079cea4d032db2dcf7c4f980e3540ee89b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 19 Apr 2024 14:43:09 +0200 Subject: [PATCH 039/112] Rename files --- packages/protocol-kit/src/SafeProvider.ts | 2 +- ...mpatibilityFallbackHandlerBaseContract.ts} | 0 ...tibilityFallbackHandlerContract_v1_3_0.ts} | 2 +- ...tibilityFallbackHandlerContract_v1_4_1.ts} | 2 +- ...actEthers.ts => CreateCallBaseContract.ts} | 0 ...Ethers.ts => CreateCallContract_v1_3_0.ts} | 2 +- ...Ethers.ts => CreateCallContract_v1_4_1.ts} | 2 +- ...ractEthers.ts => MultiSendBaseContract.ts} | 0 ...rs.ts => MultiSendCallOnlyBaseContract.ts} | 0 ..._Ethers.ts => MultiSendContract_v1_1_1.ts} | 2 +- ...ts => MultiSendCallOnlyContract_v1_3_0.ts} | 2 +- ..._Ethers.ts => MultiSendContract_v1_3_0.ts} | 2 +- ...ts => MultiSendCallOnlyContract_v1_4_1.ts} | 2 +- ..._Ethers.ts => MultiSendContract_v1_4_1.ts} | 2 +- ...eContractEthers.ts => SafeBaseContract.ts} | 0 ...1_0_0_Ethers.ts => SafeContract_v1_0_0.ts} | 2 +- ...1_1_1_Ethers.ts => SafeContract_v1_1_1.ts} | 2 +- ...1_2_0_Ethers.ts => SafeContract_v1_2_0.ts} | 2 +- ...1_3_0_Ethers.ts => SafeContract_v1_3_0.ts} | 2 +- ...1_4_1_Ethers.ts => SafeContract_v1_4_1.ts} | 2 +- ...ers.ts => SafeProxyFactoryBaseContract.ts} | 0 ....ts => SafeProxyFactoryContract_v1_0_0.ts} | 2 +- ....ts => SafeProxyFactoryContract_v1_1_1.ts} | 2 +- ....ts => SafeProxyFactoryContract_v1_3_0.ts} | 2 +- ....ts => SafeProxyFactoryContract_v1_4_1.ts} | 2 +- ...thers.ts => SignMessageLibBaseContract.ts} | 0 ...rs.ts => SignMessageLibContract_v1_3_0.ts} | 2 +- ...rs.ts => SignMessageLibContract_v1_4_1.ts} | 2 +- ...s.ts => SimulateTxAccessorBaseContract.ts} | 0 ...s => SimulateTxAccessorContract_v1_3_0.ts} | 2 +- ...s => SimulateTxAccessorContract_v1_4_1.ts} | 2 +- ...nstancesEthers.ts => contractInstances.ts} | 44 +++++++++---------- packages/protocol-kit/src/contracts/index.ts | 12 ++--- packages/protocol-kit/src/types/index.ts | 44 +++++++++---------- 34 files changed, 73 insertions(+), 73 deletions(-) rename packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/{CompatibilityFallbackHandlerBaseContractEthers.ts => CompatibilityFallbackHandlerBaseContract.ts} (100%) rename packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/{CompatibilityFallbackHandlerContract_v1_3_0_Ethers.ts => CompatibilityFallbackHandlerContract_v1_3_0.ts} (98%) rename packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/{CompatibilityFallbackHandlerContract_v1_4_1_Ethers.ts => CompatibilityFallbackHandlerContract_v1_4_1.ts} (98%) rename packages/protocol-kit/src/contracts/CreateCall/{CreateCallBaseContractEthers.ts => CreateCallBaseContract.ts} (100%) rename packages/protocol-kit/src/contracts/CreateCall/v1.3.0/{CreateCallContract_v1_3_0_Ethers.ts => CreateCallContract_v1_3_0.ts} (98%) rename packages/protocol-kit/src/contracts/CreateCall/v1.4.1/{CreateCallContract_v1_4_1_Ethers.ts => CreateCallContract_v1_4_1.ts} (98%) rename packages/protocol-kit/src/contracts/MultiSend/{MultiSendBaseContractEthers.ts => MultiSendBaseContract.ts} (100%) rename packages/protocol-kit/src/contracts/MultiSend/{MultiSendCallOnlyBaseContractEthers.ts => MultiSendCallOnlyBaseContract.ts} (100%) rename packages/protocol-kit/src/contracts/MultiSend/v1.1.1/{MultiSendContract_v1_1_1_Ethers.ts => MultiSendContract_v1_1_1.ts} (97%) rename packages/protocol-kit/src/contracts/MultiSend/v1.3.0/{MultiSendCallOnlyContract_v1_3_0_Ethers.ts => MultiSendCallOnlyContract_v1_3_0.ts} (96%) rename packages/protocol-kit/src/contracts/MultiSend/v1.3.0/{MultiSendContract_v1_3_0_Ethers.ts => MultiSendContract_v1_3_0.ts} (97%) rename packages/protocol-kit/src/contracts/MultiSend/v1.4.1/{MultiSendCallOnlyContract_v1_4_1_Ethers.ts => MultiSendCallOnlyContract_v1_4_1.ts} (96%) rename packages/protocol-kit/src/contracts/MultiSend/v1.4.1/{MultiSendContract_v1_4_1_Ethers.ts => MultiSendContract_v1_4_1.ts} (97%) rename packages/protocol-kit/src/contracts/Safe/{SafeBaseContractEthers.ts => SafeBaseContract.ts} (100%) rename packages/protocol-kit/src/contracts/Safe/v1.0.0/{SafeContract_v1_0_0_Ethers.ts => SafeContract_v1_0_0.ts} (99%) rename packages/protocol-kit/src/contracts/Safe/v1.1.1/{SafeContract_v1_1_1_Ethers.ts => SafeContract_v1_1_1.ts} (99%) rename packages/protocol-kit/src/contracts/Safe/v1.2.0/{SafeContract_v1_2_0_Ethers.ts => SafeContract_v1_2_0.ts} (99%) rename packages/protocol-kit/src/contracts/Safe/v1.3.0/{SafeContract_v1_3_0_Ethers.ts => SafeContract_v1_3_0.ts} (99%) rename packages/protocol-kit/src/contracts/Safe/v1.4.1/{SafeContract_v1_4_1_Ethers.ts => SafeContract_v1_4_1.ts} (99%) rename packages/protocol-kit/src/contracts/SafeProxyFactory/{SafeProxyFactoryBaseContractEthers.ts => SafeProxyFactoryBaseContract.ts} (100%) rename packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/{SafeProxyFactoryContract_v1_0_0_Ethers.ts => SafeProxyFactoryContract_v1_0_0.ts} (99%) rename packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/{SafeProxyFactoryContract_v1_1_1_Ethers.ts => SafeProxyFactoryContract_v1_1_1.ts} (99%) rename packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/{SafeProxyFactoryContract_v1_3_0_Ethers.ts => SafeProxyFactoryContract_v1_3_0.ts} (99%) rename packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/{SafeProxyFactoryContract_v1_4_1_Ethers.ts => SafeProxyFactoryContract_v1_4_1.ts} (99%) rename packages/protocol-kit/src/contracts/SignMessageLib/{SignMessageLibBaseContractEthers.ts => SignMessageLibBaseContract.ts} (100%) rename packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/{SignMessageLibContract_v1_3_0_Ethers.ts => SignMessageLibContract_v1_3_0.ts} (97%) rename packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/{SignMessageLibContract_v1_4_1_Ethers.ts => SignMessageLibContract_v1_4_1.ts} (97%) rename packages/protocol-kit/src/contracts/SimulateTxAccessor/{SimulateTxAccessorBaseContractEthers.ts => SimulateTxAccessorBaseContract.ts} (100%) rename packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/{SimulateTxAccessorContract_v1_3_0_Ethers.ts => SimulateTxAccessorContract_v1_3_0.ts} (99%) rename packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/{SimulateTxAccessorContract_v1_4_1_Ethers.ts => SimulateTxAccessorContract_v1_4_1.ts} (99%) rename packages/protocol-kit/src/contracts/{contractInstancesEthers.ts => contractInstances.ts} (93%) diff --git a/packages/protocol-kit/src/SafeProvider.ts b/packages/protocol-kit/src/SafeProvider.ts index 6c183a17f..fc4c82500 100644 --- a/packages/protocol-kit/src/SafeProvider.ts +++ b/packages/protocol-kit/src/SafeProvider.ts @@ -24,7 +24,7 @@ import { getSafeProxyFactoryContractInstance, getSignMessageLibContractInstance, getSimulateTxAccessorContractInstance -} from './contracts/contractInstancesEthers' +} from './contracts/contractInstances' import { SafeProviderTransaction, GetContractProps, diff --git a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.ts similarity index 100% rename from packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers.ts rename to packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.ts diff --git a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.ts similarity index 98% rename from packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers.ts rename to packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.ts index fd5bc6955..c399d0b77 100644 --- a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.ts @@ -1,4 +1,4 @@ -import CompatibilityFallbackHandlerBaseContractEthers from '@safe-global/protocol-kit/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers' +import CompatibilityFallbackHandlerBaseContractEthers from '@safe-global/protocol-kit/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, diff --git a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.ts similarity index 98% rename from packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers.ts rename to packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.ts index fc1ce0a61..62f890bcb 100644 --- a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.ts @@ -1,4 +1,4 @@ -import CompatibilityFallbackHandlerBaseContractEthers from '@safe-global/protocol-kit/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContractEthers' +import CompatibilityFallbackHandlerBaseContractEthers from '@safe-global/protocol-kit/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { compatibilityFallbackHandler_1_4_1_ContractArtifacts, diff --git a/packages/protocol-kit/src/contracts/CreateCall/CreateCallBaseContractEthers.ts b/packages/protocol-kit/src/contracts/CreateCall/CreateCallBaseContract.ts similarity index 100% rename from packages/protocol-kit/src/contracts/CreateCall/CreateCallBaseContractEthers.ts rename to packages/protocol-kit/src/contracts/CreateCall/CreateCallBaseContract.ts diff --git a/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts similarity index 98% rename from packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts rename to packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts index 737a3f498..61424ec51 100644 --- a/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts @@ -1,4 +1,4 @@ -import CreateCallBaseContractEthers from '@safe-global/protocol-kit/contracts/CreateCall/CreateCallBaseContractEthers' +import CreateCallBaseContractEthers from '@safe-global/protocol-kit/contracts/CreateCall/CreateCallBaseContract' import { SafeVersion, CreateCallContract_v1_3_0_Abi, diff --git a/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts similarity index 98% rename from packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts rename to packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts index eef986748..e08d8da58 100644 --- a/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts @@ -1,4 +1,4 @@ -import CreateCallBaseContractEthers from '@safe-global/protocol-kit/contracts/CreateCall/CreateCallBaseContractEthers' +import CreateCallBaseContractEthers from '@safe-global/protocol-kit/contracts/CreateCall/CreateCallBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, diff --git a/packages/protocol-kit/src/contracts/MultiSend/MultiSendBaseContractEthers.ts b/packages/protocol-kit/src/contracts/MultiSend/MultiSendBaseContract.ts similarity index 100% rename from packages/protocol-kit/src/contracts/MultiSend/MultiSendBaseContractEthers.ts rename to packages/protocol-kit/src/contracts/MultiSend/MultiSendBaseContract.ts diff --git a/packages/protocol-kit/src/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts b/packages/protocol-kit/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.ts similarity index 100% rename from packages/protocol-kit/src/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers.ts rename to packages/protocol-kit/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.ts diff --git a/packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.ts similarity index 97% rename from packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers.ts rename to packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.ts index 226c30cb0..25eb013ea 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.ts @@ -1,4 +1,4 @@ -import MultiSendBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendBaseContractEthers' +import MultiSendBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, diff --git a/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.ts similarity index 96% rename from packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers.ts rename to packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.ts index 66148b4bd..4804fc5c9 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.ts @@ -1,4 +1,4 @@ -import MultiSendCallOnlyBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers' +import MultiSendCallOnlyBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendCallOnlyBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, diff --git a/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.ts similarity index 97% rename from packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts rename to packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.ts index 449f6721c..d844764c2 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.ts @@ -1,4 +1,4 @@ -import MultiSendBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendBaseContractEthers' +import MultiSendBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, diff --git a/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.ts similarity index 96% rename from packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers.ts rename to packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.ts index 71786388d..38ab90bec 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.ts @@ -1,4 +1,4 @@ -import MultiSendCallOnlyBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendCallOnlyBaseContractEthers' +import MultiSendCallOnlyBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendCallOnlyBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, diff --git a/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.ts similarity index 97% rename from packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers.ts rename to packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.ts index 9c9c2b31e..f21012414 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.ts @@ -1,4 +1,4 @@ -import MultiSendBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendBaseContractEthers' +import MultiSendBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, diff --git a/packages/protocol-kit/src/contracts/Safe/SafeBaseContractEthers.ts b/packages/protocol-kit/src/contracts/Safe/SafeBaseContract.ts similarity index 100% rename from packages/protocol-kit/src/contracts/Safe/SafeBaseContractEthers.ts rename to packages/protocol-kit/src/contracts/Safe/SafeBaseContract.ts diff --git a/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts b/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts similarity index 99% rename from packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts rename to packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts index e83b2d9e9..76c418580 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts @@ -1,4 +1,4 @@ -import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContractEthers' +import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' import { sameString } from '@safe-global/protocol-kit/utils' diff --git a/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts b/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.ts similarity index 99% rename from packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts rename to packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.ts index f112a1930..895c05e86 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.ts @@ -1,4 +1,4 @@ -import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContractEthers' +import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' import { sameString } from '@safe-global/protocol-kit/utils' diff --git a/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts b/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts similarity index 99% rename from packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts rename to packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts index 394625928..5e5d23f26 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts @@ -1,4 +1,4 @@ -import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContractEthers' +import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' import { diff --git a/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.ts similarity index 99% rename from packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts rename to packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.ts index 681b526a9..5de8bd67b 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.ts @@ -1,4 +1,4 @@ -import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContractEthers' +import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/utils/constants' diff --git a/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.ts similarity index 99% rename from packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts rename to packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.ts index e761e0822..ea2d98fb9 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.ts @@ -1,4 +1,4 @@ -import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContractEthers' +import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/utils/constants' diff --git a/packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.ts similarity index 100% rename from packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers.ts rename to packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.ts diff --git a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.ts similarity index 99% rename from packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts rename to packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.ts index 8b47d18a1..985083809 100644 --- a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.ts @@ -1,7 +1,7 @@ import { ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers, { CreateProxyProps -} from '@safe-global/protocol-kit/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' +} from '@safe-global/protocol-kit/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, diff --git a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.ts similarity index 99% rename from packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts rename to packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.ts index 5c006910f..5775daa71 100644 --- a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.ts @@ -1,7 +1,7 @@ import { ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers, { CreateProxyProps -} from '@safe-global/protocol-kit/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' +} from '@safe-global/protocol-kit/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, diff --git a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.ts similarity index 99% rename from packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts rename to packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.ts index 8d86733df..175c6f682 100644 --- a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.ts @@ -1,7 +1,7 @@ import { ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers, { CreateProxyProps -} from '@safe-global/protocol-kit/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' +} from '@safe-global/protocol-kit/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, diff --git a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.ts similarity index 99% rename from packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts rename to packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.ts index cfb65d15b..e08043ae8 100644 --- a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.ts @@ -1,7 +1,7 @@ import { ContractRunner, EventLog } from 'ethers' import SafeProxyFactoryBaseContractEthers, { CreateProxyProps -} from '@safe-global/protocol-kit/contracts/SafeProxyFactory/SafeProxyFactoryBaseContractEthers' +} from '@safe-global/protocol-kit/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract' import { SafeVersion, SafeProxyFactoryContract_v1_4_1_Abi, diff --git a/packages/protocol-kit/src/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts b/packages/protocol-kit/src/contracts/SignMessageLib/SignMessageLibBaseContract.ts similarity index 100% rename from packages/protocol-kit/src/contracts/SignMessageLib/SignMessageLibBaseContractEthers.ts rename to packages/protocol-kit/src/contracts/SignMessageLib/SignMessageLibBaseContract.ts diff --git a/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts similarity index 97% rename from packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts rename to packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts index 1fd7804ef..14fa2fe38 100644 --- a/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts @@ -1,5 +1,5 @@ import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' -import SignMessageLibBaseContractEthers from '@safe-global/protocol-kit/contracts/SignMessageLib/SignMessageLibBaseContractEthers' +import SignMessageLibBaseContractEthers from '@safe-global/protocol-kit/contracts/SignMessageLib/SignMessageLibBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, diff --git a/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts similarity index 97% rename from packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts rename to packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts index e6b259abd..35b9c612b 100644 --- a/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts @@ -1,5 +1,5 @@ import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' -import SignMessageLibBaseContractEthers from '@safe-global/protocol-kit/contracts/SignMessageLib/SignMessageLibBaseContractEthers' +import SignMessageLibBaseContractEthers from '@safe-global/protocol-kit/contracts/SignMessageLib/SignMessageLibBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, diff --git a/packages/protocol-kit/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts b/packages/protocol-kit/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.ts similarity index 100% rename from packages/protocol-kit/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers.ts rename to packages/protocol-kit/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.ts diff --git a/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts b/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.ts similarity index 99% rename from packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts rename to packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.ts index 0c8381c4e..ef75e235b 100644 --- a/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers.ts +++ b/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.ts @@ -1,4 +1,4 @@ -import SimulateTxAccessorBaseContractEthers from '@safe-global/protocol-kit/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers' +import SimulateTxAccessorBaseContractEthers from '@safe-global/protocol-kit/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, diff --git a/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts b/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.ts similarity index 99% rename from packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts rename to packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.ts index 799b3266f..b4063f547 100644 --- a/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers.ts +++ b/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.ts @@ -1,4 +1,4 @@ -import SimulateTxAccessorBaseContractEthers from '@safe-global/protocol-kit/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContractEthers' +import SimulateTxAccessorBaseContractEthers from '@safe-global/protocol-kit/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, diff --git a/packages/protocol-kit/src/contracts/contractInstancesEthers.ts b/packages/protocol-kit/src/contracts/contractInstances.ts similarity index 93% rename from packages/protocol-kit/src/contracts/contractInstancesEthers.ts rename to packages/protocol-kit/src/contracts/contractInstances.ts index 99e3d61f5..decf7c9f7 100644 --- a/packages/protocol-kit/src/contracts/contractInstancesEthers.ts +++ b/packages/protocol-kit/src/contracts/contractInstances.ts @@ -24,28 +24,28 @@ import { SimulateTxAccessorContract_v1_4_1_Abi, SimulateTxAccessorContract_v1_3_0_Abi } from '@safe-global/safe-core-sdk-types' -import CreateCallContract_v1_3_0_Ethers from './CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers' -import CreateCallContract_v1_4_1_Ethers from './CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers' -import MultiSendContract_v1_1_1_Ethers from './MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers' -import MultiSendContract_v1_3_0_Ethers from './MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers' -import MultiSendContract_v1_4_1_Ethers from './MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers' -import MultiSendCallOnlyContract_v1_3_0_Ethers from './MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers' -import MultiSendCallOnlyContract_v1_4_1_Ethers from './MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers' -import SignMessageLibContract_v1_3_0_Ethers from './SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers' -import SignMessageLibContract_v1_4_1_Ethers from './SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers' -import SafeContract_v1_0_0_Ethers from './Safe/v1.0.0/SafeContract_v1_0_0_Ethers' -import SafeContract_v1_1_1_Ethers from './Safe/v1.1.1/SafeContract_v1_1_1_Ethers' -import SafeContract_v1_2_0_Ethers from './Safe/v1.2.0/SafeContract_v1_2_0_Ethers' -import SafeContract_v1_3_0_Ethers from './Safe/v1.3.0/SafeContract_v1_3_0_Ethers' -import SafeContract_v1_4_1_Ethers from './Safe/v1.4.1/SafeContract_v1_4_1_Ethers' -import SafeProxyFactoryContract_v1_0_0_Ethers from './SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers' -import SafeProxyFactoryContract_v1_1_1_Ethers from './SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers' -import SafeProxyFactoryContract_v1_3_0_Ethers from './SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers' -import SafeProxyFactoryContract_v1_4_1_Ethers from './SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers' -import SimulateTxAccessorContract_v1_3_0_Ethers from './SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers' -import SimulateTxAccessorContract_v1_4_1_Ethers from './SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers' -import CompatibilityFallbackHandlerContract_v1_3_0_Ethers from './CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers' -import CompatibilityFallbackHandlerContract_v1_4_1_Ethers from './CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers' +import CreateCallContract_v1_3_0_Ethers from './CreateCall/v1.3.0/CreateCallContract_v1_3_0' +import CreateCallContract_v1_4_1_Ethers from './CreateCall/v1.4.1/CreateCallContract_v1_4_1' +import MultiSendContract_v1_1_1_Ethers from './MultiSend/v1.1.1/MultiSendContract_v1_1_1' +import MultiSendContract_v1_3_0_Ethers from './MultiSend/v1.3.0/MultiSendContract_v1_3_0' +import MultiSendContract_v1_4_1_Ethers from './MultiSend/v1.4.1/MultiSendContract_v1_4_1' +import MultiSendCallOnlyContract_v1_3_0_Ethers from './MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0' +import MultiSendCallOnlyContract_v1_4_1_Ethers from './MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1' +import SignMessageLibContract_v1_3_0_Ethers from './SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0' +import SignMessageLibContract_v1_4_1_Ethers from './SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1' +import SafeContract_v1_0_0_Ethers from './Safe/v1.0.0/SafeContract_v1_0_0' +import SafeContract_v1_1_1_Ethers from './Safe/v1.1.1/SafeContract_v1_1_1' +import SafeContract_v1_2_0_Ethers from './Safe/v1.2.0/SafeContract_v1_2_0' +import SafeContract_v1_3_0_Ethers from './Safe/v1.3.0/SafeContract_v1_3_0' +import SafeContract_v1_4_1_Ethers from './Safe/v1.4.1/SafeContract_v1_4_1' +import SafeProxyFactoryContract_v1_0_0_Ethers from './SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0' +import SafeProxyFactoryContract_v1_1_1_Ethers from './SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1' +import SafeProxyFactoryContract_v1_3_0_Ethers from './SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0' +import SafeProxyFactoryContract_v1_4_1_Ethers from './SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1' +import SimulateTxAccessorContract_v1_3_0_Ethers from './SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0' +import SimulateTxAccessorContract_v1_4_1_Ethers from './SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1' +import CompatibilityFallbackHandlerContract_v1_3_0_Ethers from './CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0' +import CompatibilityFallbackHandlerContract_v1_4_1_Ethers from './CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1' import SafeProvider from '../SafeProvider' export async function getSafeContractInstance( diff --git a/packages/protocol-kit/src/contracts/index.ts b/packages/protocol-kit/src/contracts/index.ts index 8f77aa03f..bf44c1dff 100644 --- a/packages/protocol-kit/src/contracts/index.ts +++ b/packages/protocol-kit/src/contracts/index.ts @@ -1,10 +1,10 @@ import SafeProvider, { SafeProviderConfig } from '../SafeProvider' -import CreateCallBaseContractEthers from './CreateCall/CreateCallBaseContractEthers' -import MultiSendBaseContractEthers from './MultiSend/MultiSendBaseContractEthers' -import MultiSendCallOnlyBaseContractEthers from './MultiSend/MultiSendCallOnlyBaseContractEthers' -import SafeBaseContractEthers from './Safe/SafeBaseContractEthers' -import SafeProxyFactoryBaseContractEthers from './SafeProxyFactory/SafeProxyFactoryBaseContractEthers' -import SignMessageLibBaseContractEthers from './SignMessageLib/SignMessageLibBaseContractEthers' +import CreateCallBaseContractEthers from './CreateCall/CreateCallBaseContract' +import MultiSendBaseContractEthers from './MultiSend/MultiSendBaseContract' +import MultiSendCallOnlyBaseContractEthers from './MultiSend/MultiSendCallOnlyBaseContract' +import SafeBaseContractEthers from './Safe/SafeBaseContract' +import SafeProxyFactoryBaseContractEthers from './SafeProxyFactory/SafeProxyFactoryBaseContract' +import SignMessageLibBaseContractEthers from './SignMessageLib/SignMessageLibBaseContract' export { CreateCallBaseContractEthers, diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index 27c75edbe..66a8a671e 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -5,28 +5,28 @@ import { SafeTransactionDataPartial, SafeVersion } from '@safe-global/safe-core-sdk-types' -import SafeContract_v1_0_0_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.0.0/SafeContract_v1_0_0_Ethers' -import SafeContract_v1_1_1_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.1.1/SafeContract_v1_1_1_Ethers' -import SafeContract_v1_2_0_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.2.0/SafeContract_v1_2_0_Ethers' -import SafeContract_v1_3_0_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.3.0/SafeContract_v1_3_0_Ethers' -import SafeContract_v1_4_1_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.4.1/SafeContract_v1_4_1_Ethers' -import MultiSendContract_v1_1_1_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1_Ethers' -import MultiSendContract_v1_3_0_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0_Ethers' -import MultiSendContract_v1_4_1_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1_Ethers' -import MultiSendCallOnlyContract_v1_4_1_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1_Ethers' -import MultiSendCallOnlyContract_v1_3_0_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0_Ethers' -import CompatibilityFallbackHandlerContract_v1_3_0_Ethers from '../contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0_Ethers' -import CompatibilityFallbackHandlerContract_v1_4_1_Ethers from '../contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1_Ethers' -import SafeProxyFactoryContract_v1_0_0_Ethers from '../contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0_Ethers' -import SafeProxyFactoryContract_v1_1_1_Ethers from '../contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1_Ethers' -import SafeProxyFactoryContract_v1_3_0_Ethers from '../contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0_Ethers' -import SafeProxyFactoryContract_v1_4_1_Ethers from '../contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1_Ethers' -import SignMessageLibContract_v1_3_0_Ethers from '../contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0_Ethers' -import SignMessageLibContract_v1_4_1_Ethers from '../contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1_Ethers' -import SimulateTxAccessorContract_v1_3_0_Ethers from '../contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0_Ethers' -import SimulateTxAccessorContract_v1_4_1_Ethers from '../contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1_Ethers' -import CreateCallContract_v1_3_0_Ethers from '../contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0_Ethers' -import CreateCallContract_v1_4_1_Ethers from '../contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1_Ethers' +import SafeContract_v1_0_0_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.0.0/SafeContract_v1_0_0' +import SafeContract_v1_1_1_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.1.1/SafeContract_v1_1_1' +import SafeContract_v1_2_0_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.2.0/SafeContract_v1_2_0' +import SafeContract_v1_3_0_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.3.0/SafeContract_v1_3_0' +import SafeContract_v1_4_1_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.4.1/SafeContract_v1_4_1' +import MultiSendContract_v1_1_1_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1' +import MultiSendContract_v1_3_0_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0' +import MultiSendContract_v1_4_1_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1' +import MultiSendCallOnlyContract_v1_4_1_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1' +import MultiSendCallOnlyContract_v1_3_0_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0' +import CompatibilityFallbackHandlerContract_v1_3_0_Ethers from '../contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0' +import CompatibilityFallbackHandlerContract_v1_4_1_Ethers from '../contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1' +import SafeProxyFactoryContract_v1_0_0_Ethers from '../contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0' +import SafeProxyFactoryContract_v1_1_1_Ethers from '../contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1' +import SafeProxyFactoryContract_v1_3_0_Ethers from '../contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0' +import SafeProxyFactoryContract_v1_4_1_Ethers from '../contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1' +import SignMessageLibContract_v1_3_0_Ethers from '../contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0' +import SignMessageLibContract_v1_4_1_Ethers from '../contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1' +import SimulateTxAccessorContract_v1_3_0_Ethers from '../contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0' +import SimulateTxAccessorContract_v1_4_1_Ethers from '../contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1' +import CreateCallContract_v1_3_0_Ethers from '../contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0' +import CreateCallContract_v1_4_1_Ethers from '../contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1' export interface SafeAccountConfig { owners: string[] From 696aaa2abf340e9717dca9e7589fad6d40fb3567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 19 Apr 2024 14:45:13 +0200 Subject: [PATCH 040/112] Remove _Ethers --- ...ompatibilityFallbackHandlerBaseContract.ts | 4 +- ...atibilityFallbackHandlerContract_v1_3_0.ts | 8 +- ...atibilityFallbackHandlerContract_v1_4_1.ts | 8 +- .../CreateCall/CreateCallBaseContract.ts | 4 +- .../v1.3.0/CreateCallContract_v1_3_0.ts | 8 +- .../v1.4.1/CreateCallContract_v1_4_1.ts | 8 +- .../MultiSend/MultiSendBaseContract.ts | 4 +- .../MultiSendCallOnlyBaseContract.ts | 4 +- .../v1.1.1/MultiSendContract_v1_1_1.ts | 8 +- .../MultiSendCallOnlyContract_v1_3_0.ts | 8 +- .../v1.3.0/MultiSendContract_v1_3_0.ts | 8 +- .../MultiSendCallOnlyContract_v1_4_1.ts | 8 +- .../v1.4.1/MultiSendContract_v1_4_1.ts | 8 +- .../src/contracts/Safe/SafeBaseContract.ts | 10 +- .../Safe/v1.0.0/SafeContract_v1_0_0.ts | 8 +- .../Safe/v1.1.1/SafeContract_v1_1_1.ts | 8 +- .../Safe/v1.2.0/SafeContract_v1_2_0.ts | 8 +- .../Safe/v1.3.0/SafeContract_v1_3_0.ts | 8 +- .../Safe/v1.4.1/SafeContract_v1_4_1.ts | 8 +- .../SafeProxyFactoryBaseContract.ts | 10 +- .../v1.0.0/SafeProxyFactoryContract_v1_0_0.ts | 8 +- .../v1.1.1/SafeProxyFactoryContract_v1_1_1.ts | 8 +- .../v1.3.0/SafeProxyFactoryContract_v1_3_0.ts | 8 +- .../v1.4.1/SafeProxyFactoryContract_v1_4_1.ts | 8 +- .../SignMessageLibBaseContract.ts | 4 +- .../v1.3.0/SignMessageLibContract_v1_3_0.ts | 8 +- .../v1.4.1/SignMessageLibContract_v1_4_1.ts | 8 +- .../SimulateTxAccessorBaseContract.ts | 4 +- .../SimulateTxAccessorContract_v1_3_0.ts | 8 +- .../SimulateTxAccessorContract_v1_4_1.ts | 8 +- .../src/contracts/contractInstances.ts | 123 +++++++++--------- packages/protocol-kit/src/types/index.ts | 96 +++++++------- 32 files changed, 213 insertions(+), 226 deletions(-) diff --git a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.ts b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.ts index da2a48f50..c1b9589eb 100644 --- a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.ts +++ b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.ts @@ -16,8 +16,8 @@ import { contractName } from '@safe-global/protocol-kit/contracts/config' * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: - * - CompatibilityFallbackHandlerContract_v1_4_1_Ethers extends CompatibilityFallbackHandlerBaseContractEthers - * - CompatibilityFallbackHandlerContract_v1_3_0_Ethers extends CompatibilityFallbackHandlerBaseContractEthers + * - CompatibilityFallbackHandlerContract_v1_4_1 extends CompatibilityFallbackHandlerBaseContractEthers + * - CompatibilityFallbackHandlerContract_v1_3_0 extends CompatibilityFallbackHandlerBaseContractEthers */ abstract class CompatibilityFallbackHandlerBaseContractEthers< CompatibilityFallbackHandlerContractAbiType extends InterfaceAbi & Abi diff --git a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.ts index c399d0b77..165923b44 100644 --- a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.ts @@ -8,21 +8,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * CompatibilityFallbackHandlerContract_v1_3_0_Ethers is the implementation specific to the CompatibilityFallbackHandler contract version 1.3.0. + * CompatibilityFallbackHandlerContract_v1_3_0 is the implementation specific to the CompatibilityFallbackHandler contract version 1.3.0. * * This class specializes in handling interactions with the CompatibilityFallbackHandler contract version 1.3.0 using Ethers.js v6. * * @extends CompatibilityFallbackHandlerBaseContractEthers - Inherits from CompatibilityFallbackHandlerBaseContractEthers with ABI specific to CompatibilityFallbackHandler contract version 1.3.0. * @implements CompatibilityFallbackHandlerContract_v1_3_0_Contract - Implements the interface specific to CompatibilityFallbackHandler contract version 1.3.0. */ -class CompatibilityFallbackHandlerContract_v1_3_0_Ethers +class CompatibilityFallbackHandlerContract_v1_3_0 extends CompatibilityFallbackHandlerBaseContractEthers implements CompatibilityFallbackHandlerContract_v1_3_0_Contract { safeVersion: SafeVersion /** - * Constructs an instance of CompatibilityFallbackHandlerContract_v1_3_0_Ethers + * Constructs an instance of CompatibilityFallbackHandlerContract_v1_3_0 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -44,4 +44,4 @@ class CompatibilityFallbackHandlerContract_v1_3_0_Ethers } } -export default CompatibilityFallbackHandlerContract_v1_3_0_Ethers +export default CompatibilityFallbackHandlerContract_v1_3_0 diff --git a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.ts index 62f890bcb..93556aeb4 100644 --- a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.ts @@ -8,21 +8,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * CompatibilityFallbackHandlerContract_v1_4_1_Ethers is the implementation specific to the CompatibilityFallbackHandler contract version 1.4.1. + * CompatibilityFallbackHandlerContract_v1_4_1 is the implementation specific to the CompatibilityFallbackHandler contract version 1.4.1. * * This class specializes in handling interactions with the CompatibilityFallbackHandler contract version 1.4.1 using Ethers.js v6. * * @extends CompatibilityFallbackHandlerBaseContractEthers - Inherits from CompatibilityFallbackHandlerBaseContractEthers with ABI specific to CompatibilityFallbackHandler contract version 1.4.1. * @implements CompatibilityFallbackHandlerContract_v1_4_1_Contract - Implements the interface specific to CompatibilityFallbackHandler contract version 1.4.1. */ -class CompatibilityFallbackHandlerContract_v1_4_1_Ethers +class CompatibilityFallbackHandlerContract_v1_4_1 extends CompatibilityFallbackHandlerBaseContractEthers implements CompatibilityFallbackHandlerContract_v1_4_1_Contract { safeVersion: SafeVersion /** - * Constructs an instance of CompatibilityFallbackHandlerContract_v1_4_1_Ethers + * Constructs an instance of CompatibilityFallbackHandlerContract_v1_4_1 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -44,4 +44,4 @@ class CompatibilityFallbackHandlerContract_v1_4_1_Ethers } } -export default CompatibilityFallbackHandlerContract_v1_4_1_Ethers +export default CompatibilityFallbackHandlerContract_v1_4_1 diff --git a/packages/protocol-kit/src/contracts/CreateCall/CreateCallBaseContract.ts b/packages/protocol-kit/src/contracts/CreateCall/CreateCallBaseContract.ts index 31fb81293..5b109a325 100644 --- a/packages/protocol-kit/src/contracts/CreateCall/CreateCallBaseContract.ts +++ b/packages/protocol-kit/src/contracts/CreateCall/CreateCallBaseContract.ts @@ -16,8 +16,8 @@ import { contractName } from '@safe-global/protocol-kit/contracts/config' * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: - * - CreateCallContract_v1_4_1_Ethers extends CreateCallBaseContractEthers - * - CreateCallContract_v1_3_0_Ethers extends CreateCallBaseContractEthers + * - CreateCallContract_v1_4_1 extends CreateCallBaseContractEthers + * - CreateCallContract_v1_3_0 extends CreateCallBaseContractEthers */ abstract class CreateCallBaseContractEthers< CreateCallContractAbiType extends InterfaceAbi & Abi diff --git a/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts index 61424ec51..dc331589a 100644 --- a/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts @@ -11,21 +11,21 @@ import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' /** - * CreateCallContract_v1_3_0_Ethers is the implementation specific to the CreateCall contract version 1.3.0. + * CreateCallContract_v1_3_0 is the implementation specific to the CreateCall contract version 1.3.0. * * This class specializes in handling interactions with the CreateCall contract version 1.3.0 using Ethers.js v6. * * @extends CreateCallBaseContractEthers - Inherits from CreateCallBaseContractEthers with ABI specific to CreateCall contract version 1.3.0. * @implements CreateCallContract_v1_3_0_Contract - Implements the interface specific to CreateCall contract version 1.3.0. */ -class CreateCallContract_v1_3_0_Ethers +class CreateCallContract_v1_3_0 extends CreateCallBaseContractEthers implements CreateCallContract_v1_3_0_Contract { safeVersion: SafeVersion /** - * Constructs an instance of CreateCallContract_v1_3_0_Ethers + * Constructs an instance of CreateCallContract_v1_3_0 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -83,4 +83,4 @@ class CreateCallContract_v1_3_0_Ethers } } -export default CreateCallContract_v1_3_0_Ethers +export default CreateCallContract_v1_3_0 diff --git a/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts index e08d8da58..e233c4885 100644 --- a/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts @@ -11,21 +11,21 @@ import { import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' /** - * CreateCallContract_v1_4_1_Ethers is the implementation specific to the CreateCall contract version 1.4.1. + * CreateCallContract_v1_4_1 is the implementation specific to the CreateCall contract version 1.4.1. * * This class specializes in handling interactions with the CreateCall contract version 1.4.1 using Ethers.js v6. * * @extends CreateCallBaseContractEthers - Inherits from CreateCallBaseContractEthers with ABI specific to CreateCall contract version 1.4.1. * @implements CreateCallContract_v1_4_1_Contract - Implements the interface specific to CreateCall contract version 1.4.1. */ -class CreateCallContract_v1_4_1_Ethers +class CreateCallContract_v1_4_1 extends CreateCallBaseContractEthers implements CreateCallContract_v1_4_1_Contract { safeVersion: SafeVersion /** - * Constructs an instance of CreateCallContract_v1_4_1_Ethers + * Constructs an instance of CreateCallContract_v1_4_1 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -83,4 +83,4 @@ class CreateCallContract_v1_4_1_Ethers } } -export default CreateCallContract_v1_4_1_Ethers +export default CreateCallContract_v1_4_1 diff --git a/packages/protocol-kit/src/contracts/MultiSend/MultiSendBaseContract.ts b/packages/protocol-kit/src/contracts/MultiSend/MultiSendBaseContract.ts index 3858f79de..0725a70e9 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/MultiSendBaseContract.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/MultiSendBaseContract.ts @@ -16,8 +16,8 @@ import { contractName } from '@safe-global/protocol-kit/contracts/config' * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: - * - MultiSendContract_v1_4_1_Ethers extends MultiSendBaseContractEthers - * - MultiSendContract_v1_3_0_Ethers extends MultiSendBaseContractEthers + * - MultiSendContract_v1_4_1 extends MultiSendBaseContractEthers + * - MultiSendContract_v1_3_0 extends MultiSendBaseContractEthers */ abstract class MultiSendBaseContractEthers< MultiSendContractAbiType extends InterfaceAbi & Abi diff --git a/packages/protocol-kit/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.ts b/packages/protocol-kit/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.ts index 8a6d68e46..240458db2 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.ts @@ -16,8 +16,8 @@ import { contractName } from '@safe-global/protocol-kit/contracts/config' * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: - * - MultiSendCallOnlyContract_v1_4_1_Ethers extends MultiSendCallOnlyBaseContractEthers - * - MultiSendCallOnlyContract_v1_3_0_Ethers extends MultiSendCallOnlyBaseContractEthers + * - MultiSendCallOnlyContract_v1_4_1 extends MultiSendCallOnlyBaseContractEthers + * - MultiSendCallOnlyContract_v1_3_0 extends MultiSendCallOnlyBaseContractEthers */ abstract class MultiSendCallOnlyBaseContractEthers< MultiSendCallOnlyContractAbiType extends InterfaceAbi & Abi diff --git a/packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.ts index 25eb013ea..41ef24d7e 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.ts @@ -8,21 +8,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * MultiSendContract_v1_1_1_Ethers is the implementation specific to the MultiSend contract version 1.1.1. + * MultiSendContract_v1_1_1 is the implementation specific to the MultiSend contract version 1.1.1. * * This class specializes in handling interactions with the MultiSend contract version 1.1.1 using Ethers.js v6. * * @extends MultiSendBaseContractEthers - Inherits from MultiSendBaseContractEthers with ABI specific to MultiSend contract version 1.1.1. * @implements MultiSendContract_v1_1_1_Contract - Implements the interface specific to MultiSend contract version 1.1.1. */ -class MultiSendContract_v1_1_1_Ethers +class MultiSendContract_v1_1_1 extends MultiSendBaseContractEthers implements MultiSendContract_v1_1_1_Contract { safeVersion: SafeVersion /** - * Constructs an instance of MultiSendContract_v1_1_1_Ethers + * Constructs an instance of MultiSendContract_v1_1_1 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -44,4 +44,4 @@ class MultiSendContract_v1_1_1_Ethers } } -export default MultiSendContract_v1_1_1_Ethers +export default MultiSendContract_v1_1_1 diff --git a/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.ts index 4804fc5c9..276477f9c 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.ts @@ -8,21 +8,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * MultiSendCallOnlyContract_v1_3_0_Ethers is the implementation specific to the MultiSendCallOnly contract version 1.3.0. + * MultiSendCallOnlyContract_v1_3_0 is the implementation specific to the MultiSendCallOnly contract version 1.3.0. * * This class specializes in handling interactions with the MultiSendCallOnly contract version 1.3.0 using Ethers.js v6. * * @extends MultiSendCallOnlyBaseContractEthers - Inherits from MultiSendCallOnlyBaseContractEthers with ABI specific to MultiSendCallOnly contract version 1.3.0. * @implements MultiSendCallOnlyContract_v1_3_0_Contract - Implements the interface specific to MultiSendCallOnly contract version 1.3.0. */ -class MultiSendCallOnlyContract_v1_3_0_Ethers +class MultiSendCallOnlyContract_v1_3_0 extends MultiSendCallOnlyBaseContractEthers implements MultiSendCallOnlyContract_v1_3_0_Contract { safeVersion: SafeVersion /** - * Constructs an instance of MultiSendCallOnlyContract_v1_3_0_Ethers + * Constructs an instance of MultiSendCallOnlyContract_v1_3_0 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -44,4 +44,4 @@ class MultiSendCallOnlyContract_v1_3_0_Ethers } } -export default MultiSendCallOnlyContract_v1_3_0_Ethers +export default MultiSendCallOnlyContract_v1_3_0 diff --git a/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.ts index d844764c2..ca09a04ed 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.ts @@ -8,21 +8,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * MultiSendContract_v1_3_0_Ethers is the implementation specific to the MultiSend contract version 1.3.0. + * MultiSendContract_v1_3_0 is the implementation specific to the MultiSend contract version 1.3.0. * * This class specializes in handling interactions with the MultiSend contract version 1.3.0 using Ethers.js v6. * * @extends MultiSendBaseContractEthers - Inherits from MultiSendBaseContractEthers with ABI specific to MultiSend contract version 1.3.0. * @implements MultiSendContract_v1_3_0_Contract - Implements the interface specific to MultiSend contract version 1.3.0. */ -class MultiSendContract_v1_3_0_Ethers +class MultiSendContract_v1_3_0 extends MultiSendBaseContractEthers implements MultiSendContract_v1_3_0_Contract { safeVersion: SafeVersion /** - * Constructs an instance of MultiSendContract_v1_3_0_Ethers + * Constructs an instance of MultiSendContract_v1_3_0 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -44,4 +44,4 @@ class MultiSendContract_v1_3_0_Ethers } } -export default MultiSendContract_v1_3_0_Ethers +export default MultiSendContract_v1_3_0 diff --git a/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.ts index 38ab90bec..9e0837ea0 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.ts @@ -8,21 +8,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * MultiSendCallOnlyContract_v1_4_1_Ethers is the implementation specific to the MultiSend contract version 1.4.1. + * MultiSendCallOnlyContract_v1_4_1 is the implementation specific to the MultiSend contract version 1.4.1. * * This class specializes in handling interactions with the MultiSendCallOnly contract version 1.4.1 using Ethers.js v6. * * @extends MultiSendCallOnlyBaseContractEthers - Inherits from MultiSendBaseContractEthers with ABI specific to MultiSendCallOnly contract version 1.4.1. * @implements MultiSendCallOnlyContract_v1_4_1_Contract - Implements the interface specific to MultiSendCallOnly contract version 1.4.1. */ -class MultiSendCallOnlyContract_v1_4_1_Ethers +class MultiSendCallOnlyContract_v1_4_1 extends MultiSendCallOnlyBaseContractEthers implements MultiSendCallOnlyContract_v1_4_1_Contract { safeVersion: SafeVersion /** - * Constructs an instance of MultiSendCallOnlyContract_v1_4_1_Ethers + * Constructs an instance of MultiSendCallOnlyContract_v1_4_1 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -44,4 +44,4 @@ class MultiSendCallOnlyContract_v1_4_1_Ethers } } -export default MultiSendCallOnlyContract_v1_4_1_Ethers +export default MultiSendCallOnlyContract_v1_4_1 diff --git a/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.ts index f21012414..4d5e17fc4 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.ts @@ -8,21 +8,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * MultiSendContract_v1_4_1_Ethers is the implementation specific to the MultiSend contract version 1.4.1. + * MultiSendContract_v1_4_1 is the implementation specific to the MultiSend contract version 1.4.1. * * This class specializes in handling interactions with the MultiSend contract version 1.4.1 using Ethers.js v6. * * @extends MultiSendBaseContractEthers - Inherits from MultiSendBaseContractEthers with ABI specific to MultiSend contract version 1.4.1. * @implements MultiSendContract_v1_4_1_Contract - Implements the interface specific to MultiSend contract version 1.4.1. */ -class MultiSendContract_v1_4_1_Ethers +class MultiSendContract_v1_4_1 extends MultiSendBaseContractEthers implements MultiSendContract_v1_4_1_Contract { safeVersion: SafeVersion /** - * Constructs an instance of MultiSendContract_v1_4_1_Ethers + * Constructs an instance of MultiSendContract_v1_4_1 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -44,4 +44,4 @@ class MultiSendContract_v1_4_1_Ethers } } -export default MultiSendContract_v1_4_1_Ethers +export default MultiSendContract_v1_4_1 diff --git a/packages/protocol-kit/src/contracts/Safe/SafeBaseContract.ts b/packages/protocol-kit/src/contracts/Safe/SafeBaseContract.ts index d3bd73168..78c94766e 100644 --- a/packages/protocol-kit/src/contracts/Safe/SafeBaseContract.ts +++ b/packages/protocol-kit/src/contracts/Safe/SafeBaseContract.ts @@ -16,11 +16,11 @@ import { contractName, safeDeploymentsL1ChainIds } from '@safe-global/protocol-k * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: - * - SafeContract_v1_4_1_Ethers extends SafeBaseContractEthers - * - SafeContract_v1_3_0_Ethers extends SafeBaseContractEthers - * - SafeContract_v1_2_0_Ethers extends SafeBaseContractEthers - * - SafeContract_v1_1_1_Ethers extends SafeBaseContractEthers - * - SafeContract_v1_0_0_Ethers extends SafeBaseContractEthers + * - SafeContract_v1_4_1 extends SafeBaseContractEthers + * - SafeContract_v1_3_0 extends SafeBaseContractEthers + * - SafeContract_v1_2_0 extends SafeBaseContractEthers + * - SafeContract_v1_1_1 extends SafeBaseContractEthers + * - SafeContract_v1_0_0 extends SafeBaseContractEthers */ abstract class SafeBaseContractEthers< SafeContractAbiType extends InterfaceAbi & Abi diff --git a/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts b/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts index 76c418580..26c09b210 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts @@ -14,21 +14,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * SafeContract_v1_0_0_Ethers is the implementation specific to the Safe contract version 1.0.0. + * SafeContract_v1_0_0 is the implementation specific to the Safe contract version 1.0.0. * * This class specializes in handling interactions with the Safe contract version 1.0.0 using Ethers.js v6. * * @extends SafeBaseContractEthers - Inherits from SafeBaseContractEthers with ABI specific to Safe contract version 1.0.0. * @implements SafeContract_v1_0_0_Contract - Implements the interface specific to Safe contract version 1.0.0. */ -class SafeContract_v1_0_0_Ethers +class SafeContract_v1_0_0 extends SafeBaseContractEthers implements SafeContract_v1_0_0_Contract { safeVersion: SafeVersion /** - * Constructs an instance of SafeContract_v1_0_0_Ethers + * Constructs an instance of SafeContract_v1_0_0 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -331,4 +331,4 @@ class SafeContract_v1_0_0_Ethers } } -export default SafeContract_v1_0_0_Ethers +export default SafeContract_v1_0_0 diff --git a/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.ts b/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.ts index 895c05e86..50817c009 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.ts @@ -14,21 +14,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * SafeContract_v1_1_1_Ethers is the implementation specific to the Safe contract version 1.1.1. + * SafeContract_v1_1_1 is the implementation specific to the Safe contract version 1.1.1. * * This class specializes in handling interactions with the Safe contract version 1.1.1 using Ethers.js v6. * * @extends SafeBaseContractEthers - Inherits from SafeBaseContractEthers with ABI specific to Safe contract version 1.1.1. * @implements SafeContract_v1_1_1_Contract - Implements the interface specific to Safe contract version 1.1.1. */ -class SafeContract_v1_1_1_Ethers +class SafeContract_v1_1_1 extends SafeBaseContractEthers implements SafeContract_v1_1_1_Contract { safeVersion: SafeVersion /** - * Constructs an instance of SafeContract_v1_1_1_Ethers + * Constructs an instance of SafeContract_v1_1_1 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -318,4 +318,4 @@ class SafeContract_v1_1_1_Ethers } } -export default SafeContract_v1_1_1_Ethers +export default SafeContract_v1_1_1 diff --git a/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts b/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts index 5e5d23f26..556dcd51e 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts @@ -13,21 +13,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * SafeContract_v1_2_0_Ethers is the implementation specific to the Safe contract version 1.2.0. + * SafeContract_v1_2_0 is the implementation specific to the Safe contract version 1.2.0. * * This class specializes in handling interactions with the Safe contract version 1.2.0 using Ethers.js v6. * * @extends SafeBaseContractEthers - Inherits from SafeBaseContractEthers with ABI specific to Safe contract version 1.2.0. * @implements SafeContract_v1_2_0_Contract - Implements the interface specific to Safe contract version 1.2.0. */ -class SafeContract_v1_2_0_Ethers +class SafeContract_v1_2_0 extends SafeBaseContractEthers implements SafeContract_v1_2_0_Contract { safeVersion: SafeVersion /** - * Constructs an instance of SafeContract_v1_2_0_Ethers + * Constructs an instance of SafeContract_v1_2_0 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -322,4 +322,4 @@ class SafeContract_v1_2_0_Ethers } } -export default SafeContract_v1_2_0_Ethers +export default SafeContract_v1_2_0 diff --git a/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.ts index 5de8bd67b..dc3a506ec 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.ts @@ -13,21 +13,21 @@ import { EthersTransactionResult } from '@safe-global/safe-core-sdk-types' /** - * SafeContract_v1_3_0_Ethers is the implementation specific to the Safe contract version 1.3.0. + * SafeContract_v1_3_0 is the implementation specific to the Safe contract version 1.3.0. * * This class specializes in handling interactions with the Safe contract version 1.3.0 using Ethers.js v6. * * @extends SafeBaseContractEthers - Inherits from SafeBaseContractEthers with ABI specific to Safe contract version 1.3.0. * @implements SafeContract_v1_3_0_Contract - Implements the interface specific to Safe contract version 1.3.0. */ -class SafeContract_v1_3_0_Ethers +class SafeContract_v1_3_0 extends SafeBaseContractEthers implements SafeContract_v1_3_0_Contract { safeVersion: SafeVersion /** - * Constructs an instance of SafeContract_v1_3_0_Ethers + * Constructs an instance of SafeContract_v1_3_0 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -336,4 +336,4 @@ class SafeContract_v1_3_0_Ethers } } -export default SafeContract_v1_3_0_Ethers +export default SafeContract_v1_3_0 diff --git a/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.ts index ea2d98fb9..3c1a8c4e2 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.ts @@ -14,21 +14,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * SafeContract_v1_4_1_Ethers is the implementation specific to the Safe contract version 1.4.1. + * SafeContract_v1_4_1 is the implementation specific to the Safe contract version 1.4.1. * * This class specializes in handling interactions with the Safe contract version 1.4.1 using Ethers.js v6. * * @extends SafeBaseContractEthers - Inherits from SafeBaseContractEthers with ABI specific to Safe contract version 1.4.1. * @implements SafeContract_v1_4_1_Contract - Implements the interface specific to Safe contract version 1.4.1. */ -class SafeContract_v1_4_1_Ethers +class SafeContract_v1_4_1 extends SafeBaseContractEthers implements SafeContract_v1_4_1_Contract { safeVersion: SafeVersion /** - * Constructs an instance of SafeContract_v1_4_1_Ethers + * Constructs an instance of SafeContract_v1_4_1 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -337,4 +337,4 @@ class SafeContract_v1_4_1_Ethers } } -export default SafeContract_v1_4_1_Ethers +export default SafeContract_v1_4_1 diff --git a/packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.ts index c5b7368ac..e5168a6ae 100644 --- a/packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.ts @@ -23,11 +23,11 @@ export interface CreateProxyProps extends CreateProxyPropsGeneral { * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: - * - SafeProxyFactoryContract_v1_4_1_Ethers extends SafeProxyFactoryBaseContractEthers - * - SafeProxyFactoryContract_v1_3_0_Ethers extends SafeProxyFactoryBaseContractEthers - * - SafeProxyFactoryContract_v1_2_0_Ethers extends SafeProxyFactoryBaseContractEthers - * - SafeProxyFactoryContract_v1_1_1_Ethers extends SafeProxyFactoryBaseContractEthers - * - SafeProxyFactoryContract_v1_0_0_Ethers extends SafeProxyFactoryBaseContractEthers + * - SafeProxyFactoryContract_v1_4_1 extends SafeProxyFactoryBaseContractEthers + * - SafeProxyFactoryContract_v1_3_0 extends SafeProxyFactoryBaseContractEthers + * - SafeProxyFactoryContract_v1_2_0 extends SafeProxyFactoryBaseContractEthers + * - SafeProxyFactoryContract_v1_1_1 extends SafeProxyFactoryBaseContractEthers + * - SafeProxyFactoryContract_v1_0_0 extends SafeProxyFactoryBaseContractEthers */ abstract class SafeProxyFactoryBaseContractEthers< SafeProxyFactoryContractAbiType extends InterfaceAbi & Abi diff --git a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.ts index 985083809..e12b2c160 100644 --- a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.ts @@ -12,21 +12,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * SafeProxyFactoryContract_v1_0_0_Ethers is the implementation specific to the Safe Proxy Factory contract version 1.0.0. + * SafeProxyFactoryContract_v1_0_0 is the implementation specific to the Safe Proxy Factory contract version 1.0.0. * * This class specializes in handling interactions with the Safe Proxy Factory contract version 1.0.0 using Ethers.js v6. * * @extends SafeProxyFactoryBaseContractEthers - Inherits from SafeProxyFactoryBaseContractEthers with ABI specific to Safe Proxy Factory contract version 1.0.0. * @implements SafeProxyFactoryContract_v1_0_0_Contract - Implements the interface specific to Safe Proxy Factory contract version 1.0.0. */ -class SafeProxyFactoryContract_v1_0_0_Ethers +class SafeProxyFactoryContract_v1_0_0 extends SafeProxyFactoryBaseContractEthers implements SafeProxyFactoryContract_v1_0_0_Contract { safeVersion: SafeVersion /** - * Constructs an instance of SafeProxyFactoryContract_v1_0_0_Ethers + * Constructs an instance of SafeProxyFactoryContract_v1_0_0 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -137,4 +137,4 @@ class SafeProxyFactoryContract_v1_0_0_Ethers } } -export default SafeProxyFactoryContract_v1_0_0_Ethers +export default SafeProxyFactoryContract_v1_0_0 diff --git a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.ts index 5775daa71..57fc8d509 100644 --- a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.ts @@ -12,21 +12,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * SafeProxyFactoryContract_v1_1_1_Ethers is the implementation specific to the Safe Proxy Factory contract version 1.1.1. + * SafeProxyFactoryContract_v1_1_1 is the implementation specific to the Safe Proxy Factory contract version 1.1.1. * * This class specializes in handling interactions with the Safe Proxy Factory contract version 1.1.1 using Ethers.js v6. * * @extends SafeProxyFactoryBaseContractEthers - Inherits from SafeProxyFactoryBaseContractEthers with ABI specific to Safe Proxy Factory contract version 1.1.1. * @implements SafeProxyFactoryContract_v1_1_1_Contract - Implements the interface specific to Safe Proxy Factory contract version 1.1.1. */ -class SafeProxyFactoryContract_v1_1_1_Ethers +class SafeProxyFactoryContract_v1_1_1 extends SafeProxyFactoryBaseContractEthers implements SafeProxyFactoryContract_v1_1_1_Contract { safeVersion: SafeVersion /** - * Constructs an instance of SafeProxyFactoryContract_v1_1_1_Ethers + * Constructs an instance of SafeProxyFactoryContract_v1_1_1 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -157,4 +157,4 @@ class SafeProxyFactoryContract_v1_1_1_Ethers } } -export default SafeProxyFactoryContract_v1_1_1_Ethers +export default SafeProxyFactoryContract_v1_1_1 diff --git a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.ts index 175c6f682..575a4834e 100644 --- a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.ts @@ -12,21 +12,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * SafeProxyFactoryContract_v1_3_0_Ethers is the implementation specific to the Safe Proxy Factory contract version 1.3.0. + * SafeProxyFactoryContract_v1_3_0 is the implementation specific to the Safe Proxy Factory contract version 1.3.0. * * This class specializes in handling interactions with the Safe Proxy Factory contract version 1.3.0 using Ethers.js v6. * * @extends SafeProxyFactoryBaseContractEthers - Inherits from SafeProxyFactoryBaseContractEthers with ABI specific to Safe Proxy Factory contract version 1.3.0. * @implements SafeProxyFactoryContract_v1_3_0_Contract - Implements the interface specific to Safe Proxy Factory contract version 1.3.0. */ -class SafeProxyFactoryContract_v1_3_0_Ethers +class SafeProxyFactoryContract_v1_3_0 extends SafeProxyFactoryBaseContractEthers implements SafeProxyFactoryContract_v1_3_0_Contract { safeVersion: SafeVersion /** - * Constructs an instance of SafeProxyFactoryContract_v1_3_0_Ethers + * Constructs an instance of SafeProxyFactoryContract_v1_3_0 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -157,4 +157,4 @@ class SafeProxyFactoryContract_v1_3_0_Ethers } } -export default SafeProxyFactoryContract_v1_3_0_Ethers +export default SafeProxyFactoryContract_v1_3_0 diff --git a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.ts index e08043ae8..f41c84b13 100644 --- a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.ts @@ -12,21 +12,21 @@ import { import SafeProvider from '@safe-global/protocol-kit/SafeProvider' /** - * SafeProxyFactoryContract_v1_4_1_Ethers is the implementation specific to the Safe Proxy Factory contract version 1.4.1. + * SafeProxyFactoryContract_v1_4_1 is the implementation specific to the Safe Proxy Factory contract version 1.4.1. * * This class specializes in handling interactions with the Safe Proxy Factory contract version 1.4.1 using Ethers.js v6. * * @extends SafeProxyFactoryBaseContractEthers - Inherits from SafeProxyFactoryBaseContractEthers with ABI specific to Safe Proxy Factory contract version 1.4.1. * @implements SafeProxyFactoryContract_v1_4_1_Contract - Implements the interface specific to Safe Proxy Factory contract version 1.4.1. */ -class SafeProxyFactoryContract_v1_4_1_Ethers +class SafeProxyFactoryContract_v1_4_1 extends SafeProxyFactoryBaseContractEthers implements SafeProxyFactoryContract_v1_4_1_Contract { safeVersion: SafeVersion /** - * Constructs an instance of SafeProxyFactoryContract_v1_4_1_Ethers + * Constructs an instance of SafeProxyFactoryContract_v1_4_1 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -149,4 +149,4 @@ class SafeProxyFactoryContract_v1_4_1_Ethers } } -export default SafeProxyFactoryContract_v1_4_1_Ethers +export default SafeProxyFactoryContract_v1_4_1 diff --git a/packages/protocol-kit/src/contracts/SignMessageLib/SignMessageLibBaseContract.ts b/packages/protocol-kit/src/contracts/SignMessageLib/SignMessageLibBaseContract.ts index c25a069f9..bbb467d54 100644 --- a/packages/protocol-kit/src/contracts/SignMessageLib/SignMessageLibBaseContract.ts +++ b/packages/protocol-kit/src/contracts/SignMessageLib/SignMessageLibBaseContract.ts @@ -16,8 +16,8 @@ import { contractName } from '@safe-global/protocol-kit/contracts/config' * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: - * - SignMessageLibContract_v1_4_1_Ethers extends SignMessageLibBaseContractEthers - * - SignMessageLibContract_v1_3_0_Ethers extends SignMessageLibBaseContractEthers + * - SignMessageLibContract_v1_4_1 extends SignMessageLibBaseContractEthers + * - SignMessageLibContract_v1_3_0 extends SignMessageLibBaseContractEthers */ abstract class SignMessageLibBaseContractEthers< SignMessageLibContractAbiType extends InterfaceAbi & Abi diff --git a/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts index 14fa2fe38..171774925 100644 --- a/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts @@ -12,21 +12,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * SignMessageLibContract_v1_3_0_Ethers is the implementation specific to the SignMessageLib contract version 1.3.0. + * SignMessageLibContract_v1_3_0 is the implementation specific to the SignMessageLib contract version 1.3.0. * * This class specializes in handling interactions with the SignMessageLib contract version 1.3.0 using Ethers.js v6. * * @extends SignMessageLibBaseContractEthers - Inherits from SignMessageLibBaseContractEthers with ABI specific to SignMessageLib contract version 1.3.0. * @implements SignMessageLibContract_v1_3_0_Contract - Implements the interface specific to SignMessageLib contract version 1.3.0. */ -class SignMessageLibContract_v1_3_0_Ethers +class SignMessageLibContract_v1_3_0 extends SignMessageLibBaseContractEthers implements SignMessageLibContract_v1_3_0_Contract { safeVersion: SafeVersion /** - * Constructs an instance of SignMessageLibContract_v1_3_0_Ethers + * Constructs an instance of SignMessageLibContract_v1_3_0 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -71,4 +71,4 @@ class SignMessageLibContract_v1_3_0_Ethers } } -export default SignMessageLibContract_v1_3_0_Ethers +export default SignMessageLibContract_v1_3_0 diff --git a/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts index 35b9c612b..fb972d87a 100644 --- a/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts @@ -12,21 +12,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * SignMessageLibContract_v1_4_1_Ethers is the implementation specific to the SignMessageLib contract version 1.4.1. + * SignMessageLibContract_v1_4_1 is the implementation specific to the SignMessageLib contract version 1.4.1. * * This class specializes in handling interactions with the SignMessageLib contract version 1.4.1 using Ethers.js v6. * * @extends SignMessageLibBaseContractEthers - Inherits from SignMessageLibBaseContractEthers with ABI specific to SignMessageLib contract version 1.4.1. * @implements SignMessageLibContract_v1_4_1_Contract - Implements the interface specific to SignMessageLib contract version 1.4.1. */ -class SignMessageLibContract_v1_4_1_Ethers +class SignMessageLibContract_v1_4_1 extends SignMessageLibBaseContractEthers implements SignMessageLibContract_v1_4_1_Contract { safeVersion: SafeVersion /** - * Constructs an instance of SignMessageLibContract_v1_4_1_Ethers + * Constructs an instance of SignMessageLibContract_v1_4_1 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -72,4 +72,4 @@ class SignMessageLibContract_v1_4_1_Ethers } } -export default SignMessageLibContract_v1_4_1_Ethers +export default SignMessageLibContract_v1_4_1 diff --git a/packages/protocol-kit/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.ts b/packages/protocol-kit/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.ts index b85054c31..57e1bb05b 100644 --- a/packages/protocol-kit/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.ts +++ b/packages/protocol-kit/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.ts @@ -16,8 +16,8 @@ import { contractName } from '@safe-global/protocol-kit/contracts/config' * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: - * - SimulateTxAccessorContract_v1_4_1_Ethers extends SimulateTxAccessorBaseContractEthers - * - SimulateTxAccessorContract_v1_3_0_Ethers extends SimulateTxAccessorBaseContractEthers + * - SimulateTxAccessorContract_v1_4_1 extends SimulateTxAccessorBaseContractEthers + * - SimulateTxAccessorContract_v1_3_0 extends SimulateTxAccessorBaseContractEthers */ abstract class SimulateTxAccessorBaseContractEthers< SimulateTxAccessorContractAbiType extends InterfaceAbi & Abi diff --git a/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.ts index ef75e235b..805cb3409 100644 --- a/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.ts @@ -9,21 +9,21 @@ import { } from '@safe-global/safe-core-sdk-types' /** - * SimulateTxAccessorContract_v1_3_0_Ethers is the implementation specific to the SimulateTxAccessor contract version 1.3.0. + * SimulateTxAccessorContract_v1_3_0 is the implementation specific to the SimulateTxAccessor contract version 1.3.0. * * This class specializes in handling interactions with the SimulateTxAccessor contract version 1.3.0 using Ethers.js v6. * * @extends SimulateTxAccessorBaseContractEthers - Inherits from SimulateTxAccessorBaseContractEthers with ABI specific to SimulateTxAccessor contract version 1.3.0. * @implements SimulateTxAccessorContract_v1_3_0_Contract - Implements the interface specific to SimulateTxAccessor contract version 1.3.0. */ -class SimulateTxAccessorContract_v1_3_0_Ethers +class SimulateTxAccessorContract_v1_3_0 extends SimulateTxAccessorBaseContractEthers implements SimulateTxAccessorContract_v1_3_0_Contract { safeVersion: SafeVersion /** - * Constructs an instance of SimulateTxAccessorContract_v1_3_0_Ethers + * Constructs an instance of SimulateTxAccessorContract_v1_3_0 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -53,4 +53,4 @@ class SimulateTxAccessorContract_v1_3_0_Ethers } } -export default SimulateTxAccessorContract_v1_3_0_Ethers +export default SimulateTxAccessorContract_v1_3_0 diff --git a/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.ts index b4063f547..ebc2dd3a5 100644 --- a/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.ts @@ -8,21 +8,21 @@ import { SimulateTxAccessorContract_v1_4_1_Function } from '@safe-global/safe-core-sdk-types' /** - * SimulateTxAccessorContract_v1_4_1_Ethers is the implementation specific to the SimulateTxAccessor contract version 1.4.1. + * SimulateTxAccessorContract_v1_4_1 is the implementation specific to the SimulateTxAccessor contract version 1.4.1. * * This class specializes in handling interactions with the SimulateTxAccessor contract version 1.4.1 using Ethers.js v6. * * @extends SimulateTxAccessorBaseContractEthers - Inherits from SimulateTxAccessorBaseContractEthers with ABI specific to SimulateTxAccessor contract version 1.4.1. * @implements SimulateTxAccessorContract_v1_4_1_Contract - Implements the interface specific to SimulateTxAccessor contract version 1.4.1. */ -class SimulateTxAccessorContract_v1_4_1_Ethers +class SimulateTxAccessorContract_v1_4_1 extends SimulateTxAccessorBaseContractEthers implements SimulateTxAccessorContract_v1_4_1_Contract { safeVersion: SafeVersion /** - * Constructs an instance of SimulateTxAccessorContract_v1_4_1_Ethers + * Constructs an instance of SimulateTxAccessorContract_v1_4_1 * * @param chainId - The chain ID where the contract resides. * @param safeProvider - An instance of SafeProvider. @@ -52,4 +52,4 @@ class SimulateTxAccessorContract_v1_4_1_Ethers } } -export default SimulateTxAccessorContract_v1_4_1_Ethers +export default SimulateTxAccessorContract_v1_4_1 diff --git a/packages/protocol-kit/src/contracts/contractInstances.ts b/packages/protocol-kit/src/contracts/contractInstances.ts index decf7c9f7..4021c9bfb 100644 --- a/packages/protocol-kit/src/contracts/contractInstances.ts +++ b/packages/protocol-kit/src/contracts/contractInstances.ts @@ -24,28 +24,28 @@ import { SimulateTxAccessorContract_v1_4_1_Abi, SimulateTxAccessorContract_v1_3_0_Abi } from '@safe-global/safe-core-sdk-types' -import CreateCallContract_v1_3_0_Ethers from './CreateCall/v1.3.0/CreateCallContract_v1_3_0' -import CreateCallContract_v1_4_1_Ethers from './CreateCall/v1.4.1/CreateCallContract_v1_4_1' -import MultiSendContract_v1_1_1_Ethers from './MultiSend/v1.1.1/MultiSendContract_v1_1_1' -import MultiSendContract_v1_3_0_Ethers from './MultiSend/v1.3.0/MultiSendContract_v1_3_0' -import MultiSendContract_v1_4_1_Ethers from './MultiSend/v1.4.1/MultiSendContract_v1_4_1' -import MultiSendCallOnlyContract_v1_3_0_Ethers from './MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0' -import MultiSendCallOnlyContract_v1_4_1_Ethers from './MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1' -import SignMessageLibContract_v1_3_0_Ethers from './SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0' -import SignMessageLibContract_v1_4_1_Ethers from './SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1' -import SafeContract_v1_0_0_Ethers from './Safe/v1.0.0/SafeContract_v1_0_0' -import SafeContract_v1_1_1_Ethers from './Safe/v1.1.1/SafeContract_v1_1_1' -import SafeContract_v1_2_0_Ethers from './Safe/v1.2.0/SafeContract_v1_2_0' -import SafeContract_v1_3_0_Ethers from './Safe/v1.3.0/SafeContract_v1_3_0' -import SafeContract_v1_4_1_Ethers from './Safe/v1.4.1/SafeContract_v1_4_1' -import SafeProxyFactoryContract_v1_0_0_Ethers from './SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0' -import SafeProxyFactoryContract_v1_1_1_Ethers from './SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1' -import SafeProxyFactoryContract_v1_3_0_Ethers from './SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0' -import SafeProxyFactoryContract_v1_4_1_Ethers from './SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1' -import SimulateTxAccessorContract_v1_3_0_Ethers from './SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0' -import SimulateTxAccessorContract_v1_4_1_Ethers from './SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1' -import CompatibilityFallbackHandlerContract_v1_3_0_Ethers from './CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0' -import CompatibilityFallbackHandlerContract_v1_4_1_Ethers from './CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1' +import CreateCallContract_v1_3_0 from './CreateCall/v1.3.0/CreateCallContract_v1_3_0' +import CreateCallContract_v1_4_1 from './CreateCall/v1.4.1/CreateCallContract_v1_4_1' +import MultiSendContract_v1_1_1 from './MultiSend/v1.1.1/MultiSendContract_v1_1_1' +import MultiSendContract_v1_3_0 from './MultiSend/v1.3.0/MultiSendContract_v1_3_0' +import MultiSendContract_v1_4_1 from './MultiSend/v1.4.1/MultiSendContract_v1_4_1' +import MultiSendCallOnlyContract_v1_3_0 from './MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0' +import MultiSendCallOnlyContract_v1_4_1 from './MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1' +import SignMessageLibContract_v1_3_0 from './SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0' +import SignMessageLibContract_v1_4_1 from './SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1' +import SafeContract_v1_0_0 from './Safe/v1.0.0/SafeContract_v1_0_0' +import SafeContract_v1_1_1 from './Safe/v1.1.1/SafeContract_v1_1_1' +import SafeContract_v1_2_0 from './Safe/v1.2.0/SafeContract_v1_2_0' +import SafeContract_v1_3_0 from './Safe/v1.3.0/SafeContract_v1_3_0' +import SafeContract_v1_4_1 from './Safe/v1.4.1/SafeContract_v1_4_1' +import SafeProxyFactoryContract_v1_0_0 from './SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0' +import SafeProxyFactoryContract_v1_1_1 from './SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1' +import SafeProxyFactoryContract_v1_3_0 from './SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0' +import SafeProxyFactoryContract_v1_4_1 from './SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1' +import SimulateTxAccessorContract_v1_3_0 from './SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0' +import SimulateTxAccessorContract_v1_4_1 from './SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1' +import CompatibilityFallbackHandlerContract_v1_3_0 from './CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0' +import CompatibilityFallbackHandlerContract_v1_4_1 from './CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1' import SafeProvider from '../SafeProvider' export async function getSafeContractInstance( @@ -55,18 +55,18 @@ export async function getSafeContractInstance( customContractAbi?: JsonFragment | JsonFragment[] | undefined, isL1SafeSingleton?: boolean ): Promise< - | SafeContract_v1_4_1_Ethers - | SafeContract_v1_3_0_Ethers - | SafeContract_v1_2_0_Ethers - | SafeContract_v1_1_1_Ethers - | SafeContract_v1_0_0_Ethers + | SafeContract_v1_4_1 + | SafeContract_v1_3_0 + | SafeContract_v1_2_0 + | SafeContract_v1_1_1 + | SafeContract_v1_0_0 > { const chainId = await safeProvider.getChainId() let safeContractInstance switch (safeVersion) { case '1.4.1': - safeContractInstance = new SafeContract_v1_4_1_Ethers( + safeContractInstance = new SafeContract_v1_4_1( chainId, safeProvider, isL1SafeSingleton, @@ -75,7 +75,7 @@ export async function getSafeContractInstance( ) break case '1.3.0': - safeContractInstance = new SafeContract_v1_3_0_Ethers( + safeContractInstance = new SafeContract_v1_3_0( chainId, safeProvider, isL1SafeSingleton, @@ -84,7 +84,7 @@ export async function getSafeContractInstance( ) break case '1.2.0': - safeContractInstance = new SafeContract_v1_2_0_Ethers( + safeContractInstance = new SafeContract_v1_2_0( chainId, safeProvider, isL1SafeSingleton, @@ -93,7 +93,7 @@ export async function getSafeContractInstance( ) break case '1.1.1': - safeContractInstance = new SafeContract_v1_1_1_Ethers( + safeContractInstance = new SafeContract_v1_1_1( chainId, safeProvider, isL1SafeSingleton, @@ -102,7 +102,7 @@ export async function getSafeContractInstance( ) break case '1.0.0': - safeContractInstance = new SafeContract_v1_0_0_Ethers( + safeContractInstance = new SafeContract_v1_0_0( chainId, safeProvider, isL1SafeSingleton, @@ -125,15 +125,14 @@ export async function getCompatibilityFallbackHandlerContractInstance( contractAddress?: string, customContractAbi?: JsonFragment | JsonFragment[] | undefined ): Promise< - | CompatibilityFallbackHandlerContract_v1_4_1_Ethers - | CompatibilityFallbackHandlerContract_v1_3_0_Ethers + CompatibilityFallbackHandlerContract_v1_4_1 | CompatibilityFallbackHandlerContract_v1_3_0 > { const chainId = await safeProvider.getChainId() let compatibilityFallbackHandlerInstance switch (safeVersion) { case '1.4.1': - compatibilityFallbackHandlerInstance = new CompatibilityFallbackHandlerContract_v1_4_1_Ethers( + compatibilityFallbackHandlerInstance = new CompatibilityFallbackHandlerContract_v1_4_1( chainId, safeProvider, contractAddress, @@ -143,7 +142,7 @@ export async function getCompatibilityFallbackHandlerContractInstance( case '1.3.0': case '1.2.0': case '1.1.1': - compatibilityFallbackHandlerInstance = new CompatibilityFallbackHandlerContract_v1_3_0_Ethers( + compatibilityFallbackHandlerInstance = new CompatibilityFallbackHandlerContract_v1_3_0( chainId, safeProvider, contractAddress, @@ -164,17 +163,13 @@ export async function getMultiSendContractInstance( safeProvider: SafeProvider, contractAddress?: string, customContractAbi?: JsonFragment | JsonFragment[] | undefined -): Promise< - | MultiSendContract_v1_4_1_Ethers - | MultiSendContract_v1_3_0_Ethers - | MultiSendContract_v1_1_1_Ethers -> { +): Promise { const chainId = await safeProvider.getChainId() let multiSendContractInstance switch (safeVersion) { case '1.4.1': - multiSendContractInstance = new MultiSendContract_v1_4_1_Ethers( + multiSendContractInstance = new MultiSendContract_v1_4_1( chainId, safeProvider, contractAddress, @@ -182,7 +177,7 @@ export async function getMultiSendContractInstance( ) break case '1.3.0': - multiSendContractInstance = new MultiSendContract_v1_3_0_Ethers( + multiSendContractInstance = new MultiSendContract_v1_3_0( chainId, safeProvider, contractAddress, @@ -192,7 +187,7 @@ export async function getMultiSendContractInstance( case '1.2.0': case '1.1.1': case '1.0.0': - multiSendContractInstance = new MultiSendContract_v1_1_1_Ethers( + multiSendContractInstance = new MultiSendContract_v1_1_1( chainId, safeProvider, contractAddress, @@ -213,13 +208,13 @@ export async function getMultiSendCallOnlyContractInstance( safeProvider: SafeProvider, contractAddress?: string, customContractAbi?: JsonFragment | JsonFragment[] | undefined -): Promise { +): Promise { const chainId = await safeProvider.getChainId() let multiSendCallOnlyContractInstance switch (safeVersion) { case '1.4.1': - multiSendCallOnlyContractInstance = new MultiSendCallOnlyContract_v1_4_1_Ethers( + multiSendCallOnlyContractInstance = new MultiSendCallOnlyContract_v1_4_1( chainId, safeProvider, contractAddress, @@ -230,7 +225,7 @@ export async function getMultiSendCallOnlyContractInstance( case '1.2.0': case '1.1.1': case '1.0.0': - multiSendCallOnlyContractInstance = new MultiSendCallOnlyContract_v1_3_0_Ethers( + multiSendCallOnlyContractInstance = new MultiSendCallOnlyContract_v1_3_0( chainId, safeProvider, contractAddress, @@ -254,17 +249,17 @@ export async function getSafeProxyFactoryContractInstance( contractAddress?: string, customContractAbi?: JsonFragment | JsonFragment[] | undefined ): Promise< - | SafeProxyFactoryContract_v1_4_1_Ethers - | SafeProxyFactoryContract_v1_3_0_Ethers - | SafeProxyFactoryContract_v1_1_1_Ethers - | SafeProxyFactoryContract_v1_0_0_Ethers + | SafeProxyFactoryContract_v1_4_1 + | SafeProxyFactoryContract_v1_3_0 + | SafeProxyFactoryContract_v1_1_1 + | SafeProxyFactoryContract_v1_0_0 > { const chainId = await safeProvider.getChainId() let safeProxyFactoryContractInstance switch (safeVersion) { case '1.4.1': - safeProxyFactoryContractInstance = new SafeProxyFactoryContract_v1_4_1_Ethers( + safeProxyFactoryContractInstance = new SafeProxyFactoryContract_v1_4_1( chainId, safeProvider, contractAddress, @@ -273,7 +268,7 @@ export async function getSafeProxyFactoryContractInstance( ) break case '1.3.0': - safeProxyFactoryContractInstance = new SafeProxyFactoryContract_v1_3_0_Ethers( + safeProxyFactoryContractInstance = new SafeProxyFactoryContract_v1_3_0( chainId, safeProvider, contractAddress, @@ -283,7 +278,7 @@ export async function getSafeProxyFactoryContractInstance( break case '1.2.0': case '1.1.1': - safeProxyFactoryContractInstance = new SafeProxyFactoryContract_v1_1_1_Ethers( + safeProxyFactoryContractInstance = new SafeProxyFactoryContract_v1_1_1( chainId, safeProvider, contractAddress, @@ -292,7 +287,7 @@ export async function getSafeProxyFactoryContractInstance( ) break case '1.0.0': - safeProxyFactoryContractInstance = new SafeProxyFactoryContract_v1_0_0_Ethers( + safeProxyFactoryContractInstance = new SafeProxyFactoryContract_v1_0_0( chainId, safeProvider, contractAddress, @@ -314,13 +309,13 @@ export async function getSignMessageLibContractInstance( safeProvider: SafeProvider, contractAddress?: string, customContractAbi?: JsonFragment | JsonFragment[] | undefined -): Promise { +): Promise { const chainId = await safeProvider.getChainId() let signMessageLibContractInstance switch (safeVersion) { case '1.4.1': - signMessageLibContractInstance = new SignMessageLibContract_v1_4_1_Ethers( + signMessageLibContractInstance = new SignMessageLibContract_v1_4_1( chainId, safeProvider, contractAddress, @@ -328,7 +323,7 @@ export async function getSignMessageLibContractInstance( ) break case '1.3.0': - signMessageLibContractInstance = new SignMessageLibContract_v1_3_0_Ethers( + signMessageLibContractInstance = new SignMessageLibContract_v1_3_0( chainId, safeProvider, contractAddress, @@ -349,13 +344,13 @@ export async function getCreateCallContractInstance( safeProvider: SafeProvider, contractAddress?: string, customContractAbi?: JsonFragment | JsonFragment[] | undefined -): Promise { +): Promise { const chainId = await safeProvider.getChainId() let createCallContractInstance switch (safeVersion) { case '1.4.1': - createCallContractInstance = new CreateCallContract_v1_4_1_Ethers( + createCallContractInstance = new CreateCallContract_v1_4_1( chainId, safeProvider, contractAddress, @@ -366,7 +361,7 @@ export async function getCreateCallContractInstance( case '1.2.0': case '1.1.1': case '1.0.0': - createCallContractInstance = new CreateCallContract_v1_3_0_Ethers( + createCallContractInstance = new CreateCallContract_v1_3_0( chainId, safeProvider, contractAddress, @@ -387,13 +382,13 @@ export async function getSimulateTxAccessorContractInstance( safeProvider: SafeProvider, contractAddress?: string, customContractAbi?: JsonFragment | JsonFragment[] | undefined -): Promise { +): Promise { const chainId = await safeProvider.getChainId() let simulateTxAccessorContractInstance switch (safeVersion) { case '1.4.1': - simulateTxAccessorContractInstance = new SimulateTxAccessorContract_v1_4_1_Ethers( + simulateTxAccessorContractInstance = new SimulateTxAccessorContract_v1_4_1( chainId, safeProvider, contractAddress, @@ -401,7 +396,7 @@ export async function getSimulateTxAccessorContractInstance( ) break case '1.3.0': - simulateTxAccessorContractInstance = new SimulateTxAccessorContract_v1_3_0_Ethers( + simulateTxAccessorContractInstance = new SimulateTxAccessorContract_v1_3_0( chainId, safeProvider, contractAddress, diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index 66a8a671e..ecc216a1c 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -5,28 +5,28 @@ import { SafeTransactionDataPartial, SafeVersion } from '@safe-global/safe-core-sdk-types' -import SafeContract_v1_0_0_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.0.0/SafeContract_v1_0_0' -import SafeContract_v1_1_1_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.1.1/SafeContract_v1_1_1' -import SafeContract_v1_2_0_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.2.0/SafeContract_v1_2_0' -import SafeContract_v1_3_0_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.3.0/SafeContract_v1_3_0' -import SafeContract_v1_4_1_Ethers from '@safe-global/protocol-kit/contracts/Safe/v1.4.1/SafeContract_v1_4_1' -import MultiSendContract_v1_1_1_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1' -import MultiSendContract_v1_3_0_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0' -import MultiSendContract_v1_4_1_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1' -import MultiSendCallOnlyContract_v1_4_1_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1' -import MultiSendCallOnlyContract_v1_3_0_Ethers from '@safe-global/protocol-kit/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0' -import CompatibilityFallbackHandlerContract_v1_3_0_Ethers from '../contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0' -import CompatibilityFallbackHandlerContract_v1_4_1_Ethers from '../contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1' -import SafeProxyFactoryContract_v1_0_0_Ethers from '../contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0' -import SafeProxyFactoryContract_v1_1_1_Ethers from '../contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1' -import SafeProxyFactoryContract_v1_3_0_Ethers from '../contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0' -import SafeProxyFactoryContract_v1_4_1_Ethers from '../contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1' -import SignMessageLibContract_v1_3_0_Ethers from '../contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0' -import SignMessageLibContract_v1_4_1_Ethers from '../contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1' -import SimulateTxAccessorContract_v1_3_0_Ethers from '../contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0' -import SimulateTxAccessorContract_v1_4_1_Ethers from '../contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1' -import CreateCallContract_v1_3_0_Ethers from '../contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0' -import CreateCallContract_v1_4_1_Ethers from '../contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1' +import SafeContract_v1_0_0 from '@safe-global/protocol-kit/contracts/Safe/v1.0.0/SafeContract_v1_0_0' +import SafeContract_v1_1_1 from '@safe-global/protocol-kit/contracts/Safe/v1.1.1/SafeContract_v1_1_1' +import SafeContract_v1_2_0 from '@safe-global/protocol-kit/contracts/Safe/v1.2.0/SafeContract_v1_2_0' +import SafeContract_v1_3_0 from '@safe-global/protocol-kit/contracts/Safe/v1.3.0/SafeContract_v1_3_0' +import SafeContract_v1_4_1 from '@safe-global/protocol-kit/contracts/Safe/v1.4.1/SafeContract_v1_4_1' +import MultiSendContract_v1_1_1 from '@safe-global/protocol-kit/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1' +import MultiSendContract_v1_3_0 from '@safe-global/protocol-kit/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0' +import MultiSendContract_v1_4_1 from '@safe-global/protocol-kit/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1' +import MultiSendCallOnlyContract_v1_4_1 from '@safe-global/protocol-kit/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1' +import MultiSendCallOnlyContract_v1_3_0 from '@safe-global/protocol-kit/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0' +import CompatibilityFallbackHandlerContract_v1_3_0 from '../contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0' +import CompatibilityFallbackHandlerContract_v1_4_1 from '../contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1' +import SafeProxyFactoryContract_v1_0_0 from '../contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0' +import SafeProxyFactoryContract_v1_1_1 from '../contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1' +import SafeProxyFactoryContract_v1_3_0 from '../contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0' +import SafeProxyFactoryContract_v1_4_1 from '../contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1' +import SignMessageLibContract_v1_3_0 from '../contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0' +import SignMessageLibContract_v1_4_1 from '../contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1' +import SimulateTxAccessorContract_v1_3_0 from '../contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0' +import SimulateTxAccessorContract_v1_4_1 from '../contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1' +import CreateCallContract_v1_3_0 from '../contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0' +import CreateCallContract_v1_4_1 from '../contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1' export interface SafeAccountConfig { owners: string[] @@ -223,15 +223,15 @@ export type SigningMethodType = SigningMethod | string // Safe contract implementation types -export type SafeContract_v1_0_0_ImplementationType = SafeContract_v1_0_0_Ethers +export type SafeContract_v1_0_0_ImplementationType = SafeContract_v1_0_0 -export type SafeContract_v1_1_0_ImplementationType = SafeContract_v1_1_1_Ethers +export type SafeContract_v1_1_0_ImplementationType = SafeContract_v1_1_1 -export type SafeContract_v1_2_0_ImplementationType = SafeContract_v1_2_0_Ethers +export type SafeContract_v1_2_0_ImplementationType = SafeContract_v1_2_0 -export type SafeContract_v1_3_0_ImplementationType = SafeContract_v1_3_0_Ethers +export type SafeContract_v1_3_0_ImplementationType = SafeContract_v1_3_0 -export type SafeContract_v1_4_1_ImplementationType = SafeContract_v1_4_1_Ethers +export type SafeContract_v1_4_1_ImplementationType = SafeContract_v1_4_1 export type SafeContractImplementationType = | SafeContract_v1_0_0_ImplementationType @@ -242,11 +242,11 @@ export type SafeContractImplementationType = // MultiSend contract implementation types -export type MultiSendContract_v1_1_1_ImplementationType = MultiSendContract_v1_1_1_Ethers +export type MultiSendContract_v1_1_1_ImplementationType = MultiSendContract_v1_1_1 -export type MultiSendContract_v1_3_0_ImplementationType = MultiSendContract_v1_3_0_Ethers +export type MultiSendContract_v1_3_0_ImplementationType = MultiSendContract_v1_3_0 -export type MultiSendContract_v1_4_1_ImplementationType = MultiSendContract_v1_4_1_Ethers +export type MultiSendContract_v1_4_1_ImplementationType = MultiSendContract_v1_4_1 export type MultiSendContractImplementationType = | MultiSendContract_v1_1_1_ImplementationType @@ -255,11 +255,9 @@ export type MultiSendContractImplementationType = // MultiSendCallOnly contract implementation types -export type MultiSendCallOnlyContract_v1_3_0_ImplementationType = - MultiSendCallOnlyContract_v1_3_0_Ethers +export type MultiSendCallOnlyContract_v1_3_0_ImplementationType = MultiSendCallOnlyContract_v1_3_0 -export type MultiSendCallOnlyContract_v1_4_1_ImplementationType = - MultiSendCallOnlyContract_v1_4_1_Ethers +export type MultiSendCallOnlyContract_v1_4_1_ImplementationType = MultiSendCallOnlyContract_v1_4_1 export type MultiSendCallOnlyContractImplementationType = | MultiSendCallOnlyContract_v1_3_0_ImplementationType @@ -268,10 +266,10 @@ export type MultiSendCallOnlyContractImplementationType = // CompatibilityFallbackHandler contract implementation types export type CompatibilityFallbackHandlerContract_v1_3_0_ImplementationType = - CompatibilityFallbackHandlerContract_v1_3_0_Ethers + CompatibilityFallbackHandlerContract_v1_3_0 export type CompatibilityFallbackHandlerContract_v1_4_1_ImplementationType = - CompatibilityFallbackHandlerContract_v1_4_1_Ethers + CompatibilityFallbackHandlerContract_v1_4_1 export type CompatibilityFallbackHandlerContractImplementationType = | CompatibilityFallbackHandlerContract_v1_3_0_ImplementationType @@ -279,17 +277,13 @@ export type CompatibilityFallbackHandlerContractImplementationType = // SafeProxyFactory contract implementation types -export type SafeProxyFactoryContract_v1_0_0_ImplementationType = - SafeProxyFactoryContract_v1_0_0_Ethers +export type SafeProxyFactoryContract_v1_0_0_ImplementationType = SafeProxyFactoryContract_v1_0_0 -export type SafeProxyFactoryContract_v1_1_1_ImplementationType = - SafeProxyFactoryContract_v1_1_1_Ethers +export type SafeProxyFactoryContract_v1_1_1_ImplementationType = SafeProxyFactoryContract_v1_1_1 -export type SafeProxyFactoryContract_v1_3_0_ImplementationType = - SafeProxyFactoryContract_v1_3_0_Ethers +export type SafeProxyFactoryContract_v1_3_0_ImplementationType = SafeProxyFactoryContract_v1_3_0 -export type SafeProxyFactoryContract_v1_4_1_ImplementationType = - SafeProxyFactoryContract_v1_4_1_Ethers +export type SafeProxyFactoryContract_v1_4_1_ImplementationType = SafeProxyFactoryContract_v1_4_1 export type SafeProxyFactoryContractImplementationType = | SafeProxyFactoryContract_v1_0_0_ImplementationType @@ -299,9 +293,9 @@ export type SafeProxyFactoryContractImplementationType = // SignMessageLib contract implementation types -export type SignMessageLibContract_v1_3_0_ImplementationType = SignMessageLibContract_v1_3_0_Ethers +export type SignMessageLibContract_v1_3_0_ImplementationType = SignMessageLibContract_v1_3_0 -export type SignMessageLibContract_v1_4_1_ImplementationType = SignMessageLibContract_v1_4_1_Ethers +export type SignMessageLibContract_v1_4_1_ImplementationType = SignMessageLibContract_v1_4_1 export type SignMessageLibContractImplementationType = | SignMessageLibContract_v1_3_0_ImplementationType @@ -309,11 +303,9 @@ export type SignMessageLibContractImplementationType = // SimulateTxAccessor contract implementation types -export type SimulateTxAccessorContract_v1_3_0_ImplementationType = - SimulateTxAccessorContract_v1_3_0_Ethers +export type SimulateTxAccessorContract_v1_3_0_ImplementationType = SimulateTxAccessorContract_v1_3_0 -export type SimulateTxAccessorContract_v1_4_1_ImplementationType = - SimulateTxAccessorContract_v1_4_1_Ethers +export type SimulateTxAccessorContract_v1_4_1_ImplementationType = SimulateTxAccessorContract_v1_4_1 export type SimulateTxAccessorContractImplementationType = | SimulateTxAccessorContract_v1_3_0_ImplementationType @@ -321,9 +313,9 @@ export type SimulateTxAccessorContractImplementationType = // CreateCall contract implementation types -export type CreateCallContract_v1_3_0_ImplementationType = CreateCallContract_v1_3_0_Ethers +export type CreateCallContract_v1_3_0_ImplementationType = CreateCallContract_v1_3_0 -export type CreateCallContract_v1_4_1_ImplementationType = CreateCallContract_v1_4_1_Ethers +export type CreateCallContract_v1_4_1_ImplementationType = CreateCallContract_v1_4_1 export type CreateCallContractImplementationType = | CreateCallContract_v1_3_0_ImplementationType From 804a3ebcbcea0a45f148c9f6008210de5a01fe3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 19 Apr 2024 14:51:17 +0200 Subject: [PATCH 041/112] Remove Ethers suffix from contracts --- .../src/contracts/BaseContract.ts | 6 ++--- ...ompatibilityFallbackHandlerBaseContract.ts | 14 +++++------ ...atibilityFallbackHandlerContract_v1_3_0.ts | 6 ++--- ...atibilityFallbackHandlerContract_v1_4_1.ts | 6 ++--- .../CreateCall/CreateCallBaseContract.ts | 14 +++++------ .../v1.3.0/CreateCallContract_v1_3_0.ts | 6 ++--- .../v1.4.1/CreateCallContract_v1_4_1.ts | 6 ++--- .../MultiSend/MultiSendBaseContract.ts | 14 +++++------ .../MultiSendCallOnlyBaseContract.ts | 14 +++++------ .../v1.1.1/MultiSendContract_v1_1_1.ts | 6 ++--- .../MultiSendCallOnlyContract_v1_3_0.ts | 6 ++--- .../v1.3.0/MultiSendContract_v1_3_0.ts | 6 ++--- .../MultiSendCallOnlyContract_v1_4_1.ts | 6 ++--- .../v1.4.1/MultiSendContract_v1_4_1.ts | 6 ++--- .../src/contracts/Safe/SafeBaseContract.ts | 20 ++++++++-------- .../Safe/v1.0.0/SafeContract_v1_0_0.ts | 6 ++--- .../Safe/v1.1.1/SafeContract_v1_1_1.ts | 6 ++--- .../Safe/v1.2.0/SafeContract_v1_2_0.ts | 6 ++--- .../Safe/v1.3.0/SafeContract_v1_3_0.ts | 6 ++--- .../Safe/v1.4.1/SafeContract_v1_4_1.ts | 6 ++--- .../SafeProxyFactoryBaseContract.ts | 20 ++++++++-------- .../v1.0.0/SafeProxyFactoryContract_v1_0_0.ts | 6 ++--- .../v1.1.1/SafeProxyFactoryContract_v1_1_1.ts | 6 ++--- .../v1.3.0/SafeProxyFactoryContract_v1_3_0.ts | 6 ++--- .../v1.4.1/SafeProxyFactoryContract_v1_4_1.ts | 6 ++--- .../SignMessageLibBaseContract.ts | 14 +++++------ .../v1.3.0/SignMessageLibContract_v1_3_0.ts | 6 ++--- .../v1.4.1/SignMessageLibContract_v1_4_1.ts | 6 ++--- .../SimulateTxAccessorBaseContract.ts | 14 +++++------ .../SimulateTxAccessorContract_v1_3_0.ts | 6 ++--- .../SimulateTxAccessorContract_v1_4_1.ts | 6 ++--- packages/protocol-kit/src/contracts/index.ts | 24 +++++++++---------- packages/protocol-kit/src/index.ts | 24 +++++++++---------- 33 files changed, 155 insertions(+), 155 deletions(-) diff --git a/packages/protocol-kit/src/contracts/BaseContract.ts b/packages/protocol-kit/src/contracts/BaseContract.ts index 32545b27e..542ac1a31 100644 --- a/packages/protocol-kit/src/contracts/BaseContract.ts +++ b/packages/protocol-kit/src/contracts/BaseContract.ts @@ -22,9 +22,9 @@ import { * @template ContractAbiType - The ABI type specific to the version of the contract, extending InterfaceAbi from Ethers. * * Example subclasses: - * - SafeBaseContractEthers extends BaseContract - * - CreateCallBaseContractEthers extends BaseContract - * - SafeProxyFactoryBaseContractEthers extends BaseContract + * - SafeBaseContract extends BaseContract + * - CreateCallBaseContract extends BaseContract + * - SafeProxyFactoryBaseContract extends BaseContract */ class BaseContract { contractAbi: ContractAbiType diff --git a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.ts b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.ts index c1b9589eb..2583b1b10 100644 --- a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.ts +++ b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.ts @@ -7,26 +7,26 @@ import { SafeVersion } from '@safe-global/safe-core-sdk-types' import { contractName } from '@safe-global/protocol-kit/contracts/config' /** - * Abstract class CompatibilityFallbackHandlerBaseContractEthers extends BaseContract to specifically integrate with the CompatibilityFallbackHandler contract. + * Abstract class CompatibilityFallbackHandlerBaseContract extends BaseContract to specifically integrate with the CompatibilityFallbackHandler contract. * It is designed to be instantiated for different versions of the Safe contract. * - * Subclasses of CompatibilityFallbackHandlerBaseContractEthers are expected to represent specific versions of the contract. + * Subclasses of CompatibilityFallbackHandlerBaseContract are expected to represent specific versions of the contract. * * @template CompatibilityFallbackHandlerContractAbiType - The ABI type specific to the version of the CompatibilityFallbackHandler contract, extending InterfaceAbi from Ethers. * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: - * - CompatibilityFallbackHandlerContract_v1_4_1 extends CompatibilityFallbackHandlerBaseContractEthers - * - CompatibilityFallbackHandlerContract_v1_3_0 extends CompatibilityFallbackHandlerBaseContractEthers + * - CompatibilityFallbackHandlerContract_v1_4_1 extends CompatibilityFallbackHandlerBaseContract + * - CompatibilityFallbackHandlerContract_v1_3_0 extends CompatibilityFallbackHandlerBaseContract */ -abstract class CompatibilityFallbackHandlerBaseContractEthers< +abstract class CompatibilityFallbackHandlerBaseContract< CompatibilityFallbackHandlerContractAbiType extends InterfaceAbi & Abi > extends BaseContract { contractName: contractName /** * @constructor - * Constructs an instance of CompatibilityFallbackHandlerBaseContractEthers. + * Constructs an instance of CompatibilityFallbackHandlerBaseContract. * * @param chainId - The chain ID of the contract. * @param safeProvider - An instance of SafeProvider. @@ -61,4 +61,4 @@ abstract class CompatibilityFallbackHandlerBaseContractEthers< } } -export default CompatibilityFallbackHandlerBaseContractEthers +export default CompatibilityFallbackHandlerBaseContract diff --git a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.ts index 165923b44..349e010d7 100644 --- a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.ts @@ -1,4 +1,4 @@ -import CompatibilityFallbackHandlerBaseContractEthers from '@safe-global/protocol-kit/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract' +import CompatibilityFallbackHandlerBaseContract from '@safe-global/protocol-kit/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, @@ -12,11 +12,11 @@ import { * * This class specializes in handling interactions with the CompatibilityFallbackHandler contract version 1.3.0 using Ethers.js v6. * - * @extends CompatibilityFallbackHandlerBaseContractEthers - Inherits from CompatibilityFallbackHandlerBaseContractEthers with ABI specific to CompatibilityFallbackHandler contract version 1.3.0. + * @extends CompatibilityFallbackHandlerBaseContract - Inherits from CompatibilityFallbackHandlerBaseContract with ABI specific to CompatibilityFallbackHandler contract version 1.3.0. * @implements CompatibilityFallbackHandlerContract_v1_3_0_Contract - Implements the interface specific to CompatibilityFallbackHandler contract version 1.3.0. */ class CompatibilityFallbackHandlerContract_v1_3_0 - extends CompatibilityFallbackHandlerBaseContractEthers + extends CompatibilityFallbackHandlerBaseContract implements CompatibilityFallbackHandlerContract_v1_3_0_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.ts index 93556aeb4..3cf7af032 100644 --- a/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.ts @@ -1,4 +1,4 @@ -import CompatibilityFallbackHandlerBaseContractEthers from '@safe-global/protocol-kit/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract' +import CompatibilityFallbackHandlerBaseContract from '@safe-global/protocol-kit/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { compatibilityFallbackHandler_1_4_1_ContractArtifacts, @@ -12,11 +12,11 @@ import { * * This class specializes in handling interactions with the CompatibilityFallbackHandler contract version 1.4.1 using Ethers.js v6. * - * @extends CompatibilityFallbackHandlerBaseContractEthers - Inherits from CompatibilityFallbackHandlerBaseContractEthers with ABI specific to CompatibilityFallbackHandler contract version 1.4.1. + * @extends CompatibilityFallbackHandlerBaseContract - Inherits from CompatibilityFallbackHandlerBaseContract with ABI specific to CompatibilityFallbackHandler contract version 1.4.1. * @implements CompatibilityFallbackHandlerContract_v1_4_1_Contract - Implements the interface specific to CompatibilityFallbackHandler contract version 1.4.1. */ class CompatibilityFallbackHandlerContract_v1_4_1 - extends CompatibilityFallbackHandlerBaseContractEthers + extends CompatibilityFallbackHandlerBaseContract implements CompatibilityFallbackHandlerContract_v1_4_1_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/CreateCall/CreateCallBaseContract.ts b/packages/protocol-kit/src/contracts/CreateCall/CreateCallBaseContract.ts index 5b109a325..9dc3ae51d 100644 --- a/packages/protocol-kit/src/contracts/CreateCall/CreateCallBaseContract.ts +++ b/packages/protocol-kit/src/contracts/CreateCall/CreateCallBaseContract.ts @@ -7,26 +7,26 @@ import { SafeVersion } from '@safe-global/safe-core-sdk-types' import { contractName } from '@safe-global/protocol-kit/contracts/config' /** - * Abstract class CreateCallBaseContractEthers extends BaseContract to specifically integrate with the CreateCall contract. + * Abstract class CreateCallBaseContract extends BaseContract to specifically integrate with the CreateCall contract. * It is designed to be instantiated for different versions of the Safe contract. * - * Subclasses of CreateCallBaseContractEthers are expected to represent specific versions of the contract. + * Subclasses of CreateCallBaseContract are expected to represent specific versions of the contract. * * @template CreateCallContractAbiType - The ABI type specific to the version of the CreateCall contract, extending InterfaceAbi from Ethers. * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: - * - CreateCallContract_v1_4_1 extends CreateCallBaseContractEthers - * - CreateCallContract_v1_3_0 extends CreateCallBaseContractEthers + * - CreateCallContract_v1_4_1 extends CreateCallBaseContract + * - CreateCallContract_v1_3_0 extends CreateCallBaseContract */ -abstract class CreateCallBaseContractEthers< +abstract class CreateCallBaseContract< CreateCallContractAbiType extends InterfaceAbi & Abi > extends BaseContract { contractName: contractName /** * @constructor - * Constructs an instance of CreateCallBaseContractEthers. + * Constructs an instance of CreateCallBaseContract. * * @param chainId - The chain ID of the contract. * @param safeProvider - An instance of SafeProvider. @@ -61,4 +61,4 @@ abstract class CreateCallBaseContractEthers< } } -export default CreateCallBaseContractEthers +export default CreateCallBaseContract diff --git a/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts index dc331589a..2d7f92e28 100644 --- a/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts @@ -1,4 +1,4 @@ -import CreateCallBaseContractEthers from '@safe-global/protocol-kit/contracts/CreateCall/CreateCallBaseContract' +import CreateCallBaseContract from '@safe-global/protocol-kit/contracts/CreateCall/CreateCallBaseContract' import { SafeVersion, CreateCallContract_v1_3_0_Abi, @@ -15,11 +15,11 @@ import SafeProvider from '@safe-global/protocol-kit/SafeProvider' * * This class specializes in handling interactions with the CreateCall contract version 1.3.0 using Ethers.js v6. * - * @extends CreateCallBaseContractEthers - Inherits from CreateCallBaseContractEthers with ABI specific to CreateCall contract version 1.3.0. + * @extends CreateCallBaseContract - Inherits from CreateCallBaseContract with ABI specific to CreateCall contract version 1.3.0. * @implements CreateCallContract_v1_3_0_Contract - Implements the interface specific to CreateCall contract version 1.3.0. */ class CreateCallContract_v1_3_0 - extends CreateCallBaseContractEthers + extends CreateCallBaseContract implements CreateCallContract_v1_3_0_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts index e233c4885..8cdfbae2b 100644 --- a/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts @@ -1,4 +1,4 @@ -import CreateCallBaseContractEthers from '@safe-global/protocol-kit/contracts/CreateCall/CreateCallBaseContract' +import CreateCallBaseContract from '@safe-global/protocol-kit/contracts/CreateCall/CreateCallBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, @@ -15,11 +15,11 @@ import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' * * This class specializes in handling interactions with the CreateCall contract version 1.4.1 using Ethers.js v6. * - * @extends CreateCallBaseContractEthers - Inherits from CreateCallBaseContractEthers with ABI specific to CreateCall contract version 1.4.1. + * @extends CreateCallBaseContract - Inherits from CreateCallBaseContract with ABI specific to CreateCall contract version 1.4.1. * @implements CreateCallContract_v1_4_1_Contract - Implements the interface specific to CreateCall contract version 1.4.1. */ class CreateCallContract_v1_4_1 - extends CreateCallBaseContractEthers + extends CreateCallBaseContract implements CreateCallContract_v1_4_1_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/MultiSend/MultiSendBaseContract.ts b/packages/protocol-kit/src/contracts/MultiSend/MultiSendBaseContract.ts index 0725a70e9..835be1b2f 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/MultiSendBaseContract.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/MultiSendBaseContract.ts @@ -7,26 +7,26 @@ import BaseContract from '@safe-global/protocol-kit/contracts/BaseContract' import { contractName } from '@safe-global/protocol-kit/contracts/config' /** - * Abstract class MultiSendBaseContractEthers extends BaseContract to specifically integrate with the MultiSend contract. + * Abstract class MultiSendBaseContract extends BaseContract to specifically integrate with the MultiSend contract. * It is designed to be instantiated for different versions of the MultiSend contract. * - * Subclasses of MultiSendBaseContractEthers are expected to represent specific versions of the MultiSend contract. + * Subclasses of MultiSendBaseContract are expected to represent specific versions of the MultiSend contract. * * @template MultiSendContractAbiType - The ABI type specific to the version of the MultiSend contract, extending InterfaceAbi from Ethers. * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: - * - MultiSendContract_v1_4_1 extends MultiSendBaseContractEthers - * - MultiSendContract_v1_3_0 extends MultiSendBaseContractEthers + * - MultiSendContract_v1_4_1 extends MultiSendBaseContract + * - MultiSendContract_v1_3_0 extends MultiSendBaseContract */ -abstract class MultiSendBaseContractEthers< +abstract class MultiSendBaseContract< MultiSendContractAbiType extends InterfaceAbi & Abi > extends BaseContract { contractName: contractName /** * @constructor - * Constructs an instance of MultiSendBaseContractEthers. + * Constructs an instance of MultiSendBaseContract. * * @param chainId - The chain ID of the contract. * @param safeProvider - An instance of SafeProvider. @@ -59,4 +59,4 @@ abstract class MultiSendBaseContractEthers< } } -export default MultiSendBaseContractEthers +export default MultiSendBaseContract diff --git a/packages/protocol-kit/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.ts b/packages/protocol-kit/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.ts index 240458db2..bd69961e1 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.ts @@ -7,26 +7,26 @@ import BaseContract from '@safe-global/protocol-kit/contracts/BaseContract' import { contractName } from '@safe-global/protocol-kit/contracts/config' /** - * Abstract class MultiSendCallOnlyBaseContractEthers extends BaseContract to specifically integrate with the MultiSendCallOnly contract. + * Abstract class MultiSendCallOnlyBaseContract extends BaseContract to specifically integrate with the MultiSendCallOnly contract. * It is designed to be instantiated for different versions of the MultiSendCallOnly contract. * - * Subclasses of MultiSendCallOnlyBaseContractEthers are expected to represent specific versions of the MultiSendCallOnly contract. + * Subclasses of MultiSendCallOnlyBaseContract are expected to represent specific versions of the MultiSendCallOnly contract. * * @template MultiSendCallOnlyContractAbiType - The ABI type specific to the version of the MultiSendCallOnly contract, extending InterfaceAbi from Ethers. * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: - * - MultiSendCallOnlyContract_v1_4_1 extends MultiSendCallOnlyBaseContractEthers - * - MultiSendCallOnlyContract_v1_3_0 extends MultiSendCallOnlyBaseContractEthers + * - MultiSendCallOnlyContract_v1_4_1 extends MultiSendCallOnlyBaseContract + * - MultiSendCallOnlyContract_v1_3_0 extends MultiSendCallOnlyBaseContract */ -abstract class MultiSendCallOnlyBaseContractEthers< +abstract class MultiSendCallOnlyBaseContract< MultiSendCallOnlyContractAbiType extends InterfaceAbi & Abi > extends BaseContract { contractName: contractName /** * @constructor - * Constructs an instance of MultiSendCallOnlyBaseContractEthers. + * Constructs an instance of MultiSendCallOnlyBaseContract. * * @param chainId - The chain ID of the contract. * @param safeProvider - An instance of SafeProvider. @@ -59,4 +59,4 @@ abstract class MultiSendCallOnlyBaseContractEthers< } } -export default MultiSendCallOnlyBaseContractEthers +export default MultiSendCallOnlyBaseContract diff --git a/packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.ts index 41ef24d7e..9f7897565 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.ts @@ -1,4 +1,4 @@ -import MultiSendBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendBaseContract' +import MultiSendBaseContract from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, @@ -12,11 +12,11 @@ import { * * This class specializes in handling interactions with the MultiSend contract version 1.1.1 using Ethers.js v6. * - * @extends MultiSendBaseContractEthers - Inherits from MultiSendBaseContractEthers with ABI specific to MultiSend contract version 1.1.1. + * @extends MultiSendBaseContract - Inherits from MultiSendBaseContract with ABI specific to MultiSend contract version 1.1.1. * @implements MultiSendContract_v1_1_1_Contract - Implements the interface specific to MultiSend contract version 1.1.1. */ class MultiSendContract_v1_1_1 - extends MultiSendBaseContractEthers + extends MultiSendBaseContract implements MultiSendContract_v1_1_1_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.ts index 276477f9c..74e8ffb8f 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.ts @@ -1,4 +1,4 @@ -import MultiSendCallOnlyBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendCallOnlyBaseContract' +import MultiSendCallOnlyBaseContract from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendCallOnlyBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, @@ -12,11 +12,11 @@ import { * * This class specializes in handling interactions with the MultiSendCallOnly contract version 1.3.0 using Ethers.js v6. * - * @extends MultiSendCallOnlyBaseContractEthers - Inherits from MultiSendCallOnlyBaseContractEthers with ABI specific to MultiSendCallOnly contract version 1.3.0. + * @extends MultiSendCallOnlyBaseContract - Inherits from MultiSendCallOnlyBaseContract with ABI specific to MultiSendCallOnly contract version 1.3.0. * @implements MultiSendCallOnlyContract_v1_3_0_Contract - Implements the interface specific to MultiSendCallOnly contract version 1.3.0. */ class MultiSendCallOnlyContract_v1_3_0 - extends MultiSendCallOnlyBaseContractEthers + extends MultiSendCallOnlyBaseContract implements MultiSendCallOnlyContract_v1_3_0_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.ts index ca09a04ed..ac5146f6e 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.ts @@ -1,4 +1,4 @@ -import MultiSendBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendBaseContract' +import MultiSendBaseContract from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, @@ -12,11 +12,11 @@ import { * * This class specializes in handling interactions with the MultiSend contract version 1.3.0 using Ethers.js v6. * - * @extends MultiSendBaseContractEthers - Inherits from MultiSendBaseContractEthers with ABI specific to MultiSend contract version 1.3.0. + * @extends MultiSendBaseContract - Inherits from MultiSendBaseContract with ABI specific to MultiSend contract version 1.3.0. * @implements MultiSendContract_v1_3_0_Contract - Implements the interface specific to MultiSend contract version 1.3.0. */ class MultiSendContract_v1_3_0 - extends MultiSendBaseContractEthers + extends MultiSendBaseContract implements MultiSendContract_v1_3_0_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.ts index 9e0837ea0..339502906 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.ts @@ -1,4 +1,4 @@ -import MultiSendCallOnlyBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendCallOnlyBaseContract' +import MultiSendCallOnlyBaseContract from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendCallOnlyBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, @@ -12,11 +12,11 @@ import { * * This class specializes in handling interactions with the MultiSendCallOnly contract version 1.4.1 using Ethers.js v6. * - * @extends MultiSendCallOnlyBaseContractEthers - Inherits from MultiSendBaseContractEthers with ABI specific to MultiSendCallOnly contract version 1.4.1. + * @extends MultiSendCallOnlyBaseContract - Inherits from MultiSendBaseContract with ABI specific to MultiSendCallOnly contract version 1.4.1. * @implements MultiSendCallOnlyContract_v1_4_1_Contract - Implements the interface specific to MultiSendCallOnly contract version 1.4.1. */ class MultiSendCallOnlyContract_v1_4_1 - extends MultiSendCallOnlyBaseContractEthers + extends MultiSendCallOnlyBaseContract implements MultiSendCallOnlyContract_v1_4_1_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.ts index 4d5e17fc4..845ca5c4b 100644 --- a/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.ts @@ -1,4 +1,4 @@ -import MultiSendBaseContractEthers from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendBaseContract' +import MultiSendBaseContract from '@safe-global/protocol-kit/contracts/MultiSend/MultiSendBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, @@ -12,11 +12,11 @@ import { * * This class specializes in handling interactions with the MultiSend contract version 1.4.1 using Ethers.js v6. * - * @extends MultiSendBaseContractEthers - Inherits from MultiSendBaseContractEthers with ABI specific to MultiSend contract version 1.4.1. + * @extends MultiSendBaseContract - Inherits from MultiSendBaseContract with ABI specific to MultiSend contract version 1.4.1. * @implements MultiSendContract_v1_4_1_Contract - Implements the interface specific to MultiSend contract version 1.4.1. */ class MultiSendContract_v1_4_1 - extends MultiSendBaseContractEthers + extends MultiSendBaseContract implements MultiSendContract_v1_4_1_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/Safe/SafeBaseContract.ts b/packages/protocol-kit/src/contracts/Safe/SafeBaseContract.ts index 78c94766e..ed826fa3d 100644 --- a/packages/protocol-kit/src/contracts/Safe/SafeBaseContract.ts +++ b/packages/protocol-kit/src/contracts/Safe/SafeBaseContract.ts @@ -7,29 +7,29 @@ import BaseContract from '@safe-global/protocol-kit/contracts/BaseContract' import { contractName, safeDeploymentsL1ChainIds } from '@safe-global/protocol-kit/contracts/config' /** - * Abstract class SafeBaseContractEthers extends BaseContract to specifically integrate with the Safe contract. + * Abstract class SafeBaseContract extends BaseContract to specifically integrate with the Safe contract. * It is designed to be instantiated for different versions of the Safe contract. * - * Subclasses of SafeBaseContractEthers are expected to represent specific versions of the Safe contract. + * Subclasses of SafeBaseContract are expected to represent specific versions of the Safe contract. * * @template SafeContractAbiType - The ABI type specific to the version of the Safe contract, extending InterfaceAbi from Ethers. * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: - * - SafeContract_v1_4_1 extends SafeBaseContractEthers - * - SafeContract_v1_3_0 extends SafeBaseContractEthers - * - SafeContract_v1_2_0 extends SafeBaseContractEthers - * - SafeContract_v1_1_1 extends SafeBaseContractEthers - * - SafeContract_v1_0_0 extends SafeBaseContractEthers + * - SafeContract_v1_4_1 extends SafeBaseContract + * - SafeContract_v1_3_0 extends SafeBaseContract + * - SafeContract_v1_2_0 extends SafeBaseContract + * - SafeContract_v1_1_1 extends SafeBaseContract + * - SafeContract_v1_0_0 extends SafeBaseContract */ -abstract class SafeBaseContractEthers< +abstract class SafeBaseContract< SafeContractAbiType extends InterfaceAbi & Abi > extends BaseContract { contractName: contractName /** * @constructor - * Constructs an instance of SafeBaseContractEthers. + * Constructs an instance of SafeBaseContract. * * @param chainId - The chain ID of the contract. * @param safeProvider - An instance of SafeProvider. @@ -65,4 +65,4 @@ abstract class SafeBaseContractEthers< } } -export default SafeBaseContractEthers +export default SafeBaseContract diff --git a/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts b/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts index 26c09b210..f439accbd 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts @@ -1,4 +1,4 @@ -import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContract' +import SafeBaseContract from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' import { sameString } from '@safe-global/protocol-kit/utils' @@ -18,11 +18,11 @@ import { * * This class specializes in handling interactions with the Safe contract version 1.0.0 using Ethers.js v6. * - * @extends SafeBaseContractEthers - Inherits from SafeBaseContractEthers with ABI specific to Safe contract version 1.0.0. + * @extends SafeBaseContract - Inherits from SafeBaseContract with ABI specific to Safe contract version 1.0.0. * @implements SafeContract_v1_0_0_Contract - Implements the interface specific to Safe contract version 1.0.0. */ class SafeContract_v1_0_0 - extends SafeBaseContractEthers + extends SafeBaseContract implements SafeContract_v1_0_0_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.ts b/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.ts index 50817c009..550dc1f7b 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.ts @@ -1,4 +1,4 @@ -import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContract' +import SafeBaseContract from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' import { sameString } from '@safe-global/protocol-kit/utils' @@ -18,11 +18,11 @@ import { * * This class specializes in handling interactions with the Safe contract version 1.1.1 using Ethers.js v6. * - * @extends SafeBaseContractEthers - Inherits from SafeBaseContractEthers with ABI specific to Safe contract version 1.1.1. + * @extends SafeBaseContract - Inherits from SafeBaseContract with ABI specific to Safe contract version 1.1.1. * @implements SafeContract_v1_1_1_Contract - Implements the interface specific to Safe contract version 1.1.1. */ class SafeContract_v1_1_1 - extends SafeBaseContractEthers + extends SafeBaseContract implements SafeContract_v1_1_1_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts b/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts index 556dcd51e..a2f4c5c55 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts @@ -1,4 +1,4 @@ -import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContract' +import SafeBaseContract from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' import { @@ -17,11 +17,11 @@ import { * * This class specializes in handling interactions with the Safe contract version 1.2.0 using Ethers.js v6. * - * @extends SafeBaseContractEthers - Inherits from SafeBaseContractEthers with ABI specific to Safe contract version 1.2.0. + * @extends SafeBaseContract - Inherits from SafeBaseContract with ABI specific to Safe contract version 1.2.0. * @implements SafeContract_v1_2_0_Contract - Implements the interface specific to Safe contract version 1.2.0. */ class SafeContract_v1_2_0 - extends SafeBaseContractEthers + extends SafeBaseContract implements SafeContract_v1_2_0_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.ts index dc3a506ec..e49c49699 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.ts @@ -1,4 +1,4 @@ -import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContract' +import SafeBaseContract from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/utils/constants' @@ -17,11 +17,11 @@ import { * * This class specializes in handling interactions with the Safe contract version 1.3.0 using Ethers.js v6. * - * @extends SafeBaseContractEthers - Inherits from SafeBaseContractEthers with ABI specific to Safe contract version 1.3.0. + * @extends SafeBaseContract - Inherits from SafeBaseContract with ABI specific to Safe contract version 1.3.0. * @implements SafeContract_v1_3_0_Contract - Implements the interface specific to Safe contract version 1.3.0. */ class SafeContract_v1_3_0 - extends SafeBaseContractEthers + extends SafeBaseContract implements SafeContract_v1_3_0_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.ts index 3c1a8c4e2..6eac2325d 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.ts @@ -1,4 +1,4 @@ -import SafeBaseContractEthers from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContract' +import SafeBaseContract from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/utils/constants' @@ -18,11 +18,11 @@ import { * * This class specializes in handling interactions with the Safe contract version 1.4.1 using Ethers.js v6. * - * @extends SafeBaseContractEthers - Inherits from SafeBaseContractEthers with ABI specific to Safe contract version 1.4.1. + * @extends SafeBaseContract - Inherits from SafeBaseContract with ABI specific to Safe contract version 1.4.1. * @implements SafeContract_v1_4_1_Contract - Implements the interface specific to Safe contract version 1.4.1. */ class SafeContract_v1_4_1 - extends SafeBaseContractEthers + extends SafeBaseContract implements SafeContract_v1_4_1_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.ts index e5168a6ae..ab35d4caa 100644 --- a/packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.ts @@ -14,29 +14,29 @@ export interface CreateProxyProps extends CreateProxyPropsGeneral { } /** - * Abstract class SafeProxyFactoryBaseContractEthers extends BaseContract to specifically integrate with the SafeProxyFactory contract. + * Abstract class SafeProxyFactoryBaseContract extends BaseContract to specifically integrate with the SafeProxyFactory contract. * It is designed to be instantiated for different versions of the Safe contract. * - * Subclasses of SafeProxyFactoryBaseContractEthers are expected to represent specific versions of the contract. + * Subclasses of SafeProxyFactoryBaseContract are expected to represent specific versions of the contract. * * @template SafeProxyFactoryContractAbiType - The ABI type specific to the version of the Safe Proxy Factory contract, extending InterfaceAbi from Ethers. * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: - * - SafeProxyFactoryContract_v1_4_1 extends SafeProxyFactoryBaseContractEthers - * - SafeProxyFactoryContract_v1_3_0 extends SafeProxyFactoryBaseContractEthers - * - SafeProxyFactoryContract_v1_2_0 extends SafeProxyFactoryBaseContractEthers - * - SafeProxyFactoryContract_v1_1_1 extends SafeProxyFactoryBaseContractEthers - * - SafeProxyFactoryContract_v1_0_0 extends SafeProxyFactoryBaseContractEthers + * - SafeProxyFactoryContract_v1_4_1 extends SafeProxyFactoryBaseContract + * - SafeProxyFactoryContract_v1_3_0 extends SafeProxyFactoryBaseContract + * - SafeProxyFactoryContract_v1_2_0 extends SafeProxyFactoryBaseContract + * - SafeProxyFactoryContract_v1_1_1 extends SafeProxyFactoryBaseContract + * - SafeProxyFactoryContract_v1_0_0 extends SafeProxyFactoryBaseContract */ -abstract class SafeProxyFactoryBaseContractEthers< +abstract class SafeProxyFactoryBaseContract< SafeProxyFactoryContractAbiType extends InterfaceAbi & Abi > extends BaseContract { contractName: contractName /** * @constructor - * Constructs an instance of SafeProxyFactoryBaseContractEthers. + * Constructs an instance of SafeProxyFactoryBaseContract. * * @param chainId - The chain ID of the contract. * @param safeProvider - An instance of SafeProvider. @@ -71,4 +71,4 @@ abstract class SafeProxyFactoryBaseContractEthers< } } -export default SafeProxyFactoryBaseContractEthers +export default SafeProxyFactoryBaseContract diff --git a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.ts index e12b2c160..100e61e67 100644 --- a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.ts @@ -1,5 +1,5 @@ import { ContractRunner, EventLog } from 'ethers' -import SafeProxyFactoryBaseContractEthers, { +import SafeProxyFactoryBaseContract, { CreateProxyProps } from '@safe-global/protocol-kit/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' @@ -16,11 +16,11 @@ import { * * This class specializes in handling interactions with the Safe Proxy Factory contract version 1.0.0 using Ethers.js v6. * - * @extends SafeProxyFactoryBaseContractEthers - Inherits from SafeProxyFactoryBaseContractEthers with ABI specific to Safe Proxy Factory contract version 1.0.0. + * @extends SafeProxyFactoryBaseContract - Inherits from SafeProxyFactoryBaseContract with ABI specific to Safe Proxy Factory contract version 1.0.0. * @implements SafeProxyFactoryContract_v1_0_0_Contract - Implements the interface specific to Safe Proxy Factory contract version 1.0.0. */ class SafeProxyFactoryContract_v1_0_0 - extends SafeProxyFactoryBaseContractEthers + extends SafeProxyFactoryBaseContract implements SafeProxyFactoryContract_v1_0_0_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.ts index 57fc8d509..8cd499342 100644 --- a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.ts @@ -1,5 +1,5 @@ import { ContractRunner, EventLog } from 'ethers' -import SafeProxyFactoryBaseContractEthers, { +import SafeProxyFactoryBaseContract, { CreateProxyProps } from '@safe-global/protocol-kit/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' @@ -16,11 +16,11 @@ import { * * This class specializes in handling interactions with the Safe Proxy Factory contract version 1.1.1 using Ethers.js v6. * - * @extends SafeProxyFactoryBaseContractEthers - Inherits from SafeProxyFactoryBaseContractEthers with ABI specific to Safe Proxy Factory contract version 1.1.1. + * @extends SafeProxyFactoryBaseContract - Inherits from SafeProxyFactoryBaseContract with ABI specific to Safe Proxy Factory contract version 1.1.1. * @implements SafeProxyFactoryContract_v1_1_1_Contract - Implements the interface specific to Safe Proxy Factory contract version 1.1.1. */ class SafeProxyFactoryContract_v1_1_1 - extends SafeProxyFactoryBaseContractEthers + extends SafeProxyFactoryBaseContract implements SafeProxyFactoryContract_v1_1_1_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.ts index 575a4834e..66ca7aabb 100644 --- a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.ts @@ -1,5 +1,5 @@ import { ContractRunner, EventLog } from 'ethers' -import SafeProxyFactoryBaseContractEthers, { +import SafeProxyFactoryBaseContract, { CreateProxyProps } from '@safe-global/protocol-kit/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' @@ -16,11 +16,11 @@ import { * * This class specializes in handling interactions with the Safe Proxy Factory contract version 1.3.0 using Ethers.js v6. * - * @extends SafeProxyFactoryBaseContractEthers - Inherits from SafeProxyFactoryBaseContractEthers with ABI specific to Safe Proxy Factory contract version 1.3.0. + * @extends SafeProxyFactoryBaseContract - Inherits from SafeProxyFactoryBaseContract with ABI specific to Safe Proxy Factory contract version 1.3.0. * @implements SafeProxyFactoryContract_v1_3_0_Contract - Implements the interface specific to Safe Proxy Factory contract version 1.3.0. */ class SafeProxyFactoryContract_v1_3_0 - extends SafeProxyFactoryBaseContractEthers + extends SafeProxyFactoryBaseContract implements SafeProxyFactoryContract_v1_3_0_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.ts index f41c84b13..425a11e26 100644 --- a/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.ts @@ -1,5 +1,5 @@ import { ContractRunner, EventLog } from 'ethers' -import SafeProxyFactoryBaseContractEthers, { +import SafeProxyFactoryBaseContract, { CreateProxyProps } from '@safe-global/protocol-kit/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract' import { @@ -16,11 +16,11 @@ import SafeProvider from '@safe-global/protocol-kit/SafeProvider' * * This class specializes in handling interactions with the Safe Proxy Factory contract version 1.4.1 using Ethers.js v6. * - * @extends SafeProxyFactoryBaseContractEthers - Inherits from SafeProxyFactoryBaseContractEthers with ABI specific to Safe Proxy Factory contract version 1.4.1. + * @extends SafeProxyFactoryBaseContract - Inherits from SafeProxyFactoryBaseContract with ABI specific to Safe Proxy Factory contract version 1.4.1. * @implements SafeProxyFactoryContract_v1_4_1_Contract - Implements the interface specific to Safe Proxy Factory contract version 1.4.1. */ class SafeProxyFactoryContract_v1_4_1 - extends SafeProxyFactoryBaseContractEthers + extends SafeProxyFactoryBaseContract implements SafeProxyFactoryContract_v1_4_1_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/SignMessageLib/SignMessageLibBaseContract.ts b/packages/protocol-kit/src/contracts/SignMessageLib/SignMessageLibBaseContract.ts index bbb467d54..264019128 100644 --- a/packages/protocol-kit/src/contracts/SignMessageLib/SignMessageLibBaseContract.ts +++ b/packages/protocol-kit/src/contracts/SignMessageLib/SignMessageLibBaseContract.ts @@ -7,26 +7,26 @@ import BaseContract from '@safe-global/protocol-kit/contracts/BaseContract' import { contractName } from '@safe-global/protocol-kit/contracts/config' /** - * Abstract class SignMessageLibBaseContractEthers extends BaseContract to specifically integrate with the SignMessageLib contract. + * Abstract class SignMessageLibBaseContract extends BaseContract to specifically integrate with the SignMessageLib contract. * It is designed to be instantiated for different versions of the SignMessageLib contract. * - * Subclasses of SignMessageLibBaseContractEthers are expected to represent specific versions of the SignMessageLib contract. + * Subclasses of SignMessageLibBaseContract are expected to represent specific versions of the SignMessageLib contract. * * @template SignMessageLibContractAbiType - The ABI type specific to the version of the SignMessageLib contract, extending InterfaceAbi from Ethers. * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: - * - SignMessageLibContract_v1_4_1 extends SignMessageLibBaseContractEthers - * - SignMessageLibContract_v1_3_0 extends SignMessageLibBaseContractEthers + * - SignMessageLibContract_v1_4_1 extends SignMessageLibBaseContract + * - SignMessageLibContract_v1_3_0 extends SignMessageLibBaseContract */ -abstract class SignMessageLibBaseContractEthers< +abstract class SignMessageLibBaseContract< SignMessageLibContractAbiType extends InterfaceAbi & Abi > extends BaseContract { contractName: contractName /** * @constructor - * Constructs an instance of SignMessageLibBaseContractEthers. + * Constructs an instance of SignMessageLibBaseContract. * * @param chainId - The chain ID of the contract. * @param safeProvider - An instance of SafeProvider. @@ -59,4 +59,4 @@ abstract class SignMessageLibBaseContractEthers< } } -export default SignMessageLibBaseContractEthers +export default SignMessageLibBaseContract diff --git a/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts index 171774925..f921666cc 100644 --- a/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts @@ -1,5 +1,5 @@ import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' -import SignMessageLibBaseContractEthers from '@safe-global/protocol-kit/contracts/SignMessageLib/SignMessageLibBaseContract' +import SignMessageLibBaseContract from '@safe-global/protocol-kit/contracts/SignMessageLib/SignMessageLibBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, @@ -16,11 +16,11 @@ import { * * This class specializes in handling interactions with the SignMessageLib contract version 1.3.0 using Ethers.js v6. * - * @extends SignMessageLibBaseContractEthers - Inherits from SignMessageLibBaseContractEthers with ABI specific to SignMessageLib contract version 1.3.0. + * @extends SignMessageLibBaseContract - Inherits from SignMessageLibBaseContract with ABI specific to SignMessageLib contract version 1.3.0. * @implements SignMessageLibContract_v1_3_0_Contract - Implements the interface specific to SignMessageLib contract version 1.3.0. */ class SignMessageLibContract_v1_3_0 - extends SignMessageLibBaseContractEthers + extends SignMessageLibBaseContract implements SignMessageLibContract_v1_3_0_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts index fb972d87a..bc21e510d 100644 --- a/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts @@ -1,5 +1,5 @@ import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' -import SignMessageLibBaseContractEthers from '@safe-global/protocol-kit/contracts/SignMessageLib/SignMessageLibBaseContract' +import SignMessageLibBaseContract from '@safe-global/protocol-kit/contracts/SignMessageLib/SignMessageLibBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, @@ -16,11 +16,11 @@ import { * * This class specializes in handling interactions with the SignMessageLib contract version 1.4.1 using Ethers.js v6. * - * @extends SignMessageLibBaseContractEthers - Inherits from SignMessageLibBaseContractEthers with ABI specific to SignMessageLib contract version 1.4.1. + * @extends SignMessageLibBaseContract - Inherits from SignMessageLibBaseContract with ABI specific to SignMessageLib contract version 1.4.1. * @implements SignMessageLibContract_v1_4_1_Contract - Implements the interface specific to SignMessageLib contract version 1.4.1. */ class SignMessageLibContract_v1_4_1 - extends SignMessageLibBaseContractEthers + extends SignMessageLibBaseContract implements SignMessageLibContract_v1_4_1_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.ts b/packages/protocol-kit/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.ts index 57e1bb05b..1fda7217b 100644 --- a/packages/protocol-kit/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.ts +++ b/packages/protocol-kit/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.ts @@ -7,26 +7,26 @@ import { SafeVersion } from '@safe-global/safe-core-sdk-types' import { contractName } from '@safe-global/protocol-kit/contracts/config' /** - * Abstract class SimulateTxAccessorBaseContractEthers extends BaseContract to specifically integrate with the SimulateTxAccessor contract. + * Abstract class SimulateTxAccessorBaseContract extends BaseContract to specifically integrate with the SimulateTxAccessor contract. * It is designed to be instantiated for different versions of the Safe contract. * - * Subclasses of SimulateTxAccessorBaseContractEthers are expected to represent specific versions of the contract. + * Subclasses of SimulateTxAccessorBaseContract are expected to represent specific versions of the contract. * * @template SimulateTxAccessorContractAbiType - The ABI type specific to the version of the SimulateTxAccessor contract, extending InterfaceAbi from Ethers. * @extends BaseContract - Extends the generic BaseContract. * * Example subclasses: - * - SimulateTxAccessorContract_v1_4_1 extends SimulateTxAccessorBaseContractEthers - * - SimulateTxAccessorContract_v1_3_0 extends SimulateTxAccessorBaseContractEthers + * - SimulateTxAccessorContract_v1_4_1 extends SimulateTxAccessorBaseContract + * - SimulateTxAccessorContract_v1_3_0 extends SimulateTxAccessorBaseContract */ -abstract class SimulateTxAccessorBaseContractEthers< +abstract class SimulateTxAccessorBaseContract< SimulateTxAccessorContractAbiType extends InterfaceAbi & Abi > extends BaseContract { contractName: contractName /** * @constructor - * Constructs an instance of SimulateTxAccessorBaseContractEthers. + * Constructs an instance of SimulateTxAccessorBaseContract. * * @param chainId - The chain ID of the contract. * @param safeProvider - An instance of SafeProvider. @@ -61,4 +61,4 @@ abstract class SimulateTxAccessorBaseContractEthers< } } -export default SimulateTxAccessorBaseContractEthers +export default SimulateTxAccessorBaseContract diff --git a/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.ts index 805cb3409..97d04b92a 100644 --- a/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.ts @@ -1,4 +1,4 @@ -import SimulateTxAccessorBaseContractEthers from '@safe-global/protocol-kit/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract' +import SimulateTxAccessorBaseContract from '@safe-global/protocol-kit/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, @@ -13,11 +13,11 @@ import { * * This class specializes in handling interactions with the SimulateTxAccessor contract version 1.3.0 using Ethers.js v6. * - * @extends SimulateTxAccessorBaseContractEthers - Inherits from SimulateTxAccessorBaseContractEthers with ABI specific to SimulateTxAccessor contract version 1.3.0. + * @extends SimulateTxAccessorBaseContract - Inherits from SimulateTxAccessorBaseContract with ABI specific to SimulateTxAccessor contract version 1.3.0. * @implements SimulateTxAccessorContract_v1_3_0_Contract - Implements the interface specific to SimulateTxAccessor contract version 1.3.0. */ class SimulateTxAccessorContract_v1_3_0 - extends SimulateTxAccessorBaseContractEthers + extends SimulateTxAccessorBaseContract implements SimulateTxAccessorContract_v1_3_0_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.ts index ebc2dd3a5..294562199 100644 --- a/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.ts @@ -1,4 +1,4 @@ -import SimulateTxAccessorBaseContractEthers from '@safe-global/protocol-kit/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract' +import SimulateTxAccessorBaseContract from '@safe-global/protocol-kit/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, @@ -12,11 +12,11 @@ import { * * This class specializes in handling interactions with the SimulateTxAccessor contract version 1.4.1 using Ethers.js v6. * - * @extends SimulateTxAccessorBaseContractEthers - Inherits from SimulateTxAccessorBaseContractEthers with ABI specific to SimulateTxAccessor contract version 1.4.1. + * @extends SimulateTxAccessorBaseContract - Inherits from SimulateTxAccessorBaseContract with ABI specific to SimulateTxAccessor contract version 1.4.1. * @implements SimulateTxAccessorContract_v1_4_1_Contract - Implements the interface specific to SimulateTxAccessor contract version 1.4.1. */ class SimulateTxAccessorContract_v1_4_1 - extends SimulateTxAccessorBaseContractEthers + extends SimulateTxAccessorBaseContract implements SimulateTxAccessorContract_v1_4_1_Contract { safeVersion: SafeVersion diff --git a/packages/protocol-kit/src/contracts/index.ts b/packages/protocol-kit/src/contracts/index.ts index bf44c1dff..690585271 100644 --- a/packages/protocol-kit/src/contracts/index.ts +++ b/packages/protocol-kit/src/contracts/index.ts @@ -1,18 +1,18 @@ import SafeProvider, { SafeProviderConfig } from '../SafeProvider' -import CreateCallBaseContractEthers from './CreateCall/CreateCallBaseContract' -import MultiSendBaseContractEthers from './MultiSend/MultiSendBaseContract' -import MultiSendCallOnlyBaseContractEthers from './MultiSend/MultiSendCallOnlyBaseContract' -import SafeBaseContractEthers from './Safe/SafeBaseContract' -import SafeProxyFactoryBaseContractEthers from './SafeProxyFactory/SafeProxyFactoryBaseContract' -import SignMessageLibBaseContractEthers from './SignMessageLib/SignMessageLibBaseContract' +import CreateCallBaseContract from './CreateCall/CreateCallBaseContract' +import MultiSendBaseContract from './MultiSend/MultiSendBaseContract' +import MultiSendCallOnlyBaseContract from './MultiSend/MultiSendCallOnlyBaseContract' +import SafeBaseContract from './Safe/SafeBaseContract' +import SafeProxyFactoryBaseContract from './SafeProxyFactory/SafeProxyFactoryBaseContract' +import SignMessageLibBaseContract from './SignMessageLib/SignMessageLibBaseContract' export { - CreateCallBaseContractEthers, + CreateCallBaseContract, SafeProvider, SafeProviderConfig, - MultiSendCallOnlyBaseContractEthers, - MultiSendBaseContractEthers, - SafeBaseContractEthers, - SafeProxyFactoryBaseContractEthers, - SignMessageLibBaseContractEthers + MultiSendCallOnlyBaseContract, + MultiSendBaseContract, + SafeBaseContract, + SafeProxyFactoryBaseContract, + SignMessageLibBaseContract } diff --git a/packages/protocol-kit/src/index.ts b/packages/protocol-kit/src/index.ts index 0f9e03713..8d66ee1fa 100644 --- a/packages/protocol-kit/src/index.ts +++ b/packages/protocol-kit/src/index.ts @@ -1,13 +1,13 @@ import Safe from './Safe' import { - CreateCallBaseContractEthers, + CreateCallBaseContract, SafeProvider, SafeProviderConfig, - MultiSendBaseContractEthers, - MultiSendCallOnlyBaseContractEthers, - SafeBaseContractEthers, - SafeProxyFactoryBaseContractEthers, - SignMessageLibBaseContractEthers + MultiSendBaseContract, + MultiSendCallOnlyBaseContract, + SafeBaseContract, + SafeProxyFactoryBaseContract, + SignMessageLibBaseContract } from './contracts' import { DEFAULT_SAFE_VERSION } from './contracts/config' import { @@ -89,7 +89,7 @@ export { ConnectSafeConfigWithSafeAddress, ContractManager, ContractNetworksConfig, - CreateCallBaseContractEthers, + CreateCallBaseContract, createERC20TokenTransferTransaction, CreateTransactionProps, DEFAULT_SAFE_VERSION, @@ -97,8 +97,8 @@ export { EthSafeSignature, SafeProvider, SafeProviderConfig, - MultiSendCallOnlyBaseContractEthers, - MultiSendBaseContractEthers, + MultiSendCallOnlyBaseContract, + MultiSendBaseContract, PREDETERMINED_SALT_NONCE, PredictedSafeProps, RemoveOwnerTxParams, @@ -106,13 +106,13 @@ export { SafeConfig, SafeConfigWithPredictedSafe, SafeConfigWithSafeAddress, - SafeBaseContractEthers, + SafeBaseContract, SafeDeploymentConfig, SafeFactory, SafeFactoryConfig, - SafeProxyFactoryBaseContractEthers, + SafeProxyFactoryBaseContract, SafeTransactionOptionalProps, - SignMessageLibBaseContractEthers, + SignMessageLibBaseContract, StandardizeSafeTransactionDataProps, SwapOwnerTxParams, SigningMethod, From 13f4091290de1c7d4dbeeae0e547fa31f3b93fd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Sun, 21 Apr 2024 22:47:23 +0200 Subject: [PATCH 042/112] Fix errors in all the projects --- .../src/AccountAbstraction.test.ts | 41 ++++++++++--------- .../src/AccountAbstraction.ts | 37 +++++++++++------ .../packs/monerium/SafeMoneriumClient.test.ts | 15 +++---- .../src/packs/monerium/SafeMoneriumClient.ts | 14 +++---- packages/protocol-kit/src/Safe.ts | 4 +- packages/protocol-kit/src/SafeProvider.ts | 15 +------ packages/protocol-kit/src/contracts/index.ts | 3 +- packages/protocol-kit/src/index.ts | 36 +--------------- packages/protocol-kit/src/types/index.ts | 18 ++++++-- 9 files changed, 85 insertions(+), 98 deletions(-) diff --git a/packages/account-abstraction-kit/src/AccountAbstraction.test.ts b/packages/account-abstraction-kit/src/AccountAbstraction.test.ts index 63e1aeb5b..623db447d 100644 --- a/packages/account-abstraction-kit/src/AccountAbstraction.test.ts +++ b/packages/account-abstraction-kit/src/AccountAbstraction.test.ts @@ -1,4 +1,4 @@ -import Safe, { predictSafeAddress, EthAdapter } from '@safe-global/protocol-kit' +import Safe, { predictSafeAddress } from '@safe-global/protocol-kit' import { GelatoRelayPack, RelayKitBasePack } from '@safe-global/relay-kit' import { SafeTransaction } from '@safe-global/safe-core-sdk-types' import AccountAbstraction from './AccountAbstraction' @@ -11,7 +11,10 @@ const predictSafeAddressMock = predictSafeAddress as jest.MockedFunction describe('AccountAbstraction', () => { - const ethersAdapter = { + const provider = { + request: jest.fn() + } + const safeProvider = { getSignerAddress: jest.fn(), isContractDeployed: jest.fn(), getChainId: jest.fn() @@ -21,54 +24,54 @@ describe('AccountAbstraction', () => { beforeEach(() => { jest.clearAllMocks() - ethersAdapter.getSignerAddress.mockResolvedValue(signerAddress) + safeProvider.getSignerAddress.mockResolvedValue(signerAddress) predictSafeAddressMock.mockResolvedValue(predictSafeAddress) }) describe('init', () => { - const accountAbstraction = new AccountAbstraction(ethersAdapter as unknown as EthAdapter) + const accountAbstraction = new AccountAbstraction({ provider }) it('should initialize a Safe instance with its address if contract is deployed already', async () => { - ethersAdapter.isContractDeployed.mockResolvedValueOnce(true) + safeProvider.isContractDeployed.mockResolvedValueOnce(true) await accountAbstraction.init() - expect(ethersAdapter.getSignerAddress).toHaveBeenCalledTimes(1) + expect(safeProvider.getSignerAddress).toHaveBeenCalledTimes(1) expect(predictSafeAddressMock).toHaveBeenCalledTimes(1) expect(predictSafeAddressMock).toHaveBeenCalledWith({ - ethAdapter: ethersAdapter, + safeProvider, safeAccountConfig: { owners: ['0xSignerAddress'], threshold: 1 } }) expect(SafeMock.create).toHaveBeenCalledTimes(1) expect(SafeMock.create).toHaveBeenCalledWith({ - ethAdapter: ethersAdapter, + safeProvider, safeAddress: predictSafeAddress }) }) it('should initialize a Safe instance with a config if contract is NOT deployed yet', async () => { - ethersAdapter.isContractDeployed.mockResolvedValueOnce(false) + safeProvider.isContractDeployed.mockResolvedValueOnce(false) await accountAbstraction.init() - expect(ethersAdapter.getSignerAddress).toHaveBeenCalledTimes(1) + expect(safeProvider.getSignerAddress).toHaveBeenCalledTimes(1) expect(predictSafeAddressMock).toHaveBeenCalledTimes(1) expect(predictSafeAddressMock).toHaveBeenCalledWith({ - ethAdapter: ethersAdapter, + safeProvider, safeAccountConfig: { owners: ['0xSignerAddress'], threshold: 1 } }) expect(SafeMock.create).toHaveBeenCalledTimes(1) expect(SafeMock.create).toHaveBeenCalledWith({ - ethAdapter: ethersAdapter, + safeProvider, predictedSafe: { safeAccountConfig: { owners: ['0xSignerAddress'], threshold: 1 } } }) }) it('should throw an error if the provider has not a signer', async () => { - ethersAdapter.getSignerAddress.mockResolvedValueOnce(undefined) + safeProvider.getSignerAddress.mockResolvedValueOnce(undefined) expect(accountAbstraction.init()).rejects.toThrow( - `There's no signer in the provided EthAdapter` + `There's no signer in the provided SafeProvider` ) expect(SafeMock.create).not.toHaveBeenCalled() }) @@ -83,7 +86,7 @@ describe('AccountAbstraction', () => { } const initAccountAbstraction = async () => { - const accountAbstraction = new AccountAbstraction(ethersAdapter as unknown as EthAdapter) + const accountAbstraction = new AccountAbstraction({ provider }) await accountAbstraction.init() return accountAbstraction } @@ -107,7 +110,7 @@ describe('AccountAbstraction', () => { }) it('should not be called if the protocol-kit is not initialized', async () => { - const accountAbstraction = new AccountAbstraction(ethersAdapter as unknown as EthAdapter) + const accountAbstraction = new AccountAbstraction({ provider }) expect(accountAbstraction.protocolKit).toBe(undefined) expect(safeInstanceMock.getNonce).not.toHaveBeenCalled() }) @@ -124,7 +127,7 @@ describe('AccountAbstraction', () => { }) it('should not be called if the protocol-kit is not initialized', async () => { - const accountAbstraction = new AccountAbstraction(ethersAdapter as unknown as EthAdapter) + const accountAbstraction = new AccountAbstraction({ provider }) expect(accountAbstraction.protocolKit).toBe(undefined) expect(safeInstanceMock.getAddress).not.toHaveBeenCalled() }) @@ -139,7 +142,7 @@ describe('AccountAbstraction', () => { }) it('should not be called if the protocol-kit is not initialized', async () => { - const accountAbstraction = new AccountAbstraction(ethersAdapter as unknown as EthAdapter) + const accountAbstraction = new AccountAbstraction({ provider }) expect(accountAbstraction.protocolKit).toBe(undefined) expect(safeInstanceMock.isSafeDeployed).not.toHaveBeenCalled() }) @@ -183,7 +186,7 @@ describe('AccountAbstraction', () => { }) it('should throw if the protocol-kit is not initialized', async () => { - const accountAbstraction = new AccountAbstraction(ethersAdapter as unknown as EthAdapter) + const accountAbstraction = new AccountAbstraction({ provider }) accountAbstraction.setRelayKit( new GelatoRelayPack({ protocolKit: accountAbstraction.protocolKit }) ) diff --git a/packages/account-abstraction-kit/src/AccountAbstraction.ts b/packages/account-abstraction-kit/src/AccountAbstraction.ts index 850deb09f..aed045452 100644 --- a/packages/account-abstraction-kit/src/AccountAbstraction.ts +++ b/packages/account-abstraction-kit/src/AccountAbstraction.ts @@ -1,4 +1,14 @@ -import Safe, { SafeAccountConfig, predictSafeAddress, EthAdapter } from '@safe-global/protocol-kit' +import Safe, { + SafeAccountConfig, + predictSafeAddress, + SafeProvider, + HexAddress, + HttpTransport, + PrivateKey, + SocketTransport, + SafeProviderConfig, + Eip1193Provider +} from '@safe-global/protocol-kit' import { RelayKitBasePack } from '@safe-global/relay-kit' import { MetaTransactionData, MetaTransactionOptions } from '@safe-global/safe-core-sdk-types' @@ -9,21 +19,24 @@ import { MetaTransactionData, MetaTransactionOptions } from '@safe-global/safe-c class AccountAbstraction { protocolKit!: Safe relayKit?: RelayKitBasePack - #ethAdapter: EthAdapter + #provider: Eip1193Provider | HttpTransport | SocketTransport + #signer?: HexAddress | PrivateKey /** * @constructor - * @param ethAdapter The EthAdapter instance to be used by the Account Abstraction (e.g. EthersAdapter) + * @param safeProvider The EthAdapter instance to be used by the Account Abstraction (e.g. EthersAdapter) */ - constructor(ethAdapter: EthAdapter) { - this.#ethAdapter = ethAdapter + constructor({ provider, signer }: SafeProviderConfig) { + this.#provider = provider + this.#signer = signer } #initializeProtocolKit = async () => { - const signer = await this.#ethAdapter.getSignerAddress() + const safeProvider = new SafeProvider({ provider: this.#provider, signer: this.#signer }) + const signer = await safeProvider.getSignerAddress() if (!signer) { - throw new Error("There's no signer in the provided EthAdapter") + throw new Error("There's no signer in the provided SafeProvider") } const owners = [signer] @@ -35,18 +48,18 @@ class AccountAbstraction { } const safeAddress = await predictSafeAddress({ - ethAdapter: this.#ethAdapter, - chainId: await this.#ethAdapter.getChainId(), + safeProvider, + chainId: await safeProvider.getChainId(), safeAccountConfig }) - const isSafeDeployed = await this.#ethAdapter.isContractDeployed(safeAddress) + const isSafeDeployed = await safeProvider.isContractDeployed(safeAddress) if (isSafeDeployed) { - this.protocolKit = await Safe.create({ ethAdapter: this.#ethAdapter, safeAddress }) + this.protocolKit = await Safe.create({ provider: this.#provider, safeAddress }) } else { this.protocolKit = await Safe.create({ - ethAdapter: this.#ethAdapter, + provider: this.#provider, predictedSafe: { safeAccountConfig } }) } diff --git a/packages/onramp-kit/src/packs/monerium/SafeMoneriumClient.test.ts b/packages/onramp-kit/src/packs/monerium/SafeMoneriumClient.test.ts index ae567d424..172c4fad0 100644 --- a/packages/onramp-kit/src/packs/monerium/SafeMoneriumClient.test.ts +++ b/packages/onramp-kit/src/packs/monerium/SafeMoneriumClient.test.ts @@ -44,12 +44,12 @@ describe('SafeMoneriumClient', () => { beforeEach(() => { jest.clearAllMocks() protocolKit.getChainId = jest.fn().mockResolvedValue(5) - protocolKit.getEthAdapter = jest.fn().mockReturnValue({ + protocolKit.getSafeProvider = jest.fn().mockReturnValue({ call: jest.fn().mockImplementation(async () => MAGIC_VALUE), getSignerAddress: jest.fn().mockResolvedValue('0xSignerAddress') }) - protocolKit.getEthAdapter.call = jest.fn().mockImplementation(async () => MAGIC_VALUE) + protocolKit.getSafeProvider.call = jest.fn().mockImplementation(async () => MAGIC_VALUE) safeMoneriumClient = new SafeMoneriumClient( { environment: 'sandbox', clientId: 'mockClientId', redirectUrl: 'http://mockUrl' }, protocolKit @@ -119,7 +119,7 @@ describe('SafeMoneriumClient', () => { it('should allow to check if a message is NOT signed in the smart contract if the promise is fulfilled', async () => { // Promise fulfilled without signature - protocolKit.getEthAdapter().call = jest.fn().mockImplementation(async () => '0x') + protocolKit.getSafeProvider().call = jest.fn().mockImplementation(async () => '0x') const isMessageSigned = await safeMoneriumClient.isMessageSigned( '0xSafeAddress', @@ -139,7 +139,7 @@ describe('SafeMoneriumClient', () => { } // promise is rejected with the signature - protocolKit.getEthAdapter().call = jest + protocolKit.getSafeProvider().call = jest .fn() .mockImplementation(() => Promise.reject(new EthersError('execution reverted: "Hash not approved"', MAGIC_VALUE)) @@ -163,7 +163,7 @@ describe('SafeMoneriumClient', () => { } // promise is rejected without a signature - protocolKit.getEthAdapter().call = jest + protocolKit.getSafeProvider().call = jest .fn() .mockImplementation(() => Promise.reject(new EthersError('execution reverted: "Hash not approved"', '0x')) @@ -226,14 +226,15 @@ describe('SafeMoneriumClient', () => { safeVersion: '1.3.0', contractName: 'signMessageLibVersion', contract: new Contract('target', []), - adapter: protocolKit.getEthAdapter() as protocolKitPackage.EthersAdapter, + safeProvider: protocolKit.getSafeProvider() as protocolKitPackage.SafeProvider, encode: jest.fn(), contractAbi: signMessageLib_1_4_1_ContractArtifacts.abi, contractAddress: '', getAddress: jest.fn(), getMessageHash: jest.fn(), signMessage: jest.fn(), - estimateGas: jest.fn() + estimateGas: jest.fn(), + init: jest.fn() }) protocolKit.createTransaction = jest.fn().mockResolvedValueOnce({ diff --git a/packages/onramp-kit/src/packs/monerium/SafeMoneriumClient.ts b/packages/onramp-kit/src/packs/monerium/SafeMoneriumClient.ts index 3991d9728..a9b891bf9 100644 --- a/packages/onramp-kit/src/packs/monerium/SafeMoneriumClient.ts +++ b/packages/onramp-kit/src/packs/monerium/SafeMoneriumClient.ts @@ -10,7 +10,7 @@ import { placeOrderMessage, ClassOptions } from '@monerium/sdk' -import Safe, { getSignMessageLibContract, EthAdapter } from '@safe-global/protocol-kit' +import Safe, { getSignMessageLibContract, SafeProvider } from '@safe-global/protocol-kit' import SafeApiKit from '@safe-global/api-kit' import { decodeSignatureData, @@ -29,7 +29,7 @@ import { SafeMoneriumOrder } from './types' export class SafeMoneriumClient extends MoneriumClient { #protocolKit: Safe - #ethAdapter: EthAdapter + #safeProvider: SafeProvider /** * Constructor where the Monerium environment and the Protocol kit instance are set @@ -40,7 +40,7 @@ export class SafeMoneriumClient extends MoneriumClient { super(moneriumOptions) this.#protocolKit = protocolKit - this.#ethAdapter = protocolKit.getEthAdapter() + this.#safeProvider = protocolKit.getSafeProvider() } /** @@ -119,7 +119,7 @@ export class SafeMoneriumClient extends MoneriumClient { const safeVersion = await this.#protocolKit.getContractVersion() const signMessageContract = await getSignMessageLibContract({ - ethAdapter: this.#ethAdapter, + safeProvider: this.#safeProvider, safeVersion }) @@ -147,7 +147,7 @@ export class SafeMoneriumClient extends MoneriumClient { safeAddress, safeTransactionData: safeTransaction.data, safeTxHash, - senderAddress: (await this.#ethAdapter.getSignerAddress()) || '', + senderAddress: (await this.#safeProvider.getSignerAddress()) || '', senderSignature: senderSignature.data }) @@ -207,12 +207,12 @@ export class SafeMoneriumClient extends MoneriumClient { ]) const checks = [ - this.#ethAdapter.call({ + this.#safeProvider.call({ from: safeAddress, to: safeAddress, data: eip1271data }), - this.#ethAdapter.call({ + this.#safeProvider.call({ from: safeAddress, to: safeAddress, data: eip1271BytesData diff --git a/packages/protocol-kit/src/Safe.ts b/packages/protocol-kit/src/Safe.ts index 061ef2870..53e32d0f5 100644 --- a/packages/protocol-kit/src/Safe.ts +++ b/packages/protocol-kit/src/Safe.ts @@ -31,12 +31,14 @@ import { ConnectSafeConfig, CreateTransactionProps, Eip1193Provider, + HttpTransport, PredictedSafeProps, RemoveOwnerTxParams, SafeConfig, SafeConfigProps, SigningMethod, SigningMethodType, + SocketTransport, SwapOwnerTxParams } from './types' import { @@ -77,7 +79,7 @@ const EQ_OR_GT_1_3_0 = '>=1.3.0' class Safe { #predictedSafe?: PredictedSafeProps - #provider!: Eip1193Provider + #provider!: Eip1193Provider | HttpTransport | SocketTransport #safeProvider!: SafeProvider #contractManager!: ContractManager #ownerManager!: OwnerManager diff --git a/packages/protocol-kit/src/SafeProvider.ts b/packages/protocol-kit/src/SafeProvider.ts index fc4c82500..f520546be 100644 --- a/packages/protocol-kit/src/SafeProvider.ts +++ b/packages/protocol-kit/src/SafeProvider.ts @@ -28,22 +28,9 @@ import { import { SafeProviderTransaction, GetContractProps, - Eip1193Provider + SafeProviderConfig } from '@safe-global/protocol-kit/types' -export type HexAddress = `0x${string}` -export type PrivateKey = string -export type HttpTransport = `http${string}` -export type SocketTransport = `ws${string}` -export type SafeSigner = HexAddress | PrivateKey - -export interface SafeProviderConfig { - /** signerOrProvider - Ethers signer or provider */ - provider: Eip1193Provider | HttpTransport | SocketTransport - signer?: HexAddress | PrivateKey - privateKeyOrMnemonic?: string -} - class SafeProvider { #provider: BrowserProvider | JsonRpcProvider #signer?: string diff --git a/packages/protocol-kit/src/contracts/index.ts b/packages/protocol-kit/src/contracts/index.ts index 690585271..c6b4faa06 100644 --- a/packages/protocol-kit/src/contracts/index.ts +++ b/packages/protocol-kit/src/contracts/index.ts @@ -1,4 +1,5 @@ -import SafeProvider, { SafeProviderConfig } from '../SafeProvider' +import SafeProvider from '../SafeProvider' +import { SafeProviderConfig } from '../types' import CreateCallBaseContract from './CreateCall/CreateCallBaseContract' import MultiSendBaseContract from './MultiSend/MultiSendBaseContract' import MultiSendCallOnlyBaseContract from './MultiSend/MultiSendCallOnlyBaseContract' diff --git a/packages/protocol-kit/src/index.ts b/packages/protocol-kit/src/index.ts index 8d66ee1fa..d61a6f2bb 100644 --- a/packages/protocol-kit/src/index.ts +++ b/packages/protocol-kit/src/index.ts @@ -27,24 +27,6 @@ import { } from './contracts/utils' import ContractManager from './managers/contractManager' import SafeFactory, { DeploySafeProps, SafeFactoryConfig } from './SafeFactory' -import { - AddOwnerTxParams, - ConnectSafeConfig, - ConnectSafeConfigWithPredictedSafe, - ConnectSafeConfigWithSafeAddress, - ContractNetworksConfig, - CreateTransactionProps, - PredictedSafeProps, - RemoveOwnerTxParams, - SafeAccountConfig, - SafeConfig, - SafeConfigWithPredictedSafe, - SafeConfigWithSafeAddress, - SafeDeploymentConfig, - StandardizeSafeTransactionDataProps, - SwapOwnerTxParams, - SigningMethod -} from './types' import { EthSafeSignature, estimateTxBaseGas, @@ -79,19 +61,13 @@ import { } from './utils/eip-712' export { - AddOwnerTxParams, estimateTxBaseGas, estimateTxGas, estimateSafeTxGas, estimateSafeDeploymentGas, - ConnectSafeConfig, - ConnectSafeConfigWithPredictedSafe, - ConnectSafeConfigWithSafeAddress, ContractManager, - ContractNetworksConfig, CreateCallBaseContract, createERC20TokenTransferTransaction, - CreateTransactionProps, DEFAULT_SAFE_VERSION, DeploySafeProps, EthSafeSignature, @@ -100,22 +76,12 @@ export { MultiSendCallOnlyBaseContract, MultiSendBaseContract, PREDETERMINED_SALT_NONCE, - PredictedSafeProps, - RemoveOwnerTxParams, - SafeAccountConfig, - SafeConfig, - SafeConfigWithPredictedSafe, - SafeConfigWithSafeAddress, SafeBaseContract, - SafeDeploymentConfig, SafeFactory, SafeFactoryConfig, SafeProxyFactoryBaseContract, SafeTransactionOptionalProps, SignMessageLibBaseContract, - StandardizeSafeTransactionDataProps, - SwapOwnerTxParams, - SigningMethod, encodeCreateProxyWithNonce, encodeMultiSendData, encodeSetupCallData, @@ -144,4 +110,6 @@ export { generateTypedData } +export * from './types' + export default Safe diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index ecc216a1c..413e50b8d 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -105,7 +105,7 @@ type SafeConfigWithPredictedSafeProps = { export type SafeConfigProps = { /** provider - Compatible EIP-1193 provider */ - provider: Eip1193Provider + provider: Eip1193Provider | HttpTransport | SocketTransport signer?: string /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ isL1SafeSingleton?: boolean @@ -133,7 +133,7 @@ type ConnectSafeConfigWithPredictedSafeProps = { type ConnectSafeConfigProps = { /** provider - Compatible EIP-1193 provider */ - provider?: Eip1193Provider + provider?: Eip1193Provider | HttpTransport | SocketTransport signer?: string /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ isL1SafeSingleton?: boolean @@ -195,7 +195,7 @@ type StandardizeSafeTxDataWithPredictedSafeProps = { interface StandardizeSafeTransactionData { /** provider - Compatible EIP-1193 provider */ - provider: Eip1193Provider + provider: Eip1193Provider | HttpTransport | SocketTransport signer?: string /** tx - Safe transaction */ tx: SafeTransactionDataPartial @@ -347,3 +347,15 @@ export interface GetContractProps { customContractAbi?: JsonFragment | JsonFragment[] isL1SafeSingleton?: boolean } + +export type HexAddress = `0x${string}` +export type PrivateKey = string +export type HttpTransport = `http${string}` +export type SocketTransport = `ws${string}` +export type SafeSigner = HexAddress | PrivateKey + +export interface SafeProviderConfig { + /** signerOrProvider - Ethers signer or provider */ + provider: Eip1193Provider | HttpTransport | SocketTransport + signer?: HexAddress | PrivateKey +} From 5bb337a33407e31fc819e20a034d351a3e99e2f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 22 Apr 2024 10:56:31 +0200 Subject: [PATCH 043/112] Remove remaining EthersAdapter instances --- .../src/AccountAbstraction.ts | 2 +- packages/auth-kit/example/src/App.tsx | 12 ++----- .../src/components/monerium/Monerium.tsx | 10 ++---- packages/protocol-kit/src/SafeFactory.ts | 32 +++++++++++++------ packages/protocol-kit/src/types/index.ts | 6 ++-- playground/api-kit/confirm-transaction.ts | 17 +++------- playground/api-kit/execute-transaction.ts | 15 ++------- playground/api-kit/propose-transaction.ts | 17 +++------- .../create-execute-transaction.ts | 15 ++------- playground/protocol-kit/deploy-safe.ts | 16 +++------- playground/protocol-kit/eip1271.ts | 18 +++-------- .../protocol-kit/generate-safe-address.ts | 14 +++----- playground/relay-kit/paid-transaction.ts | 18 ++++------- playground/relay-kit/sponsored-transaction.ts | 15 +++------ 14 files changed, 73 insertions(+), 134 deletions(-) diff --git a/packages/account-abstraction-kit/src/AccountAbstraction.ts b/packages/account-abstraction-kit/src/AccountAbstraction.ts index aed045452..91177a6f4 100644 --- a/packages/account-abstraction-kit/src/AccountAbstraction.ts +++ b/packages/account-abstraction-kit/src/AccountAbstraction.ts @@ -24,7 +24,7 @@ class AccountAbstraction { /** * @constructor - * @param safeProvider The EthAdapter instance to be used by the Account Abstraction (e.g. EthersAdapter) + * @param config The SafeProviderConfig */ constructor({ provider, signer }: SafeProviderConfig) { this.#provider = provider diff --git a/packages/auth-kit/example/src/App.tsx b/packages/auth-kit/example/src/App.tsx index 26c883ffb..cb3e570fb 100644 --- a/packages/auth-kit/example/src/App.tsx +++ b/packages/auth-kit/example/src/App.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from 'react' import { BrowserProvider, Eip1193Provider, ethers } from 'ethers' import { Box, Button, Divider, Grid, Typography } from '@mui/material' import { EthHashInfo } from '@safe-global/safe-react-components' -import Safe, { EthersAdapter } from '@safe-global/protocol-kit' +import Safe from '@safe-global/protocol-kit' import AppBar from './AppBar' import { AuthKitSignInData, @@ -129,15 +129,9 @@ function App() { const safeAddress = safeAuthSignInResponse?.safes?.[index] || '0x' // Wrap Web3Auth provider with ethers - const provider = new BrowserProvider(safeAuthPack?.getProvider() as Eip1193Provider) - const signer = await provider.getSigner() - const ethAdapter = new EthersAdapter({ - ethers, - signerOrProvider: signer - }) const protocolKit = await Safe.create({ - safeAddress, - ethAdapter + provider: safeAuthPack?.getProvider() as Eip1193Provider, + safeAddress }) // Create transaction diff --git a/packages/onramp-kit/example/client/src/components/monerium/Monerium.tsx b/packages/onramp-kit/example/client/src/components/monerium/Monerium.tsx index b96d730c3..b8c81aa96 100644 --- a/packages/onramp-kit/example/client/src/components/monerium/Monerium.tsx +++ b/packages/onramp-kit/example/client/src/components/monerium/Monerium.tsx @@ -1,8 +1,7 @@ import { useState, useEffect } from 'react' -import { ethers } from 'ethers' import { AuthContext, OrderState, PaymentStandard } from '@monerium/sdk' import { Box } from '@mui/material' -import Safe, { EthersAdapter } from '@safe-global/protocol-kit' +import Safe from '@safe-global/protocol-kit' import { useAuth } from '../../AuthContext' import { MoneriumPack, SafeMoneriumClient } from '@safe-global/onramp-kit' @@ -23,13 +22,8 @@ function Monerium() { ;(async () => { if (!authProvider || !selectedSafe) return - const provider = new ethers.BrowserProvider(authProvider) - - const safeOwner = await provider.getSigner() - const ethAdapter = new EthersAdapter({ ethers, signerOrProvider: safeOwner }) - const protocolKit = await Safe.create({ - ethAdapter: ethAdapter, + provider: authProvider, safeAddress: selectedSafe, isL1SafeSingleton: true }) diff --git a/packages/protocol-kit/src/SafeFactory.ts b/packages/protocol-kit/src/SafeFactory.ts index 66a697150..d62a8513d 100644 --- a/packages/protocol-kit/src/SafeFactory.ts +++ b/packages/protocol-kit/src/SafeFactory.ts @@ -13,14 +13,18 @@ import { } from '@safe-global/protocol-kit/contracts/utils' import { ContractNetworksConfig, + HexAddress, + HttpTransport, + PrivateKey, SafeAccountConfig, SafeContractImplementationType, SafeDeploymentConfig, - SafeProxyFactoryContractImplementationType + SafeProxyFactoryContractImplementationType, + SocketTransport, + Eip1193Provider } from '@safe-global/protocol-kit/types' import { SafeVersion, TransactionOptions } from '@safe-global/safe-core-sdk-types' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' -import { Eip1193Provider } from '@safe-global/protocol-kit/types' export interface DeploySafeProps { safeAccountConfig: SafeAccountConfig @@ -31,9 +35,8 @@ export interface DeploySafeProps { export interface SafeFactoryConfig { /** provider - Ethereum EIP-1193 compatible provider */ - provider: Eip1193Provider - signerAddress?: string - privateKeyOrMnemonic?: string + provider: Eip1193Provider | HttpTransport | SocketTransport + signer?: HexAddress | PrivateKey /** safeVersion - Versions of the Safe deployed by this Factory contract */ safeVersion?: SafeVersion /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ @@ -44,8 +47,8 @@ export interface SafeFactoryConfig { interface SafeFactoryInitConfig { /** provider - Ethereum EIP-1193 compatible provider */ - provider: Eip1193Provider - signerAddress?: string + provider: Eip1193Provider | HttpTransport | SocketTransport + signer?: HexAddress | PrivateKey privateKeyOrMnemonic?: string /** safeVersion - Versions of the Safe deployed by this Factory contract */ safeVersion: SafeVersion @@ -61,27 +64,37 @@ class SafeFactory { #safeVersion!: SafeVersion #safeProxyFactoryContract!: SafeProxyFactoryContractImplementationType #safeContract!: SafeContractImplementationType - #provider!: Eip1193Provider + #provider!: Eip1193Provider | HttpTransport | SocketTransport + #signer?: HexAddress | PrivateKey #safeProvider!: SafeProvider static async create({ provider, + signer, safeVersion = DEFAULT_SAFE_VERSION, isL1SafeSingleton = false, contractNetworks }: SafeFactoryConfig): Promise { const safeFactorySdk = new SafeFactory() - await safeFactorySdk.init({ provider, safeVersion, isL1SafeSingleton, contractNetworks }) + await safeFactorySdk.init({ + provider, + signer, + safeVersion, + isL1SafeSingleton, + contractNetworks + }) return safeFactorySdk } private async init({ provider, + signer, safeVersion, isL1SafeSingleton, contractNetworks }: SafeFactoryInitConfig): Promise { this.#provider = provider + this.#signer = signer this.#safeProvider = new SafeProvider({ provider }) this.#safeVersion = safeVersion this.#isL1SafeSingleton = isL1SafeSingleton @@ -183,6 +196,7 @@ class SafeFactory { } const safe = await Safe.create({ provider: this.#provider, + signer: this.#signer, safeAddress, isL1SafeSingleton: this.#isL1SafeSingleton, contractNetworks: this.#contractNetworks diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index 413e50b8d..af40d369c 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -348,10 +348,10 @@ export interface GetContractProps { isL1SafeSingleton?: boolean } -export type HexAddress = `0x${string}` +export type HexAddress = string export type PrivateKey = string -export type HttpTransport = `http${string}` -export type SocketTransport = `ws${string}` +export type HttpTransport = string +export type SocketTransport = string export type SafeSigner = HexAddress | PrivateKey export interface SafeProviderConfig { diff --git a/playground/api-kit/confirm-transaction.ts b/playground/api-kit/confirm-transaction.ts index 8e4b0ccaf..b8c662dec 100644 --- a/playground/api-kit/confirm-transaction.ts +++ b/playground/api-kit/confirm-transaction.ts @@ -1,6 +1,5 @@ +import Safe from '@safe-global/protocol-kit' import SafeApiKit from '@safe-global/api-kit' -import Safe, { EthersAdapter } from '@safe-global/protocol-kit' -import { ethers } from 'ethers' // This file can be used to play around with the Safe Core SDK @@ -21,18 +20,10 @@ const config: Config = { } async function main() { - const provider = new ethers.JsonRpcProvider(config.RPC_URL) - const signer = new ethers.Wallet(config.SIGNER_ADDRESS_PRIVATE_KEY, provider) - - // Create EthAdapter instance - const ethAdapter = new EthersAdapter({ - ethers, - signerOrProvider: signer - }) - // Create Safe instance const safe = await Safe.create({ - ethAdapter, + provider: config.RPC_URL, + signer: config.SIGNER_ADDRESS_PRIVATE_KEY, safeAddress: config.SAFE_ADDRESS }) @@ -55,7 +46,7 @@ async function main() { // Confirm the Safe transaction const signatureResponse = await service.confirmTransaction(safeTxHash, signature.data) - const signerAddress = await signer.getAddress() + const signerAddress = await safe.getSafeProvider().getSignerAddress() console.log('Added a new signature to transaction with safeTxGas:', config.SAFE_TX_HASH) console.log('- Signer:', signerAddress) console.log('- Signer signature:', signatureResponse.signature) diff --git a/playground/api-kit/execute-transaction.ts b/playground/api-kit/execute-transaction.ts index 039b2b807..e49316bd5 100644 --- a/playground/api-kit/execute-transaction.ts +++ b/playground/api-kit/execute-transaction.ts @@ -1,6 +1,5 @@ +import Safe from '@safe-global/protocol-kit' import SafeApiKit from '@safe-global/api-kit' -import Safe, { EthersAdapter } from '@safe-global/protocol-kit' -import { ethers } from 'ethers' // This file can be used to play around with the Safe Core SDK @@ -21,18 +20,10 @@ const config: Config = { } async function main() { - const provider = new ethers.JsonRpcProvider(config.RPC_URL) - const signer = new ethers.Wallet(config.SIGNER_ADDRESS_PRIVATE_KEY, provider) - - // Create EthAdapter instance - const ethAdapter = new EthersAdapter({ - ethers, - signerOrProvider: signer - }) - // Create Safe instance const safe = await Safe.create({ - ethAdapter, + provider: config.RPC_URL, + signer: config.SIGNER_ADDRESS_PRIVATE_KEY, safeAddress: config.SAFE_ADDRESS }) diff --git a/playground/api-kit/propose-transaction.ts b/playground/api-kit/propose-transaction.ts index 279584f41..d6bd7a309 100644 --- a/playground/api-kit/propose-transaction.ts +++ b/playground/api-kit/propose-transaction.ts @@ -1,7 +1,6 @@ +import Safe from '@safe-global/protocol-kit' import SafeApiKit from '@safe-global/api-kit' -import Safe, { EthersAdapter } from '@safe-global/protocol-kit' import { OperationType, SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types' -import { ethers } from 'ethers' // This file can be used to play around with the Safe Core SDK @@ -20,18 +19,10 @@ const config: Config = { } async function main() { - const provider = new ethers.JsonRpcProvider(config.RPC_URL) - const signer = new ethers.Wallet(config.SIGNER_ADDRESS_PRIVATE_KEY, provider) - - // Create EthAdapter instance - const ethAdapter = new EthersAdapter({ - ethers, - signerOrProvider: signer - }) - // Create Safe instance const safe = await Safe.create({ - ethAdapter, + provider: config.RPC_URL, + signer: config.SIGNER_ADDRESS_PRIVATE_KEY, safeAddress: config.SAFE_ADDRESS }) @@ -49,7 +40,7 @@ async function main() { } const safeTransaction = await safe.createTransaction({ transactions: [safeTransactionData] }) - const senderAddress = await signer.getAddress() + const senderAddress = (await safe.getSafeProvider().getSignerAddress()) || '0x' const safeTxHash = await safe.getTransactionHash(safeTransaction) const signature = await safe.signHash(safeTxHash) diff --git a/playground/protocol-kit/create-execute-transaction.ts b/playground/protocol-kit/create-execute-transaction.ts index 90e1ceb79..97ad9d720 100644 --- a/playground/protocol-kit/create-execute-transaction.ts +++ b/playground/protocol-kit/create-execute-transaction.ts @@ -1,6 +1,5 @@ -import { ethers } from 'ethers' import * as dotenv from 'dotenv' -import Safe, { EthersAdapter, SigningMethod } from '@safe-global/protocol-kit' +import Safe, { SigningMethod } from '@safe-global/protocol-kit' import { OperationType, SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types' dotenv.config() @@ -25,18 +24,10 @@ const config: Config = { } async function main() { - const provider = new ethers.JsonRpcProvider(config.RPC_URL) - const signer = new ethers.Wallet(config.SIGNER_ADDRESS_PRIVATE_KEY, provider) - - // Create EthAdapter instance - const ethAdapter = new EthersAdapter({ - ethers, - signerOrProvider: signer - }) - // Create Safe instance const safe = await Safe.create({ - ethAdapter, + provider: config.RPC_URL, + signer: config.SIGNER_ADDRESS_PRIVATE_KEY, safeAddress: config.SAFE_ADDRESS }) diff --git a/playground/protocol-kit/deploy-safe.ts b/playground/protocol-kit/deploy-safe.ts index 3ce239bee..db7f18f03 100644 --- a/playground/protocol-kit/deploy-safe.ts +++ b/playground/protocol-kit/deploy-safe.ts @@ -1,5 +1,4 @@ import { SafeAccountConfig, SafeFactory } from '@safe-global/protocol-kit' -import { EthersAdapter } from '@safe-global/protocol-kit' import { SafeVersion } from '@safe-global/safe-core-sdk-types' import { ethers } from 'ethers' @@ -28,21 +27,16 @@ const config: Config = { } async function main() { - const provider = new ethers.JsonRpcProvider(config.RPC_URL) - const deployerSigner = new ethers.Wallet(config.DEPLOYER_ADDRESS_PRIVATE_KEY, provider) - - // Create EthAdapter instance - const ethAdapter = new EthersAdapter({ - ethers, - signerOrProvider: deployerSigner - }) - const safeVersion = config.DEPLOY_SAFE.SAFE_VERSION as SafeVersion console.log('safe config: ', config.DEPLOY_SAFE) // Create SafeFactory instance - const safeFactory = await SafeFactory.create({ ethAdapter, safeVersion }) + const safeFactory = await SafeFactory.create({ + provider: config.RPC_URL, + signer: config.DEPLOYER_ADDRESS_PRIVATE_KEY, + safeVersion + }) // Config of the deployed Safe const safeAccountConfig: SafeAccountConfig = { diff --git a/playground/protocol-kit/eip1271.ts b/playground/protocol-kit/eip1271.ts index 10129eea3..3578dee49 100644 --- a/playground/protocol-kit/eip1271.ts +++ b/playground/protocol-kit/eip1271.ts @@ -1,5 +1,5 @@ import Safe from '@safe-global/protocol-kit' -import { EthersAdapter, hashSafeMessage } from '@safe-global/protocol-kit' +import { hashSafeMessage } from '@safe-global/protocol-kit' import { ethers, JsonRpcProvider } from 'ethers' // This file can be used to play around with the Safe Core SDK @@ -22,24 +22,16 @@ const config: Config = { } async function main() { - const provider = new JsonRpcProvider(config.RPC_URL) - const signer1 = new ethers.Wallet(config.OWNER1_PRIVATE_KEY, provider) - const signer2 = new ethers.Wallet(config.OWNER2_PRIVATE_KEY, provider) - // Create safeSdk instances const safeSdk1 = await Safe.create({ - ethAdapter: new EthersAdapter({ - ethers, - signerOrProvider: signer1 - }), + provider: config.RPC_URL, + signer: config.OWNER1_PRIVATE_KEY, safeAddress: config.SAFE_2_3_ADDRESS }) const safeSdk2 = await Safe.create({ - ethAdapter: new EthersAdapter({ - ethers, - signerOrProvider: signer2 - }), + provider: config.RPC_URL, + signer: config.OWNER2_PRIVATE_KEY, safeAddress: config.SAFE_2_3_ADDRESS }) diff --git a/playground/protocol-kit/generate-safe-address.ts b/playground/protocol-kit/generate-safe-address.ts index b71ba39da..0b91618ac 100644 --- a/playground/protocol-kit/generate-safe-address.ts +++ b/playground/protocol-kit/generate-safe-address.ts @@ -1,11 +1,10 @@ import { - EthersAdapter, + SafeProvider, SafeAccountConfig, SafeDeploymentConfig, predictSafeAddress } from '@safe-global/protocol-kit' import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import { ethers } from 'ethers' // This script can be used to generate a custom Safe address @@ -29,7 +28,7 @@ async function generateSafeAddresses() { threshold: config.threshold } - const chainId = await ethAdapter.getChainId() + const chainId = await safeProvider.getChainId() // infinite loop to search a valid Safe addresses for (saltNonce; true; saltNonce++ && iteractions++) { @@ -41,7 +40,7 @@ async function generateSafeAddresses() { // we predict the Safe address using the current saltNonce const predictedSafeAddress = await predictSafeAddress({ - ethAdapter, + safeProvider, chainId, safeAccountConfig, safeDeploymentConfig @@ -60,11 +59,8 @@ async function generateSafeAddresses() { } } -const provider = new ethers.JsonRpcProvider(config.rpcUrl) - -const ethAdapter = new EthersAdapter({ - ethers, - signerOrProvider: provider +const safeProvider = new SafeProvider({ + provider: config.rpcUrl }) const start = Date.now() diff --git a/playground/relay-kit/paid-transaction.ts b/playground/relay-kit/paid-transaction.ts index 47b5b6aa2..3942c926a 100644 --- a/playground/relay-kit/paid-transaction.ts +++ b/playground/relay-kit/paid-transaction.ts @@ -6,7 +6,6 @@ import { OperationType } from '@safe-global/safe-core-sdk-types' import { ethers } from 'ethers' -import { EthersAdapter } from '@safe-global/protocol-kit' // Check the status of a transaction after it is relayed: // https://relay.gelato.digital/tasks/status/ @@ -30,7 +29,7 @@ const txConfig = { VALUE: '', // Options: GAS_LIMIT: '', - GAS_TOKEN: ethers.ZeroAddress + GAS_TOKEN: '0x0000000000000000000000000000000000000000' } async function main() { @@ -38,15 +37,10 @@ async function main() { // SDK Initialization - const provider = new ethers.JsonRpcProvider(config.RPC_URL) - const signer = new ethers.Wallet(config.SAFE_SIGNER_PRIVATE_KEY, provider) - - const safeAccountAbstraction = new AccountAbstraction( - new EthersAdapter({ - ethers, - signerOrProvider: signer - }) - ) + const safeAccountAbstraction = new AccountAbstraction({ + provider: config.RPC_URL, + signer: config.SAFE_SIGNER_PRIVATE_KEY + }) await safeAccountAbstraction.init() @@ -62,6 +56,8 @@ async function main() { const isSafeDeployed = await safeAccountAbstraction.protocolKit.isSafeDeployed() console.log({ isSafeDeployed }) + const provider = safeAccountAbstraction.protocolKit.getSafeProvider().getProvider() + // Fake on-ramp to transfer enough funds to the Safe address const chainId = (await provider.getNetwork()).chainId diff --git a/playground/relay-kit/sponsored-transaction.ts b/playground/relay-kit/sponsored-transaction.ts index 08f11d553..9f8d51c44 100644 --- a/playground/relay-kit/sponsored-transaction.ts +++ b/playground/relay-kit/sponsored-transaction.ts @@ -1,5 +1,4 @@ import AccountAbstraction from '@safe-global/account-abstraction-kit-poc' -import { EthersAdapter } from '@safe-global/protocol-kit' import { GelatoRelayPack } from '@safe-global/relay-kit' import { MetaTransactionData, @@ -39,15 +38,10 @@ async function main() { // SDK Initialization - const provider = new ethers.JsonRpcProvider(config.RPC_URL) - const signer = new ethers.Wallet(config.SAFE_SIGNER_PRIVATE_KEY, provider) - - const safeAccountAbstraction = new AccountAbstraction( - new EthersAdapter({ - ethers, - signerOrProvider: signer - }) - ) + const safeAccountAbstraction = new AccountAbstraction({ + provider: config.RPC_URL, + signer: config.SAFE_SIGNER_PRIVATE_KEY + }) await safeAccountAbstraction.init() @@ -68,6 +62,7 @@ async function main() { // Fake on-ramp to fund the Safe + const provider = safeAccountAbstraction.protocolKit.getSafeProvider().getProvider() const safeBalance = await provider.getBalance(predictedSafeAddress) console.log({ safeBalance: ethers.formatEther(safeBalance.toString()) }) if (safeBalance < BigInt(txConfig.VALUE)) { From d4450999bf65cb53e015d507d57c5f22bb3eaab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 22 Apr 2024 16:26:33 +0200 Subject: [PATCH 044/112] Update protocol-kit code after merge --- packages/protocol-kit/src/Safe.ts | 4 ++-- packages/protocol-kit/src/contracts/utils.ts | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/protocol-kit/src/Safe.ts b/packages/protocol-kit/src/Safe.ts index 787c5abb2..cd78d61f4 100644 --- a/packages/protocol-kit/src/Safe.ts +++ b/packages/protocol-kit/src/Safe.ts @@ -213,10 +213,10 @@ class Safe { throw new Error('The Safe already exists') } - const chainId = await this.#ethAdapter.getChainId() + const chainId = await this.#safeProvider.getChainId() return getPredictedSafeAddressInitCode({ - ethAdapter: this.#ethAdapter, + safeProvider: this.#safeProvider, chainId, customContracts: this.#contractManager.contractNetworks?.[chainId.toString()], ...this.#predictedSafe diff --git a/packages/protocol-kit/src/contracts/utils.ts b/packages/protocol-kit/src/contracts/utils.ts index 5447d4cbd..a91c8facc 100644 --- a/packages/protocol-kit/src/contracts/utils.ts +++ b/packages/protocol-kit/src/contracts/utils.ts @@ -197,7 +197,7 @@ export function getChainSpecificDefaultSaltNonce(chainId: bigint): string { } export async function getPredictedSafeAddressInitCode({ - ethAdapter, + safeProvider, chainId, safeAccountConfig, safeDeploymentConfig = {}, @@ -213,14 +213,14 @@ export async function getPredictedSafeAddressInitCode({ } = safeDeploymentConfig const safeProxyFactoryContract = await memoizedGetProxyFactoryContract({ - ethAdapter, + safeProvider, safeVersion, customContracts, chainId: chainId.toString() }) const safeContract = await memoizedGetSafeContract({ - ethAdapter, + safeProvider, safeVersion, isL1SafeSingleton, customContracts, @@ -228,14 +228,14 @@ export async function getPredictedSafeAddressInitCode({ }) const initializer = await encodeSetupCallData({ - ethAdapter, + safeProvider, safeAccountConfig, safeContract, customContracts, customSafeVersion: safeVersion // it is more efficient if we provide the safeVersion manually }) - const encodedNonce = toBuffer(ethAdapter.encodeParameters(['uint256'], [saltNonce])).toString( + const encodedNonce = toBuffer(safeProvider.encodeParameters(['uint256'], [saltNonce])).toString( 'hex' ) const safeSingletonAddress = await safeContract.getAddress() From 753ce9059451cdd2275f193a7854408365c01e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 22 Apr 2024 16:54:11 +0200 Subject: [PATCH 045/112] latest changes and build --- .../src/AccountAbstraction.test.ts | 2 +- .../src/AccountAbstraction.ts | 11 +++------- packages/api-kit/package.json | 2 +- packages/auth-kit/package.json | 2 +- packages/onramp-kit/package.json | 2 +- .../src/packs/safe-4337/Safe4337Pack.test.ts | 6 +++-- .../src/packs/safe-4337/Safe4337Pack.ts | 22 ++++++++++--------- .../packs/safe-4337/testing-utils/helpers.ts | 11 ++-------- .../relay-kit/src/packs/safe-4337/types.ts | 5 +++-- yarn.lock | 14 ------------ 10 files changed, 28 insertions(+), 49 deletions(-) diff --git a/packages/account-abstraction-kit/src/AccountAbstraction.test.ts b/packages/account-abstraction-kit/src/AccountAbstraction.test.ts index fa8fa34b9..e4d54fda4 100644 --- a/packages/account-abstraction-kit/src/AccountAbstraction.test.ts +++ b/packages/account-abstraction-kit/src/AccountAbstraction.test.ts @@ -199,7 +199,7 @@ describe('AccountAbstraction', () => { }) it('should throw if relay-kit is not initialized', async () => { - const accountAbstraction = new AccountAbstraction(ethersAdapter as unknown as EthAdapter) + const accountAbstraction = new AccountAbstraction({ provider }) await accountAbstraction.init() expect(accountAbstraction.relayTransaction(transactionsMock, optionsMock)).rejects.toThrow( diff --git a/packages/account-abstraction-kit/src/AccountAbstraction.ts b/packages/account-abstraction-kit/src/AccountAbstraction.ts index 23b755388..763b18ce5 100644 --- a/packages/account-abstraction-kit/src/AccountAbstraction.ts +++ b/packages/account-abstraction-kit/src/AccountAbstraction.ts @@ -1,13 +1,8 @@ import Safe, { SafeAccountConfig, predictSafeAddress, - SafeProvider, - HexAddress, - HttpTransport, - PrivateKey, - SocketTransport, SafeProviderConfig, - Eip1193Provider + SafeProvider } from '@safe-global/protocol-kit' import { RelayKitBasePack } from '@safe-global/relay-kit' import { @@ -23,8 +18,8 @@ import { class AccountAbstraction { protocolKit!: Safe relayKit?: RelayKitBasePack - #provider: Eip1193Provider | HttpTransport | SocketTransport - #signer?: HexAddress | PrivateKey + #provider: SafeProviderConfig['provider'] + #signer?: SafeProviderConfig['signer'] /** * @constructor diff --git a/packages/api-kit/package.json b/packages/api-kit/package.json index 264ef3744..c0f93a342 100644 --- a/packages/api-kit/package.json +++ b/packages/api-kit/package.json @@ -55,7 +55,7 @@ "yargs": "^17.7.2" }, "dependencies": { - "@safe-global/protocol-kit": "^3.0.2", + "@safe-global/protocol-kit": "3.1.0-alpha.0", "@safe-global/safe-core-sdk-types": "^4.0.2", "ethers": "^6.7.1", "node-fetch": "^2.7.0" diff --git a/packages/auth-kit/package.json b/packages/auth-kit/package.json index a60365865..a4e2ead8e 100644 --- a/packages/auth-kit/package.json +++ b/packages/auth-kit/package.json @@ -41,7 +41,7 @@ }, "dependencies": { "@safe-global/api-kit": "^2.3.0", - "@safe-global/protocol-kit": "^3.0.2", + "@safe-global/protocol-kit": "3.1.0-alpha.0", "@web3auth/safeauth-embed": "^0.0.0", "ethers": "^6.7.1" } diff --git a/packages/onramp-kit/package.json b/packages/onramp-kit/package.json index 3ce950ddf..009972f42 100644 --- a/packages/onramp-kit/package.json +++ b/packages/onramp-kit/package.json @@ -37,7 +37,7 @@ "dependencies": { "@monerium/sdk": "^2.9.0", "@safe-global/api-kit": "^2.3.0", - "@safe-global/protocol-kit": "^3.0.2", + "@safe-global/protocol-kit": "3.1.0-alpha.0", "@safe-global/safe-core-sdk-types": "^4.0.2", "@stripe/crypto": "^0.0.4", "@stripe/stripe-js": "^1.54.2", diff --git a/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.test.ts b/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.test.ts index cc84ca34f..fc7311f54 100644 --- a/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.test.ts +++ b/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.test.ts @@ -193,7 +193,8 @@ describe('Safe4337Pack', () => { expect(encodeFunctionDataSpy).toHaveBeenCalledWith('enableModules', [[safe4337ModuleAddress]]) expect(safeCreateSpy).toHaveBeenCalledWith({ - ethAdapter: safe4337Pack.protocolKit.getEthAdapter(), + provider: safe4337Pack.protocolKit.getSafeProvider().getProvider(), + signer: await safe4337Pack.protocolKit.getSafeProvider().getSigner(), predictedSafe: { safeDeploymentConfig: { safeVersion: constants.DEFAULT_SAFE_VERSION, @@ -259,7 +260,8 @@ describe('Safe4337Pack', () => { expect(encodeFunctionDataSpy).toHaveBeenNthCalledWith(4, 'multiSend', [multiSendData]) expect(safeCreateSpy).toHaveBeenCalledWith({ - ethAdapter: safe4337Pack.protocolKit.getEthAdapter(), + provider: safe4337Pack.protocolKit.getSafeProvider().getProvider(), + signer: await safe4337Pack.protocolKit.getSafeProvider().getSigner(), predictedSafe: { safeDeploymentConfig: { safeVersion: constants.DEFAULT_SAFE_VERSION, diff --git a/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts b/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts index d5b5d10b6..abd37da20 100644 --- a/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts +++ b/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts @@ -2,7 +2,7 @@ import { ethers } from 'ethers' import semverSatisfies from 'semver/functions/satisfies' import Safe, { EthSafeSignature, - EthersAdapter, + SafeProvider, SigningMethod, encodeMultiSendData, getMultiSendContract @@ -105,7 +105,7 @@ export class Safe4337Pack extends RelayKitBasePack<{ * @return {Promise} The Promise object that will be resolved into an instance of Safe4337Pack. */ static async init(initOptions: Safe4337InitOptions): Promise { - const { ethersAdapter, options, bundlerUrl, rpcUrl, customContracts, paymasterOptions } = + const { provider, signer, options, bundlerUrl, rpcUrl, customContracts, paymasterOptions } = initOptions let protocolKit: Safe const bundlerClient = getEip4337BundlerProvider(bundlerUrl) @@ -143,7 +143,8 @@ export class Safe4337Pack extends RelayKitBasePack<{ // Existing Safe if ('safeAddress' in options) { protocolKit = await Safe.create({ - ethAdapter: ethersAdapter, + provider, + signer, safeAddress: options.safeAddress }) @@ -211,7 +212,7 @@ export class Safe4337Pack extends RelayKitBasePack<{ ]) const multiSendContract = await getMultiSendContract({ - ethAdapter: ethersAdapter, + safeProvider: new SafeProvider({ provider, signer }), safeVersion: options.safeVersion || DEFAULT_SAFE_VERSION }) @@ -220,7 +221,8 @@ export class Safe4337Pack extends RelayKitBasePack<{ } protocolKit = await Safe.create({ - ethAdapter: ethersAdapter, + provider, + signer, predictedSafe: { safeDeploymentConfig: { safeVersion: options.safeVersion || DEFAULT_SAFE_VERSION, @@ -424,7 +426,7 @@ export class Safe4337Pack extends RelayKitBasePack<{ signingMethod: SigningMethod = SigningMethod.ETH_SIGN_TYPED_DATA_V4 ): Promise { const owners = await this.protocolKit.getOwners() - const signerAddress = await this.protocolKit.getEthAdapter().getSignerAddress() + const signerAddress = await this.protocolKit.getSafeProvider().getSignerAddress() if (!signerAddress) { throw new Error('EthAdapter must be initialized with a signer to use this method') } @@ -446,7 +448,7 @@ export class Safe4337Pack extends RelayKitBasePack<{ ) { signature = await this.#signTypedData(safeOperation.data) } else { - const chainId = await this.protocolKit.getEthAdapter().getChainId() + const chainId = await this.protocolKit.getSafeProvider().getChainId() const safeOpHash = this.#getSafeUserOperationHash(safeOperation.data, chainId) signature = await this.protocolKit.signHash(safeOpHash) @@ -578,9 +580,9 @@ export class Safe4337Pack extends RelayKitBasePack<{ * @return {Promise} The SafeSignature object containing the data and the signatures. */ async #signTypedData(safeUserOperation: SafeUserOperation): Promise { - const ethAdapter = this.protocolKit.getEthAdapter() as EthersAdapter - const signer = ethAdapter.getSigner() as ethers.Signer - const chainId = await ethAdapter.getChainId() + const safeProvider = this.protocolKit.getSafeProvider() + const signer = (await safeProvider.getSigner()) as ethers.Signer + const chainId = await safeProvider.getChainId() const signerAddress = await signer.getAddress() const signature = await signer.signTypedData( { diff --git a/packages/relay-kit/src/packs/safe-4337/testing-utils/helpers.ts b/packages/relay-kit/src/packs/safe-4337/testing-utils/helpers.ts index 69a7f67a7..0e347508e 100644 --- a/packages/relay-kit/src/packs/safe-4337/testing-utils/helpers.ts +++ b/packages/relay-kit/src/packs/safe-4337/testing-utils/helpers.ts @@ -1,5 +1,4 @@ import { ethers } from 'ethers' -import * as protocolKit from '@safe-global/protocol-kit' import { Safe4337InitOptions } from '../types' import { Safe4337Pack } from '../Safe4337Pack' import * as fixtures from './fixtures' @@ -14,19 +13,13 @@ export const generateTransferCallData = (to: string, value: bigint) => { export const createSafe4337Pack = async ( initOptions: Partial ): Promise => { - const provider = new ethers.JsonRpcProvider(fixtures.RPC_URL) - const signer = new ethers.Wallet(process.env.PRIVATE_KEY || '0x', provider) - const ethersAdapter = new protocolKit.EthersAdapter({ - ethers, - signerOrProvider: signer - }) - const safe4337Pack = await Safe4337Pack.init({ + provider: fixtures.RPC_URL, + signer: process.env.PRIVATE_KEY, options: { safeAddress: '' }, ...initOptions, - ethersAdapter, rpcUrl: fixtures.RPC_URL, bundlerUrl: fixtures.BUNDLER_URL }) diff --git a/packages/relay-kit/src/packs/safe-4337/types.ts b/packages/relay-kit/src/packs/safe-4337/types.ts index ddb701b37..95458c849 100644 --- a/packages/relay-kit/src/packs/safe-4337/types.ts +++ b/packages/relay-kit/src/packs/safe-4337/types.ts @@ -1,4 +1,4 @@ -import Safe, { EthersAdapter } from '@safe-global/protocol-kit' +import Safe, { SafeProviderConfig } from '@safe-global/protocol-kit' import { MetaTransactionData, SafeVersion } from '@safe-global/safe-core-sdk-types' import { ethers } from 'ethers' import SafeOperation from './SafeOperation' @@ -24,7 +24,8 @@ export type PaymasterOptions = { } export type Safe4337InitOptions = { - ethersAdapter: EthersAdapter + provider: SafeProviderConfig['provider'] + signer?: SafeProviderConfig['signer'] bundlerUrl: string rpcUrl: string safeModulesVersion?: string diff --git a/yarn.lock b/yarn.lock index 58de0f772..6cce3398c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1831,20 +1831,6 @@ picocolors "^1.0.0" tslib "^2.6.0" -"@safe-global/protocol-kit@^3.0.2": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@safe-global/protocol-kit/-/protocol-kit-3.0.2.tgz#cfa4c5e890c101aa89e11768d07b2bc5455f72fb" - integrity sha512-Jxvvfu4yqEdWeOuY3VWOOs/q5f27om3tctL2guOCDbAuSx3Vd1peaKRwLiREkvrrqKEW0tfmzUSsqtmlJExfBw== - dependencies: - "@noble/hashes" "^1.3.3" - "@safe-global/safe-deployments" "^1.34.0" - ethereumjs-util "^7.1.5" - ethers "^6.7.1" - semver "^7.5.4" - web3 "^1.10.3" - web3-core "^1.10.3" - web3-utils "^1.10.3" - "@safe-global/safe-contracts-v1.4.1@npm:@safe-global/safe-contracts@1.4.1": version "1.4.1" resolved "https://registry.npmjs.org/@safe-global/safe-contracts/-/safe-contracts-1.4.1.tgz" From c0e8a725699847fbee11abb7650351128318a3a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 22 Apr 2024 22:25:51 +0200 Subject: [PATCH 046/112] Simplify provider retrieval in test --- .../tests/e2e/contractManager.test.ts | 19 +-- packages/protocol-kit/tests/e2e/core.test.ts | 57 +++---- .../createSafeDeploymentTransaction.test.ts | 41 ++--- .../tests/e2e/createTransaction.test.ts | 54 +++---- .../e2e/eip1271-contract-signatures.test.ts | 37 ++--- .../protocol-kit/tests/e2e/eip1271.test.ts | 13 +- .../protocol-kit/tests/e2e/erc-20.test.ts | 28 ++-- .../protocol-kit/tests/e2e/execution.test.ts | 145 ++++++------------ .../tests/e2e/fallbackHandlerManager.test.ts | 59 +++---- .../tests/e2e/getEncodedTransaction.test.ts | 14 +- .../tests/e2e/guardManager.test.ts | 55 +++---- .../tests/e2e/moduleManager.test.ts | 94 +++++------- .../tests/e2e/offChainSignatures.test.ts | 50 +++--- .../tests/e2e/onChainSignatures.test.ts | 29 ++-- .../tests/e2e/ownerManager.test.ts | 144 ++++++----------- .../tests/e2e/safeFactory.test.ts | 73 ++++----- .../tests/e2e/safeProvider.test.ts | 26 ++-- .../protocol-kit/tests/e2e/threshold.test.ts | 26 ++-- .../tests/e2e/utilsContracts.test.ts | 35 ++--- ...SafeTransactionIntoDeploymentBatch.test.ts | 19 +-- 20 files changed, 361 insertions(+), 657 deletions(-) diff --git a/packages/protocol-kit/tests/e2e/contractManager.test.ts b/packages/protocol-kit/tests/e2e/contractManager.test.ts index a800b7604..7168ffca9 100644 --- a/packages/protocol-kit/tests/e2e/contractManager.test.ts +++ b/packages/protocol-kit/tests/e2e/contractManager.test.ts @@ -27,18 +27,19 @@ describe('Safe contracts manager', () => { const accounts = await getAccounts() const chainId = BigInt(await getChainId()) const contractNetworks = await getContractNetworks(chainId) + const provider = getEip1193Provider() return { safe: await getSafeWithOwners([accounts[0].address]), accounts, contractNetworks, - chainId + chainId, + provider } }) describe('create', async () => { it('should initialize the SDK with a Safe that is not deployed', async () => { - const { accounts, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { accounts, contractNetworks, provider } = await setupTests() const predictedSafe: PredictedSafeProps = { safeAccountConfig: { owners: [accounts[0].address], @@ -58,8 +59,7 @@ describe('Safe contracts manager', () => { }) it('should fail if the current network is not a default network and no contractNetworks is provided', async () => { - const { safe } = await setupTests() - const provider = getEip1193Provider() + const { safe, provider } = await setupTests() const safeAddress = await safe.getAddress() await chai .expect( @@ -72,8 +72,7 @@ describe('Safe contracts manager', () => { }) it('should fail if SafeProxy contract is not deployed on the current network', async () => { - const { contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { contractNetworks, provider } = await setupTests() await chai .expect( Safe.create({ @@ -86,7 +85,7 @@ describe('Safe contracts manager', () => { }) it('should fail if MultiSend contract is specified in contractNetworks but not deployed', async () => { - const { safe, chainId } = await setupTests() + const { safe, chainId, provider } = await setupTests() const customContractNetworks: ContractNetworksConfig = { [chainId.toString()]: { safeSingletonAddress: ZERO_ADDRESS, @@ -108,7 +107,6 @@ describe('Safe contracts manager', () => { } } - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() await chai .expect( @@ -122,8 +120,7 @@ describe('Safe contracts manager', () => { }) it('should set the MultiSend contract available on the current network', async () => { - const { safe, chainId, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, chainId, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, diff --git a/packages/protocol-kit/tests/e2e/core.test.ts b/packages/protocol-kit/tests/e2e/core.test.ts index 4cc58b942..7e53961f3 100644 --- a/packages/protocol-kit/tests/e2e/core.test.ts +++ b/packages/protocol-kit/tests/e2e/core.test.ts @@ -28,9 +28,11 @@ describe('Safe Info', () => { safeVersion: safeVersionDeployed } } + const provider = getEip1193Provider() return { chainId, safe: await getSafeWithOwners([accounts[0].address, accounts[1].address]), + provider, predictedSafe, accounts, contractNetworks @@ -41,8 +43,7 @@ describe('Safe Info', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail to connect a Safe { - const { predictedSafe, safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -61,9 +62,8 @@ describe('Safe Info', () => { itif(safeVersionDeployed >= '1.3.0')( 'should connect a Safe >=v1.3.0 that is not deployed', async () => { - const { predictedSafe, safe, accounts, contractNetworks } = await setupTests() + const { predictedSafe, safe, accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -78,9 +78,8 @@ describe('Safe Info', () => { ) it('should connect a deployed Safe', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const [account1, account2, account3] = accounts - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -92,9 +91,7 @@ describe('Safe Info', () => { .expect(await safeSdk.getSafeProvider().getSignerAddress()) .to.be.eq(await account1.signer.getAddress()) - const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk.connect({ - provider: provider2, signer: account2.address, contractNetworks }) @@ -104,11 +101,9 @@ describe('Safe Info', () => { .to.be.eq(await account2.signer.getAddress()) const safe2 = await getSafeWithOwners([account3.address]) - const provider3 = getEip1193Provider() const safe2Address = await safe2.getAddress() const safeSdk3 = await safeSdk2.connect({ safeAddress: safe2Address, - provider: provider3, signer: account3.address }) chai.expect(await safeSdk3.getAddress()).to.be.eq(safe2Address) @@ -120,8 +115,7 @@ describe('Safe Info', () => { describe('getContractVersion', async () => { it('should return the contract version of a Safe that is not deployed with a custom version configuration', async () => { - const { predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -132,8 +126,7 @@ describe('Safe Info', () => { }) it('should return the contract version of a Safe that is not deployed with a default version configuration', async () => { - const { predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeConfig: PredictedSafeProps = { ...predictedSafe, safeDeploymentConfig: {} @@ -148,8 +141,7 @@ describe('Safe Info', () => { }) it('should return the Safe contract version', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -165,8 +157,7 @@ describe('Safe Info', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail to return the address of a Safe { - const { predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -184,8 +175,7 @@ describe('Safe Info', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return the address of a Safe >=v1.3.0 that is not deployed', async () => { - const { predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -206,8 +196,7 @@ describe('Safe Info', () => { ) it('should return the address of a deployed Safe', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -220,9 +209,8 @@ describe('Safe Info', () => { describe('getEip1193Provider', async () => { it('should return the connected SafeProvider', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -237,8 +225,7 @@ describe('Safe Info', () => { describe('getNonce', async () => { it('should return the nonce of a Safe that is not deployed', async () => { - const { predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -248,9 +235,8 @@ describe('Safe Info', () => { }) it('should return the Safe nonce', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ @@ -274,8 +260,7 @@ describe('Safe Info', () => { describe('getChainId', async () => { it('should return the chainId of a Safe that is not deployed', async () => { - const { predictedSafe, chainId, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, chainId, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -285,8 +270,7 @@ describe('Safe Info', () => { }) it('should return the chainId of the current network', async () => { - const { safe, chainId, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, chainId, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -301,8 +285,7 @@ describe('Safe Info', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail to return the balance of a Safe { - const { predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -319,9 +302,8 @@ describe('Safe Info', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return the balance of a Safe >=v1.3.0 that is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() + const { predictedSafe, accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -343,9 +325,8 @@ describe('Safe Info', () => { ) it('should return the balance of a deployed Safe', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, diff --git a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts index 50c482b19..5c4feb530 100644 --- a/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createSafeDeploymentTransaction.test.ts @@ -23,7 +23,7 @@ describe('createSafeDeploymentTransaction', () => { const accounts = await getAccounts() const chainId = BigInt(await getChainId()) const contractNetworks = await getContractNetworks(chainId) - + const provider = getEip1193Provider() const predictedSafe: PredictedSafeProps = { safeAccountConfig: { owners: [accounts[0].address], @@ -38,14 +38,13 @@ describe('createSafeDeploymentTransaction', () => { accounts, contractNetworks, predictedSafe, - chainId + chainId, + provider } }) itif(safeVersionDeployed == '1.4.1')('should return a Safe deployment transactions', async () => { - const { contractNetworks, predictedSafe } = await setupTests() - - const provider = getEip1193Provider() + const { contractNetworks, predictedSafe, provider } = await setupTests() const safeSdk = await Safe.create({ provider, @@ -66,9 +65,7 @@ describe('createSafeDeploymentTransaction', () => { }) itif(safeVersionDeployed == '1.3.0')('should return a Safe deployment transactions', async () => { - const { contractNetworks, predictedSafe } = await setupTests() - - const provider = getEip1193Provider() + const { contractNetworks, predictedSafe, provider } = await setupTests() const safeSdk = await Safe.create({ provider, @@ -89,9 +86,7 @@ describe('createSafeDeploymentTransaction', () => { }) itif(safeVersionDeployed == '1.2.0')('should return a Safe deployment transactions', async () => { - const { contractNetworks, predictedSafe } = await setupTests() - - const provider = getEip1193Provider() + const { contractNetworks, predictedSafe, provider } = await setupTests() const safeSdk = await Safe.create({ provider, @@ -112,9 +107,7 @@ describe('createSafeDeploymentTransaction', () => { }) itif(safeVersionDeployed == '1.1.1')('should return a Safe deployment transactions', async () => { - const { contractNetworks, predictedSafe } = await setupTests() - - const provider = getEip1193Provider() + const { contractNetworks, predictedSafe, provider } = await setupTests() const safeSdk = await Safe.create({ provider, @@ -135,9 +128,7 @@ describe('createSafeDeploymentTransaction', () => { }) itif(safeVersionDeployed == '1.0.0')('should return a Safe deployment transactions', async () => { - const { contractNetworks, predictedSafe } = await setupTests() - - const provider = getEip1193Provider() + const { contractNetworks, predictedSafe, provider } = await setupTests() const safeSdk = await Safe.create({ provider, @@ -158,9 +149,8 @@ describe('createSafeDeploymentTransaction', () => { }) it('should contain the initializer setup call in the deployment data to sets the threshold & owners of the deployed Safe', async () => { - const { contractNetworks, predictedSafe, chainId } = await setupTests() + const { contractNetworks, predictedSafe, chainId, provider } = await setupTests() - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -190,9 +180,8 @@ describe('createSafeDeploymentTransaction', () => { describe('salt nonce', () => { it('should include the predetermined salt nonce in the Safe deployment data', async () => { - const { contractNetworks, predictedSafe, chainId } = await setupTests() + const { contractNetworks, predictedSafe, chainId, provider } = await setupTests() - const provider = getEip1193Provider() const safeProvider = new SafeProvider({ provider }) const safeSdk = await Safe.create({ provider, @@ -214,9 +203,8 @@ describe('createSafeDeploymentTransaction', () => { }) it('should include the custom salt nonce in the Safe deployment data', async () => { - const { contractNetworks, predictedSafe } = await setupTests() + const { contractNetworks, predictedSafe, provider } = await setupTests() - const provider = getEip1193Provider() const safeProvider = new SafeProvider({ provider }) const safeSdk = await Safe.create({ provider, @@ -235,9 +223,7 @@ describe('createSafeDeploymentTransaction', () => { }) it('should include the salt nonce included in the safeDeploymentConfig in the Safe deployment data', async () => { - const { contractNetworks, predictedSafe } = await setupTests() - - const provider = getEip1193Provider() + const { contractNetworks, predictedSafe, provider } = await setupTests() const customSaltNonce = '123456789' @@ -265,11 +251,10 @@ describe('createSafeDeploymentTransaction', () => { }) it('should throw an error if predicted Safe is not present', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ diff --git a/packages/protocol-kit/tests/e2e/createTransaction.test.ts b/packages/protocol-kit/tests/e2e/createTransaction.test.ts index 1f20bbcb8..814e796c2 100644 --- a/packages/protocol-kit/tests/e2e/createTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createTransaction.test.ts @@ -2,9 +2,10 @@ import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/de import Safe, { PredictedSafeProps, SafeTransactionOptionalProps, - standardizeSafeTransactionData + standardizeSafeTransactionData, + SafeContractImplementationType as SafeContract } from '@safe-global/protocol-kit/index' -import { SafeContract, SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types' +import { SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' @@ -31,6 +32,7 @@ describe('Transactions creation', () => { const accounts = await getAccounts() const chainId = BigInt(await getChainId()) const contractNetworks = await getContractNetworks(chainId) + const provider = getEip1193Provider() const predictedSafe: PredictedSafeProps = { safeAccountConfig: { owners: [accounts[0].address], @@ -46,7 +48,8 @@ describe('Transactions creation', () => { accounts, chainId, contractNetworks, - predictedSafe + predictedSafe, + provider } }) @@ -54,10 +57,9 @@ describe('Transactions creation', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return a transaction with safeTxGas=0 if safeVersion>=1.3.0 and gasPrice=0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -82,10 +84,9 @@ describe('Transactions creation', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return a transaction with estimated safeTxGas if safeVersion>=1.3.0 and gasPrice>0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -111,10 +112,9 @@ describe('Transactions creation', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return a transaction with defined safeTxGas if safeVersion>=1.3.0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -141,10 +141,9 @@ describe('Transactions creation', () => { itif(safeVersionDeployed < '1.3.0')( 'should return a transaction with estimated safeTxGas if safeVersion<1.3.0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -169,10 +168,9 @@ describe('Transactions creation', () => { itif(safeVersionDeployed < '1.3.0')( 'should return a transaction with defined safeTxGas of 0 if safeVersion<1.3.0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -199,10 +197,9 @@ describe('Transactions creation', () => { itif(safeVersionDeployed < '1.3.0')( 'should return a transaction with defined safeTxGas if safeVersion<1.3.0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -229,9 +226,8 @@ describe('Transactions creation', () => { describe('createTransaction', async () => { it('should create a single transaction with gasPrice=0', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() + const { predictedSafe, accounts, contractNetworks, provider } = await setupTests() const [, account2] = accounts - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -251,10 +247,9 @@ describe('Transactions creation', () => { }) it('should create a single transaction with gasPrice=0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -282,10 +277,9 @@ describe('Transactions creation', () => { }) it('should create a single transaction with gasPrice>0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -313,10 +307,9 @@ describe('Transactions creation', () => { }) it('should create a single transaction when passing a transaction array with length=1', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -335,10 +328,9 @@ describe('Transactions creation', () => { }) it('should create a single transaction when passing a transaction array with length=1 and options', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -364,10 +356,9 @@ describe('Transactions creation', () => { }) it('should fail when creating a MultiSend transaction passing a transaction array with length=0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -379,10 +370,9 @@ describe('Transactions creation', () => { }) it('should create a MultiSend transaction', async () => { - const { accounts, contractNetworks, erc20Mintable, chainId } = await setupTests() + const { accounts, contractNetworks, erc20Mintable, chainId, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -414,11 +404,10 @@ describe('Transactions creation', () => { }) it('should create a MultiSend transaction with options', async () => { - const { accounts, contractNetworks, erc20Mintable, chainId } = await setupTests() + const { accounts, contractNetworks, erc20Mintable, chainId, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, @@ -460,8 +449,7 @@ describe('Transactions creation', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail to create a transaction if the Safe with version { - const { safe, predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, predictedSafe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, diff --git a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts index bcb5ff3d6..d11181548 100644 --- a/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271-contract-signatures.test.ts @@ -23,6 +23,7 @@ describe('The EIP1271 implementation', () => { const contractNetworks = await getContractNetworks(BigInt(chainId)) const fallbackHandlerAddress = contractNetworks[chainId].fallbackHandlerAddress const [account1, account2, account3, account4, account5] = accounts + const provider = getEip1193Provider() // Create a 1/1 signer Safe const signerSafe1_1 = await getSafeWithOwners( @@ -59,7 +60,8 @@ describe('The EIP1271 implementation', () => { accounts, contractNetworks, chainId, - fallbackHandlerAddress + fallbackHandlerAddress, + provider } }) @@ -71,20 +73,15 @@ describe('The EIP1271 implementation', () => { accounts, signerSafeAddress1_1, signerSafeAddress2_3, - contractNetworks + contractNetworks, + provider } = await setupTests() // Create adapters and the protocol kit instance const [account1, account2, account3, account4, account5] = accounts - const provider1 = getEip1193Provider() - const provider2 = getEip1193Provider() - const provider3 = getEip1193Provider() - const provider4 = getEip1193Provider() - const provider5 = getEip1193Provider() - let protocolKit = await Safe.create({ - provider: provider1, + provider: provider, safeAddress, contractNetworks }) @@ -103,14 +100,12 @@ describe('The EIP1271 implementation', () => { // EOA signatures tx = await protocolKit.signTransaction(tx) // Owner 1 signature protocolKit = await protocolKit.connect({ - provider: provider2, signer: account2.address }) // Connect another owner tx = await protocolKit.signTransaction(tx) // Owner 2 signature // 1/1 Signer Safe signature protocolKit = await protocolKit.connect({ - provider: provider3, signer: account3.address, safeAddress: signerSafeAddress1_1 }) @@ -130,7 +125,6 @@ describe('The EIP1271 implementation', () => { // 2/3 Signer Safe signature protocolKit = await protocolKit.connect({ - provider: provider4, signer: account4.address, safeAddress: signerSafeAddress2_3 }) @@ -143,7 +137,6 @@ describe('The EIP1271 implementation', () => { safeAddress ) protocolKit = await protocolKit.connect({ - provider: provider5, signer: account5.address }) signerSafeTx2_3 = await protocolKit.signTransaction( @@ -163,7 +156,7 @@ describe('The EIP1271 implementation', () => { value: 1_000_000_000_000_000_000n // 1 ETH }) protocolKit = await protocolKit.connect({ - provider: provider1, + provider: provider, signer: account1.address, safeAddress }) @@ -185,7 +178,8 @@ describe('The EIP1271 implementation', () => { signerSafeAddress1_1, signerSafeAddress2_3, contractNetworks, - chainId + chainId, + provider } = await setupTests() const MESSAGE = { @@ -238,14 +232,8 @@ describe('The EIP1271 implementation', () => { // Create adapters and the protocol kit instance const [account1, account2, account3, account4, account5] = accounts - const provider1 = getEip1193Provider() - const provider2 = getEip1193Provider() - const provider3 = getEip1193Provider() - const provider4 = getEip1193Provider() - const provider5 = getEip1193Provider() - let protocolKit = await Safe.create({ - provider: provider1, + provider, safeAddress, contractNetworks }) @@ -255,14 +243,12 @@ describe('The EIP1271 implementation', () => { // EOA signatures message = await protocolKit.signMessage(message) // Owner 1 signature protocolKit = await protocolKit.connect({ - provider: provider2, signer: account2.address }) // Connect another owner message = await protocolKit.signMessage(message) // Owner 2 signature // 1/1 Signer Safe signature protocolKit = await protocolKit.connect({ - provider: provider3, signer: account3.address, safeAddress: signerSafeAddress1_1 }) @@ -280,7 +266,6 @@ describe('The EIP1271 implementation', () => { // 2/3 Signer Safe signature protocolKit = await protocolKit.connect({ - provider: provider4, signer: account4.address, safeAddress: signerSafeAddress2_3 }) @@ -291,7 +276,6 @@ describe('The EIP1271 implementation', () => { safeAddress ) protocolKit = await protocolKit.connect({ - provider: provider5, signer: account5.address }) signerSafeMessage2_3 = await protocolKit.signMessage( @@ -307,7 +291,6 @@ describe('The EIP1271 implementation', () => { // Connect the original Safe protocolKit = await protocolKit.connect({ - provider: provider1, signer: account1.address, safeAddress }) diff --git a/packages/protocol-kit/tests/e2e/eip1271.test.ts b/packages/protocol-kit/tests/e2e/eip1271.test.ts index 2c08dbf7a..8e97e5655 100644 --- a/packages/protocol-kit/tests/e2e/eip1271.test.ts +++ b/packages/protocol-kit/tests/e2e/eip1271.test.ts @@ -48,6 +48,7 @@ describe('The EIP1271 implementation', () => { const contractNetworks = await getContractNetworks(BigInt(chainId)) const fallbackHandlerAddress = contractNetworks[chainId].fallbackHandlerAddress const [account1, account2] = accounts + const provider = getEip1193Provider() // Create a 1/2 Safe to sign the messages const signerSafe = await getSafeWithOwners( @@ -65,18 +66,15 @@ describe('The EIP1271 implementation', () => { ) const safeAddress = await safe.getAddress() - // Adapter and Safe instance for owner 1 - const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, safeAddress, contractNetworks }) // Adapter and Safe instance for owner 2 - const provider2 = getEip1193Provider() const safeSdk2 = await Safe.create({ - provider: provider2, + provider, signer: account2.address, safeAddress, contractNetworks @@ -84,7 +82,7 @@ describe('The EIP1271 implementation', () => { // Adapter and Safe instance for owner 3 const safeSdk3 = await Safe.create({ - provider: provider1, + provider, signer: account1.address, safeAddress: signerSafeAddress, contractNetworks @@ -97,9 +95,8 @@ describe('The EIP1271 implementation', () => { signerSafeAddress, accounts, contractNetworks, + provider, chainId, - provider1, - provider2, safeSdk1, safeSdk2, safeSdk3, diff --git a/packages/protocol-kit/tests/e2e/erc-20.test.ts b/packages/protocol-kit/tests/e2e/erc-20.test.ts index e58367c91..82b44fc7f 100644 --- a/packages/protocol-kit/tests/e2e/erc-20.test.ts +++ b/packages/protocol-kit/tests/e2e/erc-20.test.ts @@ -35,11 +35,13 @@ describe('ERC-20 utils', () => { const accounts = await getAccounts() const chainId = BigInt(await getChainId()) const contractNetworks = await getContractNetworks(chainId) + const provider = getEip1193Provider() return { safe: await getSafeWithOwners([accounts[0].address, accounts[1].address]), contractNetworks, - accounts + accounts, + provider } }) @@ -47,12 +49,10 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return the correct decimals for a standard ERC20 token', async () => { - const { safe, contractNetworks } = await setupTests() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() - // mock decimals() call callStub = sinon.stub(SafeProvider.prototype, 'call').returns(Promise.resolve('0x12')) @@ -71,11 +71,9 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return the correct decimals for a non-standard ERC20 token', async () => { - const { safe, contractNetworks } = await setupTests() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() - // mock decimals() call callStub = sinon.stub(SafeProvider.prototype, 'call').returns(Promise.resolve('0x06')) @@ -94,11 +92,9 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should throw an error if decimals() fn is not defined', async () => { - const { safe, contractNetworks } = await setupTests() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() - // mock decimals() call callStub = sinon.stub(SafeProvider.prototype, 'call').returns(Promise.resolve('0x')) @@ -119,11 +115,9 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return true if it is the Native token', async () => { - const { safe, contractNetworks } = await setupTests() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() - const safeSdk = await Safe.create({ provider, safeAddress, @@ -142,11 +136,9 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return true if it is an standard ERC20 token', async () => { - const { safe, contractNetworks } = await setupTests() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() - // mock decimals() call callStub = sinon.stub(SafeProvider.prototype, 'call').returns(Promise.resolve('0x12')) @@ -168,11 +160,9 @@ describe('ERC-20 utils', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return false for a non-standard ERC20 token', async () => { - const { safe, contractNetworks } = await setupTests() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() - // mock decimals() call callStub = sinon.stub(SafeProvider.prototype, 'call').returns(Promise.resolve('0x06')) diff --git a/packages/protocol-kit/tests/e2e/execution.test.ts b/packages/protocol-kit/tests/e2e/execution.test.ts index ea4322f92..9e8e8e998 100644 --- a/packages/protocol-kit/tests/e2e/execution.test.ts +++ b/packages/protocol-kit/tests/e2e/execution.test.ts @@ -23,29 +23,29 @@ describe('Transactions execution', () => { const accounts = await getAccounts() const chainId = BigInt(await getChainId()) const contractNetworks = await getContractNetworks(chainId) + const provider = getEip1193Provider() + return { erc20Mintable: await getERC20Mintable(), safe: await getSafeWithOwners([accounts[0].address, accounts[1].address]), accounts, - contractNetworks + contractNetworks, + provider } }) describe('isValidTransaction', async () => { it('should return false if a transaction will not be executed successfully', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, safeAddress, contractNetworks }) - const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ - provider: provider2, signer: account2.address, contractNetworks }) @@ -72,11 +72,10 @@ describe('Transactions execution', () => { }) it('should return true if a transaction will execute successfully', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -102,11 +101,10 @@ describe('Transactions execution', () => { describe('executeTransaction', async () => { it('should fail if there are not enough Ether funds', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -126,19 +124,17 @@ describe('Transactions execution', () => { }) it('should fail if there are not enough signatures (1 missing)', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, contractNetworks }) - const provider2 = getEip1193Provider() + const safeSdk2 = await safeSdk1.connect({ - provider: provider2, signer: account2.address }) const safeTransactionData = { @@ -157,11 +153,10 @@ describe('Transactions execution', () => { }) it('should fail if there are not enough signatures (>1 missing)', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -179,19 +174,16 @@ describe('Transactions execution', () => { }) it('should fail if the user tries to execute a transaction that was rejected', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, safeAddress, contractNetworks }) - const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ - provider: provider2, signer: account2.address, contractNetworks }) @@ -216,11 +208,10 @@ describe('Transactions execution', () => { }) it('should fail if a user tries to execute a transaction with options: { gas, gasLimit }', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -243,11 +234,10 @@ describe('Transactions execution', () => { }) it('should fail if a user tries to execute a transaction with options: { nonce: }', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -270,11 +260,10 @@ describe('Transactions execution', () => { }) it('should execute a transaction with threshold 1', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -303,7 +292,7 @@ describe('Transactions execution', () => { itif(process.env.ETH_LIB === 'web3' && safeVersionDeployed === '1.0.0')( 'should execute a transaction with threshold >1 and all different kind of signatures with web3 provider and safeVersion===1.0.0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() @@ -311,20 +300,15 @@ describe('Transactions execution', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - const provider1 = getEip1193Provider() - const provider2 = getEip1193Provider() - const provider3 = getEip1193Provider() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, safeAddress, contractNetworks }) const safeSdk2 = await safeSdk1.connect({ - provider: provider2, signer: account2.address }) const safeSdk3 = await safeSdk1.connect({ - provider: provider3, signer: account3.address }) const safeInitialBalance = await safeSdk1.getBalance() @@ -356,7 +340,7 @@ describe('Transactions execution', () => { itif(process.env.ETH_LIB === 'web3' && safeVersionDeployed > '1.0.0')( 'should execute a transaction with threshold >1 and all different kind of signatures with web3 provider and safeVersion>1.0.0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2, account3, account4] = accounts const safe = await getSafeWithOwners([ account1.address, @@ -369,25 +353,18 @@ describe('Transactions execution', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - const provider1 = getEip1193Provider() - const provider2 = getEip1193Provider() - const provider3 = getEip1193Provider() - const provider4 = getEip1193Provider() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, safeAddress, contractNetworks }) const safeSdk2 = await safeSdk1.connect({ - provider: provider2, signer: account2.address }) const safeSdk3 = await safeSdk1.connect({ - provider: provider3, signer: account3.address }) const safeSdk4 = await safeSdk1.connect({ - provider: provider4, signer: account4.address }) const safeInitialBalance = await safeSdk1.getBalance() @@ -422,7 +399,7 @@ describe('Transactions execution', () => { itif(process.env.ETH_LIB === 'ethers' && safeVersionDeployed === '1.0.0')( 'should execute a transaction with threshold >1 and all different kind of signatures with ethers provider and safeVersion===1.0.0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2, account3, account4, account5] = accounts const safe = await getSafeWithOwners([ account1.address, @@ -436,30 +413,21 @@ describe('Transactions execution', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - const provider1 = getEip1193Provider() - const provider2 = getEip1193Provider() - const provider3 = getEip1193Provider() - const provider4 = getEip1193Provider() - const provider5 = getEip1193Provider() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, safeAddress, contractNetworks }) const safeSdk2 = await safeSdk1.connect({ - provider: provider2, signer: account2.address }) const safeSdk3 = await safeSdk1.connect({ - provider: provider3, signer: account3.address }) const safeSdk4 = await safeSdk1.connect({ - provider: provider4, signer: account4.address }) const safeSdk5 = await safeSdk1.connect({ - provider: provider5, signer: account5.address }) const safeInitialBalance = await safeSdk1.getBalance() @@ -497,7 +465,7 @@ describe('Transactions execution', () => { itif(process.env.ETH_LIB === 'ethers' && safeVersionDeployed > '1.0.0')( 'should execute a transaction with threshold >1 and all different kind of signatures with ethers provider and safeVersion>1.0.0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2, account3, account4, account5, account6] = accounts const safe = await getSafeWithOwners([ account1.address, @@ -512,35 +480,24 @@ describe('Transactions execution', () => { to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH }) - const provider1 = getEip1193Provider() - const provider2 = getEip1193Provider() - const provider3 = getEip1193Provider() - const provider4 = getEip1193Provider() - const provider5 = getEip1193Provider() - const provider6 = getEip1193Provider() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, safeAddress, contractNetworks }) const safeSdk2 = await safeSdk1.connect({ - provider: provider2, signer: account2.address }) const safeSdk3 = await safeSdk1.connect({ - provider: provider3, signer: account3.address }) const safeSdk4 = await safeSdk1.connect({ - provider: provider4, signer: account4.address }) const safeSdk5 = await safeSdk1.connect({ - provider: provider5, signer: account5.address }) const safeSdk6 = await safeSdk1.connect({ - provider: provider6, signer: account6.address }) const safeInitialBalance = await safeSdk1.getBalance() @@ -579,25 +536,22 @@ describe('Transactions execution', () => { ) it('should execute a transaction when is not submitted by an owner', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const [, account2, account3] = accounts - const provider1 = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, safeAddress, contractNetworks }) - const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ - provider: provider2, signer: account2.address }) - const provider3 = getEip1193Provider() + const safeSdk3 = await safeSdk1.connect({ - provider: provider3, signer: account3.address }) + await account2.signer.sendTransaction({ to: safeAddress, value: 1_000_000_000_000_000_000n // 1 ETH @@ -622,11 +576,10 @@ describe('Transactions execution', () => { itif(process.env.ETH_LIB === 'ethers')( 'should execute a transaction with options: { gasLimit }', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -653,11 +606,10 @@ describe('Transactions execution', () => { itif(process.env.ETH_LIB === 'ethers')( 'should execute a transaction with options: { gasLimit, gasPrice }', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -688,11 +640,10 @@ describe('Transactions execution', () => { itif(process.env.ETH_LIB === 'ethers')( 'should execute a transaction with options: { maxFeePerGas, maxPriorityFeePerGas }', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -725,11 +676,10 @@ describe('Transactions execution', () => { itif(process.env.ETH_LIB === 'web3')( 'should execute a transaction with options: { gas }', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -756,11 +706,10 @@ describe('Transactions execution', () => { itif(process.env.ETH_LIB === 'web3')( 'should execute a transaction with options: { gas, gasPrice }', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -791,11 +740,10 @@ describe('Transactions execution', () => { itif(process.env.ETH_LIB === 'web3')( 'should execute a transaction with options: { maxFeePerGas, maxPriorityFeePerGas }', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -826,11 +774,10 @@ describe('Transactions execution', () => { ) it('should execute a transaction with options: { nonce }', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk1 = await Safe.create({ provider, safeAddress, @@ -857,24 +804,21 @@ describe('Transactions execution', () => { describe('executeTransaction (MultiSend)', async () => { it('should execute a batch transaction with threshold >1', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() - const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, safeAddress, contractNetworks }) - const provider2 = getEip1193Provider() + const safeSdk2 = await safeSdk1.connect({ - provider: provider2, signer: account2.address }) - const provider3 = getEip1193Provider() + const safeSdk3 = await safeSdk1.connect({ - provider: provider3, signer: account3.address }) await account1.signer.sendTransaction({ @@ -908,24 +852,21 @@ describe('Transactions execution', () => { }) it('should execute a batch transaction with contract calls and threshold >1', async () => { - const { accounts, contractNetworks, erc20Mintable } = await setupTests() + const { accounts, contractNetworks, erc20Mintable, provider } = await setupTests() const [account1, account2, account3] = accounts const safe = await getSafeWithOwners([account1.address, account2.address, account3.address]) const safeAddress = await safe.getAddress() - const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, safeAddress, contractNetworks }) - const provider2 = getEip1193Provider() + const safeSdk2 = await safeSdk1.connect({ - provider: provider2, signer: account2.address }) - const provider3 = getEip1193Provider() + const safeSdk3 = await safeSdk1.connect({ - provider: provider3, signer: account3.address }) diff --git a/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts b/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts index 145dd168c..421ba1770 100644 --- a/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts @@ -35,12 +35,15 @@ describe('Fallback handler manager', () => { safeVersion: safeVersionDeployed } } + const provider = getEip1193Provider() + return { safe: await getSafeWithOwners([accounts[0].address]), accounts, contractNetworks, defaultCallbackHandler: await getDefaultCallbackHandler(), - predictedSafe + predictedSafe, + provider } }) @@ -48,9 +51,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed < '1.1.1')( 'should fail if getting the enabled fallback handler is not supported', async () => { - const { safe, contractNetworks } = await setupTests() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, @@ -66,8 +68,7 @@ describe('Fallback handler manager', () => { ) itif(safeVersionDeployed >= '1.1.1')('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -77,8 +78,7 @@ describe('Fallback handler manager', () => { }) itif(safeVersionDeployed >= '1.1.1')('should return the enabled fallback handler', async () => { - const { safe, contractNetworks, defaultCallbackHandler } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, defaultCallbackHandler, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -104,8 +104,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail if the Safe with version { - const { predictedSafe, contractNetworks, defaultCallbackHandler } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, defaultCallbackHandler, provider } = + await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -123,8 +123,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should fail if the Safe with version >=v1.3.0 is not deployed', async () => { - const { predictedSafe, contractNetworks, defaultCallbackHandler } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, defaultCallbackHandler, provider } = + await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -138,8 +138,7 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed < '1.1.1')( 'should fail if enabling a fallback handler is not supported', async () => { - const { safe, contractNetworks, defaultCallbackHandler } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, defaultCallbackHandler, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -156,8 +155,7 @@ describe('Fallback handler manager', () => { ) itif(safeVersionDeployed >= '1.1.1')('should fail if address is invalid', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -171,8 +169,7 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')( 'should fail if address is equal to 0x address', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -185,8 +182,7 @@ describe('Fallback handler manager', () => { ) itif(safeVersionDeployed >= '1.1.1')('should fail if address is already enabled', async () => { - const { safe, contractNetworks, defaultCallbackHandler } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, defaultCallbackHandler, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -205,8 +201,7 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')( 'should build the transaction with the optional props', async () => { - const { safe, contractNetworks, defaultCallbackHandler } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, defaultCallbackHandler, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -235,8 +230,7 @@ describe('Fallback handler manager', () => { ) itif(safeVersionDeployed >= '1.1.1')('should enable a fallback handler', async () => { - const { safe, contractNetworks, defaultCallbackHandler } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, defaultCallbackHandler, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -262,8 +256,7 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail if the Safe with version { - const { predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -281,8 +274,8 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should fail if the Safe with version >=v1.3.0 is not deployed', async () => { - const { predictedSafe, contractNetworks, defaultCallbackHandler } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, defaultCallbackHandler, provider } = + await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -296,11 +289,10 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed < '1.1.1')( 'should fail if disabling a fallback handler is not supported', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, @@ -318,8 +310,7 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')( 'should fail if no fallback handler is enabled', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -340,11 +331,10 @@ describe('Fallback handler manager', () => { itif(safeVersionDeployed >= '1.1.1')( 'should build the transaction with the optional props', async () => { - const { accounts, contractNetworks, defaultCallbackHandler } = await setupTests() + const { accounts, contractNetworks, defaultCallbackHandler, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, @@ -378,11 +368,10 @@ describe('Fallback handler manager', () => { ) itif(safeVersionDeployed >= '1.1.1')('should disable an enabled fallback handler', async () => { - const { accounts, contractNetworks, defaultCallbackHandler } = await setupTests() + const { accounts, contractNetworks, defaultCallbackHandler, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, diff --git a/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts b/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts index c7b133192..8cd49ca9b 100644 --- a/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/getEncodedTransaction.test.ts @@ -14,19 +14,21 @@ describe('getEncodedTransaction', () => { const accounts = await getAccounts() const chainId = BigInt(await getChainId()) const contractNetworks = await getContractNetworks(chainId) + const provider = getEip1193Provider() + return { accounts, - contractNetworks + contractNetworks, + provider } }) itif(safeVersionDeployed >= '1.3.0')('should return a transaction encoded', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -52,12 +54,11 @@ describe('getEncodedTransaction', () => { }) itif(safeVersionDeployed <= '1.2.0')('should return a transaction encoded', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -83,12 +84,11 @@ describe('getEncodedTransaction', () => { }) it('should return a signed transaction with the signatures encoded', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, diff --git a/packages/protocol-kit/tests/e2e/guardManager.test.ts b/packages/protocol-kit/tests/e2e/guardManager.test.ts index 022dc64ba..35c04e427 100644 --- a/packages/protocol-kit/tests/e2e/guardManager.test.ts +++ b/packages/protocol-kit/tests/e2e/guardManager.test.ts @@ -22,6 +22,7 @@ describe('Safe guard manager', () => { const accounts = await getAccounts() const chainId = BigInt(await getChainId()) const contractNetworks = await getContractNetworks(chainId) + const provider = getEip1193Provider() const predictedSafe: PredictedSafeProps = { safeAccountConfig: { owners: [accounts[0].address], @@ -36,7 +37,8 @@ describe('Safe guard manager', () => { safe: await getSafeWithOwners([accounts[0].address]), accounts, contractNetworks, - predictedSafe + predictedSafe, + provider } }) @@ -44,8 +46,7 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail if getting the enabled guard is not supported', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -62,8 +63,7 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -75,8 +75,7 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should return 0x address when no Safe guard is enabled', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -88,8 +87,7 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should return the enabled Safe guard', async () => { - const { safe, contractNetworks, debugTransactionGuard } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, debugTransactionGuard, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -108,9 +106,7 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail if enabling a Safe guard is not supported', async () => { - const { safe, contractNetworks, debugTransactionGuard } = await setupTests() - - const provider = getEip1193Provider() + const { safe, contractNetworks, debugTransactionGuard, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -127,9 +123,9 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should fail if the Safe is not deployed', async () => { - const { predictedSafe, debugTransactionGuard, contractNetworks } = await setupTests() + const { predictedSafe, debugTransactionGuard, contractNetworks, provider } = + await setupTests() - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -140,9 +136,7 @@ describe('Safe guard manager', () => { }) itif(safeVersionDeployed >= '1.3.0')('should fail if address is invalid', async () => { - const { safe, contractNetworks } = await setupTests() - - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -156,9 +150,8 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should fail if address is equal to 0x address', async () => { - const { safe, contractNetworks } = await setupTests() + const { safe, contractNetworks, provider } = await setupTests() - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -171,9 +164,8 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should fail if address is already enabled', async () => { - const { safe, contractNetworks, debugTransactionGuard } = await setupTests() + const { safe, contractNetworks, debugTransactionGuard, provider } = await setupTests() - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -190,9 +182,8 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should build the transaction with the optional props', async () => { - const { safe, contractNetworks, debugTransactionGuard } = await setupTests() + const { safe, contractNetworks, debugTransactionGuard, provider } = await setupTests() - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -221,9 +212,8 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should enable a Safe guard', async () => { - const { safe, contractNetworks, debugTransactionGuard } = await setupTests() + const { safe, contractNetworks, debugTransactionGuard, provider } = await setupTests() - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -242,10 +232,9 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail if disabling a Safe guard is not supported', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -262,9 +251,8 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks } = await setupTests() + const { predictedSafe, contractNetworks, provider } = await setupTests() - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -275,9 +263,8 @@ describe('Safe guard manager', () => { }) itif(safeVersionDeployed >= '1.3.0')('should fail if no Safe guard is enabled', async () => { - const { safe, contractNetworks } = await setupTests() + const { safe, contractNetworks, provider } = await setupTests() - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -291,11 +278,10 @@ describe('Safe guard manager', () => { itif(safeVersionDeployed >= '1.3.0')( 'should build the transaction with the optional props', async () => { - const { accounts, contractNetworks, debugTransactionGuard } = await setupTests() + const { accounts, contractNetworks, debugTransactionGuard, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, @@ -324,11 +310,10 @@ describe('Safe guard manager', () => { ) itif(safeVersionDeployed >= '1.3.0')('should disable an enabled Safe guard', async () => { - const { accounts, contractNetworks, debugTransactionGuard } = await setupTests() + const { accounts, contractNetworks, debugTransactionGuard, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, diff --git a/packages/protocol-kit/tests/e2e/moduleManager.test.ts b/packages/protocol-kit/tests/e2e/moduleManager.test.ts index 65a627bc8..b85355712 100644 --- a/packages/protocol-kit/tests/e2e/moduleManager.test.ts +++ b/packages/protocol-kit/tests/e2e/moduleManager.test.ts @@ -34,20 +34,22 @@ describe('Safe modules manager', () => { safeVersion: safeVersionDeployed } } + const provider = getEip1193Provider() + return { dailyLimitModule: await getDailyLimitModule(), socialRecoveryModule: await getSocialRecoveryModule(), safe: await getSafeWithOwners([accounts[0].address]), accounts, contractNetworks, - predictedSafe + predictedSafe, + provider } }) describe('getModules', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -57,8 +59,8 @@ describe('Safe modules manager', () => { }) it('should return all the enabled modules', async () => { - const { safe, dailyLimitModule, socialRecoveryModule, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, dailyLimitModule, socialRecoveryModule, contractNetworks, provider } = + await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -86,11 +88,9 @@ describe('Safe modules manager', () => { describe('getModulesPaginated', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -100,12 +100,10 @@ describe('Safe modules manager', () => { }) it('should return the enabled modules', async () => { - const { safe, accounts, dailyLimitModule, contractNetworks } = await setupTests() - const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const { safe, dailyLimitModule, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -117,15 +115,13 @@ describe('Safe modules manager', () => { }) it('should constraint returned modules by pageSize', async () => { - const { safe, accounts, dailyLimitModule, contractNetworks, socialRecoveryModule } = + const { safe, dailyLimitModule, contractNetworks, socialRecoveryModule, provider } = await setupTests() - const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() - const dailyLimitsAddress = await await dailyLimitModule.getAddress() - const socialRecoveryAddress = await await socialRecoveryModule.getAddress() + const dailyLimitsAddress = await dailyLimitModule.getAddress() + const socialRecoveryAddress = await socialRecoveryModule.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -144,15 +140,13 @@ describe('Safe modules manager', () => { }) it('should offset the returned modules', async () => { - const { safe, accounts, dailyLimitModule, contractNetworks, socialRecoveryModule } = + const { safe, dailyLimitModule, contractNetworks, socialRecoveryModule, provider } = await setupTests() - const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) const safeAddress = await safe.getAddress() const dailyLimitsAddress = await await dailyLimitModule.getAddress() const socialRecoveryAddress = await await socialRecoveryModule.getAddress() const safeSdk = await Safe.create({ - ethAdapter, + provider, safeAddress, contractNetworks }) @@ -172,11 +166,9 @@ describe('Safe modules manager', () => { }) it('should fail if pageSize is invalid', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() - const [account1] = accounts - const ethAdapter = await getEthAdapter(account1.signer) + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ - ethAdapter, + provider, predictedSafe, contractNetworks }) @@ -189,8 +181,7 @@ describe('Safe modules manager', () => { describe('isModuleEnabled', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, dailyLimitModule, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, dailyLimitModule, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -201,8 +192,7 @@ describe('Safe modules manager', () => { }) it('should return true if a module is enabled', async () => { - const { safe, dailyLimitModule, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, dailyLimitModule, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -219,8 +209,7 @@ describe('Safe modules manager', () => { describe('createEnableModuleTx', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, dailyLimitModule, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, dailyLimitModule, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -231,8 +220,7 @@ describe('Safe modules manager', () => { }) it('should fail if address is invalid', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -244,8 +232,7 @@ describe('Safe modules manager', () => { }) it('should fail if address is equal to sentinel', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -257,8 +244,7 @@ describe('Safe modules manager', () => { }) it('should fail if address is equal to 0x address', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -270,8 +256,7 @@ describe('Safe modules manager', () => { }) it('should fail if address is already enabled', async () => { - const { safe, dailyLimitModule, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, dailyLimitModule, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -286,8 +271,7 @@ describe('Safe modules manager', () => { }) it('should build the transaction with the optional props', async () => { - const { safe, dailyLimitModule, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, dailyLimitModule, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -312,8 +296,7 @@ describe('Safe modules manager', () => { }) it('should enable a Safe module', async () => { - const { safe, dailyLimitModule, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, dailyLimitModule, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -332,8 +315,7 @@ describe('Safe modules manager', () => { describe('createDisableModuleTx', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, dailyLimitModule, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, dailyLimitModule, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -344,8 +326,7 @@ describe('Safe modules manager', () => { }) it('should fail if address is invalid', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -357,8 +338,7 @@ describe('Safe modules manager', () => { }) it('should fail if address is equal to sentinel', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -370,8 +350,7 @@ describe('Safe modules manager', () => { }) it('should fail if address is equal to 0x address', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -383,8 +362,7 @@ describe('Safe modules manager', () => { }) it('should fail if address is not enabled', async () => { - const { safe, dailyLimitModule, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, dailyLimitModule, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -396,11 +374,10 @@ describe('Safe modules manager', () => { }) it('should build the transaction with the optional props', async () => { - const { dailyLimitModule, accounts, contractNetworks } = await setupTests() + const { dailyLimitModule, accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, @@ -431,12 +408,11 @@ describe('Safe modules manager', () => { }) it('should disable Safe modules', async () => { - const { dailyLimitModule, accounts, socialRecoveryModule, contractNetworks } = + const { dailyLimitModule, accounts, socialRecoveryModule, contractNetworks, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress, diff --git a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts index 316bdc7be..ee25bdb90 100644 --- a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts @@ -27,18 +27,20 @@ describe('Off-chain signatures', () => { safeVersion: safeVersionDeployed } } + const provider = getEip1193Provider() + return { safe: await getSafeWithOwners([accounts[0].address, accounts[1].address]), accounts, contractNetworks, - predictedSafe + predictedSafe, + provider } }) describe('signHash', async () => { it('should sign a transaction hash with the current signer if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -50,8 +52,7 @@ describe('Off-chain signatures', () => { }) it('should sign a transaction hash with the current signer', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -74,8 +75,7 @@ describe('Off-chain signatures', () => { itif(safeVersionDeployed < '1.3.0')( 'should fail to sign a transaction if the Safe with version { - const { safe, predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -107,8 +107,7 @@ describe('Off-chain signatures', () => { itif(safeVersionDeployed >= '1.3.0')( 'should sign a transaction with the current signer if the Safe with version >=v1.3.0 is using predicted config', async () => { - const { safe, predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -129,9 +128,8 @@ describe('Off-chain signatures', () => { ) it('should fail if the signature is added by an account that is not an owner', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const account3 = accounts[2] - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -151,8 +149,7 @@ describe('Off-chain signatures', () => { }) it('should ignore duplicated signatures', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -176,8 +173,7 @@ describe('Off-chain signatures', () => { itif(safeVersionDeployed === '1.0.0')( 'should fail if the signature of the current signer is added using eth_sign and safeVersion===1.0.0', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -199,8 +195,7 @@ describe('Off-chain signatures', () => { itif(safeVersionDeployed > '1.0.0')( 'should add the signature of the current signer using eth_sign if safeVersion>1.0.0', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -223,8 +218,7 @@ describe('Off-chain signatures', () => { itif(process.env.ETH_LIB === 'ethers')( 'should add the signature of the current signer using eth_signTypedData with ethers provider', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -247,8 +241,7 @@ describe('Off-chain signatures', () => { itif(process.env.ETH_LIB === 'web3')( 'should fail if the signature of the current signer is added using eth_signTypedData with web3 provider', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -270,8 +263,7 @@ describe('Off-chain signatures', () => { itif(process.env.ETH_LIB === 'ethers')( 'should add the signature of the current signer using eth_signTypedData_v3 with ethers provider', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -294,8 +286,7 @@ describe('Off-chain signatures', () => { itif(process.env.ETH_LIB === 'web3')( 'should fail if the signature of the current signer is added using eth_signTypedData_v3 with web3 provider', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -315,8 +306,7 @@ describe('Off-chain signatures', () => { ) it('should add the signature of the current signer using eth_signTypedData_v4', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -336,8 +326,7 @@ describe('Off-chain signatures', () => { }) it('should add the signature of the current signer using eth_signTypedData_v4 by default', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, @@ -357,9 +346,8 @@ describe('Off-chain signatures', () => { }) it('should sign a transaction received from the Safe Transaction Service', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ provider, diff --git a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts index 92bf943ef..cfb98b211 100644 --- a/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/onChainSignatures.test.ts @@ -26,18 +26,20 @@ describe('On-chain signatures', () => { safeVersion: safeVersionDeployed } } + const provider = getEip1193Provider() + return { safe: await getSafeWithOwners([accounts[0].address, accounts[1].address]), accounts, contractNetworks, - predictedSafe + predictedSafe, + provider } }) describe('approveTransactionHash', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk1 = await Safe.create({ provider, predictedSafe, @@ -50,9 +52,8 @@ describe('On-chain signatures', () => { }) it('should fail if a transaction hash is approved by an account that is not an owner', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const account3 = accounts[2] - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ provider, @@ -73,9 +74,8 @@ describe('On-chain signatures', () => { }) it('should approve the transaction hash', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ provider, @@ -95,9 +95,8 @@ describe('On-chain signatures', () => { }) it('should ignore a duplicated signatures', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts - const provider = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ provider, @@ -123,10 +122,9 @@ describe('On-chain signatures', () => { describe('getOwnersWhoApprovedTx', async () => { it('should fail if Safe is not deployed', async () => { - const { predictedSafe, contractNetworks } = await setupTests() - const provider1 = getEip1193Provider() + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, predictedSafe, contractNetworks }) @@ -136,18 +134,15 @@ describe('On-chain signatures', () => { }) it('should return the list of owners who approved a transaction hash', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const [, account2] = accounts - const provider1 = getEip1193Provider() const safeAddress = await safe.getAddress() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, safeAddress: safeAddress, contractNetworks }) - const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ - provider: provider2, signer: account2.address }) const safeTransactionData = { diff --git a/packages/protocol-kit/tests/e2e/ownerManager.test.ts b/packages/protocol-kit/tests/e2e/ownerManager.test.ts index 3074a4779..9cb046b9f 100644 --- a/packages/protocol-kit/tests/e2e/ownerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/ownerManager.test.ts @@ -21,6 +21,7 @@ describe('Safe owners manager', () => { const accounts = await getAccounts() const chainId = BigInt(await getChainId()) const contractNetworks = await getContractNetworks(chainId) + const provider = getEip1193Provider() const predictedSafe: PredictedSafeProps = { safeAccountConfig: { owners: [accounts[0].address], @@ -38,14 +39,14 @@ describe('Safe owners manager', () => { ]), accounts, contractNetworks, - predictedSafe + predictedSafe, + provider } }) describe('getOwners', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -55,10 +56,9 @@ describe('Safe owners manager', () => { }) it('should return the list of Safe owners', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address, account2.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -73,9 +73,8 @@ describe('Safe owners manager', () => { describe('isOwner', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() + const { predictedSafe, accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -85,10 +84,9 @@ describe('Safe owners manager', () => { }) it('should return true if an account is an owner of the connected Safe', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -99,10 +97,9 @@ describe('Safe owners manager', () => { }) it('should return false if an account is not an owner of the connected Safe', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -115,9 +112,8 @@ describe('Safe owners manager', () => { describe('createAddOwnerTx', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() + const { predictedSafe, accounts, contractNetworks, provider } = await setupTests() const [, account2] = accounts - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -128,10 +124,9 @@ describe('Safe owners manager', () => { }) it('should fail if address is invalid', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -142,10 +137,9 @@ describe('Safe owners manager', () => { }) it('should fail if address is equal to sentinel', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -156,10 +150,9 @@ describe('Safe owners manager', () => { }) it('should fail if address is equal to 0x address', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -170,10 +163,9 @@ describe('Safe owners manager', () => { }) it('should fail if address is already an owner', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -184,10 +176,9 @@ describe('Safe owners manager', () => { }) it('should fail if the threshold is bigger than the number of owners', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -204,10 +195,9 @@ describe('Safe owners manager', () => { }) it('should fail if the threshold is not bigger than 0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -218,10 +208,9 @@ describe('Safe owners manager', () => { }) it('should build the transaction with the optional props', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -245,10 +234,9 @@ describe('Safe owners manager', () => { }) it('should add an owner and keep the same threshold', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -270,10 +258,9 @@ describe('Safe owners manager', () => { }) it('should add an owner and update the threshold', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -299,9 +286,8 @@ describe('Safe owners manager', () => { describe('createRemoveOwnerTx', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() + const { predictedSafe, accounts, contractNetworks, provider } = await setupTests() const [, account2] = accounts - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -312,8 +298,7 @@ describe('Safe owners manager', () => { }) it('should fail if address is invalid', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -324,8 +309,7 @@ describe('Safe owners manager', () => { }) it('should fail if address is equal to sentinel', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -336,8 +320,7 @@ describe('Safe owners manager', () => { }) it('should fail if address is equal to 0x address', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -348,9 +331,8 @@ describe('Safe owners manager', () => { }) it('should fail if address is not an owner', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const [, , , account4] = accounts - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -361,9 +343,8 @@ describe('Safe owners manager', () => { }) it('should fail if the threshold is bigger than the number of owners', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -380,9 +361,8 @@ describe('Safe owners manager', () => { }) it('should fail if the threshold is not bigger than 0', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -393,11 +373,10 @@ describe('Safe owners manager', () => { }) it('should build the transaction with the optional props', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts - const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, safeAddress: await safe.getAddress(), contractNetworks }) @@ -419,22 +398,17 @@ describe('Safe owners manager', () => { }) it('should remove the first owner of a Safe and decrease the threshold', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const [account1, account2, account3] = accounts - const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, safeAddress: await safe.getAddress(), contractNetworks }) - const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ - provider: provider2, signer: account2.address }) - const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ - provider: provider3, signer: account3.address }) const initialThreshold = await safeSdk1.getThreshold() @@ -457,22 +431,17 @@ describe('Safe owners manager', () => { }) it('should remove any owner of a Safe and decrease the threshold', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const [account1, account2, account3] = accounts - const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, safeAddress: await safe.getAddress(), contractNetworks }) - const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ - provider: provider2, signer: account2.address }) - const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ - provider: provider3, signer: account3.address, contractNetworks }) @@ -496,22 +465,17 @@ describe('Safe owners manager', () => { }) it('should remove an owner and update the threshold', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const [account1, account2, account3] = accounts - const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, safeAddress: await safe.getAddress(), contractNetworks }) - const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ - provider: provider2, signer: account2.address }) - const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ - provider: provider3, signer: account3.address }) const newThreshold = 1 @@ -538,9 +502,8 @@ describe('Safe owners manager', () => { describe('createSwapOwnerTx', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, accounts, contractNetworks } = await setupTests() + const { predictedSafe, accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -554,10 +517,9 @@ describe('Safe owners manager', () => { }) it('should fail if old address is invalid', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -571,10 +533,9 @@ describe('Safe owners manager', () => { }) it('should fail if new address is invalid', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -588,10 +549,9 @@ describe('Safe owners manager', () => { }) it('should fail if old address is equal to sentinel', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -605,10 +565,9 @@ describe('Safe owners manager', () => { }) it('should fail if new address is equal to sentinel', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -622,10 +581,9 @@ describe('Safe owners manager', () => { }) it('should fail if old address is equal to 0x address', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -639,10 +597,9 @@ describe('Safe owners manager', () => { }) it('should fail if new address is equal to 0x address', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -656,10 +613,9 @@ describe('Safe owners manager', () => { }) it('should fail if old address is not an owner', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2, , account4] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -673,10 +629,9 @@ describe('Safe owners manager', () => { }) it('should fail if new address is already an owner', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -690,10 +645,9 @@ describe('Safe owners manager', () => { }) it('should build the transaction with the optional props', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -720,10 +674,9 @@ describe('Safe owners manager', () => { }) it('should replace the first owner of a Safe', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -744,22 +697,17 @@ describe('Safe owners manager', () => { }) it('should replace any owner of a Safe', async () => { - const { safe, accounts, contractNetworks } = await setupTests() + const { safe, accounts, contractNetworks, provider } = await setupTests() const [account1, account2, account3, account4] = accounts - const provider1 = getEip1193Provider() const safeSdk1 = await Safe.create({ - provider: provider1, + provider, safeAddress: await safe.getAddress(), contractNetworks }) - const provider2 = getEip1193Provider() const safeSdk2 = await safeSdk1.connect({ - provider: provider2, signer: account2.address }) - const provider3 = getEip1193Provider() const safeSdk3 = await safeSdk1.connect({ - provider: provider3, signer: account3.address }) const initialOwners = await safeSdk1.getOwners() diff --git a/packages/protocol-kit/tests/e2e/safeFactory.test.ts b/packages/protocol-kit/tests/e2e/safeFactory.test.ts index 372c3f7eb..9d476f8e2 100644 --- a/packages/protocol-kit/tests/e2e/safeFactory.test.ts +++ b/packages/protocol-kit/tests/e2e/safeFactory.test.ts @@ -35,25 +35,27 @@ describe('SafeProxyFactory', () => { const accounts = await getAccounts() const chainId = BigInt(await getChainId()) const contractNetworks = await getContractNetworks(chainId) + const provider = getEip1193Provider() + return { defaultCallbackHandler: await getDefaultCallbackHandler(), chainId, accounts, - contractNetworks + contractNetworks, + provider } }) describe('create', async () => { it('should fail if the current network is not a default network and no contractNetworks is provided', async () => { - const provider = getEip1193Provider() + const { provider } = await setupTests() chai .expect(SafeFactory.create({ provider })) .rejectedWith('Invalid SafeProxyFactory contract') }) it('should fail if the contractNetworks provided are not deployed', async () => { - const { chainId } = await setupTests() - const provider = getEip1193Provider() + const { chainId, provider } = await setupTests() const contractNetworks: ContractNetworksConfig = { [chainId.toString()]: { safeSingletonAddress: ZERO_ADDRESS, @@ -80,8 +82,7 @@ describe('SafeProxyFactory', () => { }) it('should instantiate the SafeProxyFactory', async () => { - const { contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { contractNetworks, provider } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const networkId = await safeProvider.getChainId() @@ -93,9 +94,8 @@ describe('SafeProxyFactory', () => { describe('getEip1193Provider', async () => { it('should return the connected SafeProvider', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1] = accounts - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) chai .expect(await safeFactory.getSafeProvider().getSignerAddress()) @@ -105,8 +105,7 @@ describe('SafeProxyFactory', () => { describe('getChainId', async () => { it('should return the chainId of the current network', async () => { - const { chainId, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { chainId, contractNetworks, provider } = await setupTests() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) chai.expect(await safeFactory.getChainId()).to.be.eq(chainId) }) @@ -114,8 +113,7 @@ describe('SafeProxyFactory', () => { describe('predictSafeAddress', async () => { it('should fail if there are no owners', async () => { - const { contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { contractNetworks, provider } = await setupTests() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners: string[] = [] const threshold = 2 @@ -128,9 +126,8 @@ describe('SafeProxyFactory', () => { }) it('should fail if the threshold is lower than 0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const invalidThreshold = 0 @@ -143,9 +140,8 @@ describe('SafeProxyFactory', () => { }) it('should fail if the threshold is higher than the threshold', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const invalidThreshold = 3 @@ -158,9 +154,8 @@ describe('SafeProxyFactory', () => { }) it('should fail if the saltNonce is lower than 0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -177,9 +172,8 @@ describe('SafeProxyFactory', () => { }) it('should predict a new Safe with saltNonce', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -204,9 +198,8 @@ describe('SafeProxyFactory', () => { itif(safeVersionDeployed > '1.0.0')( 'should predict a new Safe with the default CompatibilityFallbackHandler', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -233,9 +226,8 @@ describe('SafeProxyFactory', () => { itif(safeVersionDeployed > '1.0.0')( 'should predict a new Safe with a custom fallback handler', async () => { - const { accounts, contractNetworks, defaultCallbackHandler } = await setupTests() + const { accounts, contractNetworks, defaultCallbackHandler, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -265,8 +257,7 @@ describe('SafeProxyFactory', () => { describe('deploySafe', async () => { it('should fail if there are no owners', async () => { - const { contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { contractNetworks, provider } = await setupTests() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners: string[] = [] const threshold = 2 @@ -278,9 +269,8 @@ describe('SafeProxyFactory', () => { }) it('should fail if the threshold is lower than 0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const threshold = 0 @@ -292,9 +282,8 @@ describe('SafeProxyFactory', () => { }) it('should fail if the threshold is higher than the threshold', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const threshold = 3 @@ -306,9 +295,8 @@ describe('SafeProxyFactory', () => { }) it('should fail if the saltNonce is lower than 0', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -327,9 +315,8 @@ describe('SafeProxyFactory', () => { itif(safeVersionDeployed > '1.0.0')( 'should deploy a new Safe with custom fallback handler', async () => { - const { accounts, contractNetworks, defaultCallbackHandler } = await setupTests() + const { accounts, contractNetworks, defaultCallbackHandler, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -356,9 +343,8 @@ describe('SafeProxyFactory', () => { itif(safeVersionDeployed > '1.0.0')( 'should deploy a new Safe with the default CompatibilityFallbackHandler', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -378,9 +364,8 @@ describe('SafeProxyFactory', () => { ) it('should deploy a new Safe without saltNonce', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -398,9 +383,8 @@ describe('SafeProxyFactory', () => { }) it('should deploy a new Safe with saltNonce', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -419,13 +403,12 @@ describe('SafeProxyFactory', () => { }) it('should deploy a new Safe with callback', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts let callbackResult = '' const callback = (txHash: string) => { callbackResult = txHash } - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, @@ -445,9 +428,8 @@ describe('SafeProxyFactory', () => { itif(safeVersionDeployed === DEFAULT_SAFE_VERSION)( 'should deploy last Safe version by default', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, contractNetworks }) const owners = [account1.address, account2.address] const threshold = 2 @@ -460,9 +442,8 @@ describe('SafeProxyFactory', () => { ) it('should deploy a specific Safe version', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts - const provider = getEip1193Provider() const safeFactory = await SafeFactory.create({ provider, safeVersion: safeVersionDeployed, diff --git a/packages/protocol-kit/tests/e2e/safeProvider.test.ts b/packages/protocol-kit/tests/e2e/safeProvider.test.ts index d8bc6e50b..f63532f67 100644 --- a/packages/protocol-kit/tests/e2e/safeProvider.test.ts +++ b/packages/protocol-kit/tests/e2e/safeProvider.test.ts @@ -24,10 +24,13 @@ describe('Safe contracts', () => { const accounts = await getAccounts() const chainId = BigInt(await getChainId()) const contractNetworks = await getContractNetworks(chainId) + const provider = getEip1193Provider() + return { accounts, contractNetworks, - chainId + chainId, + provider } }) @@ -68,8 +71,7 @@ describe('Safe contracts', () => { }) it('should return a Safe contract from the custom addresses', async () => { - const { contractNetworks, chainId } = await setupTests() - const provider = getEip1193Provider() + const { contractNetworks, chainId, provider } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -97,8 +99,7 @@ describe('Safe contracts', () => { }) it('should return a MultiSend contract from the custom addresses', async () => { - const { contractNetworks, chainId } = await setupTests() - const provider = getEip1193Provider() + const { contractNetworks, chainId, provider } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -126,8 +127,7 @@ describe('Safe contracts', () => { }) it('should return a MultiSendCallOnly contract from the custom addresses', async () => { - const { contractNetworks, chainId } = await setupTests() - const provider = getEip1193Provider() + const { contractNetworks, chainId, provider } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -156,8 +156,7 @@ describe('Safe contracts', () => { }) it('should return a CompatibilityFallbackHandler contract from the custom addresses', async () => { - const { contractNetworks, chainId } = await setupTests() - const provider = getEip1193Provider() + const { contractNetworks, chainId, provider } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -186,8 +185,7 @@ describe('Safe contracts', () => { }) it('should return a SafeProxyFactory contract from the custom addresses', async () => { - const { contractNetworks, chainId } = await setupTests() - const provider = getEip1193Provider() + const { contractNetworks, chainId, provider } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -215,8 +213,7 @@ describe('Safe contracts', () => { }) it('should return a SignMessageLib contract from the custom addresses', async () => { - const { contractNetworks, chainId } = await setupTests() - const provider = getEip1193Provider() + const { contractNetworks, chainId, provider } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] @@ -244,8 +241,7 @@ describe('Safe contracts', () => { }) it('should return a SafeProxyFactory contract from the custom addresses', async () => { - const { contractNetworks, chainId } = await setupTests() - const provider = getEip1193Provider() + const { contractNetworks, chainId, provider } = await setupTests() const safeProvider = new SafeProvider({ provider }) const safeVersion: SafeVersion = '1.3.0' const customContract = contractNetworks[chainId.toString()] diff --git a/packages/protocol-kit/tests/e2e/threshold.test.ts b/packages/protocol-kit/tests/e2e/threshold.test.ts index fb5148798..254f2ad0d 100644 --- a/packages/protocol-kit/tests/e2e/threshold.test.ts +++ b/packages/protocol-kit/tests/e2e/threshold.test.ts @@ -29,18 +29,20 @@ describe('Safe Threshold', () => { safeVersion: safeVersionDeployed } } + const provider = getEip1193Provider() + return { safe: await getSafeWithOwners([accounts[0].address]), accounts, contractNetworks, - predictedSafe + predictedSafe, + provider } }) describe('getThreshold', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -50,8 +52,7 @@ describe('Safe Threshold', () => { }) it('should return the Safe threshold', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -63,8 +64,7 @@ describe('Safe Threshold', () => { describe('createChangeThresholdTx', async () => { it('should fail if the Safe is not deployed', async () => { - const { predictedSafe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, predictedSafe, @@ -77,8 +77,7 @@ describe('Safe Threshold', () => { }) it('should fail if the threshold is bigger than the number of owners', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -93,8 +92,7 @@ describe('Safe Threshold', () => { }) it('should fail if the threshold is not bigger than 0', async () => { - const { safe, contractNetworks } = await setupTests() - const provider = getEip1193Provider() + const { safe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -107,10 +105,9 @@ describe('Safe Threshold', () => { }) it('should build the transaction with the optional props', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address, account2.address], 1) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), @@ -136,10 +133,9 @@ describe('Safe Threshold', () => { }) it('should change the threshold', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address, account2.address], 1) - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, safeAddress: await safe.getAddress(), diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index 330f95f67..cdd2d9bf3 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -42,24 +42,26 @@ describe('Contract utils', () => { const accounts = await getAccounts() const chainId = BigInt(await getChainId()) const contractNetworks = await getContractNetworks(chainId) + const provider = getEip1193Provider() + return { defaultCallbackHandler: await getDefaultCallbackHandler(), chainId, accounts, - contractNetworks + contractNetworks, + provider } }) describe('predictSafeAddress', () => { it('returns the predicted address of a 1/1 Safe', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() + const { accounts, contractNetworks, chainId, provider } = await setupTests() // 1/1 Safe const [owner1] = accounts const owners = [owner1.address] const threshold = 1 const safeVersion = safeVersionDeployed - const provider = getEip1193Provider() const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] @@ -98,14 +100,13 @@ describe('Contract utils', () => { }) it('returns the predicted address of a 1/2 Safe', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() + const { accounts, contractNetworks, chainId, provider } = await setupTests() // 1/2 Safe const [owner1, owner2] = accounts const owners = [owner1.address, owner2.address] const threshold = 1 const safeVersion = safeVersionDeployed - const provider = getEip1193Provider() const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] @@ -144,14 +145,13 @@ describe('Contract utils', () => { }) it('returns the predicted address of a 2/2 Safe', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() + const { accounts, contractNetworks, chainId, provider } = await setupTests() // 2/2 Safe const [owner1, owner2] = accounts const owners = [owner1.address, owner2.address] const threshold = 2 const safeVersion = safeVersionDeployed - const provider = getEip1193Provider() const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] @@ -190,14 +190,13 @@ describe('Contract utils', () => { }) it('should fail if the provided threshold is invalid (greater than owners length)', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() + const { accounts, contractNetworks, chainId, provider } = await setupTests() // invalid threshold 3/2 Safe const [owner1, owner2] = accounts const owners = [owner1.address, owner2.address] const invalidThreshold = 3 const safeVersion = safeVersionDeployed - const provider = getEip1193Provider() const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] @@ -225,14 +224,13 @@ describe('Contract utils', () => { }) it('should fail if the provided threshold is invalid (zero value)', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() + const { accounts, contractNetworks, chainId, provider } = await setupTests() // invalid threshold 0/2 Safe const [owner1, owner2] = accounts const owners = [owner1.address, owner2.address] const invalidThreshold = 0 const safeVersion = safeVersionDeployed - const provider = getEip1193Provider() const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] @@ -260,14 +258,13 @@ describe('Contract utils', () => { }) it('should fail if the provided threshold is invalid (negative value)', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() + const { accounts, contractNetworks, chainId, provider } = await setupTests() // invalid threshold -2/2 Safe const [owner1, owner2] = accounts const owners = [owner1.address, owner2.address] const invalidThreshold = -2 const safeVersion = safeVersionDeployed - const provider = getEip1193Provider() const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] @@ -295,13 +292,12 @@ describe('Contract utils', () => { }) it('should fail if no owners are present (empty array)', async () => { - const { contractNetworks, chainId } = await setupTests() + const { contractNetworks, chainId, provider } = await setupTests() // invalid owners 1/0 Safe const invalidOwners: string[] = [] const threshold = 1 const safeVersion = safeVersionDeployed - const provider = getEip1193Provider() const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] @@ -329,14 +325,13 @@ describe('Contract utils', () => { }) it('returns different addresses with different saltNonce value but same Safe config (threshold & owners)', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() + const { accounts, contractNetworks, chainId, provider } = await setupTests() // 1/2 Safe const [owner1, owner2] = accounts const owners = [owner1.address, owner2.address] const threshold = 1 const safeVersion = safeVersionDeployed - const provider = getEip1193Provider() const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] @@ -423,14 +418,13 @@ describe('Contract utils', () => { }) it('returns the same predicted address for multiple calls to predictedSafeAddress with the same config (owners, threshold & saltNonce)', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() + const { accounts, contractNetworks, chainId, provider } = await setupTests() // 2/2 Safe const [owner1, owner2] = accounts const owners = [owner1.address, owner2.address] const threshold = 2 const safeVersion = safeVersionDeployed - const provider = getEip1193Provider() const safeProvider = new SafeProvider({ provider }) const customContracts = contractNetworks[chainId.toString()] @@ -489,13 +483,12 @@ describe('Contract utils', () => { itif(safeVersionDeployed > '1.0.0')( 'safeDeploymentConfig is an optional parameter', async () => { - const { accounts, contractNetworks, chainId } = await setupTests() + const { accounts, contractNetworks, chainId, provider } = await setupTests() // 1/1 Safe const [owner1] = accounts const owners = [owner1.address] const threshold = 1 - const provider = getEip1193Provider() const customContracts = contractNetworks[chainId.toString()] const safeAccountConfig: SafeAccountConfig = { diff --git a/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts b/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts index d37acb91b..d1cb7081d 100644 --- a/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts +++ b/packages/protocol-kit/tests/e2e/wrapSafeTransactionIntoDeploymentBatch.test.ts @@ -29,22 +29,23 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { safeVersion: safeVersionDeployed } } + const provider = getEip1193Provider() return { accounts, contractNetworks, predictedSafe, - chainId + chainId, + provider } }) it('should throw an error if the Safe is already deployed', async () => { - const { accounts, contractNetworks } = await setupTests() + const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) const safeAddress = await safe.getAddress() - const provider = getEip1193Provider() const safeSdk = await Safe.create({ provider, @@ -70,11 +71,9 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { itif(safeVersionDeployed == '1.4.1')( 'should return a batch transaction with the Safe deployment Transaction and the Safe Transaction', async () => { - const { accounts, contractNetworks, predictedSafe } = await setupTests() + const { accounts, contractNetworks, predictedSafe, provider } = await setupTests() const [, account2] = accounts - const provider = getEip1193Provider() - const safeSdk = await Safe.create({ provider, predictedSafe, @@ -106,11 +105,9 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { itif(safeVersionDeployed == '1.3.0')( 'should return a batch transaction with the Safe deployment Transaction and the Safe Transaction', async () => { - const { accounts, contractNetworks, predictedSafe } = await setupTests() + const { accounts, contractNetworks, predictedSafe, provider } = await setupTests() const [, account2] = accounts - const provider = getEip1193Provider() - const safeSdk = await Safe.create({ provider, predictedSafe, @@ -142,11 +139,9 @@ describe('wrapSafeTransactionIntoDeploymentBatch', () => { itif(safeVersionDeployed >= '1.3.0')( 'should include the custom salt nonce in the Safe deployment data', async () => { - const { accounts, contractNetworks, predictedSafe } = await setupTests() + const { accounts, contractNetworks, predictedSafe, provider } = await setupTests() const [, account2] = accounts - const provider = getEip1193Provider() - const safeSdk = await Safe.create({ provider, predictedSafe, From 334e414f8d7df97b84ad1aee9c1c9926700aca45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 23 Apr 2024 13:17:21 +0200 Subject: [PATCH 047/112] Skip getModulesPaginated --- packages/protocol-kit/tests/e2e/moduleManager.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/protocol-kit/tests/e2e/moduleManager.test.ts b/packages/protocol-kit/tests/e2e/moduleManager.test.ts index b85355712..bb0e53b82 100644 --- a/packages/protocol-kit/tests/e2e/moduleManager.test.ts +++ b/packages/protocol-kit/tests/e2e/moduleManager.test.ts @@ -86,7 +86,8 @@ describe('Safe modules manager', () => { }) }) - describe('getModulesPaginated', async () => { + //TODO: Fix getModulesPaginated tests + describe.skip('getModulesPaginated', async () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ From 60d49e360319a52db5b764221d86d1da1300924d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 23 Apr 2024 17:49:35 +0200 Subject: [PATCH 048/112] Fix api-kit tests --- packages/api-kit/tests/e2e/addMessage.test.ts | 18 +++--- .../tests/e2e/addMessageSignature.test.ts | 61 ++++++++----------- .../api-kit/tests/e2e/addSafeDelegate.test.ts | 61 ++++++++++--------- .../tests/e2e/confirmTransaction.test.ts | 45 ++++++-------- packages/api-kit/tests/e2e/decodeData.test.ts | 6 +- .../tests/e2e/getIncomingTransactions.test.ts | 6 +- packages/api-kit/tests/e2e/getMessage.test.ts | 6 +- .../api-kit/tests/e2e/getMessages.test.ts | 6 +- .../tests/e2e/getMultisigTransactions.test.ts | 6 +- .../api-kit/tests/e2e/getNextNonce.test.ts | 6 +- .../tests/e2e/getPendingTransactions.test.ts | 6 +- .../tests/e2e/getSafeDelegates.test.ts | 11 ++-- .../api-kit/tests/e2e/getSafeInfo.test.ts | 6 +- .../tests/e2e/getSafesByModule.test.ts | 6 +- .../api-kit/tests/e2e/getSafesByOwner.test.ts | 6 +- .../api-kit/tests/e2e/getServiceInfo.test.ts | 6 +- .../e2e/getServiceSingletonsInfo.test.ts | 6 +- packages/api-kit/tests/e2e/getToken.test.ts | 6 +- .../api-kit/tests/e2e/getTokenList.test.ts | 6 +- .../api-kit/tests/e2e/getTransaction.test.ts | 6 +- .../e2e/getTransactionConfirmations.test.ts | 13 +--- .../tests/e2e/removeSafeDelegate.test.ts | 11 ++-- packages/api-kit/tests/endpoint/index.test.ts | 36 +++++------ packages/api-kit/tests/utils/setupKits.ts | 61 +++++++++++++++++++ packages/api-kit/tests/utils/setupProvider.ts | 17 ------ .../api-kit/tests/utils/setupServiceClient.ts | 22 ------- 26 files changed, 201 insertions(+), 245 deletions(-) create mode 100644 packages/api-kit/tests/utils/setupKits.ts delete mode 100644 packages/api-kit/tests/utils/setupProvider.ts delete mode 100644 packages/api-kit/tests/utils/setupServiceClient.ts diff --git a/packages/api-kit/tests/e2e/addMessage.test.ts b/packages/api-kit/tests/e2e/addMessage.test.ts index 0c149727d..ca1fa483a 100644 --- a/packages/api-kit/tests/e2e/addMessage.test.ts +++ b/packages/api-kit/tests/e2e/addMessage.test.ts @@ -1,14 +1,14 @@ import Safe from '@safe-global/protocol-kit' -import { Eip1193Provider } from '@safe-global/safe-core-sdk-types' import SafeApiKit from '@safe-global/api-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { getServiceClient } from '../utils/setupServiceClient' +import { getKits } from '../utils/setupKits' chai.use(chaiAsPromised) +const PRIVATE_KEY = '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' + let safeApiKit: SafeApiKit -let provider: Eip1193Provider let protocolKit: Safe const generateRandomUUID = (): string => { @@ -24,14 +24,10 @@ const safeAddress = '0xF8ef84392f7542576F6b9d1b140334144930Ac78' describe('addMessage', () => { before(async () => { - ;({ safeApiKit, provider } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) - - protocolKit = await Safe.create({ - provider, - safeAddress - }) + ;({ safeApiKit, protocolKit } = await getKits({ + safeAddress, + signer: PRIVATE_KEY + })) }) it('should fail if safeAddress is empty or invalid', async () => { diff --git a/packages/api-kit/tests/e2e/addMessageSignature.test.ts b/packages/api-kit/tests/e2e/addMessageSignature.test.ts index 80efcd711..b4b5cad94 100644 --- a/packages/api-kit/tests/e2e/addMessageSignature.test.ts +++ b/packages/api-kit/tests/e2e/addMessageSignature.test.ts @@ -3,21 +3,23 @@ import Safe, { buildSignatureBytes, hashSafeMessage, SigningMethod, - buildContractSignature, - EthAdapter + buildContractSignature } from '@safe-global/protocol-kit' -import { Eip1193Provider, SafeMessage } from '@safe-global/safe-core-sdk-types' +import { SafeMessage } from '@safe-global/safe-core-sdk-types' import SafeApiKit from '@safe-global/api-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { getServiceClient } from '../utils/setupServiceClient' +import { getKits } from '../utils/setupKits' chai.use(chaiAsPromised) -let safeApiKit1: SafeApiKit +const PRIVATE_KEY_1 = '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' +const PRIVATE_KEY_2 = '0xb88ad5789871315d0dab6fc5961d6714f24f35a6393f13a6f426dfecfc00ab44' + +let safeApiKit: SafeApiKit let protocolKit: Safe -let provider1: Eip1193Provider -let provider2: Eip1193Provider +const safeAddress = '0xF8ef84392f7542576F6b9d1b140334144930Ac78' +const signerSafeAddress = '0xDa8dd250065F19f7A29564396D7F13230b9fC5A3' const generateRandomUUID = (): string => { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { @@ -28,39 +30,28 @@ const generateRandomUUID = (): string => { } const generateMessage = () => `${generateRandomUUID()}: I am the owner of the safe` -const safeAddress = '0xF8ef84392f7542576F6b9d1b140334144930Ac78' -const signerSafeAddress = '0xDa8dd250065F19f7A29564396D7F13230b9fC5A3' describe('addMessageSignature', () => { before(async () => { - ;({ safeApiKit: safeApiKit1, provider: provider1 } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) - ;({ provider: provider2 } = await getServiceClient( - '0xb88ad5789871315d0dab6fc5961d6714f24f35a6393f13a6f426dfecfc00ab44' - )) + ;({ safeApiKit, protocolKit } = await getKits({ + safeAddress, + signer: PRIVATE_KEY_1 + })) }) it('should fail if safeAddress is empty', async () => { await chai - .expect(safeApiKit1.addMessageSignature('', '0x')) + .expect(safeApiKit.addMessageSignature('', '0x')) .to.be.rejectedWith('Invalid messageHash or signature') }) it('should fail if signature is empty', async () => { await chai - .expect(safeApiKit1.addMessageSignature(safeAddress, '')) + .expect(safeApiKit.addMessageSignature(safeAddress, '')) .to.be.rejectedWith('Invalid messageHash or signature') }) describe('when adding a new message', () => { - beforeEach(async () => { - protocolKit = await Safe.create({ - provider: provider1, - safeAddress - }) - }) - it('should allow to add a confirmation signature using the EIP-712', async () => { const rawMessage: string = generateMessage() let safeMessage: SafeMessage = protocolKit.createMessage(rawMessage) @@ -69,33 +60,33 @@ describe('addMessageSignature', () => { let signerAddress = (await protocolKit.getSafeProvider().getSignerAddress()) || '0x' await chai.expect( - safeApiKit1.addMessage(safeAddress, { + safeApiKit.addMessage(safeAddress, { message: rawMessage, signature: safeMessage.getSignature(signerAddress)?.data || '0x' }) ).to.be.fulfilled - protocolKit = await protocolKit.connect({ provider: provider2 }) + protocolKit = await protocolKit.connect({ signer: PRIVATE_KEY_2 }) safeMessage = await protocolKit.signMessage(safeMessage, 'eth_signTypedData_v4') const safeMessageHash = await protocolKit.getSafeMessageHash(hashSafeMessage(rawMessage)) signerAddress = (await protocolKit.getSafeProvider().getSignerAddress()) || '0x' await chai.expect( - safeApiKit1.addMessageSignature( + safeApiKit.addMessageSignature( safeMessageHash, safeMessage.getSignature(signerAddress)?.data || '0x' ) ).to.be.fulfilled - const confirmedMessage = await safeApiKit1.getMessage(safeMessageHash) + const confirmedMessage = await safeApiKit.getMessage(safeMessageHash) chai.expect(confirmedMessage.confirmations.length).to.eq(2) }) it('should allow to add a confirmation signature using a Safe signer', async () => { protocolKit = await protocolKit.connect({ - provider: provider1, + signer: PRIVATE_KEY_1, safeAddress }) @@ -109,14 +100,14 @@ describe('addMessageSignature', () => { const ethSig = safeMessage.getSignature(signerAddress) as EthSafeSignature await chai.expect( - safeApiKit1.addMessage(safeAddress, { + safeApiKit.addMessage(safeAddress, { message: rawMessage, signature: buildSignatureBytes([ethSig]) }) ).to.be.fulfilled protocolKit = await protocolKit.connect({ - provider: provider1, + signer: PRIVATE_KEY_1, safeAddress: signerSafeAddress }) let signerSafeMessage = protocolKit.createMessage(rawMessage) @@ -127,7 +118,7 @@ describe('addMessageSignature', () => { ) protocolKit = await protocolKit.connect({ - provider: provider2, + signer: PRIVATE_KEY_2, safeAddress: signerSafeAddress }) signerSafeMessage = await protocolKit.signMessage( @@ -142,7 +133,7 @@ describe('addMessageSignature', () => { ) protocolKit = await protocolKit.connect({ - provider: provider1, + signer: PRIVATE_KEY_1, safeAddress }) @@ -157,10 +148,10 @@ describe('addMessageSignature', () => { const contractSig = buildSignatureBytes([signerSafeSig]) - await chai.expect(safeApiKit1.addMessageSignature(safeMessageHash, contractSig)).to.be + await chai.expect(safeApiKit.addMessageSignature(safeMessageHash, contractSig)).to.be .fulfilled - const confirmedMessage = await safeApiKit1.getMessage(safeMessageHash) + const confirmedMessage = await safeApiKit.getMessage(safeMessageHash) chai.expect(confirmedMessage.confirmations.length).to.eq(2) }) }) diff --git a/packages/api-kit/tests/e2e/addSafeDelegate.test.ts b/packages/api-kit/tests/e2e/addSafeDelegate.test.ts index e3b00bf04..3ccb8dc93 100644 --- a/packages/api-kit/tests/e2e/addSafeDelegate.test.ts +++ b/packages/api-kit/tests/e2e/addSafeDelegate.test.ts @@ -1,29 +1,33 @@ -import { Signer } from 'ethers' +import { ethers, Signer } from 'ethers' import SafeApiKit, { AddSafeDelegateProps } from '@safe-global/api-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import config from '../utils/config' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' chai.use(chaiAsPromised) +const PRIVATE_KEY_1 = '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' +const PRIVATE_KEY_2 = '0xb0057716d5917badaf911b193b12b910811c1497b5bada8d7711f758981c3773' + let safeApiKit: SafeApiKit -let signer: Signer +let signer1: Signer +let signer2: Signer describe('addSafeDelegate', () => { before(async () => { - ;({ safeApiKit, signer } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() + signer1 = new ethers.Wallet(PRIVATE_KEY_1) + signer2 = new ethers.Wallet(PRIVATE_KEY_2) }) it('should fail if Label is empty', async () => { const delegateAddress = '0x9cCBDE03eDd71074ea9c49e413FA9CDfF16D263B' - const delegatorAddress = await signer.getAddress() + const delegatorAddress = await signer1.getAddress() const delegateConfig: AddSafeDelegateProps = { delegateAddress, delegatorAddress, - signer, + signer: signer1, label: '' } await chai @@ -33,11 +37,11 @@ describe('addSafeDelegate', () => { it('should fail if Safe delegate address is empty', async () => { const delegateAddress = '' - const delegatorAddress = await signer.getAddress() + const delegatorAddress = await signer1.getAddress() const delegateConfig: AddSafeDelegateProps = { delegateAddress, delegatorAddress, - signer, + signer: signer1, label: 'Label' } await chai @@ -51,7 +55,7 @@ describe('addSafeDelegate', () => { const delegateConfig: AddSafeDelegateProps = { delegateAddress, delegatorAddress, - signer, + signer: signer1, label: 'Label' } await chai @@ -62,12 +66,12 @@ describe('addSafeDelegate', () => { it('should fail if Safe address is not checksummed', async () => { const safeAddress = '0xF8ef84392f7542576F6b9d1b140334144930Ac78'.toLowerCase() const delegateAddress = '0x9cCBDE03eDd71074ea9c49e413FA9CDfF16D263B' - const delegatorAddress = await signer.getAddress() + const delegatorAddress = await signer1.getAddress() const delegateConfig: AddSafeDelegateProps = { safeAddress, delegateAddress, delegatorAddress, - signer, + signer: signer1, label: 'Label' } await chai @@ -78,12 +82,12 @@ describe('addSafeDelegate', () => { it('should fail if Safe delegate address is not checksummed', async () => { const safeAddress = '0xF8ef84392f7542576F6b9d1b140334144930Ac78' const delegateAddress = '0x9cCBDE03eDd71074ea9c49e413FA9CDfF16D263B'.toLowerCase() - const delegatorAddress = await signer.getAddress() + const delegatorAddress = await signer1.getAddress() const delegateConfig: AddSafeDelegateProps = { safeAddress, delegateAddress, delegatorAddress, - signer, + signer: signer1, label: 'Label' } await chai @@ -94,12 +98,12 @@ describe('addSafeDelegate', () => { it('should fail if Safe delegator address is not checksummed', async () => { const safeAddress = '0xF8ef84392f7542576F6b9d1b140334144930Ac78' const delegateAddress = '0x9cCBDE03eDd71074ea9c49e413FA9CDfF16D263B' - const delegatorAddress = (await signer.getAddress()).toLowerCase() + const delegatorAddress = (await signer1.getAddress()).toLowerCase() const delegateConfig: AddSafeDelegateProps = { safeAddress, delegateAddress, delegatorAddress, - signer, + signer: signer1, label: 'Label' } await chai @@ -110,12 +114,12 @@ describe('addSafeDelegate', () => { it('should fail if Safe does not exist', async () => { const safeAddress = '0x1dF62f291b2E969fB0849d99D9Ce41e2F137006e' const delegateAddress = '0x9cCBDE03eDd71074ea9c49e413FA9CDfF16D263B' - const delegatorAddress = await signer.getAddress() + const delegatorAddress = await signer1.getAddress() const delegateConfig: AddSafeDelegateProps = { safeAddress, delegateAddress, delegatorAddress, - signer, + signer: signer1, label: 'Label' } await chai @@ -124,17 +128,14 @@ describe('addSafeDelegate', () => { }) it('should fail if the signer is not an owner of the Safe', async () => { - const { safeApiKit, signer } = await getServiceClient( - '0xb0057716d5917badaf911b193b12b910811c1497b5bada8d7711f758981c3773' - ) const safeAddress = '0xF8ef84392f7542576F6b9d1b140334144930Ac78' const delegateAddress = '0x9cCBDE03eDd71074ea9c49e413FA9CDfF16D263B' - const delegatorAddress = await signer.getAddress() + const delegatorAddress = await signer2.getAddress() const delegateConfig: AddSafeDelegateProps = { safeAddress, delegateAddress, delegatorAddress, - signer, + signer: signer2, label: 'Label' } await chai @@ -147,12 +148,12 @@ describe('addSafeDelegate', () => { it('should add a new delegate', async () => { const safeAddress = '0xF8ef84392f7542576F6b9d1b140334144930Ac78' const delegateAddress = '0x9cCBDE03eDd71074ea9c49e413FA9CDfF16D263B' - const delegatorAddress = await signer.getAddress() + const delegatorAddress = await signer1.getAddress() const delegateConfig: AddSafeDelegateProps = { safeAddress, delegateAddress, delegatorAddress, - signer, + signer: signer1, label: 'Label' } const { results: initialDelegates } = await safeApiKit.getSafeDelegates({ safeAddress }) @@ -170,11 +171,11 @@ describe('addSafeDelegate', () => { it('should add a new delegate without specifying a Safe', async () => { const delegateAddress = '0x9cCBDE03eDd71074ea9c49e413FA9CDfF16D263B' - const delegatorAddress = await signer.getAddress() + const delegatorAddress = await signer1.getAddress() const delegateConfig: AddSafeDelegateProps = { delegateAddress, delegatorAddress, - signer, + signer: signer1, label: 'Label' } const { results: initialDelegates } = await safeApiKit.getSafeDelegates({ @@ -200,13 +201,13 @@ describe('addSafeDelegate', () => { const eip3770SafeAddress = `${config.EIP_3770_PREFIX}:${safeAddress}` const delegateAddress = '0x9cCBDE03eDd71074ea9c49e413FA9CDfF16D263B' const eip3770DelegateAddress = `${config.EIP_3770_PREFIX}:${delegateAddress}` - const delegatorAddress = await signer.getAddress() + const delegatorAddress = await signer1.getAddress() const eip3770DelegatorAddress = `${config.EIP_3770_PREFIX}:${delegatorAddress}` const delegateConfig: AddSafeDelegateProps = { safeAddress: eip3770SafeAddress, delegateAddress: eip3770DelegateAddress, delegatorAddress: eip3770DelegatorAddress, - signer, + signer: signer1, label: 'Label' } const { results: initialDelegates } = await safeApiKit.getSafeDelegates({ diff --git a/packages/api-kit/tests/e2e/confirmTransaction.test.ts b/packages/api-kit/tests/e2e/confirmTransaction.test.ts index 70e313392..c2878e7f5 100644 --- a/packages/api-kit/tests/e2e/confirmTransaction.test.ts +++ b/packages/api-kit/tests/e2e/confirmTransaction.test.ts @@ -2,40 +2,31 @@ import Safe, { EthSafeSignature, buildSignatureBytes, SigningMethod, - buildContractSignature, - EthAdapter + buildContractSignature } from '@safe-global/protocol-kit' -import { Eip1193Provider, SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types' +import { SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types' import SafeApiKit from '@safe-global/api-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { getServiceClient } from '../utils/setupServiceClient' +import { getKits } from '../utils/setupKits' chai.use(chaiAsPromised) -let safeApiKit1: SafeApiKit +const PRIVATE_KEY_1 = '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' +const PRIVATE_KEY_2 = '0xb88ad5789871315d0dab6fc5961d6714f24f35a6393f13a6f426dfecfc00ab44' + +let safeApiKit: SafeApiKit let protocolKit: Safe -let provider1: Eip1193Provider -let provider2: Eip1193Provider const safeAddress = '0xF8ef84392f7542576F6b9d1b140334144930Ac78' const signerSafeAddress = '0xDa8dd250065F19f7A29564396D7F13230b9fC5A3' describe('proposeTransaction', () => { before(async () => { - ;({ safeApiKit: safeApiKit1, provider: provider1 } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) - ;({ provider: provider2 } = await getServiceClient( - '0xb88ad5789871315d0dab6fc5961d6714f24f35a6393f13a6f426dfecfc00ab44' - )) - }) - - beforeEach(async () => { - protocolKit = await Safe.create({ - provider: provider1, + ;({ safeApiKit, protocolKit } = await getKits({ + signer: PRIVATE_KEY_1, safeAddress - }) + })) }) it('should allow to create and confirm transactions signature using a Safe signer', async () => { @@ -51,7 +42,7 @@ describe('proposeTransaction', () => { // EOA signature tx = await protocolKit.signTransaction(tx) - const signerAddress = (await provider1.getSignerAddress()) || '0x' + const signerAddress = (await protocolKit.getSafeProvider().getSignerAddress()) || '0x' const ethSig = tx.getSignature(signerAddress) as EthSafeSignature const txOptions = { @@ -62,11 +53,11 @@ describe('proposeTransaction', () => { senderSignature: buildSignatureBytes([ethSig]) } - await chai.expect(safeApiKit1.proposeTransaction(txOptions)).to.be.fulfilled + await chai.expect(safeApiKit.proposeTransaction(txOptions)).to.be.fulfilled // Signer Safe signature protocolKit = await protocolKit.connect({ - provider: provider1, + signer: PRIVATE_KEY_1, safeAddress: signerSafeAddress }) @@ -80,7 +71,7 @@ describe('proposeTransaction', () => { ) protocolKit = await protocolKit.connect({ - provider: provider2, + signer: PRIVATE_KEY_2, safeAddress: signerSafeAddress }) signerSafeTx = await protocolKit.signTransaction( @@ -95,7 +86,7 @@ describe('proposeTransaction', () => { ) protocolKit = await protocolKit.connect({ - provider: provider1, + signer: PRIVATE_KEY_1, safeAddress }) @@ -104,9 +95,9 @@ describe('proposeTransaction', () => { // chai.expect(isValidSignature).to.be.true const contractSig = buildSignatureBytes([signerSafeSig]) - await chai.expect(safeApiKit1.confirmTransaction(txHash, contractSig)).to.be.fulfilled + await chai.expect(safeApiKit.confirmTransaction(txHash, contractSig)).to.be.fulfilled - const confirmedMessage = await safeApiKit1.getTransaction(txHash) - chai.expect(confirmedMessage.confirmations.length).to.eq(2) + const confirmedMessage = await safeApiKit.getTransaction(txHash) + chai.expect(confirmedMessage?.confirmations?.length).to.eq(2) }) }) diff --git a/packages/api-kit/tests/e2e/decodeData.test.ts b/packages/api-kit/tests/e2e/decodeData.test.ts index e383ab7b0..7d96a5548 100644 --- a/packages/api-kit/tests/e2e/decodeData.test.ts +++ b/packages/api-kit/tests/e2e/decodeData.test.ts @@ -1,7 +1,7 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import SafeApiKit from '@safe-global/api-kit/index' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' chai.use(chaiAsPromised) @@ -9,9 +9,7 @@ let safeApiKit: SafeApiKit describe('decodeData', () => { before(async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() }) it('should fail if data is empty', async () => { diff --git a/packages/api-kit/tests/e2e/getIncomingTransactions.test.ts b/packages/api-kit/tests/e2e/getIncomingTransactions.test.ts index e0a7dd7be..85c9b1ef8 100644 --- a/packages/api-kit/tests/e2e/getIncomingTransactions.test.ts +++ b/packages/api-kit/tests/e2e/getIncomingTransactions.test.ts @@ -2,7 +2,7 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import SafeApiKit from '@safe-global/api-kit/index' import config from '../utils/config' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' chai.use(chaiAsPromised) @@ -10,9 +10,7 @@ let safeApiKit: SafeApiKit describe('getIncomingTransactions', () => { before(async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() }) it('should fail if Safe address is empty', async () => { diff --git a/packages/api-kit/tests/e2e/getMessage.test.ts b/packages/api-kit/tests/e2e/getMessage.test.ts index 527fb6c3a..7a310372c 100644 --- a/packages/api-kit/tests/e2e/getMessage.test.ts +++ b/packages/api-kit/tests/e2e/getMessage.test.ts @@ -1,7 +1,7 @@ import SafeApiKit from '@safe-global/api-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' chai.use(chaiAsPromised) @@ -10,9 +10,7 @@ const safeAddress = '0xF8ef84392f7542576F6b9d1b140334144930Ac78' describe('getMessages', () => { before(async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() }) it('should fail if safeAddress is empty', async () => { diff --git a/packages/api-kit/tests/e2e/getMessages.test.ts b/packages/api-kit/tests/e2e/getMessages.test.ts index 2826f4b76..ec4768d5a 100644 --- a/packages/api-kit/tests/e2e/getMessages.test.ts +++ b/packages/api-kit/tests/e2e/getMessages.test.ts @@ -1,7 +1,7 @@ import SafeApiKit from '@safe-global/api-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' chai.use(chaiAsPromised) @@ -10,9 +10,7 @@ const safeAddress = '0xF8ef84392f7542576F6b9d1b140334144930Ac78' describe('getMessages', () => { before(async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() }) it('should fail if safeAddress is empty or invalid', async () => { diff --git a/packages/api-kit/tests/e2e/getMultisigTransactions.test.ts b/packages/api-kit/tests/e2e/getMultisigTransactions.test.ts index d1b1590ff..fc6f63f06 100644 --- a/packages/api-kit/tests/e2e/getMultisigTransactions.test.ts +++ b/packages/api-kit/tests/e2e/getMultisigTransactions.test.ts @@ -2,7 +2,7 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import SafeApiKit from '@safe-global/api-kit/index' import config from '../utils/config' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' chai.use(chaiAsPromised) @@ -10,9 +10,7 @@ let safeApiKit: SafeApiKit describe('getMultisigTransactions', () => { before(async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() }) it('should fail if Safe address is empty', async () => { diff --git a/packages/api-kit/tests/e2e/getNextNonce.test.ts b/packages/api-kit/tests/e2e/getNextNonce.test.ts index 4120a13a5..736b4e13f 100644 --- a/packages/api-kit/tests/e2e/getNextNonce.test.ts +++ b/packages/api-kit/tests/e2e/getNextNonce.test.ts @@ -2,16 +2,14 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import SafeApiKit from '@safe-global/api-kit/index' import config from '../utils/config' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' chai.use(chaiAsPromised) let safeApiKit: SafeApiKit describe('getNextNonce', () => { before(async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() }) it('should fail if Safe address is empty', async () => { diff --git a/packages/api-kit/tests/e2e/getPendingTransactions.test.ts b/packages/api-kit/tests/e2e/getPendingTransactions.test.ts index 53a7f3388..e8d4e3938 100644 --- a/packages/api-kit/tests/e2e/getPendingTransactions.test.ts +++ b/packages/api-kit/tests/e2e/getPendingTransactions.test.ts @@ -2,7 +2,7 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import SafeApiKit from '@safe-global/api-kit/index' import config from '../utils/config' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' chai.use(chaiAsPromised) @@ -10,9 +10,7 @@ let safeApiKit: SafeApiKit describe('getPendingTransactions', () => { before(async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() }) it('should fail if safeAddress is empty', async () => { diff --git a/packages/api-kit/tests/e2e/getSafeDelegates.test.ts b/packages/api-kit/tests/e2e/getSafeDelegates.test.ts index b88b2c863..a3efeff0d 100644 --- a/packages/api-kit/tests/e2e/getSafeDelegates.test.ts +++ b/packages/api-kit/tests/e2e/getSafeDelegates.test.ts @@ -1,20 +1,21 @@ -import { Signer } from 'ethers' +import { ethers, Signer } from 'ethers' import SafeApiKit, { DeleteSafeDelegateProps } from '@safe-global/api-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import config from '../utils/config' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' chai.use(chaiAsPromised) +const PRIVATE_KEY = '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' + let safeApiKit: SafeApiKit let signer: Signer describe('getSafeDelegates', () => { before(async () => { - ;({ safeApiKit, signer } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() + signer = new ethers.Wallet(PRIVATE_KEY) }) it('should fail if Safe address is empty', async () => { diff --git a/packages/api-kit/tests/e2e/getSafeInfo.test.ts b/packages/api-kit/tests/e2e/getSafeInfo.test.ts index 7434099ba..a6621ef3b 100644 --- a/packages/api-kit/tests/e2e/getSafeInfo.test.ts +++ b/packages/api-kit/tests/e2e/getSafeInfo.test.ts @@ -2,7 +2,7 @@ import SafeApiKit from '@safe-global/api-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import config from '../utils/config' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' chai.use(chaiAsPromised) @@ -10,9 +10,7 @@ let safeApiKit: SafeApiKit describe('getSafeInfo', () => { before(async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() }) it('should fail if Safe address is empty', async () => { diff --git a/packages/api-kit/tests/e2e/getSafesByModule.test.ts b/packages/api-kit/tests/e2e/getSafesByModule.test.ts index 21bcbdfd5..856d96563 100644 --- a/packages/api-kit/tests/e2e/getSafesByModule.test.ts +++ b/packages/api-kit/tests/e2e/getSafesByModule.test.ts @@ -2,7 +2,7 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import SafeApiKit from '@safe-global/api-kit/index' import config from '../utils/config' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' chai.use(chaiAsPromised) @@ -11,9 +11,7 @@ const goerliSpendingLimitModule = '0xCFbFaC74C26F8647cBDb8c5caf80BB5b32E43134' describe('getSafesByModule', () => { before(async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() }) it('should fail if module address is empty', async () => { diff --git a/packages/api-kit/tests/e2e/getSafesByOwner.test.ts b/packages/api-kit/tests/e2e/getSafesByOwner.test.ts index 33e00c5c7..ffc356748 100644 --- a/packages/api-kit/tests/e2e/getSafesByOwner.test.ts +++ b/packages/api-kit/tests/e2e/getSafesByOwner.test.ts @@ -2,7 +2,7 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import SafeApiKit from '@safe-global/api-kit/index' import config from '../utils/config' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' chai.use(chaiAsPromised) @@ -10,9 +10,7 @@ let safeApiKit: SafeApiKit describe('getSafesByOwner', () => { before(async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() }) it('should fail if owner address is empty', async () => { diff --git a/packages/api-kit/tests/e2e/getServiceInfo.test.ts b/packages/api-kit/tests/e2e/getServiceInfo.test.ts index e63c41dde..7074ff3d3 100644 --- a/packages/api-kit/tests/e2e/getServiceInfo.test.ts +++ b/packages/api-kit/tests/e2e/getServiceInfo.test.ts @@ -1,14 +1,12 @@ import { expect } from 'chai' import SafeApiKit from '@safe-global/api-kit/index' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' let safeApiKit: SafeApiKit describe('getServiceInfo', () => { before(async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() }) it('should return the Safe info', async () => { diff --git a/packages/api-kit/tests/e2e/getServiceSingletonsInfo.test.ts b/packages/api-kit/tests/e2e/getServiceSingletonsInfo.test.ts index cd4d48e5b..0c518db85 100644 --- a/packages/api-kit/tests/e2e/getServiceSingletonsInfo.test.ts +++ b/packages/api-kit/tests/e2e/getServiceSingletonsInfo.test.ts @@ -1,15 +1,13 @@ import chai from 'chai' import SafeApiKit from '@safe-global/api-kit/index' import semverSatisfies from 'semver/functions/satisfies' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' let safeApiKit: SafeApiKit describe('getServiceSingletonsInfo', () => { before(async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() }) it('should call getServiceSingletonsInfo', async () => { diff --git a/packages/api-kit/tests/e2e/getToken.test.ts b/packages/api-kit/tests/e2e/getToken.test.ts index 693f37ca7..cd1c20046 100644 --- a/packages/api-kit/tests/e2e/getToken.test.ts +++ b/packages/api-kit/tests/e2e/getToken.test.ts @@ -2,7 +2,7 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import SafeApiKit from '@safe-global/api-kit/index' import config from '../utils/config' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' chai.use(chaiAsPromised) @@ -10,9 +10,7 @@ let safeApiKit: SafeApiKit describe('getToken', () => { before(async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() }) it('should fail if token address is empty', async () => { diff --git a/packages/api-kit/tests/e2e/getTokenList.test.ts b/packages/api-kit/tests/e2e/getTokenList.test.ts index 6115f76d5..c1e3bc68e 100644 --- a/packages/api-kit/tests/e2e/getTokenList.test.ts +++ b/packages/api-kit/tests/e2e/getTokenList.test.ts @@ -1,14 +1,12 @@ import chai from 'chai' import SafeApiKit from '@safe-global/api-kit/index' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' let safeApiKit: SafeApiKit describe('getTokenList', () => { before(async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() }) it('should return an array of tokens', async () => { diff --git a/packages/api-kit/tests/e2e/getTransaction.test.ts b/packages/api-kit/tests/e2e/getTransaction.test.ts index 50e39a98b..7d459fb3c 100644 --- a/packages/api-kit/tests/e2e/getTransaction.test.ts +++ b/packages/api-kit/tests/e2e/getTransaction.test.ts @@ -1,7 +1,7 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import SafeApiKit from '@safe-global/api-kit/index' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' chai.use(chaiAsPromised) @@ -9,9 +9,7 @@ let safeApiKit: SafeApiKit describe('getTransaction', () => { before(async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() }) it('should fail if safeTxHash is empty', async () => { diff --git a/packages/api-kit/tests/e2e/getTransactionConfirmations.test.ts b/packages/api-kit/tests/e2e/getTransactionConfirmations.test.ts index 5c8103fff..caf585c58 100644 --- a/packages/api-kit/tests/e2e/getTransactionConfirmations.test.ts +++ b/packages/api-kit/tests/e2e/getTransactionConfirmations.test.ts @@ -1,7 +1,7 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import SafeApiKit from '@safe-global/api-kit/index' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' chai.use(chaiAsPromised) @@ -9,9 +9,7 @@ let safeApiKit: SafeApiKit describe('getTransactionConfirmations', () => { before(async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() }) it('should fail if safeTxHash is empty', async () => { @@ -21,13 +19,6 @@ describe('getTransactionConfirmations', () => { .to.be.rejectedWith('Invalid safeTxHash') }) - it.skip('should return an empty array if the safeTxHash is not found', async () => { - const safeTxHash = '0x' - const transactionConfirmations = await safeApiKit.getTransactionConfirmations(safeTxHash) - chai.expect(transactionConfirmations.count).to.be.equal(0) - chai.expect(transactionConfirmations.results.length).to.be.equal(0) - }) - it('should return the transaction with the given safeTxHash', async () => { const safeTxHash = '0x317834aea988fd3cfa54fd8b2be2c96b4fd70a14d8c9470a7110576b01e6480a' const transactionConfirmations = await safeApiKit.getTransactionConfirmations(safeTxHash) diff --git a/packages/api-kit/tests/e2e/removeSafeDelegate.test.ts b/packages/api-kit/tests/e2e/removeSafeDelegate.test.ts index 4e642f21f..6c43b792a 100644 --- a/packages/api-kit/tests/e2e/removeSafeDelegate.test.ts +++ b/packages/api-kit/tests/e2e/removeSafeDelegate.test.ts @@ -1,20 +1,21 @@ -import { Signer } from 'ethers' +import { ethers, Signer } from 'ethers' import SafeApiKit, { DeleteSafeDelegateProps } from '@safe-global/api-kit/index' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import config from '../utils/config' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit } from '../utils/setupKits' chai.use(chaiAsPromised) +const PRIVATE_KEY = '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' + let safeApiKit: SafeApiKit let signer: Signer describe('removeSafeDelegate', () => { before(async () => { - ;({ safeApiKit, signer } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) + safeApiKit = getApiKit() + signer = new ethers.Wallet(PRIVATE_KEY) }) it('should fail if Safe delegate address is empty', async () => { diff --git a/packages/api-kit/tests/endpoint/index.test.ts b/packages/api-kit/tests/endpoint/index.test.ts index d621ee054..12b78c779 100644 --- a/packages/api-kit/tests/endpoint/index.test.ts +++ b/packages/api-kit/tests/endpoint/index.test.ts @@ -7,17 +7,18 @@ import SafeApiKit, { } from '@safe-global/api-kit/index' import * as httpRequests from '@safe-global/api-kit/utils/httpRequests' import Safe from '@safe-global/protocol-kit' -import { Eip1193Provider } from '@safe-global/safe-core-sdk-types' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import sinon from 'sinon' import sinonChai from 'sinon-chai' import config from '../utils/config' -import { getServiceClient } from '../utils/setupServiceClient' +import { getApiKit, getKits } from '../utils/setupKits' chai.use(chaiAsPromised) chai.use(sinonChai) +const PRIVATE_KEY_1 = '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' + const safeAddress = '0xF8ef84392f7542576F6b9d1b140334144930Ac78' const eip3770SafeAddress = `${config.EIP_3770_PREFIX}:${safeAddress}` const randomAddress = '0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0' @@ -29,21 +30,17 @@ const eip3770TokenAddress = `${config.EIP_3770_PREFIX}:${tokenAddress}` const safeTxHash = '0x317834aea988fd3cfa54fd8b2be2c96b4fd70a14d8c9470a7110576b01e6480a' const txServiceBaseUrl = 'https://safe-transaction-sepolia.safe.global/api' const defaultProvider = getDefaultProvider(config.JSON_RPC) -const signer = new Wallet( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676', - defaultProvider -) -let provider: Eip1193Provider +const signer = new Wallet(PRIVATE_KEY_1, defaultProvider) + +let protocolKit: Safe let safeApiKit: SafeApiKit let delegatorAddress: string let eip3770DelegatorAddress: string describe('Endpoint tests', () => { before(async () => { - ;({ safeApiKit, provider } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676' - )) - delegatorAddress = await signer.getAddress() + ;({ safeApiKit, protocolKit } = await getKits({ signer: PRIVATE_KEY_1, safeAddress })) + delegatorAddress = (await protocolKit.getSafeProvider().getSignerAddress()) || '0x' eip3770DelegatorAddress = `${config.EIP_3770_PREFIX}:${delegatorAddress}` }) @@ -364,12 +361,11 @@ describe('Endpoint tests', () => { } const origin = 'Safe Core SDK: Safe API Kit' const signerAddress = await signer.getAddress() - const safeSdk = await Safe.create({ provider, safeAddress }) - const safeTransaction = await safeSdk.createTransaction({ + const safeTransaction = await protocolKit.createTransaction({ transactions: [safeTransactionData], options }) - const senderSignature = await safeSdk.signHash(safeTxHash) + const senderSignature = await protocolKit.signHash(safeTxHash) await chai .expect( safeApiKit.proposeTransaction({ @@ -413,12 +409,11 @@ describe('Endpoint tests', () => { } const origin = 'Safe Core SDK: Safe API Kit' const signerAddress = await signer.getAddress() - const safeSdk = await Safe.create({ provider, safeAddress }) - const safeTransaction = await safeSdk.createTransaction({ + const safeTransaction = await protocolKit.createTransaction({ transactions: [safeTransactionData], options }) - const senderSignature = await safeSdk.signHash(safeTxHash) + const senderSignature = await protocolKit.signHash(safeTxHash) await chai .expect( safeApiKit.proposeTransaction({ @@ -651,12 +646,9 @@ describe('Endpoint tests', () => { const txServiceUrl = 'http://my-custom-tx-service.com/api' it('should can instantiate the SafeApiKit with a custom endpoint', async () => { - ;({ safeApiKit } = await getServiceClient( - '0x83a415ca62e11f5fa5567e98450d0f82ae19ff36ef876c10a8d448c788a53676', - txServiceUrl - )) + const apiKit = getApiKit(txServiceUrl) - await chai.expect(safeApiKit.getServiceInfo()).to.be.fulfilled + await chai.expect(apiKit.getServiceInfo()).to.be.fulfilled chai.expect(fetchData).to.have.been.calledWith({ url: `${txServiceUrl}/v1/about`, diff --git a/packages/api-kit/tests/utils/setupKits.ts b/packages/api-kit/tests/utils/setupKits.ts new file mode 100644 index 000000000..18052f3b4 --- /dev/null +++ b/packages/api-kit/tests/utils/setupKits.ts @@ -0,0 +1,61 @@ +import Safe, { SafeProviderConfig, Eip1193Provider } from '@safe-global/protocol-kit' +import SafeApiKit from '@safe-global/api-kit/index' +import { ethers, web3 } from 'hardhat' + +import config from './config' + +type GetKits = { + protocolKit: Safe + safeApiKit: SafeApiKit +} + +type GetKitsOptions = { + signer?: SafeProviderConfig['signer'] + txServiceUrl?: string + safeAddress: string +} + +function getEip1193Provider(): Eip1193Provider { + switch (process.env.ETH_LIB) { + case 'web3': + return web3.currentProvider as Eip1193Provider + case 'ethers': + return { + request: async (request) => { + return ethers.provider.send(request.method, [...((request.params as unknown[]) ?? [])]) + } + } + default: + throw new Error('Ethereum library not supported') + } +} + +export async function getProtocolKit({ + signer, + safeAddress +}: { + signer?: GetKitsOptions['signer'] + safeAddress: GetKitsOptions['safeAddress'] +}): Promise { + const provider = getEip1193Provider() + const protocolKit = await Safe.create({ provider, signer, safeAddress }) + + return protocolKit +} + +export function getApiKit(txServiceUrl?: GetKitsOptions['txServiceUrl']): SafeApiKit { + const safeApiKit = new SafeApiKit({ chainId: config.CHAIN_ID, txServiceUrl }) + + return safeApiKit +} + +export async function getKits({ + signer, + safeAddress, + txServiceUrl +}: GetKitsOptions): Promise { + const protocolKit = await getProtocolKit({ signer, safeAddress }) + const safeApiKit = getApiKit(txServiceUrl) + + return { protocolKit, safeApiKit } +} diff --git a/packages/api-kit/tests/utils/setupProvider.ts b/packages/api-kit/tests/utils/setupProvider.ts deleted file mode 100644 index c9a95f41b..000000000 --- a/packages/api-kit/tests/utils/setupProvider.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ethers, web3 } from 'hardhat' -import { Eip1193Provider } from '@safe-global/protocol-kit/types' - -export function getEip1193Provider(): Eip1193Provider { - switch (process.env.ETH_LIB) { - case 'web3': - return web3.currentProvider as Eip1193Provider - case 'ethers': - return { - request: async (request) => { - return ethers.provider.send(request.method, [...((request.params as unknown[]) ?? [])]) - } - } - default: - throw new Error('Ethereum library not supported') - } -} diff --git a/packages/api-kit/tests/utils/setupServiceClient.ts b/packages/api-kit/tests/utils/setupServiceClient.ts deleted file mode 100644 index fb302f7c9..000000000 --- a/packages/api-kit/tests/utils/setupServiceClient.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { getDefaultProvider, Wallet } from 'ethers' -import SafeApiKit from '@safe-global/api-kit/index' -import config from '../utils/config' -import { getEip1193Provider } from '../utils/setupProvider' -import { Eip1193Provider } from '@safe-global/protocol-kit/types' - -interface ServiceClientConfig { - safeApiKit: SafeApiKit - provider: Eip1193Provider - signer: Wallet -} - -export async function getServiceClient( - signerPk: string, - txServiceUrl?: string -): Promise { - const signer = new Wallet(signerPk, getDefaultProvider(config.JSON_RPC)) - const provider = getEip1193Provider() - const safeApiKit = new SafeApiKit({ chainId: config.CHAIN_ID, txServiceUrl }) - - return { safeApiKit, provider, signer } -} From 25f5555209511060bc89049f28c18021afc9f3b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 23 Apr 2024 17:54:20 +0200 Subject: [PATCH 049/112] Remove Ganache --- .github/workflows/test_contracts.yml | 2 +- packages/protocol-kit/hardhat.config.ts | 1 - packages/protocol-kit/package.json | 40 +++++++------------ .../protocol-kit/src/utils/eip-3770/config.ts | 6 +-- .../tests/e2e/utils/setupTestNetwork.ts | 17 +------- 5 files changed, 19 insertions(+), 47 deletions(-) diff --git a/.github/workflows/test_contracts.yml b/.github/workflows/test_contracts.yml index b7c0e614d..14fad70c2 100644 --- a/.github/workflows/test_contracts.yml +++ b/.github/workflows/test_contracts.yml @@ -26,4 +26,4 @@ jobs: - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | cd packages/protocol-kit - yarn test:hardhat:${{ matrix.provider }}:${{ matrix.contract-version }} + yarn test:${{ matrix.provider }}:${{ matrix.contract-version }} diff --git a/packages/protocol-kit/hardhat.config.ts b/packages/protocol-kit/hardhat.config.ts index 5ab637921..50c9f1bd3 100644 --- a/packages/protocol-kit/hardhat.config.ts +++ b/packages/protocol-kit/hardhat.config.ts @@ -49,7 +49,6 @@ const config: HardhatUserConfig = { blockGasLimit: 100000000, gas: 100000000, accounts: [ - // Same as ganache-cli -d { balance: '100000000000000000000', privateKey: '0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d' diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index b2f177a20..87b1a88df 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -12,31 +12,21 @@ "scripts": { "safe-deployments": "ts-node scripts/checkSafeDeployments.ts", "test": "mocha -r ts-node/register -r tsconfig-paths/register tests/unit/**/*.ts", - "test:ganache:web3:v1.0.0": "export TEST_NETWORK=ganache && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:web3:v1.1.1": "export TEST_NETWORK=ganache && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:web3:v1.2.0": "export TEST_NETWORK=ganache && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:web3:v1.3.0": "export TEST_NETWORK=ganache && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:web3:v1.4.1": "export TEST_NETWORK=ganache && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:ethers:v1.0.0": "export TEST_NETWORK=ganache && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:ethers:v1.1.1": "export TEST_NETWORK=ganache && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:ethers:v1.2.0": "export TEST_NETWORK=ganache && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:ethers:v1.3.0": "export TEST_NETWORK=ganache && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:ethers:v1.4.1": "export TEST_NETWORK=ganache && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && hardhat deploy && nyc hardhat test", - "test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:web3:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:web3:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && hardhat deploy && nyc hardhat test", - "test:hardhat:ethers:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:ethers:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && hardhat deploy && nyc hardhat test", - "test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:ethers:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && hardhat deploy && nyc hardhat test", - "test:hardhat:viem:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:viem:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && hardhat deploy && nyc hardhat test", - "test:hardhat:viem:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:viem:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && hardhat deploy && nyc hardhat test", - "test:hardhat:viem:v1.4.1": "export TEST_NETWORK=hardhat && export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && hardhat deploy && nyc hardhat test", + "test:web3:v1.0.0": "export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && hardhat deploy && nyc hardhat test", + "test:web3:v1.1.1": "export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && hardhat deploy && nyc hardhat test", + "test:web3:v1.2.0": "export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && hardhat deploy && nyc hardhat test", + "test:web3:v1.3.0": "export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && hardhat deploy && nyc hardhat test", + "test:web3:v1.4.1": "export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && hardhat deploy && nyc hardhat test", + "test:ethers:v1.0.0": "export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && hardhat deploy && nyc hardhat test", + "test:ethers:v1.1.1": "export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && hardhat deploy && nyc hardhat test", + "test:ethers:v1.2.0": "export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && hardhat deploy && nyc hardhat test", + "test:ethers:v1.3.0": "export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && hardhat deploy && nyc hardhat test", + "test:ethers:v1.4.1": "export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && hardhat deploy && nyc hardhat test", + "test:viem:v1.0.0": "export ETH_LIB=viem && export SAFE_VERSION=1.0.0 && hardhat deploy && nyc hardhat test", + "test:viem:v1.1.1": "export ETH_LIB=viem && export SAFE_VERSION=1.1.1 && hardhat deploy && nyc hardhat test", + "test:viem:v1.2.0": "export ETH_LIB=viem && export SAFE_VERSION=1.2.0 && hardhat deploy && nyc hardhat test", + "test:viem:v1.3.0": "export ETH_LIB=viem && export SAFE_VERSION=1.3.0 && hardhat deploy && nyc hardhat test", + "test:viem:v1.4.1": "export ETH_LIB=viem && export SAFE_VERSION=1.4.1 && hardhat deploy && nyc hardhat test", "coverage": "nyc report --reporter=lcov", "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", diff --git a/packages/protocol-kit/src/utils/eip-3770/config.ts b/packages/protocol-kit/src/utils/eip-3770/config.ts index fda3b3e01..e35adc0a8 100644 --- a/packages/protocol-kit/src/utils/eip-3770/config.ts +++ b/packages/protocol-kit/src/utils/eip-3770/config.ts @@ -207,8 +207,4 @@ export const networks: NetworkShortName[] = [ { chainId: 11297108109n, shortName: 'palm' } ] -if (process.env.TEST_NETWORK === 'hardhat') { - networks.push({ shortName: 'local', chainId: 31337n }) -} else if (process.env.TEST_NETWORK === 'ganache') { - networks.push({ shortName: 'local', chainId: 1337n }) -} +networks.push({ shortName: 'local', chainId: 31337n }) diff --git a/packages/protocol-kit/tests/e2e/utils/setupTestNetwork.ts b/packages/protocol-kit/tests/e2e/utils/setupTestNetwork.ts index 8e08c7cb0..43455ad0d 100644 --- a/packages/protocol-kit/tests/e2e/utils/setupTestNetwork.ts +++ b/packages/protocol-kit/tests/e2e/utils/setupTestNetwork.ts @@ -1,22 +1,10 @@ import { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers' -import { ethers, Web3 } from 'hardhat' +import { ethers } from 'hardhat' interface Account { signer: HardhatEthersSigner address: string } -async function getGanacheAccounts(): Promise { - const web3 = new Web3('http://localhost:8545') - const provider = new ethers.BrowserProvider(web3.currentProvider as any) - const accounts: Account[] = [] - for (let i = 0; i < 10; i++) { - const signer = provider.getSigner(i) - const account: Account = { signer, address: await signer.getAddress() } - accounts.push(account) - } - return accounts -} - async function getHardhatAccounts(): Promise { const wallets = await ethers.getSigners() @@ -32,7 +20,6 @@ async function getHardhatAccounts(): Promise { } export async function getAccounts(): Promise { - const accounts = - process.env.TEST_NETWORK === 'ganache' ? await getGanacheAccounts() : await getHardhatAccounts() + const accounts = await getHardhatAccounts() return accounts } From 125d56b12d874b97f435efbc6bfd21ad4a6fe2e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 23 Apr 2024 22:27:45 +0200 Subject: [PATCH 050/112] Remove ganache --- packages/protocol-kit/hardhat.config.ts | 1 - packages/protocol-kit/package.json | 10 ---------- .../protocol-kit/src/utils/eip-3770/config.ts | 2 -- .../tests/e2e/utils/setupTestNetwork.ts | 17 ++--------------- 4 files changed, 2 insertions(+), 28 deletions(-) diff --git a/packages/protocol-kit/hardhat.config.ts b/packages/protocol-kit/hardhat.config.ts index 5ab637921..50c9f1bd3 100644 --- a/packages/protocol-kit/hardhat.config.ts +++ b/packages/protocol-kit/hardhat.config.ts @@ -49,7 +49,6 @@ const config: HardhatUserConfig = { blockGasLimit: 100000000, gas: 100000000, accounts: [ - // Same as ganache-cli -d { balance: '100000000000000000000', privateKey: '0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d' diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index b2f177a20..f8b362031 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -12,16 +12,6 @@ "scripts": { "safe-deployments": "ts-node scripts/checkSafeDeployments.ts", "test": "mocha -r ts-node/register -r tsconfig-paths/register tests/unit/**/*.ts", - "test:ganache:web3:v1.0.0": "export TEST_NETWORK=ganache && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:web3:v1.1.1": "export TEST_NETWORK=ganache && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:web3:v1.2.0": "export TEST_NETWORK=ganache && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:web3:v1.3.0": "export TEST_NETWORK=ganache && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:web3:v1.4.1": "export TEST_NETWORK=ganache && export ETH_LIB=web3 && export SAFE_VERSION=1.4.1 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:ethers:v1.0.0": "export TEST_NETWORK=ganache && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:ethers:v1.1.1": "export TEST_NETWORK=ganache && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:ethers:v1.2.0": "export TEST_NETWORK=ganache && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:ethers:v1.3.0": "export TEST_NETWORK=ganache && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", - "test:ganache:ethers:v1.4.1": "export TEST_NETWORK=ganache && export ETH_LIB=ethers && export SAFE_VERSION=1.4.1 && hardhat --network localhost deploy && nyc hardhat --network localhost test", "test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && hardhat deploy && nyc hardhat test", "test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && hardhat deploy && nyc hardhat test", "test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && hardhat deploy && nyc hardhat test", diff --git a/packages/protocol-kit/src/utils/eip-3770/config.ts b/packages/protocol-kit/src/utils/eip-3770/config.ts index fda3b3e01..f4909daef 100644 --- a/packages/protocol-kit/src/utils/eip-3770/config.ts +++ b/packages/protocol-kit/src/utils/eip-3770/config.ts @@ -209,6 +209,4 @@ export const networks: NetworkShortName[] = [ if (process.env.TEST_NETWORK === 'hardhat') { networks.push({ shortName: 'local', chainId: 31337n }) -} else if (process.env.TEST_NETWORK === 'ganache') { - networks.push({ shortName: 'local', chainId: 1337n }) } diff --git a/packages/protocol-kit/tests/e2e/utils/setupTestNetwork.ts b/packages/protocol-kit/tests/e2e/utils/setupTestNetwork.ts index 8e08c7cb0..43455ad0d 100644 --- a/packages/protocol-kit/tests/e2e/utils/setupTestNetwork.ts +++ b/packages/protocol-kit/tests/e2e/utils/setupTestNetwork.ts @@ -1,22 +1,10 @@ import { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers' -import { ethers, Web3 } from 'hardhat' +import { ethers } from 'hardhat' interface Account { signer: HardhatEthersSigner address: string } -async function getGanacheAccounts(): Promise { - const web3 = new Web3('http://localhost:8545') - const provider = new ethers.BrowserProvider(web3.currentProvider as any) - const accounts: Account[] = [] - for (let i = 0; i < 10; i++) { - const signer = provider.getSigner(i) - const account: Account = { signer, address: await signer.getAddress() } - accounts.push(account) - } - return accounts -} - async function getHardhatAccounts(): Promise { const wallets = await ethers.getSigners() @@ -32,7 +20,6 @@ async function getHardhatAccounts(): Promise { } export async function getAccounts(): Promise { - const accounts = - process.env.TEST_NETWORK === 'ganache' ? await getGanacheAccounts() : await getHardhatAccounts() + const accounts = await getHardhatAccounts() return accounts } From 48e2788c4d763d0efd67d3125294061bb94792d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 23 Apr 2024 22:30:46 +0200 Subject: [PATCH 051/112] Add hardhat again to e2e --- .github/workflows/test_contracts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_contracts.yml b/.github/workflows/test_contracts.yml index 14fad70c2..b7c0e614d 100644 --- a/.github/workflows/test_contracts.yml +++ b/.github/workflows/test_contracts.yml @@ -26,4 +26,4 @@ jobs: - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | cd packages/protocol-kit - yarn test:${{ matrix.provider }}:${{ matrix.contract-version }} + yarn test:hardhat:${{ matrix.provider }}:${{ matrix.contract-version }} From 4396c77deb6f09b63b319ff12924ab6d21c7ceb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 23 Apr 2024 23:20:17 +0200 Subject: [PATCH 052/112] Remove web3 specific related tests --- .../protocol-kit/tests/e2e/execution.test.ts | 45 +++---------------- .../tests/e2e/offChainSignatures.test.ts | 44 ------------------ .../tests/e2e/utils/transactions.ts | 17 ++----- 3 files changed, 11 insertions(+), 95 deletions(-) diff --git a/packages/protocol-kit/tests/e2e/execution.test.ts b/packages/protocol-kit/tests/e2e/execution.test.ts index 9e8e8e998..fa9e6f85c 100644 --- a/packages/protocol-kit/tests/e2e/execution.test.ts +++ b/packages/protocol-kit/tests/e2e/execution.test.ts @@ -1,10 +1,10 @@ import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' -import Safe, { +import Safe, { SigningMethod } from '@safe-global/protocol-kit/index' +import { EthersTransactionOptions, - SigningMethod, - Web3TransactionOptions -} from '@safe-global/protocol-kit/index' -import { MetaTransactionData, TransactionOptions } from '@safe-global/safe-core-sdk-types' + MetaTransactionData, + TransactionOptions +} from '@safe-global/safe-core-sdk-types' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' @@ -674,7 +674,7 @@ describe('Transactions execution', () => { ) itif(process.env.ETH_LIB === 'web3')( - 'should execute a transaction with options: { gas }', + 'should execute a transaction with options: { gasPrice }', async () => { const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts @@ -695,37 +695,7 @@ describe('Transactions execution', () => { data: '0x' } const tx = await safeSdk1.createTransaction({ transactions: [safeTransactionData] }) - const execOptions: Web3TransactionOptions = { gas: 123456 } - const txResponse = await safeSdk1.executeTransaction(tx, execOptions) - await waitSafeTxReceipt(txResponse) - const txConfirmed = await safeSdk1.getSafeProvider().getTransaction(txResponse.hash) - chai.expect(execOptions.gas).to.be.eq(txConfirmed.gas) - } - ) - - itif(process.env.ETH_LIB === 'web3')( - 'should execute a transaction with options: { gas, gasPrice }', - async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) - const safeAddress = await safe.getAddress() - const safeSdk1 = await Safe.create({ - provider, - safeAddress, - contractNetworks - }) - await account1.signer.sendTransaction({ - to: safeAddress, - value: 1_000_000_000_000_000_000n // 1 ETH - }) - const safeTransactionData = { - to: account2.address, - value: '500000000000000000', // 0.5 ETH - data: '0x' - } - const tx = await safeSdk1.createTransaction({ transactions: [safeTransactionData] }) - const execOptions: Web3TransactionOptions = { + const execOptions = { gas: 123456, gasPrice: 170000000 } @@ -733,7 +703,6 @@ describe('Transactions execution', () => { await waitSafeTxReceipt(txResponse) const txConfirmed = await safeSdk1.getSafeProvider().getTransaction(txResponse.hash) chai.expect(execOptions.gasPrice).to.be.eq(Number(txConfirmed.gasPrice)) - chai.expect(execOptions.gas).to.be.eq(txConfirmed.gas) } ) diff --git a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts index ee25bdb90..00bc18932 100644 --- a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts @@ -238,28 +238,6 @@ describe('Off-chain signatures', () => { } ) - itif(process.env.ETH_LIB === 'web3')( - 'should fail if the signature of the current signer is added using eth_signTypedData with web3 provider', - async () => { - const { safe, contractNetworks, provider } = await setupTests() - const safeAddress = await safe.getAddress() - const safeSdk = await Safe.create({ - provider, - safeAddress, - contractNetworks - }) - const safeTransactionData = { - to: safeAddress, - value: '0', - data: '0x' - } - const tx = await safeSdk.createTransaction({ transactions: [safeTransactionData] }) - await chai - .expect(safeSdk.signTransaction(tx, SigningMethod.ETH_SIGN_TYPED_DATA)) - .to.be.rejectedWith("EIP-712 is not supported by user's wallet") - } - ) - itif(process.env.ETH_LIB === 'ethers')( 'should add the signature of the current signer using eth_signTypedData_v3 with ethers provider', async () => { @@ -283,28 +261,6 @@ describe('Off-chain signatures', () => { } ) - itif(process.env.ETH_LIB === 'web3')( - 'should fail if the signature of the current signer is added using eth_signTypedData_v3 with web3 provider', - async () => { - const { safe, contractNetworks, provider } = await setupTests() - const safeAddress = await safe.getAddress() - const safeSdk = await Safe.create({ - provider, - safeAddress, - contractNetworks - }) - const safeTransactionData = { - to: safeAddress, - value: '0', - data: '0x' - } - const tx = await safeSdk.createTransaction({ transactions: [safeTransactionData] }) - await chai - .expect(safeSdk.signTransaction(tx, SigningMethod.ETH_SIGN_TYPED_DATA_V3)) - .to.be.rejectedWith("EIP-712 is not supported by user's wallet") - } - ) - it('should add the signature of the current signer using eth_signTypedData_v4', async () => { const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() diff --git a/packages/protocol-kit/tests/e2e/utils/transactions.ts b/packages/protocol-kit/tests/e2e/utils/transactions.ts index c3f9a7a62..27265dbd1 100644 --- a/packages/protocol-kit/tests/e2e/utils/transactions.ts +++ b/packages/protocol-kit/tests/e2e/utils/transactions.ts @@ -1,22 +1,13 @@ import { ContractTransactionReceipt } from 'ethers' import { TransactionResult } from '@safe-global/safe-core-sdk-types' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' -import { TransactionReceipt } from 'web3-core/types' export async function waitSafeTxReceipt( txResult: TransactionResult -): Promise { - const receipt: ContractTransactionReceipt | TransactionReceipt | undefined = txResult.promiEvent - ? await new Promise( - (resolve, reject) => - txResult.promiEvent && - txResult.promiEvent - .on('confirmation', (_confirmationNumber: any, receipt: TransactionReceipt) => - resolve(receipt) - ) - .catch(reject) - ) - : txResult.transactionResponse && (await txResult.transactionResponse.wait()) +): Promise { + const receipt: ContractTransactionReceipt | null | undefined = + txResult.transactionResponse && (await txResult.transactionResponse.wait()) + return receipt } From ae0b9d4eb05f569f6301d8564c4851435d1fc432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 24 Apr 2024 09:18:46 +0200 Subject: [PATCH 053/112] Remove web3 gas options --- packages/protocol-kit/src/Safe.ts | 7 +- packages/protocol-kit/src/SafeFactory.ts | 4 - packages/safe-core-sdk-types/package.json | 3 +- packages/safe-core-sdk-types/src/types.ts | 5 +- yarn.lock | 279 +--------------------- 5 files changed, 7 insertions(+), 291 deletions(-) diff --git a/packages/protocol-kit/src/Safe.ts b/packages/protocol-kit/src/Safe.ts index cd78d61f4..2a825ae71 100644 --- a/packages/protocol-kit/src/Safe.ts +++ b/packages/protocol-kit/src/Safe.ts @@ -813,9 +813,7 @@ class Safe { if (!addressIsOwner) { throw new Error('Transaction hashes can only be approved by Safe owners') } - if (options?.gas && options?.gasLimit) { - throw new Error('Cannot specify gas and gasLimit together in transaction options') - } + // TODO: fix this return this.#contractManager.safeContract.approveHash(hash, { from: signerAddress, @@ -1235,9 +1233,6 @@ class Safe { } } - if (options?.gas && options?.gasLimit) { - throw new Error('Cannot specify gas and gasLimit together in transaction options') - } const txResponse = await this.#contractManager.safeContract.execTransaction( signedSafeTransaction, { diff --git a/packages/protocol-kit/src/SafeFactory.ts b/packages/protocol-kit/src/SafeFactory.ts index d62a8513d..fe4f26570 100644 --- a/packages/protocol-kit/src/SafeFactory.ts +++ b/packages/protocol-kit/src/SafeFactory.ts @@ -176,10 +176,6 @@ class SafeFactory { customContracts }) - if (options?.gas && options?.gasLimit) { - throw new Error('Cannot specify gas and gasLimit together in transaction options') - } - const safeAddress = await this.#safeProxyFactoryContract.createProxyWithOptions({ safeSingletonAddress: await this.#safeContract.getAddress(), initializer, diff --git a/packages/safe-core-sdk-types/package.json b/packages/safe-core-sdk-types/package.json index 5135faabb..e5cab6681 100644 --- a/packages/safe-core-sdk-types/package.json +++ b/packages/safe-core-sdk-types/package.json @@ -30,8 +30,7 @@ "homepage": "https://github.com/safe-global/safe-core-sdk#readme", "dependencies": { "@safe-global/safe-deployments": "^1.34.0", - "ethers": "^6.7.1", - "web3-core": "^1.10.3" + "ethers": "^6.7.1" }, "devDependencies": { "abitype": "^1.0.2" diff --git a/packages/safe-core-sdk-types/src/types.ts b/packages/safe-core-sdk-types/src/types.ts index b32e6b0d5..b08a521a4 100644 --- a/packages/safe-core-sdk-types/src/types.ts +++ b/packages/safe-core-sdk-types/src/types.ts @@ -1,5 +1,4 @@ import { ContractTransactionResponse } from 'ethers' -import { PromiEvent, TransactionReceipt } from 'web3-core/types' export type SafeVersion = '1.4.1' | '1.3.0' | '1.2.0' | '1.1.1' | '1.0.0' @@ -86,7 +85,6 @@ interface TransactionBase { export interface TransactionOptions { from?: string - gas?: number | string gasLimit?: number | string gasPrice?: number | string maxFeePerGas?: number | string @@ -99,8 +97,7 @@ export interface BaseTransactionResult { } export interface TransactionResult extends BaseTransactionResult { - promiEvent?: PromiEvent - transactionResponse?: ContractTransactionResponse + transactionResponse: ContractTransactionResponse options?: TransactionOptions } diff --git a/yarn.lock b/yarn.lock index 6cce3398c..0f13a03b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -740,7 +740,7 @@ "@ethersproject/constants" "^5.7.0" "@ethersproject/logger" "^5.7.0" -"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.6.2", "@ethersproject/transactions@^5.7.0": +"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz" integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== @@ -2243,7 +2243,7 @@ dependencies: bignumber.js "*" -"@types/bn.js@*", "@types/bn.js@^5.1.0", "@types/bn.js@^5.1.1": +"@types/bn.js@*", "@types/bn.js@^5.1.0": version "5.1.1" resolved "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz" integrity sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g== @@ -2369,11 +2369,6 @@ resolved "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz" integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q== -"@types/node@^12.12.6": - version "12.20.55" - resolved "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz" - integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== - "@types/normalize-package-data@^2.4.0": version "2.4.1" resolved "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz" @@ -2649,11 +2644,6 @@ abort-controller@^3.0.0: dependencies: event-target-shim "^5.0.0" -abortcontroller-polyfill@^1.7.5: - version "1.7.5" - resolved "https://registry.npmjs.org/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz" - integrity sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ== - abstract-level@^1.0.0, abstract-level@^1.0.2, abstract-level@^1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/abstract-level/-/abstract-level-1.0.3.tgz" @@ -3030,7 +3020,7 @@ bigint-crypto-utils@^3.0.23: resolved "https://registry.npmjs.org/bigint-crypto-utils/-/bigint-crypto-utils-3.2.2.tgz" integrity sha512-U1RbE3aX9ayCUVcIPHuPDPKcK3SFOXf93J1UK/iHlJuQB7bhagPIX06/CLpLEsDThJ7KA4Dhrnzynl+d2weTiw== -bignumber.js@*, bignumber.js@^9.0.0, bignumber.js@^9.1.2: +bignumber.js@*, bignumber.js@^9.1.2: version "9.1.2" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== @@ -3054,11 +3044,6 @@ blakejs@^1.1.0: resolved "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz" integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== -bn.js@4.11.6: - version "4.11.6" - resolved "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz" - integrity sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA== - bn.js@^4.11.0, bn.js@^4.11.8, bn.js@^4.11.9: version "4.12.0" resolved "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz" @@ -3201,13 +3186,6 @@ buffer@^6.0.3: base64-js "^1.3.1" ieee754 "^1.2.1" -bufferutil@^4.0.1: - version "4.0.8" - resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.8.tgz#1de6a71092d65d7766c4d8a522b261a6e787e8ea" - integrity sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw== - dependencies: - node-gyp-build "^4.3.0" - builtins@^1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz" @@ -3851,14 +3829,6 @@ cssstyle@^2.3.0: dependencies: cssom "~0.3.6" -d@1, d@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/d/-/d-1.0.1.tgz" - integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== - dependencies: - es5-ext "^0.10.50" - type "^1.0.1" - dargs@^7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz" @@ -3885,13 +3855,6 @@ debug@4, debug@4.3.4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3, de dependencies: ms "2.1.2" -debug@^2.2.0: - version "2.6.9" - resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - decamelize-keys@^1.1.0: version "1.1.1" resolved "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz" @@ -4200,42 +4163,11 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es5-ext@^0.10.35, es5-ext@^0.10.50: - version "0.10.62" - resolved "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz" - integrity sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA== - dependencies: - es6-iterator "^2.0.3" - es6-symbol "^3.1.3" - next-tick "^1.1.0" - es6-error@^4.0.1: version "4.1.1" resolved "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz" integrity sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg== -es6-iterator@^2.0.3: - version "2.0.3" - resolved "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz" - integrity sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g== - dependencies: - d "1" - es5-ext "^0.10.35" - es6-symbol "^3.1.1" - -es6-promise@^4.2.8: - version "4.2.8" - resolved "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz" - integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== - -es6-symbol@^3.1.1, es6-symbol@^3.1.3: - version "3.1.3" - resolved "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz" - integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== - dependencies: - d "^1.0.1" - ext "^1.1.2" - escalade@^3.1.1: version "3.1.1" resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz" @@ -4384,13 +4316,6 @@ eth-testing@^1.14.0: abitype "^0.1.6" ethers "^5.5.4" -ethereum-bloom-filters@^1.0.6: - version "1.0.10" - resolved "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz" - integrity sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA== - dependencies: - js-sha3 "^0.8.0" - ethereum-cryptography@0.1.3, ethereum-cryptography@^0.1.3: version "0.1.3" resolved "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz" @@ -4526,14 +4451,6 @@ ethers@^6.7.1, ethers@^6.8.1: tslib "2.4.0" ws "8.5.0" -ethjs-unit@0.1.6: - version "0.1.6" - resolved "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz" - integrity sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw== - dependencies: - bn.js "4.11.6" - number-to-bn "1.7.0" - ethjs-util@0.1.6, ethjs-util@^0.1.6: version "0.1.6" resolved "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz" @@ -4547,11 +4464,6 @@ event-target-shim@^5.0.0: resolved "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz" integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== -eventemitter3@4.0.4: - version "4.0.4" - resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.4.tgz" - integrity sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ== - eventemitter3@^4.0.4: version "4.0.7" resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz" @@ -4636,13 +4548,6 @@ expect@^29.0.0, expect@^29.7.0: jest-message-util "^29.7.0" jest-util "^29.7.0" -ext@^1.1.2: - version "1.7.0" - resolved "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz" - integrity sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw== - dependencies: - type "^2.7.2" - external-editor@^3.0.3: version "3.1.0" resolved "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz" @@ -5412,11 +5317,6 @@ http-errors@2.0.0: statuses "2.0.1" toidentifier "1.0.1" -http-https@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz" - integrity sha512-o0PWwVCSp3O0wS6FvNr6xfBCHgt0m1tvPLFOCc2iFDKTRAXhB7m8klDf7ErowFH8POa6dVdGatKU5I1YYwzUyg== - http-proxy-agent@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz" @@ -6326,7 +6226,7 @@ js-sdsl@^4.1.4: resolved "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.0.tgz" integrity sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg== -js-sha3@0.8.0, js-sha3@^0.8.0: +js-sha3@0.8.0: version "0.8.0" resolved "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz" integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== @@ -7236,11 +7136,6 @@ module-error@^1.0.1, module-error@^1.0.2: resolved "https://registry.npmjs.org/module-error/-/module-error-1.0.2.tgz" integrity sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA== -ms@2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz" - integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== - ms@2.1.2: version "2.1.2" resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" @@ -7311,11 +7206,6 @@ neo-async@^2.6.0: resolved "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -next-tick@^1.1.0: - version "1.1.0" - resolved "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz" - integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== - nise@^5.1.2: version "5.1.4" resolved "https://registry.npmjs.org/nise/-/nise-5.1.4.tgz" @@ -7550,14 +7440,6 @@ npmlog@^6.0.0, npmlog@^6.0.2: gauge "^4.0.3" set-blocking "^2.0.0" -number-to-bn@1.7.0: - version "1.7.0" - resolved "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz" - integrity sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig== - dependencies: - bn.js "4.11.6" - strip-hex-prefix "1.0.0" - nwsapi@^2.2.2: version "2.2.4" resolved "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.4.tgz" @@ -7669,13 +7551,6 @@ oblivious-set@1.1.1: resolved "https://registry.npmjs.org/oblivious-set/-/oblivious-set-1.1.1.tgz" integrity sha512-Oh+8fK09mgGmAshFdH6hSVco6KZmd1tTwNFWj35OvzdmJTMZtAkbn05zar2iG3v6sDs1JLEtOiBGNb6BHwkb2w== -oboe@2.1.5: - version "2.1.5" - resolved "https://registry.npmjs.org/oboe/-/oboe-2.1.5.tgz" - integrity sha512-zRFWiF+FoicxEs3jNI/WYUrVEgA7DeET/InK0XQuudGHRg8iIob3cNPrJTKaz4004uaA9Pbe+Dwa8iluhjLZWA== - dependencies: - http-https "^1.0.0" - once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" @@ -9375,16 +9250,6 @@ type-fest@^1.0.2: resolved "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz" integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA== -type@^1.0.1: - version "1.2.0" - resolved "https://registry.npmjs.org/type/-/type-1.2.0.tgz" - integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== - -type@^2.7.2: - version "2.7.2" - resolved "https://registry.npmjs.org/type/-/type-2.7.2.tgz" - integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw== - typedarray-to-buffer@^3.1.5: version "3.1.5" resolved "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz" @@ -9510,18 +9375,6 @@ url-parse@^1.5.3: querystringify "^2.1.1" requires-port "^1.0.0" -utf-8-validate@^5.0.2: - version "5.0.10" - resolved "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz" - integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ== - dependencies: - node-gyp-build "^4.3.0" - -utf8@3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz" - integrity sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ== - util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" @@ -9624,64 +9477,6 @@ wcwidth@^1.0.0, wcwidth@^1.0.1: dependencies: defaults "^1.0.3" -web3-core-helpers@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.10.3.tgz" - integrity sha512-Yv7dQC3B9ipOc5sWm3VAz1ys70Izfzb8n9rSiQYIPjpqtJM+3V4EeK6ghzNR6CO2es0+Yu9CtCkw0h8gQhrTxA== - dependencies: - web3-eth-iban "1.10.3" - web3-utils "1.10.3" - -web3-core-method@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.10.3.tgz" - integrity sha512-VZ/Dmml4NBmb0ep5PTSg9oqKoBtG0/YoMPei/bq/tUdlhB2dMB79sbeJPwx592uaV0Vpk7VltrrrBv5hTM1y4Q== - dependencies: - "@ethersproject/transactions" "^5.6.2" - web3-core-helpers "1.10.3" - web3-core-promievent "1.10.3" - web3-core-subscriptions "1.10.3" - web3-utils "1.10.3" - -web3-core-promievent@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.10.3.tgz" - integrity sha512-HgjY+TkuLm5uTwUtaAfkTgRx/NzMxvVradCi02gy17NxDVdg/p6svBHcp037vcNpkuGeFznFJgULP+s2hdVgUQ== - dependencies: - eventemitter3 "4.0.4" - -web3-core-requestmanager@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.10.3.tgz" - integrity sha512-VT9sKJfgM2yBOIxOXeXiDuFMP4pxzF6FT+y8KTLqhDFHkbG3XRe42Vm97mB/IvLQCJOmokEjl3ps8yP1kbggyw== - dependencies: - util "^0.12.5" - web3-core-helpers "1.10.3" - web3-providers-http "1.10.3" - web3-providers-ipc "1.10.3" - web3-providers-ws "1.10.3" - -web3-core-subscriptions@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.10.3.tgz" - integrity sha512-KW0Mc8sgn70WadZu7RjQ4H5sNDJ5Lx8JMI3BWos+f2rW0foegOCyWhRu33W1s6ntXnqeBUw5rRCXZRlA3z+HNA== - dependencies: - eventemitter3 "4.0.4" - web3-core-helpers "1.10.3" - -web3-core@^1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-core/-/web3-core-1.10.3.tgz" - integrity sha512-Vbk0/vUNZxJlz3RFjAhNNt7qTpX8yE3dn3uFxfX5OHbuon5u65YEOd3civ/aQNW745N0vGUlHFNxxmn+sG9DIw== - dependencies: - "@types/bn.js" "^5.1.1" - "@types/node" "^12.12.6" - bignumber.js "^9.0.0" - web3-core-helpers "1.10.3" - web3-core-method "1.10.3" - web3-core-requestmanager "1.10.3" - web3-utils "1.10.3" - web3-core@^4.3.0, web3-core@^4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-4.3.2.tgz#f24b11d6a57dee527de8d42c89de2a439f0c4bed" @@ -9757,14 +9552,6 @@ web3-eth-ens@^4.2.0: web3-utils "^4.2.2" web3-validator "^2.0.5" -web3-eth-iban@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.10.3.tgz" - integrity sha512-ZCfOjYKAjaX2TGI8uif5ah+J3BYFuo+47JOIV1RIz2l7kD9VfnxvRH5UiQDRyMALQC7KFd2hUqIEtHklapNyKA== - dependencies: - bn.js "^5.2.1" - web3-utils "1.10.3" - web3-eth-iban@^4.0.7: version "4.0.7" resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-4.0.7.tgz#ee504f845d7b6315f0be78fcf070ccd5d38e4aaf" @@ -9814,16 +9601,6 @@ web3-net@^4.0.7: web3-types "^1.3.0" web3-utils "^4.0.7" -web3-providers-http@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.10.3.tgz" - integrity sha512-6dAgsHR3MxJ0Qyu3QLFlQEelTapVfWNTu5F45FYh8t7Y03T1/o+YAkVxsbY5AdmD+y5bXG/XPJ4q8tjL6MgZHw== - dependencies: - abortcontroller-polyfill "^1.7.5" - cross-fetch "^4.0.0" - es6-promise "^4.2.8" - web3-core-helpers "1.10.3" - web3-providers-http@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-4.1.0.tgz#8d7afda67d1d8542ca85b30f60a3d1fe1993b561" @@ -9834,14 +9611,6 @@ web3-providers-http@^4.1.0: web3-types "^1.3.0" web3-utils "^4.0.7" -web3-providers-ipc@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.10.3.tgz" - integrity sha512-vP5WIGT8FLnGRfswTxNs9rMfS1vCbMezj/zHbBe/zB9GauBRTYVrUo2H/hVrhLg8Ut7AbsKZ+tCJ4mAwpKi2hA== - dependencies: - oboe "2.1.5" - web3-core-helpers "1.10.3" - web3-providers-ipc@^4.0.7: version "4.0.7" resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-4.0.7.tgz#9ec4c8565053af005a5170ba80cddeb40ff3e3d3" @@ -9851,15 +9620,6 @@ web3-providers-ipc@^4.0.7: web3-types "^1.3.0" web3-utils "^4.0.7" -web3-providers-ws@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.10.3.tgz" - integrity sha512-/filBXRl48INxsh6AuCcsy4v5ndnTZ/p6bl67kmO9aK1wffv7CT++DrtclDtVMeDGCgB3van+hEf9xTAVXur7Q== - dependencies: - eventemitter3 "4.0.4" - web3-core-helpers "1.10.3" - websocket "^1.0.32" - web3-providers-ws@^4.0.7: version "4.0.7" resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-4.0.7.tgz#7a78a0dcf077e0e802da524fbb37d080b356c14b" @@ -9886,20 +9646,6 @@ web3-types@^1.3.0, web3-types@^1.3.1, web3-types@^1.5.0, web3-types@^1.6.0: resolved "https://registry.yarnpkg.com/web3-types/-/web3-types-1.6.0.tgz#ebe7f140c31f7cc0ad15f238ad7e7ac72797ff3b" integrity sha512-qgOtADqlD5hw+KPKBUGaXAcdNLL0oh6qTeVgXwewCfbL/lG9R+/GrgMQB1gbTJ3cit8hMwtH8KX2Em6OwO0HRw== -web3-utils@1.10.3: - version "1.10.3" - resolved "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.3.tgz" - integrity sha512-OqcUrEE16fDBbGoQtZXWdavsPzbGIDc5v3VrRTZ0XrIpefC/viZ1ZU9bGEemazyS0catk/3rkOOxpzTfY+XsyQ== - dependencies: - "@ethereumjs/util" "^8.1.0" - bn.js "^5.2.1" - ethereum-bloom-filters "^1.0.6" - ethereum-cryptography "^2.1.2" - ethjs-unit "0.1.6" - number-to-bn "1.7.0" - randombytes "^2.1.0" - utf8 "3.0.0" - web3-utils@^4.0.7, web3-utils@^4.1.0, web3-utils@^4.2.2, web3-utils@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-4.2.3.tgz#e1d30c4b087cd95f4307baeb80e3160f174e1cfd" @@ -9954,18 +9700,6 @@ webidl-conversions@^7.0.0: resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz" integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== -websocket@^1.0.32: - version "1.0.34" - resolved "https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz" - integrity sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ== - dependencies: - bufferutil "^4.0.1" - debug "^2.2.0" - es5-ext "^0.10.50" - typedarray-to-buffer "^3.1.5" - utf-8-validate "^5.0.2" - yaeti "^0.0.6" - whatwg-encoding@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz" @@ -10209,11 +9943,6 @@ y18n@^5.0.5: resolved "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== -yaeti@^0.0.6: - version "0.0.6" - resolved "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz" - integrity sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug== - yallist@^3.0.2: version "3.1.1" resolved "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz" From 00442fd19abcebe689911aa83f649b5964baace9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 24 Apr 2024 09:47:01 +0200 Subject: [PATCH 054/112] Remove test --- .../protocol-kit/tests/e2e/execution.test.ts | 32 +------------------ 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/packages/protocol-kit/tests/e2e/execution.test.ts b/packages/protocol-kit/tests/e2e/execution.test.ts index fa9e6f85c..38942d393 100644 --- a/packages/protocol-kit/tests/e2e/execution.test.ts +++ b/packages/protocol-kit/tests/e2e/execution.test.ts @@ -1,10 +1,6 @@ import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' import Safe, { SigningMethod } from '@safe-global/protocol-kit/index' -import { - EthersTransactionOptions, - MetaTransactionData, - TransactionOptions -} from '@safe-global/safe-core-sdk-types' +import { EthersTransactionOptions, MetaTransactionData } from '@safe-global/safe-core-sdk-types' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' @@ -207,32 +203,6 @@ describe('Transactions execution', () => { .to.be.rejectedWith(safeVersionDeployed >= '1.3.0' ? 'GS026' : 'Invalid owner provided') }) - it('should fail if a user tries to execute a transaction with options: { gas, gasLimit }', async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) - const safeAddress = await safe.getAddress() - const safeSdk1 = await Safe.create({ - provider, - safeAddress, - contractNetworks - }) - await account1.signer.sendTransaction({ - to: safeAddress, - value: 1_000_000_000_000_000_000n // 1 ETH - }) - const safeTransactionData = { - to: account2.address, - value: '500000000000000000', // 0.5 ETH - data: '0x' - } - const tx = await safeSdk1.createTransaction({ transactions: [safeTransactionData] }) - const options: TransactionOptions = { gas: 123456, gasLimit: 123456 } - await chai - .expect(safeSdk1.executeTransaction(tx, options)) - .to.be.rejectedWith('Cannot specify gas and gasLimit together in transaction options') - }) - it('should fail if a user tries to execute a transaction with options: { nonce: }', async () => { const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts From d8b4dbb3c59f72c2df43b1ecc35be8aa8aaaa4f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 24 Apr 2024 10:11:07 +0200 Subject: [PATCH 055/112] Add viem specific error handling --- .../protocol-kit/tests/e2e/execution.test.ts | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/packages/protocol-kit/tests/e2e/execution.test.ts b/packages/protocol-kit/tests/e2e/execution.test.ts index 38942d393..3d723c97d 100644 --- a/packages/protocol-kit/tests/e2e/execution.test.ts +++ b/packages/protocol-kit/tests/e2e/execution.test.ts @@ -169,7 +169,7 @@ describe('Transactions execution', () => { .to.be.rejectedWith('There are 2 signatures missing') }) - it('should fail if the user tries to execute a transaction that was rejected', async () => { + it.only('should fail if the user tries to execute a transaction that was rejected', async () => { const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) @@ -198,9 +198,24 @@ describe('Transactions execution', () => { const txRejectResponse = await safeSdk2.executeTransaction(signedRejectTx) await waitSafeTxReceipt(txRejectResponse) const signedTx = await safeSdk1.signTransaction(tx) - await chai - .expect(safeSdk2.executeTransaction(signedTx)) - .to.be.rejectedWith(safeVersionDeployed >= '1.3.0' ? 'GS026' : 'Invalid owner provided') + try { + await safeSdk2.executeTransaction(signedTx) + } catch (error) { + console.log(error) + } + if (process.env.ETH_LIB === 'viem') { + try { + await safeSdk2.executeTransaction(signedTx) + } catch (error) { + chai + .expect((error as any)?.info?.error?.message) + .includes(safeVersionDeployed >= '1.3.0' ? 'GS026' : 'Invalid owner provided') + } + } else { + await chai + .expect(safeSdk2.executeTransaction(signedTx)) + .to.be.rejectedWith(safeVersionDeployed >= '1.3.0' ? 'GS026' : 'Invalid owner provided') + } }) it('should fail if a user tries to execute a transaction with options: { nonce: }', async () => { From e4c5e0a922680c1034aede727b62edbdc9b72bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 24 Apr 2024 10:58:28 +0200 Subject: [PATCH 056/112] Rename props in SafeProvider --- .../src/AccountAbstraction.ts | 2 +- packages/protocol-kit/src/Safe.ts | 17 ++---- packages/protocol-kit/src/SafeProvider.ts | 61 ++++++++++--------- .../src/contracts/BaseContract.ts | 2 +- .../src/packs/safe-4337/Safe4337Pack.test.ts | 8 +-- .../src/packs/safe-4337/Safe4337Pack.ts | 2 +- 6 files changed, 46 insertions(+), 46 deletions(-) diff --git a/packages/account-abstraction-kit/src/AccountAbstraction.ts b/packages/account-abstraction-kit/src/AccountAbstraction.ts index 763b18ce5..09711ac54 100644 --- a/packages/account-abstraction-kit/src/AccountAbstraction.ts +++ b/packages/account-abstraction-kit/src/AccountAbstraction.ts @@ -35,7 +35,7 @@ class AccountAbstraction { const signer = await safeProvider.getSignerAddress() if (!signer) { - throw new Error("There's no signer in the provided SafeProvider") + throw new Error("There's no signer available in the provided config") } const owners = [signer] diff --git a/packages/protocol-kit/src/Safe.ts b/packages/protocol-kit/src/Safe.ts index 2a825ae71..d5224508e 100644 --- a/packages/protocol-kit/src/Safe.ts +++ b/packages/protocol-kit/src/Safe.ts @@ -31,15 +31,12 @@ import { AddOwnerTxParams, ConnectSafeConfig, CreateTransactionProps, - Eip1193Provider, - HttpTransport, PredictedSafeProps, RemoveOwnerTxParams, SafeConfig, SafeConfigProps, SigningMethod, SigningMethodType, - SocketTransport, SwapOwnerTxParams } from './types' import { @@ -80,7 +77,6 @@ const EQ_OR_GT_1_3_0 = '>=1.3.0' class Safe { #predictedSafe?: PredictedSafeProps - #provider!: Eip1193Provider | HttpTransport | SocketTransport #safeProvider!: SafeProvider #contractManager!: ContractManager #ownerManager!: OwnerManager @@ -117,7 +113,6 @@ class Safe { private async init(config: SafeConfig): Promise { const { provider, signer, isL1SafeSingleton, contractNetworks } = config - this.#provider = provider this.#safeProvider = new SafeProvider({ provider, signer @@ -126,7 +121,7 @@ class Safe { this.#predictedSafe = config.predictedSafe this.#contractManager = await ContractManager.create( { - provider: this.#provider, + provider, predictedSafe: this.#predictedSafe, isL1SafeSingleton, contractNetworks @@ -136,7 +131,7 @@ class Safe { } else { this.#contractManager = await ContractManager.create( { - provider: this.#provider, + provider, safeAddress: config.safeAddress, isL1SafeSingleton, contractNetworks @@ -166,7 +161,7 @@ class Safe { const { provider, signer, safeAddress, predictedSafe, isL1SafeSingleton, contractNetworks } = config const configProps: SafeConfigProps = { - provider: provider || this.#provider, + provider: provider || this.#safeProvider.provider, signer, isL1SafeSingleton: isL1SafeSingleton || this.#contractManager.isL1SafeSingleton, contractNetworks: contractNetworks || this.#contractManager.contractNetworks @@ -490,7 +485,7 @@ class Safe { return new EthSafeTransaction( await standardizeSafeTransactionData({ predictedSafe: this.#predictedSafe, - provider: this.#provider, + provider: this.#safeProvider.provider, tx: newTransaction, contractNetworks: this.#contractManager.contractNetworks }) @@ -503,7 +498,7 @@ class Safe { return new EthSafeTransaction( await standardizeSafeTransactionData({ safeContract: this.#contractManager.safeContract, - provider: this.#provider, + provider: this.#safeProvider.provider, tx: newTransaction, contractNetworks: this.#contractManager.contractNetworks }) @@ -689,7 +684,7 @@ class Safe { const safeEIP712Args: SafeEIP712Args = { safeAddress: await this.getAddress(), safeVersion: await this.getContractVersion(), - chainId: await this.getSafeProvider().getChainId(), + chainId: await this.#safeProvider.getChainId(), data: eip712Data.data } diff --git a/packages/protocol-kit/src/SafeProvider.ts b/packages/protocol-kit/src/SafeProvider.ts index f520546be..ea8da1fba 100644 --- a/packages/protocol-kit/src/SafeProvider.ts +++ b/packages/protocol-kit/src/SafeProvider.ts @@ -28,40 +28,45 @@ import { import { SafeProviderTransaction, GetContractProps, - SafeProviderConfig + SafeProviderConfig, + Eip1193Provider, + HttpTransport, + SocketTransport } from '@safe-global/protocol-kit/types' class SafeProvider { - #provider: BrowserProvider | JsonRpcProvider - #signer?: string + #externalProvider: BrowserProvider | JsonRpcProvider + signer?: string + provider: Eip1193Provider | HttpTransport | SocketTransport constructor({ provider, signer }: SafeProviderConfig) { if (typeof provider === 'string') { - this.#provider = new JsonRpcProvider(provider) + this.#externalProvider = new JsonRpcProvider(provider) } else { - this.#provider = new BrowserProvider(provider) + this.#externalProvider = new BrowserProvider(provider) } - this.#signer = signer + this.provider = provider + this.signer = signer } - getProvider(): Provider { - return this.#provider + getExternalProvider(): Provider { + return this.#externalProvider } - async getSigner(): Promise { + async getExternalSigner(): Promise { // If the signer is not an Ethereum address, it should be a private key - if (this.#signer && !ethers.isAddress(this.#signer)) { - const privateKeySigner = new ethers.Wallet(this.#signer, this.#provider) + if (this.signer && !ethers.isAddress(this.signer)) { + const privateKeySigner = new ethers.Wallet(this.signer, this.#externalProvider) return privateKeySigner } - if (this.#signer) { - return this.#provider.getSigner(this.#signer) + if (this.signer) { + return this.#externalProvider.getSigner(this.signer) } - if (this.#provider instanceof BrowserProvider) { - return this.#provider.getSigner() + if (this.#externalProvider instanceof BrowserProvider) { + return this.#externalProvider.getSigner() } return undefined @@ -77,15 +82,15 @@ class SafeProvider { } async getBalance(address: string, blockTag?: string | number): Promise { - return this.#provider.getBalance(address, blockTag) + return this.#externalProvider.getBalance(address, blockTag) } async getNonce(address: string, blockTag?: string | number): Promise { - return this.#provider.getTransactionCount(address, blockTag) + return this.#externalProvider.getTransactionCount(address, blockTag) } async getChainId(): Promise { - return (await this.#provider.getNetwork()).chainId + return (await this.#externalProvider.getNetwork()).chainId } getChecksummedAddress(address: string): string { @@ -112,7 +117,7 @@ class SafeProvider { customContractAddress, customContractAbi }: GetContractProps) { - const signerOrProvider = (await this.getSigner()) || this.#provider + const signerOrProvider = (await this.getExternalSigner()) || this.#externalProvider return getSafeProxyFactoryContractInstance( safeVersion, this, @@ -196,32 +201,32 @@ class SafeProvider { } async getContractCode(address: string, blockTag?: string | number): Promise { - return this.#provider.getCode(address, blockTag) + return this.#externalProvider.getCode(address, blockTag) } async isContractDeployed(address: string, blockTag?: string | number): Promise { - const contractCode = await this.#provider.getCode(address, blockTag) + const contractCode = await this.#externalProvider.getCode(address, blockTag) return contractCode !== '0x' } async getStorageAt(address: string, position: string): Promise { - const content = await this.#provider.getStorage(address, position) + const content = await this.#externalProvider.getStorage(address, position) const decodedContent = this.decodeParameters(['address'], content) return decodedContent[0] } async getTransaction(transactionHash: string): Promise { - return this.#provider.getTransaction(transactionHash) as Promise + return this.#externalProvider.getTransaction(transactionHash) as Promise } async getSignerAddress(): Promise { - const signer = await this.getSigner() + const signer = await this.getExternalSigner() return signer?.getAddress() } async signMessage(message: string): Promise { - const signer = await this.getSigner() + const signer = await this.getExternalSigner() if (!signer) { throw new Error('SafeProvider must be initialized with a signer to use this method') @@ -232,7 +237,7 @@ class SafeProvider { } async signTypedData(safeEIP712Args: SafeEIP712Args): Promise { - const signer = await this.getSigner() + const signer = await this.getExternalSigner() if (!signer) { throw new Error('SafeProvider must be initialized with a signer to use this method') @@ -254,11 +259,11 @@ class SafeProvider { } async estimateGas(transaction: SafeProviderTransaction): Promise { - return (await this.#provider.estimateGas(transaction)).toString() + return (await this.#externalProvider.estimateGas(transaction)).toString() } call(transaction: SafeProviderTransaction, blockTag?: string | number): Promise { - return this.#provider.call({ ...transaction, blockTag }) + return this.#externalProvider.call({ ...transaction, blockTag }) } // TODO: fix anys diff --git a/packages/protocol-kit/src/contracts/BaseContract.ts b/packages/protocol-kit/src/contracts/BaseContract.ts index 542ac1a31..a5896a35d 100644 --- a/packages/protocol-kit/src/contracts/BaseContract.ts +++ b/packages/protocol-kit/src/contracts/BaseContract.ts @@ -81,7 +81,7 @@ class BaseContract { this.contract = new Contract( this.contractAddress, this.contractAbi, - this.runner || (await this.safeProvider.getSigner()) + this.runner || (await this.safeProvider.getExternalSigner()) ) } diff --git a/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.test.ts b/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.test.ts index fc7311f54..66d4d51bd 100644 --- a/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.test.ts +++ b/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.test.ts @@ -193,8 +193,8 @@ describe('Safe4337Pack', () => { expect(encodeFunctionDataSpy).toHaveBeenCalledWith('enableModules', [[safe4337ModuleAddress]]) expect(safeCreateSpy).toHaveBeenCalledWith({ - provider: safe4337Pack.protocolKit.getSafeProvider().getProvider(), - signer: await safe4337Pack.protocolKit.getSafeProvider().getSigner(), + provider: safe4337Pack.protocolKit.getSafeProvider().provider, + signer: await safe4337Pack.protocolKit.getSafeProvider().signer, predictedSafe: { safeDeploymentConfig: { safeVersion: constants.DEFAULT_SAFE_VERSION, @@ -260,8 +260,8 @@ describe('Safe4337Pack', () => { expect(encodeFunctionDataSpy).toHaveBeenNthCalledWith(4, 'multiSend', [multiSendData]) expect(safeCreateSpy).toHaveBeenCalledWith({ - provider: safe4337Pack.protocolKit.getSafeProvider().getProvider(), - signer: await safe4337Pack.protocolKit.getSafeProvider().getSigner(), + provider: safe4337Pack.protocolKit.getSafeProvider().provider, + signer: await safe4337Pack.protocolKit.getSafeProvider().signer, predictedSafe: { safeDeploymentConfig: { safeVersion: constants.DEFAULT_SAFE_VERSION, diff --git a/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts b/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts index abd37da20..ed590443a 100644 --- a/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts +++ b/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts @@ -581,7 +581,7 @@ export class Safe4337Pack extends RelayKitBasePack<{ */ async #signTypedData(safeUserOperation: SafeUserOperation): Promise { const safeProvider = this.protocolKit.getSafeProvider() - const signer = (await safeProvider.getSigner()) as ethers.Signer + const signer = (await safeProvider.getExternalSigner()) as ethers.Signer const chainId = await safeProvider.getChainId() const signerAddress = await signer.getAddress() const signature = await signer.signTypedData( From e8ee3388d9b83df058974e703165b8840d384613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 24 Apr 2024 11:38:57 +0200 Subject: [PATCH 057/112] Fix SafProvider instantiation --- packages/protocol-kit/src/SafeFactory.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/protocol-kit/src/SafeFactory.ts b/packages/protocol-kit/src/SafeFactory.ts index fe4f26570..671897630 100644 --- a/packages/protocol-kit/src/SafeFactory.ts +++ b/packages/protocol-kit/src/SafeFactory.ts @@ -34,7 +34,6 @@ export interface DeploySafeProps { } export interface SafeFactoryConfig { - /** provider - Ethereum EIP-1193 compatible provider */ provider: Eip1193Provider | HttpTransport | SocketTransport signer?: HexAddress | PrivateKey /** safeVersion - Versions of the Safe deployed by this Factory contract */ @@ -46,7 +45,6 @@ export interface SafeFactoryConfig { } interface SafeFactoryInitConfig { - /** provider - Ethereum EIP-1193 compatible provider */ provider: Eip1193Provider | HttpTransport | SocketTransport signer?: HexAddress | PrivateKey privateKeyOrMnemonic?: string @@ -95,7 +93,7 @@ class SafeFactory { }: SafeFactoryInitConfig): Promise { this.#provider = provider this.#signer = signer - this.#safeProvider = new SafeProvider({ provider }) + this.#safeProvider = new SafeProvider({ provider, signer }) this.#safeVersion = safeVersion this.#isL1SafeSingleton = isL1SafeSingleton this.#contractNetworks = contractNetworks From 2c72b5eac0726ea30d1ae98a953cd4eb93ebb2d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 24 Apr 2024 12:41:05 +0200 Subject: [PATCH 058/112] Improve some imports --- packages/protocol-kit/src/contracts/index.ts | 4 ---- packages/protocol-kit/src/index.ts | 8 +++----- packages/protocol-kit/src/utils/transactions/utils.ts | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/protocol-kit/src/contracts/index.ts b/packages/protocol-kit/src/contracts/index.ts index c6b4faa06..009c4b5a3 100644 --- a/packages/protocol-kit/src/contracts/index.ts +++ b/packages/protocol-kit/src/contracts/index.ts @@ -1,5 +1,3 @@ -import SafeProvider from '../SafeProvider' -import { SafeProviderConfig } from '../types' import CreateCallBaseContract from './CreateCall/CreateCallBaseContract' import MultiSendBaseContract from './MultiSend/MultiSendBaseContract' import MultiSendCallOnlyBaseContract from './MultiSend/MultiSendCallOnlyBaseContract' @@ -9,8 +7,6 @@ import SignMessageLibBaseContract from './SignMessageLib/SignMessageLibBaseContr export { CreateCallBaseContract, - SafeProvider, - SafeProviderConfig, MultiSendCallOnlyBaseContract, MultiSendBaseContract, SafeBaseContract, diff --git a/packages/protocol-kit/src/index.ts b/packages/protocol-kit/src/index.ts index 59453f8ca..86ae0ad38 100644 --- a/packages/protocol-kit/src/index.ts +++ b/packages/protocol-kit/src/index.ts @@ -1,8 +1,7 @@ import Safe from './Safe' +import SafeProvider from './SafeProvider' import { CreateCallBaseContract, - SafeProvider, - SafeProviderConfig, MultiSendBaseContract, MultiSendCallOnlyBaseContract, SafeBaseContract, @@ -72,8 +71,6 @@ export { DEFAULT_SAFE_VERSION, DeploySafeProps, EthSafeSignature, - SafeProvider, - SafeProviderConfig, MultiSendCallOnlyBaseContract, MultiSendBaseContract, PREDETERMINED_SALT_NONCE, @@ -109,7 +106,8 @@ export { getEip712TxTypes, getEip712MessageTypes, hashSafeMessage, - generateTypedData + generateTypedData, + SafeProvider } export * from './types' diff --git a/packages/protocol-kit/src/utils/transactions/utils.ts b/packages/protocol-kit/src/utils/transactions/utils.ts index f371b1c4f..583752527 100644 --- a/packages/protocol-kit/src/utils/transactions/utils.ts +++ b/packages/protocol-kit/src/utils/transactions/utils.ts @@ -1,4 +1,5 @@ import { ethers, Interface, getBytes, solidityPacked as solidityPack } from 'ethers' +import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { DEFAULT_SAFE_VERSION } from '@safe-global/protocol-kit/contracts/config' import { StandardizeSafeTransactionDataProps } from '@safe-global/protocol-kit/types' import { hasSafeFeature, SAFE_FEATURES } from '@safe-global/protocol-kit/utils' @@ -14,7 +15,6 @@ import { } from '@safe-global/safe-core-sdk-types' import semverSatisfies from 'semver/functions/satisfies' import { estimateGas, estimateTxGas } from './gas' -import { SafeProvider } from '../..' export function standardizeMetaTransactionData( tx: SafeTransactionDataPartial From bcb2bbeaa26739e0e9c74b13bda501eee4766758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 24 Apr 2024 12:44:19 +0200 Subject: [PATCH 059/112] Improve imports --- packages/protocol-kit/src/types/index.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index af40d369c..83fcea682 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -15,18 +15,18 @@ import MultiSendContract_v1_3_0 from '@safe-global/protocol-kit/contracts/MultiS import MultiSendContract_v1_4_1 from '@safe-global/protocol-kit/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1' import MultiSendCallOnlyContract_v1_4_1 from '@safe-global/protocol-kit/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1' import MultiSendCallOnlyContract_v1_3_0 from '@safe-global/protocol-kit/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0' -import CompatibilityFallbackHandlerContract_v1_3_0 from '../contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0' -import CompatibilityFallbackHandlerContract_v1_4_1 from '../contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1' -import SafeProxyFactoryContract_v1_0_0 from '../contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0' -import SafeProxyFactoryContract_v1_1_1 from '../contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1' -import SafeProxyFactoryContract_v1_3_0 from '../contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0' -import SafeProxyFactoryContract_v1_4_1 from '../contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1' -import SignMessageLibContract_v1_3_0 from '../contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0' -import SignMessageLibContract_v1_4_1 from '../contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1' -import SimulateTxAccessorContract_v1_3_0 from '../contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0' -import SimulateTxAccessorContract_v1_4_1 from '../contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1' -import CreateCallContract_v1_3_0 from '../contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0' -import CreateCallContract_v1_4_1 from '../contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1' +import CompatibilityFallbackHandlerContract_v1_3_0 from '@safe-global/protocol-kit/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0' +import CompatibilityFallbackHandlerContract_v1_4_1 from '@safe-global/protocol-kit/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1' +import SafeProxyFactoryContract_v1_0_0 from '@safe-global/protocol-kit/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0' +import SafeProxyFactoryContract_v1_1_1 from '@safe-global/protocol-kit/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1' +import SafeProxyFactoryContract_v1_3_0 from '@safe-global/protocol-kit/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0' +import SafeProxyFactoryContract_v1_4_1 from '@safe-global/protocol-kit/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1' +import SignMessageLibContract_v1_3_0 from '@safe-global/protocol-kit/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0' +import SignMessageLibContract_v1_4_1 from '@safe-global/protocol-kit/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1' +import SimulateTxAccessorContract_v1_3_0 from '@safe-global/protocol-kit/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0' +import SimulateTxAccessorContract_v1_4_1 from '@safe-global/protocol-kit/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1' +import CreateCallContract_v1_3_0 from '@safe-global/protocol-kit/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0' +import CreateCallContract_v1_4_1 from '@safe-global/protocol-kit/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1' export interface SafeAccountConfig { owners: string[] From 0f47dd91a3ec7f417ca45326583fa8fb3542a7fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 24 Apr 2024 12:55:36 +0200 Subject: [PATCH 060/112] Removed unnecessary types --- packages/protocol-kit/src/types/index.ts | 101 ++++-------------- .../protocol-kit/src/utils/safeVersions.ts | 40 +++---- 2 files changed, 38 insertions(+), 103 deletions(-) diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index 83fcea682..c6f889735 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -104,7 +104,6 @@ type SafeConfigWithPredictedSafeProps = { } export type SafeConfigProps = { - /** provider - Compatible EIP-1193 provider */ provider: Eip1193Provider | HttpTransport | SocketTransport signer?: string /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ @@ -132,7 +131,6 @@ type ConnectSafeConfigWithPredictedSafeProps = { } type ConnectSafeConfigProps = { - /** provider - Compatible EIP-1193 provider */ provider?: Eip1193Provider | HttpTransport | SocketTransport signer?: string /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ @@ -194,7 +192,6 @@ type StandardizeSafeTxDataWithPredictedSafeProps = { } interface StandardizeSafeTransactionData { - /** provider - Compatible EIP-1193 provider */ provider: Eip1193Provider | HttpTransport | SocketTransport signer?: string /** tx - Safe transaction */ @@ -222,104 +219,50 @@ export enum SigningMethod { export type SigningMethodType = SigningMethod | string // Safe contract implementation types - -export type SafeContract_v1_0_0_ImplementationType = SafeContract_v1_0_0 - -export type SafeContract_v1_1_0_ImplementationType = SafeContract_v1_1_1 - -export type SafeContract_v1_2_0_ImplementationType = SafeContract_v1_2_0 - -export type SafeContract_v1_3_0_ImplementationType = SafeContract_v1_3_0 - -export type SafeContract_v1_4_1_ImplementationType = SafeContract_v1_4_1 - export type SafeContractImplementationType = - | SafeContract_v1_0_0_ImplementationType - | SafeContract_v1_1_0_ImplementationType - | SafeContract_v1_2_0_ImplementationType - | SafeContract_v1_3_0_ImplementationType - | SafeContract_v1_4_1_ImplementationType + | SafeContract_v1_0_0 + | SafeContract_v1_1_1 + | SafeContract_v1_2_0 + | SafeContract_v1_3_0 + | SafeContract_v1_4_1 // MultiSend contract implementation types - -export type MultiSendContract_v1_1_1_ImplementationType = MultiSendContract_v1_1_1 - -export type MultiSendContract_v1_3_0_ImplementationType = MultiSendContract_v1_3_0 - -export type MultiSendContract_v1_4_1_ImplementationType = MultiSendContract_v1_4_1 - export type MultiSendContractImplementationType = - | MultiSendContract_v1_1_1_ImplementationType - | MultiSendContract_v1_3_0_ImplementationType - | MultiSendContract_v1_4_1_ImplementationType + | MultiSendContract_v1_1_1 + | MultiSendContract_v1_3_0 + | MultiSendContract_v1_4_1 // MultiSendCallOnly contract implementation types - -export type MultiSendCallOnlyContract_v1_3_0_ImplementationType = MultiSendCallOnlyContract_v1_3_0 - -export type MultiSendCallOnlyContract_v1_4_1_ImplementationType = MultiSendCallOnlyContract_v1_4_1 - export type MultiSendCallOnlyContractImplementationType = - | MultiSendCallOnlyContract_v1_3_0_ImplementationType - | MultiSendCallOnlyContract_v1_4_1_ImplementationType + | MultiSendCallOnlyContract_v1_3_0 + | MultiSendCallOnlyContract_v1_4_1 // CompatibilityFallbackHandler contract implementation types - -export type CompatibilityFallbackHandlerContract_v1_3_0_ImplementationType = - CompatibilityFallbackHandlerContract_v1_3_0 - -export type CompatibilityFallbackHandlerContract_v1_4_1_ImplementationType = - CompatibilityFallbackHandlerContract_v1_4_1 - export type CompatibilityFallbackHandlerContractImplementationType = - | CompatibilityFallbackHandlerContract_v1_3_0_ImplementationType - | CompatibilityFallbackHandlerContract_v1_4_1_ImplementationType + | CompatibilityFallbackHandlerContract_v1_3_0 + | CompatibilityFallbackHandlerContract_v1_4_1 // SafeProxyFactory contract implementation types - -export type SafeProxyFactoryContract_v1_0_0_ImplementationType = SafeProxyFactoryContract_v1_0_0 - -export type SafeProxyFactoryContract_v1_1_1_ImplementationType = SafeProxyFactoryContract_v1_1_1 - -export type SafeProxyFactoryContract_v1_3_0_ImplementationType = SafeProxyFactoryContract_v1_3_0 - -export type SafeProxyFactoryContract_v1_4_1_ImplementationType = SafeProxyFactoryContract_v1_4_1 - export type SafeProxyFactoryContractImplementationType = - | SafeProxyFactoryContract_v1_0_0_ImplementationType - | SafeProxyFactoryContract_v1_1_1_ImplementationType - | SafeProxyFactoryContract_v1_3_0_ImplementationType - | SafeProxyFactoryContract_v1_4_1_ImplementationType + | SafeProxyFactoryContract_v1_0_0 + | SafeProxyFactoryContract_v1_1_1 + | SafeProxyFactoryContract_v1_3_0 + | SafeProxyFactoryContract_v1_4_1 // SignMessageLib contract implementation types - -export type SignMessageLibContract_v1_3_0_ImplementationType = SignMessageLibContract_v1_3_0 - -export type SignMessageLibContract_v1_4_1_ImplementationType = SignMessageLibContract_v1_4_1 - export type SignMessageLibContractImplementationType = - | SignMessageLibContract_v1_3_0_ImplementationType - | SignMessageLibContract_v1_4_1_ImplementationType + | SignMessageLibContract_v1_3_0 + | SignMessageLibContract_v1_4_1 // SimulateTxAccessor contract implementation types - -export type SimulateTxAccessorContract_v1_3_0_ImplementationType = SimulateTxAccessorContract_v1_3_0 - -export type SimulateTxAccessorContract_v1_4_1_ImplementationType = SimulateTxAccessorContract_v1_4_1 - export type SimulateTxAccessorContractImplementationType = - | SimulateTxAccessorContract_v1_3_0_ImplementationType - | SimulateTxAccessorContract_v1_4_1_ImplementationType + | SimulateTxAccessorContract_v1_3_0 + | SimulateTxAccessorContract_v1_4_1 // CreateCall contract implementation types - -export type CreateCallContract_v1_3_0_ImplementationType = CreateCallContract_v1_3_0 - -export type CreateCallContract_v1_4_1_ImplementationType = CreateCallContract_v1_4_1 - export type CreateCallContractImplementationType = - | CreateCallContract_v1_3_0_ImplementationType - | CreateCallContract_v1_4_1_ImplementationType + | CreateCallContract_v1_3_0 + | CreateCallContract_v1_4_1 export type RequestArguments = { readonly method: string diff --git a/packages/protocol-kit/src/utils/safeVersions.ts b/packages/protocol-kit/src/utils/safeVersions.ts index 3da9bcc25..76f052adb 100644 --- a/packages/protocol-kit/src/utils/safeVersions.ts +++ b/packages/protocol-kit/src/utils/safeVersions.ts @@ -1,12 +1,10 @@ import semverSatisfies from 'semver/functions/satisfies' -import { - SafeContractImplementationType, - SafeContract_v1_0_0_ImplementationType, - SafeContract_v1_1_0_ImplementationType, - SafeContract_v1_2_0_ImplementationType, - SafeContract_v1_3_0_ImplementationType, - SafeContract_v1_4_1_ImplementationType -} from '@safe-global/protocol-kit/types' +import { SafeContractImplementationType } from '@safe-global/protocol-kit/types' +import SafeContract_v1_0_0 from '@safe-global/protocol-kit/contracts/Safe/v1.0.0/SafeContract_v1_0_0' +import SafeContract_v1_1_1 from '@safe-global/protocol-kit/contracts/Safe/v1.1.1/SafeContract_v1_1_1' +import SafeContract_v1_2_0 from '@safe-global/protocol-kit/contracts/Safe/v1.2.0/SafeContract_v1_2_0' +import SafeContract_v1_3_0 from '@safe-global/protocol-kit/contracts/Safe/v1.3.0/SafeContract_v1_3_0' +import SafeContract_v1_4_1 from '@safe-global/protocol-kit/contracts/Safe/v1.4.1/SafeContract_v1_4_1' export enum SAFE_FEATURES { SAFE_TX_GAS_OPTIONAL = 'SAFE_TX_GAS_OPTIONAL', @@ -37,27 +35,21 @@ export const hasSafeFeature = (feature: SAFE_FEATURES, version: string): boolean } export type SafeContractCompatibleWithFallbackHandler = - | SafeContract_v1_1_0_ImplementationType - | SafeContract_v1_2_0_ImplementationType - | SafeContract_v1_3_0_ImplementationType - | SafeContract_v1_4_1_ImplementationType + | SafeContract_v1_1_1 + | SafeContract_v1_2_0 + | SafeContract_v1_3_0 + | SafeContract_v1_4_1 -export type SafeContractCompatibleWithGuardManager = - | SafeContract_v1_3_0_ImplementationType - | SafeContract_v1_4_1_ImplementationType +export type SafeContractCompatibleWithGuardManager = SafeContract_v1_3_0 | SafeContract_v1_4_1 -export type SafeContractCompatibleWithModuleManager = - | SafeContract_v1_3_0_ImplementationType - | SafeContract_v1_4_1_ImplementationType +export type SafeContractCompatibleWithModuleManager = SafeContract_v1_3_0 | SafeContract_v1_4_1 export type SafeContractCompatibleWithRequiredTxGas = - | SafeContract_v1_0_0_ImplementationType - | SafeContract_v1_1_0_ImplementationType - | SafeContract_v1_2_0_ImplementationType + | SafeContract_v1_0_0 + | SafeContract_v1_1_1 + | SafeContract_v1_2_0 -export type SafeContractCompatibleWithSimulateAndRevert = - | SafeContract_v1_3_0_ImplementationType - | SafeContract_v1_4_1_ImplementationType +export type SafeContractCompatibleWithSimulateAndRevert = SafeContract_v1_3_0 | SafeContract_v1_4_1 export async function isSafeContractCompatibleWithRequiredTxGas( safeContract: SafeContractImplementationType From c6f4e5b14306d388aab5e590de46ea1619ffc744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 24 Apr 2024 15:06:49 +0200 Subject: [PATCH 061/112] Remove unnecesary awaits --- packages/relay-kit/src/packs/safe-4337/Safe4337Pack.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.test.ts b/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.test.ts index 66d4d51bd..506b2a41d 100644 --- a/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.test.ts +++ b/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.test.ts @@ -194,7 +194,7 @@ describe('Safe4337Pack', () => { expect(encodeFunctionDataSpy).toHaveBeenCalledWith('enableModules', [[safe4337ModuleAddress]]) expect(safeCreateSpy).toHaveBeenCalledWith({ provider: safe4337Pack.protocolKit.getSafeProvider().provider, - signer: await safe4337Pack.protocolKit.getSafeProvider().signer, + signer: safe4337Pack.protocolKit.getSafeProvider().signer, predictedSafe: { safeDeploymentConfig: { safeVersion: constants.DEFAULT_SAFE_VERSION, @@ -261,7 +261,7 @@ describe('Safe4337Pack', () => { expect(encodeFunctionDataSpy).toHaveBeenNthCalledWith(4, 'multiSend', [multiSendData]) expect(safeCreateSpy).toHaveBeenCalledWith({ provider: safe4337Pack.protocolKit.getSafeProvider().provider, - signer: await safe4337Pack.protocolKit.getSafeProvider().signer, + signer: safe4337Pack.protocolKit.getSafeProvider().signer, predictedSafe: { safeDeploymentConfig: { safeVersion: constants.DEFAULT_SAFE_VERSION, From fecfac9bd141230fd5a6424a79aa20d56ce1452a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 24 Apr 2024 17:15:03 +0200 Subject: [PATCH 062/112] Update api-kit playgrounds --- playground/api-kit/confirm-transaction.ts | 20 +++++++------------- playground/api-kit/execute-transaction.ts | 13 ++++++------- playground/api-kit/propose-transaction.ts | 22 ++++++++++++---------- 3 files changed, 25 insertions(+), 30 deletions(-) diff --git a/playground/api-kit/confirm-transaction.ts b/playground/api-kit/confirm-transaction.ts index b8c662dec..10c7ee3b6 100644 --- a/playground/api-kit/confirm-transaction.ts +++ b/playground/api-kit/confirm-transaction.ts @@ -21,32 +21,26 @@ const config: Config = { async function main() { // Create Safe instance - const safe = await Safe.create({ + const protocolKit = await Safe.create({ provider: config.RPC_URL, signer: config.SIGNER_ADDRESS_PRIVATE_KEY, safeAddress: config.SAFE_ADDRESS }) // Create Safe API Kit instance - const service = new SafeApiKit({ + const apiKit = new SafeApiKit({ chainId: config.CHAIN_ID }) // Get the transaction - const transaction = await service.getTransaction(config.SAFE_TX_HASH) - // const transactions = await service.getPendingTransactions() - // const transactions = await service.getIncomingTransactions() - // const transactions = await service.getMultisigTransactions() - // const transactions = await service.getModuleTransactions() - // const transactions = await service.getAllTransactions() - - const safeTxHash = transaction.transactionHash - const signature = await safe.signHash(safeTxHash) + const safeTransaction = await apiKit.getTransaction(config.SAFE_TX_HASH) + const safeTxHash = safeTransaction.safeTxHash + const signature = await protocolKit.signHash(safeTxHash) // Confirm the Safe transaction - const signatureResponse = await service.confirmTransaction(safeTxHash, signature.data) + const signatureResponse = await apiKit.confirmTransaction(safeTxHash, signature.data) - const signerAddress = await safe.getSafeProvider().getSignerAddress() + const signerAddress = await protocolKit.getSafeProvider().getSignerAddress() console.log('Added a new signature to transaction with safeTxGas:', config.SAFE_TX_HASH) console.log('- Signer:', signerAddress) console.log('- Signer signature:', signatureResponse.signature) diff --git a/playground/api-kit/execute-transaction.ts b/playground/api-kit/execute-transaction.ts index e49316bd5..b48272bb3 100644 --- a/playground/api-kit/execute-transaction.ts +++ b/playground/api-kit/execute-transaction.ts @@ -21,29 +21,28 @@ const config: Config = { async function main() { // Create Safe instance - const safe = await Safe.create({ + const protocolKit = await Safe.create({ provider: config.RPC_URL, signer: config.SIGNER_ADDRESS_PRIVATE_KEY, safeAddress: config.SAFE_ADDRESS }) // Create Safe API Kit instance - const service = new SafeApiKit({ + const apiKit = new SafeApiKit({ chainId: config.CHAIN_ID }) // Get the transaction - const safeTransaction = await service.getTransaction(config.SAFE_TX_HASH) - - const isTxExecutable = await safe.isValidTransaction(safeTransaction) + const safeTransaction = await apiKit.getTransaction(config.SAFE_TX_HASH) + const isTxExecutable = await protocolKit.isValidTransaction(safeTransaction) if (isTxExecutable) { // Execute the transaction - const txResponse = await safe.executeTransaction(safeTransaction) + const txResponse = await protocolKit.executeTransaction(safeTransaction) const contractReceipt = await txResponse.transactionResponse?.wait() console.log('Transaction executed.') - console.log('- Transaction hash:', contractReceipt?.transactionHash) + console.log('- Transaction hash:', contractReceipt?.hash) } else { console.log('Transaction invalid. Transaction was not executed.') } diff --git a/playground/api-kit/propose-transaction.ts b/playground/api-kit/propose-transaction.ts index d6bd7a309..d2a6a38df 100644 --- a/playground/api-kit/propose-transaction.ts +++ b/playground/api-kit/propose-transaction.ts @@ -20,42 +20,44 @@ const config: Config = { async function main() { // Create Safe instance - const safe = await Safe.create({ + const protocolKit = await Safe.create({ provider: config.RPC_URL, signer: config.SIGNER_ADDRESS_PRIVATE_KEY, safeAddress: config.SAFE_ADDRESS }) // Create Safe API Kit instance - const service = new SafeApiKit({ + const apiKit = new SafeApiKit({ chainId: config.CHAIN_ID }) // Create transaction const safeTransactionData: SafeTransactionDataPartial = { - to: '0x', + to: config.SAFE_ADDRESS, value: '1', // 1 wei data: '0x', operation: OperationType.Call } - const safeTransaction = await safe.createTransaction({ transactions: [safeTransactionData] }) + const safeTransaction = await protocolKit.createTransaction({ + transactions: [safeTransactionData] + }) - const senderAddress = (await safe.getSafeProvider().getSignerAddress()) || '0x' - const safeTxHash = await safe.getTransactionHash(safeTransaction) - const signature = await safe.signHash(safeTxHash) + const signerAddress = (await protocolKit.getSafeProvider().getSignerAddress()) || '0x' + const safeTxHash = await protocolKit.getTransactionHash(safeTransaction) + const signature = await protocolKit.signHash(safeTxHash) // Propose transaction to the service - await service.proposeTransaction({ + await apiKit.proposeTransaction({ safeAddress: config.SAFE_ADDRESS, safeTransactionData: safeTransaction.data, safeTxHash, - senderAddress, + senderAddress: signerAddress, senderSignature: signature.data }) console.log('Proposed a transaction with Safe:', config.SAFE_ADDRESS) console.log('- safeTxHash:', safeTxHash) - console.log('- Sender:', senderAddress) + console.log('- Sender:', signerAddress) console.log('- Sender signature:', signature.data) } From e170263dd1e9bbda705433e54f400d99431be6b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 25 Apr 2024 10:23:14 +0200 Subject: [PATCH 063/112] Update relay-kit playgrounds --- .../src/packs/safe-4337/Safe4337Pack.ts | 3 -- playground/relay-kit/paid-transaction.ts | 10 ++--- playground/relay-kit/sponsored-transaction.ts | 8 ++-- .../usdc-transfer-4337-counterfactual.ts | 39 ++++++++++--------- ...usdc-transfer-4337-erc20-counterfactual.ts | 35 ++++++++++------- .../relay-kit/usdc-transfer-4337-erc20.ts | 30 +++++++------- ...-transfer-4337-sponsored-counterfactual.ts | 35 ++++++++++------- .../relay-kit/usdc-transfer-4337-sponsored.ts | 15 ++----- playground/relay-kit/usdc-transfer-4337.ts | 15 ++----- 9 files changed, 97 insertions(+), 93 deletions(-) diff --git a/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts b/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts index ed590443a..1ebe24a0f 100644 --- a/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts +++ b/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts @@ -572,9 +572,6 @@ export class Safe4337Pack extends RelayKitBasePack<{ /** * Signs typed data. - * This is currently only EthersAdapter compatible (Reflected in the init() props). If I want to make it compatible with any EthAdapter I need to either: - * - Add a SafeOp type to the protocol-kit (createSafeOperation, signSafeOperation, etc) - * - Allow to pass the data types (SafeOp, SafeMessage, SafeTx) to the signTypedData method and refactor the protocol-kit to allow any kind of data signing from outside (Currently only SafeTx and SafeMessage) * * @param {SafeUserOperation} safeUserOperation - Safe user operation to sign. * @return {Promise} The SafeSignature object containing the data and the signatures. diff --git a/playground/relay-kit/paid-transaction.ts b/playground/relay-kit/paid-transaction.ts index 3942c926a..d9309ed68 100644 --- a/playground/relay-kit/paid-transaction.ts +++ b/playground/relay-kit/paid-transaction.ts @@ -56,20 +56,20 @@ async function main() { const isSafeDeployed = await safeAccountAbstraction.protocolKit.isSafeDeployed() console.log({ isSafeDeployed }) - const provider = safeAccountAbstraction.protocolKit.getSafeProvider().getProvider() + const ethersProvider = safeAccountAbstraction.protocolKit.getSafeProvider().getExternalProvider() // Fake on-ramp to transfer enough funds to the Safe address - const chainId = (await provider.getNetwork()).chainId + const chainId = (await ethersProvider.getNetwork()).chainId const relayFee = BigInt( await relayPack.getEstimateFee(chainId, txConfig.GAS_LIMIT, txConfig.GAS_TOKEN) ) - const safeBalance = await provider.getBalance(predictedSafeAddress) + const safeBalance = await ethersProvider.getBalance(predictedSafeAddress) console.log({ minSafeBalance: ethers.formatEther(relayFee.toString()) }) console.log({ safeBalance: ethers.formatEther(safeBalance.toString()) }) if (safeBalance < relayFee) { - const fakeOnRampSigner = new ethers.Wallet(mockOnRampConfig.PRIVATE_KEY, provider) + const fakeOnRampSigner = new ethers.Wallet(mockOnRampConfig.PRIVATE_KEY, ethersProvider) const fundingAmount = safeBalance < relayFee ? relayFee - safeBalance : safeBalance - relayFee const onRampResponse = await fakeOnRampSigner.sendTransaction({ to: predictedSafeAddress, @@ -78,7 +78,7 @@ async function main() { console.log(`Funding the Safe with ${ethers.formatEther(fundingAmount.toString())} ETH`) await onRampResponse.wait() - const safeBalanceAfter = await provider.getBalance(predictedSafeAddress) + const safeBalanceAfter = await ethersProvider.getBalance(predictedSafeAddress) console.log({ safeBalance: ethers.formatEther(safeBalanceAfter.toString()) }) } diff --git a/playground/relay-kit/sponsored-transaction.ts b/playground/relay-kit/sponsored-transaction.ts index 9f8d51c44..1ba02227e 100644 --- a/playground/relay-kit/sponsored-transaction.ts +++ b/playground/relay-kit/sponsored-transaction.ts @@ -62,11 +62,11 @@ async function main() { // Fake on-ramp to fund the Safe - const provider = safeAccountAbstraction.protocolKit.getSafeProvider().getProvider() - const safeBalance = await provider.getBalance(predictedSafeAddress) + const ethersProvider = safeAccountAbstraction.protocolKit.getSafeProvider().getExternalProvider() + const safeBalance = await ethersProvider.getBalance(predictedSafeAddress) console.log({ safeBalance: ethers.formatEther(safeBalance.toString()) }) if (safeBalance < BigInt(txConfig.VALUE)) { - const fakeOnRampSigner = new ethers.Wallet(mockOnRampConfig.PRIVATE_KEY, provider) + const fakeOnRampSigner = new ethers.Wallet(mockOnRampConfig.PRIVATE_KEY, ethersProvider) const onRampResponse = await fakeOnRampSigner.sendTransaction({ to: predictedSafeAddress, value: txConfig.VALUE @@ -74,7 +74,7 @@ async function main() { console.log(`Funding the Safe with ${ethers.formatEther(txConfig.VALUE.toString())} ETH`) await onRampResponse.wait() - const safeBalanceAfter = await provider.getBalance(predictedSafeAddress) + const safeBalanceAfter = await ethersProvider.getBalance(predictedSafeAddress) console.log({ safeBalance: ethers.formatEther(safeBalanceAfter.toString()) }) } diff --git a/playground/relay-kit/usdc-transfer-4337-counterfactual.ts b/playground/relay-kit/usdc-transfer-4337-counterfactual.ts index 637e3d3e7..6e0469470 100644 --- a/playground/relay-kit/usdc-transfer-4337-counterfactual.ts +++ b/playground/relay-kit/usdc-transfer-4337-counterfactual.ts @@ -1,5 +1,4 @@ -import { EthersAdapter } from '@safe-global/protocol-kit' -import { ethers } from 'ethers' +import { ethers, AbstractSigner } from 'ethers' import { Safe4337Pack } from '@safe-global/relay-kit' // Safe owner PK @@ -7,6 +6,9 @@ const PRIVATE_KEY = '' const PIMLICO_API_KEY = '' +// Safe owner address +const OWNER_ADDRESS = '' + // RPC URL const RPC_URL = 'https://rpc.ankr.com/eth_sepolia' // SEPOLIA // const RPC_URL = 'https://rpc.gnosischain.com/' // GNOSIS @@ -24,21 +26,14 @@ const usdcTokenAddress = '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238' // SEPOLIA // const usdcTokenAddress = '0xddafbb505ad214d7b80b1f830fccc89b60fb7a83' // GNOSIS async function main() { - // Instantiate EtherAdapter - const provider = new ethers.JsonRpcProvider(RPC_URL) - const signer = new ethers.Wallet(PRIVATE_KEY, provider) - const ethersAdapter = new EthersAdapter({ - ethers, - signerOrProvider: signer - }) - // 1) Initialize pack const safe4337Pack = await Safe4337Pack.init({ - ethersAdapter, + provider: RPC_URL, + signer: PRIVATE_KEY, rpcUrl: RPC_URL, bundlerUrl: BUNDLER_URL, options: { - owners: [await signer.getAddress()], + owners: [OWNER_ADDRESS], threshold: 1, saltNonce: '4337' + '1' // to update the address } @@ -65,9 +60,17 @@ async function main() { console.log(`sending ${nativeTokenAmount} ETH...`) - const transactionFundingResponse = await signer.sendTransaction(fundingSafe) + const ethersSigner = await safe4337Pack.protocolKit.getSafeProvider().getExternalSigner() + const signerAddress = await safe4337Pack.protocolKit.getSafeProvider().getSignerAddress() + const ethersProvider = safe4337Pack.protocolKit.getSafeProvider().getExternalProvider() + + if (!ethersSigner || !signerAddress) { + throw new Error('No signer found!') + } + + const transactionFundingResponse = await ethersSigner?.sendTransaction(fundingSafe) - await transactionFundingResponse.wait() + await transactionFundingResponse?.wait() // Create transaction batch with two 0.1 USDC transfers @@ -76,18 +79,18 @@ async function main() { console.log(`sending USDC...`) // send 0.2 USDC to the Safe - await transfer(signer, usdcTokenAddress, senderAddress, usdcAmount * 2n) + await transfer(ethersSigner, usdcTokenAddress, senderAddress, usdcAmount * 2n) console.log(`creating the Safe batch...`) const transferUSDC = { to: usdcTokenAddress, - data: generateTransferCallData(signer.address, usdcAmount), + data: generateTransferCallData(signerAddress, usdcAmount), value: '0' } const transactions = [transferUSDC, transferUSDC] - const timestamp = (await provider.getBlock('latest'))?.timestamp || 0 + const timestamp = (await ethersProvider.getBlock('latest'))?.timestamp || 0 // 2) Create transaction batch const safeOperation = await safe4337Pack.createTransaction({ @@ -127,7 +130,7 @@ async function main() { main() -async function transfer(signer: ethers.Wallet, tokenAddress: string, to: string, amount: bigint) { +async function transfer(signer: AbstractSigner, tokenAddress: string, to: string, amount: bigint) { const transferEC20 = { to: tokenAddress, data: generateTransferCallData(to, amount), diff --git a/playground/relay-kit/usdc-transfer-4337-erc20-counterfactual.ts b/playground/relay-kit/usdc-transfer-4337-erc20-counterfactual.ts index f8ec40b1c..c58e401f0 100644 --- a/playground/relay-kit/usdc-transfer-4337-erc20-counterfactual.ts +++ b/playground/relay-kit/usdc-transfer-4337-erc20-counterfactual.ts @@ -1,4 +1,3 @@ -import { EthersAdapter } from '@safe-global/protocol-kit' import { ethers } from 'ethers' import { Safe4337Pack } from '@safe-global/relay-kit' @@ -7,6 +6,9 @@ const PRIVATE_KEY = '' const PIMLICO_API_KEY = '' +// Safe owner address +const OWNER_ADDRESS = '' + // CHAIN const CHAIN_NAME = 'sepolia' // const CHAIN_NAME = 'gnosis' @@ -28,17 +30,10 @@ const usdcTokenAddress = '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238' // SEPOLIA // const usdcTokenAddress = '0xddafbb505ad214d7b80b1f830fccc89b60fb7a83' // GNOSIS async function main() { - // Instantiate EtherAdapter - const provider = new ethers.JsonRpcProvider(RPC_URL) - const signer = new ethers.Wallet(PRIVATE_KEY, provider) - const ethersAdapter = new EthersAdapter({ - ethers, - signerOrProvider: signer - }) - // 1) Initialize pack with the paymaster data const safe4337Pack = await Safe4337Pack.init({ - ethersAdapter, + provider: RPC_URL, + signer: PRIVATE_KEY, rpcUrl: RPC_URL, bundlerUrl: BUNDLER_URL, paymasterOptions: { @@ -47,7 +42,7 @@ async function main() { // amountToApprove?: bigint // optional value to set the paymaster approve amount on the deployment }, options: { - owners: [await signer.getAddress()], + owners: [OWNER_ADDRESS], threshold: 1, saltNonce: '4337' + '1' // to update the address } @@ -68,8 +63,15 @@ async function main() { console.log(`sending USDC...`) + const ethersSigner = await safe4337Pack.protocolKit.getSafeProvider().getExternalSigner() + const ethersProvider = safe4337Pack.protocolKit.getSafeProvider().getExternalProvider() + + if (!ethersSigner) { + throw new Error('No signer found!') + } + // send 15 USDC to the Safe - await transfer(signer, usdcTokenAddress, senderAddress, usdcAmount * 150n) + await transfer(ethersSigner, usdcTokenAddress, senderAddress, usdcAmount * 150n) console.log(`creating the Safe batch...`) @@ -79,7 +81,7 @@ async function main() { value: '0' } const transactions = [transferUSDC, transferUSDC] - const timestamp = (await provider.getBlock('latest'))?.timestamp || 0 + const timestamp = (await ethersProvider.getBlock('latest'))?.timestamp || 0 // 2) Create transaction batch const safeOperation = await safe4337Pack.createTransaction({ @@ -126,7 +128,12 @@ const generateTransferCallData = (to: string, value: bigint) => { return iface.encodeFunctionData('transfer', [to, value]) } -async function transfer(signer: ethers.Wallet, tokenAddress: string, to: string, amount: bigint) { +async function transfer( + signer: ethers.AbstractSigner, + tokenAddress: string, + to: string, + amount: bigint +) { const transferEC20 = { to: tokenAddress, data: generateTransferCallData(to, amount), diff --git a/playground/relay-kit/usdc-transfer-4337-erc20.ts b/playground/relay-kit/usdc-transfer-4337-erc20.ts index 911a8b8e7..be36163e3 100644 --- a/playground/relay-kit/usdc-transfer-4337-erc20.ts +++ b/playground/relay-kit/usdc-transfer-4337-erc20.ts @@ -1,4 +1,3 @@ -import { EthersAdapter } from '@safe-global/protocol-kit' import { ethers } from 'ethers' import { Safe4337Pack } from '@safe-global/relay-kit' @@ -31,17 +30,10 @@ const usdcTokenAddress = '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238' // SEPOLIA // const usdcTokenAddress = '0xddafbb505ad214d7b80b1f830fccc89b60fb7a83' // GNOSIS async function main() { - // Instantiate EtherAdapter - const provider = new ethers.JsonRpcProvider(RPC_URL) - const signer = new ethers.Wallet(PRIVATE_KEY, provider) - const ethersAdapter = new EthersAdapter({ - ethers, - signerOrProvider: signer - }) - // 1) Initialize pack with the paymaster data const safe4337Pack = await Safe4337Pack.init({ - ethersAdapter, + provider: RPC_URL, + signer: PRIVATE_KEY, rpcUrl: RPC_URL, bundlerUrl: BUNDLER_URL, paymasterOptions: { @@ -65,8 +57,15 @@ async function main() { console.log(`sending USDC...`) + const ethersSigner = await safe4337Pack.protocolKit.getSafeProvider().getExternalSigner() + const ethersProvider = safe4337Pack.protocolKit.getSafeProvider().getExternalProvider() + + if (!ethersSigner) { + throw new Error('No signer found!') + } + // send 5 USDC to the Safe - await transfer(signer, usdcTokenAddress, senderAddress, usdcAmount * 50n) + await transfer(ethersSigner, usdcTokenAddress, senderAddress, usdcAmount * 50n) console.log(`creating the Safe batch...`) @@ -76,7 +75,7 @@ async function main() { value: '0' } const transactions = [transferUSDC, transferUSDC] - const timestamp = (await provider.getBlock('latest'))?.timestamp || 0 + const timestamp = (await ethersProvider.getBlock('latest'))?.timestamp || 0 // 2) Create transaction batch const safeOperation = await safe4337Pack.createTransaction({ @@ -123,7 +122,12 @@ const generateTransferCallData = (to: string, value: bigint) => { return iface.encodeFunctionData('transfer', [to, value]) } -async function transfer(signer: ethers.Wallet, tokenAddress: string, to: string, amount: bigint) { +async function transfer( + signer: ethers.AbstractSigner, + tokenAddress: string, + to: string, + amount: bigint +) { const transferEC20 = { to: tokenAddress, data: generateTransferCallData(to, amount), diff --git a/playground/relay-kit/usdc-transfer-4337-sponsored-counterfactual.ts b/playground/relay-kit/usdc-transfer-4337-sponsored-counterfactual.ts index 218b12866..c855a1f03 100644 --- a/playground/relay-kit/usdc-transfer-4337-sponsored-counterfactual.ts +++ b/playground/relay-kit/usdc-transfer-4337-sponsored-counterfactual.ts @@ -1,4 +1,3 @@ -import { EthersAdapter } from '@safe-global/protocol-kit' import { ethers } from 'ethers' import { Safe4337Pack } from '@safe-global/relay-kit' @@ -7,6 +6,9 @@ const PRIVATE_KEY = '' const PIMLICO_API_KEY = '' +// Safe owner address +const OWNER_ADDRESS = '' + // PolicyId is an optional parameter, you can create one here: https://dashboard.pimlico.io/sponsorship-policies const POLICY_ID = '' @@ -34,17 +36,10 @@ const usdcTokenAddress = '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238' // SEPOLIA // const usdcTokenAddress = '0xddafbb505ad214d7b80b1f830fccc89b60fb7a83' // GNOSIS async function main() { - // Instantiate EtherAdapter - const provider = new ethers.JsonRpcProvider(RPC_URL) - const signer = new ethers.Wallet(PRIVATE_KEY, provider) - const ethersAdapter = new EthersAdapter({ - ethers, - signerOrProvider: signer - }) - // 1) Initialize pack with the paymaster data const safe4337Pack = await Safe4337Pack.init({ - ethersAdapter, + provider: RPC_URL, + signer: PRIVATE_KEY, rpcUrl: RPC_URL, bundlerUrl: BUNDLER_URL, paymasterOptions: { @@ -54,7 +49,7 @@ async function main() { paymasterUrl: PAYMASTER_URL }, options: { - owners: [await signer.getAddress()], + owners: [OWNER_ADDRESS], threshold: 1, saltNonce: '4337' + '1' // to update the address } @@ -75,8 +70,15 @@ async function main() { console.log(`sending USDC...`) + const ethersSigner = await safe4337Pack.protocolKit.getSafeProvider().getExternalSigner() + const ethersProvider = safe4337Pack.protocolKit.getSafeProvider().getExternalProvider() + + if (!ethersSigner) { + throw new Error('No signer found!') + } + // send 0.2 USDC to the Safe - await transfer(signer, usdcTokenAddress, senderAddress, usdcAmount * 2n) + await transfer(ethersSigner, usdcTokenAddress, senderAddress, usdcAmount * 2n) console.log(`creating the Safe batch...`) @@ -86,7 +88,7 @@ async function main() { value: '0' } const transactions = [transferUSDC, transferUSDC] - const timestamp = (await provider.getBlock('latest'))?.timestamp || 0 + const timestamp = (await ethersProvider.getBlock('latest'))?.timestamp || 0 // 2) Create transaction batch const safeOperation = await safe4337Pack.createTransaction({ @@ -133,7 +135,12 @@ const generateTransferCallData = (to: string, value: bigint) => { return iface.encodeFunctionData('transfer', [to, value]) } -async function transfer(signer: ethers.Wallet, tokenAddress: string, to: string, amount: bigint) { +async function transfer( + signer: ethers.AbstractSigner, + tokenAddress: string, + to: string, + amount: bigint +) { const transferEC20 = { to: tokenAddress, data: generateTransferCallData(to, amount), diff --git a/playground/relay-kit/usdc-transfer-4337-sponsored.ts b/playground/relay-kit/usdc-transfer-4337-sponsored.ts index 39af77cfd..6a398623d 100644 --- a/playground/relay-kit/usdc-transfer-4337-sponsored.ts +++ b/playground/relay-kit/usdc-transfer-4337-sponsored.ts @@ -1,4 +1,3 @@ -import { EthersAdapter } from '@safe-global/protocol-kit' import { ethers } from 'ethers' import { Safe4337Pack } from '@safe-global/relay-kit' @@ -37,17 +36,10 @@ const usdcTokenAddress = '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238' // SEPOLIA // const usdcTokenAddress = '0xddafbb505ad214d7b80b1f830fccc89b60fb7a83' // GNOSIS async function main() { - // Instantiate EtherAdapter - const provider = new ethers.JsonRpcProvider(RPC_URL) - const signer = new ethers.Wallet(PRIVATE_KEY, provider) - const ethersAdapter = new EthersAdapter({ - ethers, - signerOrProvider: signer - }) - // 1) Initialize pack with the paymaster data const safe4337Pack = await Safe4337Pack.init({ - ethersAdapter, + provider: RPC_URL, + signer: PRIVATE_KEY, rpcUrl: RPC_URL, bundlerUrl: BUNDLER_URL, paymasterOptions: { @@ -76,7 +68,8 @@ async function main() { value: '0' } const transactions = [transferUSDC, transferUSDC] - const timestamp = (await provider.getBlock('latest'))?.timestamp || 0 + const ethersProvider = safe4337Pack.protocolKit.getSafeProvider().getExternalProvider() + const timestamp = (await ethersProvider.getBlock('latest'))?.timestamp || 0 // 2) Create transaction batch const safeOperation = await safe4337Pack.createTransaction({ diff --git a/playground/relay-kit/usdc-transfer-4337.ts b/playground/relay-kit/usdc-transfer-4337.ts index 048eb6ab0..f1e91bf9f 100644 --- a/playground/relay-kit/usdc-transfer-4337.ts +++ b/playground/relay-kit/usdc-transfer-4337.ts @@ -1,4 +1,3 @@ -import { EthersAdapter } from '@safe-global/protocol-kit' import { ethers } from 'ethers' import { Safe4337Pack } from '@safe-global/relay-kit' @@ -21,17 +20,10 @@ const RPC_URL = 'https://rpc.ankr.com/eth_sepolia' const usdcTokenAddress = '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238' async function main() { - // Instantiate EtherAdapter - const provider = new ethers.JsonRpcProvider(RPC_URL) - const signer = new ethers.Wallet(PRIVATE_KEY, provider) - const ethersAdapter = new EthersAdapter({ - ethers, - signerOrProvider: signer - }) - // 1) Initialize pack const safe4337Pack = await Safe4337Pack.init({ - ethersAdapter, + provider: RPC_URL, + signer: PRIVATE_KEY, rpcUrl: RPC_URL, bundlerUrl: BUNDLER_URL, options: { @@ -55,7 +47,8 @@ async function main() { value: '0' } const transactions = [transferUSDC, transferUSDC] - const timestamp = (await provider.getBlock('latest'))?.timestamp || 0 + const ethersProvider = safe4337Pack.protocolKit.getSafeProvider().getExternalProvider() + const timestamp = (await ethersProvider.getBlock('latest'))?.timestamp || 0 // 2) Create transaction batch const safeOperation = await safe4337Pack.createTransaction({ From 2a8107118d6f8e1bfcdfc29449fa8436a1adc043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 25 Apr 2024 12:55:28 +0200 Subject: [PATCH 064/112] Organize protocol-kit types and export from barrel --- packages/protocol-kit/src/types/contracts.ts | 118 +++++++ packages/protocol-kit/src/types/index.ts | 309 +----------------- packages/protocol-kit/src/types/safeConfig.ts | 83 +++++ .../protocol-kit/src/types/safeProvider.ts | 31 ++ packages/protocol-kit/src/types/signing.ts | 9 + .../protocol-kit/src/types/transactions.ts | 68 ++++ 6 files changed, 314 insertions(+), 304 deletions(-) create mode 100644 packages/protocol-kit/src/types/contracts.ts create mode 100644 packages/protocol-kit/src/types/safeConfig.ts create mode 100644 packages/protocol-kit/src/types/safeProvider.ts create mode 100644 packages/protocol-kit/src/types/signing.ts create mode 100644 packages/protocol-kit/src/types/transactions.ts diff --git a/packages/protocol-kit/src/types/contracts.ts b/packages/protocol-kit/src/types/contracts.ts new file mode 100644 index 000000000..612f3fd28 --- /dev/null +++ b/packages/protocol-kit/src/types/contracts.ts @@ -0,0 +1,118 @@ +import { JsonFragment } from 'ethers' +import { SafeVersion } from '@safe-global/safe-core-sdk-types' + +import SafeContract_v1_0_0 from '@safe-global/protocol-kit/contracts/Safe/v1.0.0/SafeContract_v1_0_0' +import SafeContract_v1_1_1 from '@safe-global/protocol-kit/contracts/Safe/v1.1.1/SafeContract_v1_1_1' +import SafeContract_v1_2_0 from '@safe-global/protocol-kit/contracts/Safe/v1.2.0/SafeContract_v1_2_0' +import SafeContract_v1_3_0 from '@safe-global/protocol-kit/contracts/Safe/v1.3.0/SafeContract_v1_3_0' +import SafeContract_v1_4_1 from '@safe-global/protocol-kit/contracts/Safe/v1.4.1/SafeContract_v1_4_1' +import MultiSendContract_v1_1_1 from '@safe-global/protocol-kit/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1' +import MultiSendContract_v1_3_0 from '@safe-global/protocol-kit/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0' +import MultiSendContract_v1_4_1 from '@safe-global/protocol-kit/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1' +import MultiSendCallOnlyContract_v1_4_1 from '@safe-global/protocol-kit/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1' +import MultiSendCallOnlyContract_v1_3_0 from '@safe-global/protocol-kit/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0' +import CompatibilityFallbackHandlerContract_v1_3_0 from '@safe-global/protocol-kit/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0' +import CompatibilityFallbackHandlerContract_v1_4_1 from '@safe-global/protocol-kit/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1' +import SafeProxyFactoryContract_v1_0_0 from '@safe-global/protocol-kit/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0' +import SafeProxyFactoryContract_v1_1_1 from '@safe-global/protocol-kit/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1' +import SafeProxyFactoryContract_v1_3_0 from '@safe-global/protocol-kit/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0' +import SafeProxyFactoryContract_v1_4_1 from '@safe-global/protocol-kit/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1' +import SignMessageLibContract_v1_3_0 from '@safe-global/protocol-kit/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0' +import SignMessageLibContract_v1_4_1 from '@safe-global/protocol-kit/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1' +import SimulateTxAccessorContract_v1_3_0 from '@safe-global/protocol-kit/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0' +import SimulateTxAccessorContract_v1_4_1 from '@safe-global/protocol-kit/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1' +import CreateCallContract_v1_3_0 from '@safe-global/protocol-kit/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0' +import CreateCallContract_v1_4_1 from '@safe-global/protocol-kit/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1' + +// Safe contract implementation types +export type SafeContractImplementationType = + | SafeContract_v1_0_0 + | SafeContract_v1_1_1 + | SafeContract_v1_2_0 + | SafeContract_v1_3_0 + | SafeContract_v1_4_1 + +// MultiSend contract implementation types +export type MultiSendContractImplementationType = + | MultiSendContract_v1_1_1 + | MultiSendContract_v1_3_0 + | MultiSendContract_v1_4_1 + +// MultiSendCallOnly contract implementation types +export type MultiSendCallOnlyContractImplementationType = + | MultiSendCallOnlyContract_v1_3_0 + | MultiSendCallOnlyContract_v1_4_1 + +// CompatibilityFallbackHandler contract implementation types +export type CompatibilityFallbackHandlerContractImplementationType = + | CompatibilityFallbackHandlerContract_v1_3_0 + | CompatibilityFallbackHandlerContract_v1_4_1 + +// SafeProxyFactory contract implementation types +export type SafeProxyFactoryContractImplementationType = + | SafeProxyFactoryContract_v1_0_0 + | SafeProxyFactoryContract_v1_1_1 + | SafeProxyFactoryContract_v1_3_0 + | SafeProxyFactoryContract_v1_4_1 + +// SignMessageLib contract implementation types +export type SignMessageLibContractImplementationType = + | SignMessageLibContract_v1_3_0 + | SignMessageLibContract_v1_4_1 + +// SimulateTxAccessor contract implementation types +export type SimulateTxAccessorContractImplementationType = + | SimulateTxAccessorContract_v1_3_0 + | SimulateTxAccessorContract_v1_4_1 + +// CreateCall contract implementation types +export type CreateCallContractImplementationType = + | CreateCallContract_v1_3_0 + | CreateCallContract_v1_4_1 + +export type GetContractProps = { + safeVersion: SafeVersion + customContractAddress?: string + customContractAbi?: JsonFragment | JsonFragment[] + isL1SafeSingleton?: boolean +} + +export type ContractNetworkConfig = { + /** safeSingletonAddress - Address of the Safe Singleton contract deployed on a specific network */ + safeSingletonAddress: string + /** safeSingletonAbi - Abi of the Safe Singleton contract deployed on a specific network */ + safeSingletonAbi?: JsonFragment | JsonFragment[] + /** safeProxyFactoryAddress - Address of the SafeProxyFactory contract deployed on a specific network */ + safeProxyFactoryAddress: string + /** safeProxyFactoryAbi - Abi of the SafeProxyFactory contract deployed on a specific network */ + safeProxyFactoryAbi?: JsonFragment | JsonFragment[] + /** multiSendAddress - Address of the MultiSend contract deployed on a specific network */ + multiSendAddress: string + /** multiSendAbi - Abi of the MultiSend contract deployed on a specific network */ + multiSendAbi?: JsonFragment | JsonFragment[] + /** multiSendCallOnlyAddress - Address of the MultiSendCallOnly contract deployed on a specific network */ + multiSendCallOnlyAddress: string + /** multiSendCallOnlyAbi - Abi of the MultiSendCallOnly contract deployed on a specific network */ + multiSendCallOnlyAbi?: JsonFragment | JsonFragment[] + /** fallbackHandlerAddress - Address of the Fallback Handler contract deployed on a specific network */ + fallbackHandlerAddress: string + /** fallbackHandlerAbi - Abi of the Fallback Handler contract deployed on a specific network */ + fallbackHandlerAbi?: JsonFragment | JsonFragment[] + /** signMessageLibAddress - Address of the SignMessageLib contract deployed on a specific network */ + signMessageLibAddress: string + /** signMessageLibAbi - Abi of the SignMessageLib contract deployed on a specific network */ + signMessageLibAbi?: JsonFragment | JsonFragment[] + /** createCallAddress - Address of the CreateCall contract deployed on a specific network */ + createCallAddress: string + /** createCallAbi - Abi of the CreateCall contract deployed on a specific network */ + createCallAbi?: JsonFragment | JsonFragment[] + /** simulateTxAccessorAddress - Address of the SimulateTxAccessor contract deployed on a specific network */ + simulateTxAccessorAddress: string + /** simulateTxAccessorAbi - Abi of the SimulateTxAccessor contract deployed on a specific network */ + simulateTxAccessorAbi?: JsonFragment | JsonFragment[] +} + +export type ContractNetworksConfig = { + /** id - Network id */ + [id: string]: ContractNetworkConfig +} diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index c6f889735..77bcfa8ba 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -1,304 +1,5 @@ -import { JsonFragment } from 'ethers' -import { SafeTransactionOptionalProps } from '@safe-global/protocol-kit/utils/transactions' -import { - MetaTransactionData, - SafeTransactionDataPartial, - SafeVersion -} from '@safe-global/safe-core-sdk-types' -import SafeContract_v1_0_0 from '@safe-global/protocol-kit/contracts/Safe/v1.0.0/SafeContract_v1_0_0' -import SafeContract_v1_1_1 from '@safe-global/protocol-kit/contracts/Safe/v1.1.1/SafeContract_v1_1_1' -import SafeContract_v1_2_0 from '@safe-global/protocol-kit/contracts/Safe/v1.2.0/SafeContract_v1_2_0' -import SafeContract_v1_3_0 from '@safe-global/protocol-kit/contracts/Safe/v1.3.0/SafeContract_v1_3_0' -import SafeContract_v1_4_1 from '@safe-global/protocol-kit/contracts/Safe/v1.4.1/SafeContract_v1_4_1' -import MultiSendContract_v1_1_1 from '@safe-global/protocol-kit/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1' -import MultiSendContract_v1_3_0 from '@safe-global/protocol-kit/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0' -import MultiSendContract_v1_4_1 from '@safe-global/protocol-kit/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1' -import MultiSendCallOnlyContract_v1_4_1 from '@safe-global/protocol-kit/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1' -import MultiSendCallOnlyContract_v1_3_0 from '@safe-global/protocol-kit/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0' -import CompatibilityFallbackHandlerContract_v1_3_0 from '@safe-global/protocol-kit/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0' -import CompatibilityFallbackHandlerContract_v1_4_1 from '@safe-global/protocol-kit/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1' -import SafeProxyFactoryContract_v1_0_0 from '@safe-global/protocol-kit/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0' -import SafeProxyFactoryContract_v1_1_1 from '@safe-global/protocol-kit/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1' -import SafeProxyFactoryContract_v1_3_0 from '@safe-global/protocol-kit/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0' -import SafeProxyFactoryContract_v1_4_1 from '@safe-global/protocol-kit/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1' -import SignMessageLibContract_v1_3_0 from '@safe-global/protocol-kit/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0' -import SignMessageLibContract_v1_4_1 from '@safe-global/protocol-kit/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1' -import SimulateTxAccessorContract_v1_3_0 from '@safe-global/protocol-kit/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0' -import SimulateTxAccessorContract_v1_4_1 from '@safe-global/protocol-kit/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1' -import CreateCallContract_v1_3_0 from '@safe-global/protocol-kit/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0' -import CreateCallContract_v1_4_1 from '@safe-global/protocol-kit/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1' - -export interface SafeAccountConfig { - owners: string[] - threshold: number - to?: string - data?: string - fallbackHandler?: string - paymentToken?: string - payment?: number - paymentReceiver?: string -} - -export interface SafeDeploymentConfig { - saltNonce?: string - safeVersion?: SafeVersion -} - -export interface PredictedSafeProps { - safeAccountConfig: SafeAccountConfig - safeDeploymentConfig?: SafeDeploymentConfig -} - -export interface ContractNetworkConfig { - /** safeSingletonAddress - Address of the Safe Singleton contract deployed on a specific network */ - safeSingletonAddress: string - /** safeSingletonAbi - Abi of the Safe Singleton contract deployed on a specific network */ - safeSingletonAbi?: JsonFragment | JsonFragment[] - /** safeProxyFactoryAddress - Address of the SafeProxyFactory contract deployed on a specific network */ - safeProxyFactoryAddress: string - /** safeProxyFactoryAbi - Abi of the SafeProxyFactory contract deployed on a specific network */ - safeProxyFactoryAbi?: JsonFragment | JsonFragment[] - /** multiSendAddress - Address of the MultiSend contract deployed on a specific network */ - multiSendAddress: string - /** multiSendAbi - Abi of the MultiSend contract deployed on a specific network */ - multiSendAbi?: JsonFragment | JsonFragment[] - /** multiSendCallOnlyAddress - Address of the MultiSendCallOnly contract deployed on a specific network */ - multiSendCallOnlyAddress: string - /** multiSendCallOnlyAbi - Abi of the MultiSendCallOnly contract deployed on a specific network */ - multiSendCallOnlyAbi?: JsonFragment | JsonFragment[] - /** fallbackHandlerAddress - Address of the Fallback Handler contract deployed on a specific network */ - fallbackHandlerAddress: string - /** fallbackHandlerAbi - Abi of the Fallback Handler contract deployed on a specific network */ - fallbackHandlerAbi?: JsonFragment | JsonFragment[] - /** signMessageLibAddress - Address of the SignMessageLib contract deployed on a specific network */ - signMessageLibAddress: string - /** signMessageLibAbi - Abi of the SignMessageLib contract deployed on a specific network */ - signMessageLibAbi?: JsonFragment | JsonFragment[] - /** createCallAddress - Address of the CreateCall contract deployed on a specific network */ - createCallAddress: string - /** createCallAbi - Abi of the CreateCall contract deployed on a specific network */ - createCallAbi?: JsonFragment | JsonFragment[] - /** simulateTxAccessorAddress - Address of the SimulateTxAccessor contract deployed on a specific network */ - simulateTxAccessorAddress: string - /** simulateTxAccessorAbi - Abi of the SimulateTxAccessor contract deployed on a specific network */ - simulateTxAccessorAbi?: JsonFragment | JsonFragment[] -} - -export interface ContractNetworksConfig { - /** id - Network id */ - [id: string]: ContractNetworkConfig -} - -type SafeConfigWithSafeAddressProps = { - /** safeAddress - The address of the Safe account to use */ - safeAddress: string - /** predictedSafe - The configuration of the Safe that is not yet deployed */ - predictedSafe?: never -} - -type SafeConfigWithPredictedSafeProps = { - /** safeAddress - The address of the Safe account to use */ - safeAddress?: never - /** predictedSafe - The configuration of the Safe that is not yet deployed */ - predictedSafe: PredictedSafeProps -} - -export type SafeConfigProps = { - provider: Eip1193Provider | HttpTransport | SocketTransport - signer?: string - /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ - isL1SafeSingleton?: boolean - /** contractNetworks - Contract network configuration */ - contractNetworks?: ContractNetworksConfig -} - -export type SafeConfigWithSafeAddress = SafeConfigProps & SafeConfigWithSafeAddressProps -export type SafeConfigWithPredictedSafe = SafeConfigProps & SafeConfigWithPredictedSafeProps -export type SafeConfig = SafeConfigWithSafeAddress | SafeConfigWithPredictedSafe - -type ConnectSafeConfigWithSafeAddressProps = { - /** safeAddress - The address of the Safe account to use */ - safeAddress?: string - /** predictedSafe - The configuration of the Safe that is not yet deployed */ - predictedSafe?: never -} - -type ConnectSafeConfigWithPredictedSafeProps = { - /** safeAddress - The address of the Safe account to use */ - safeAddress?: never - /** predictedSafe - The configuration of the Safe that is not yet deployed */ - predictedSafe?: PredictedSafeProps -} - -type ConnectSafeConfigProps = { - provider?: Eip1193Provider | HttpTransport | SocketTransport - signer?: string - /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ - isL1SafeSingleton?: boolean - /** contractNetworks - Contract network configuration */ - contractNetworks?: ContractNetworksConfig -} - -export type ConnectSafeConfigWithSafeAddress = ConnectSafeConfigProps & - ConnectSafeConfigWithSafeAddressProps -export type ConnectSafeConfigWithPredictedSafe = ConnectSafeConfigProps & - ConnectSafeConfigWithPredictedSafeProps -export type ConnectSafeConfig = - | ConnectSafeConfigWithSafeAddress - | ConnectSafeConfigWithPredictedSafe - -export interface CreateTransactionProps { - /** transactions - The transaction array to process */ - transactions: MetaTransactionData[] - /** options - The transaction array optional properties */ - options?: SafeTransactionOptionalProps - /** onlyCalls - Forces the execution of the transaction array with MultiSendCallOnly contract */ - onlyCalls?: boolean -} - -export interface AddOwnerTxParams { - /** ownerAddress - The address of the new owner */ - ownerAddress: string - /** threshold - The new threshold */ - threshold?: number -} - -export interface RemoveOwnerTxParams { - /** ownerAddress - The address of the owner that will be removed */ - ownerAddress: string - /** threshold - The new threshold */ - threshold?: number -} - -export interface SwapOwnerTxParams { - /** oldOwnerAddress - The old owner address */ - oldOwnerAddress: string - /** newOwnerAddress - The new owner address */ - newOwnerAddress: string -} - -type StandardizeSafeTxDataWithSafeContractProps = { - /** safeContract - The Safe contract to use */ - safeContract: SafeContractImplementationType - /** predictedSafe - The configuration of the Safe that is not yet deployed */ - predictedSafe?: never -} - -type StandardizeSafeTxDataWithPredictedSafeProps = { - /** safeContract - The Safe contract to use */ - safeContract?: never - /** predictedSafe - The configuration of the Safe that is not yet deployed */ - predictedSafe: PredictedSafeProps -} - -interface StandardizeSafeTransactionData { - provider: Eip1193Provider | HttpTransport | SocketTransport - signer?: string - /** tx - Safe transaction */ - tx: SafeTransactionDataPartial - /** contractNetworks - Contract network configuration */ - contractNetworks?: ContractNetworksConfig -} - -export type StandardizeSafeTxDataWithSafeContract = StandardizeSafeTransactionData & - StandardizeSafeTxDataWithSafeContractProps -export type StandardizeSafeTxDataWithPredictedSafe = StandardizeSafeTransactionData & - StandardizeSafeTxDataWithPredictedSafeProps -export type StandardizeSafeTransactionDataProps = - | StandardizeSafeTxDataWithSafeContract - | StandardizeSafeTxDataWithPredictedSafe - -export enum SigningMethod { - ETH_SIGN = 'eth_sign', - ETH_SIGN_TYPED_DATA = 'eth_signTypedData', - ETH_SIGN_TYPED_DATA_V3 = 'eth_signTypedData_v3', - ETH_SIGN_TYPED_DATA_V4 = 'eth_signTypedData_v4', - SAFE_SIGNATURE = 'safe_sign' -} - -export type SigningMethodType = SigningMethod | string - -// Safe contract implementation types -export type SafeContractImplementationType = - | SafeContract_v1_0_0 - | SafeContract_v1_1_1 - | SafeContract_v1_2_0 - | SafeContract_v1_3_0 - | SafeContract_v1_4_1 - -// MultiSend contract implementation types -export type MultiSendContractImplementationType = - | MultiSendContract_v1_1_1 - | MultiSendContract_v1_3_0 - | MultiSendContract_v1_4_1 - -// MultiSendCallOnly contract implementation types -export type MultiSendCallOnlyContractImplementationType = - | MultiSendCallOnlyContract_v1_3_0 - | MultiSendCallOnlyContract_v1_4_1 - -// CompatibilityFallbackHandler contract implementation types -export type CompatibilityFallbackHandlerContractImplementationType = - | CompatibilityFallbackHandlerContract_v1_3_0 - | CompatibilityFallbackHandlerContract_v1_4_1 - -// SafeProxyFactory contract implementation types -export type SafeProxyFactoryContractImplementationType = - | SafeProxyFactoryContract_v1_0_0 - | SafeProxyFactoryContract_v1_1_1 - | SafeProxyFactoryContract_v1_3_0 - | SafeProxyFactoryContract_v1_4_1 - -// SignMessageLib contract implementation types -export type SignMessageLibContractImplementationType = - | SignMessageLibContract_v1_3_0 - | SignMessageLibContract_v1_4_1 - -// SimulateTxAccessor contract implementation types -export type SimulateTxAccessorContractImplementationType = - | SimulateTxAccessorContract_v1_3_0 - | SimulateTxAccessorContract_v1_4_1 - -// CreateCall contract implementation types -export type CreateCallContractImplementationType = - | CreateCallContract_v1_3_0 - | CreateCallContract_v1_4_1 - -export type RequestArguments = { - readonly method: string - readonly params?: readonly unknown[] | object -} - -export interface Eip1193Provider { - request: (args: RequestArguments) => Promise -} - -export interface SafeProviderTransaction { - to: string - from: string - data: string - value?: string - gasPrice?: number | string - gasLimit?: number | string - maxFeePerGas?: number | string - maxPriorityFeePerGas?: number | string -} - -export interface GetContractProps { - safeVersion: SafeVersion - customContractAddress?: string - customContractAbi?: JsonFragment | JsonFragment[] - isL1SafeSingleton?: boolean -} - -export type HexAddress = string -export type PrivateKey = string -export type HttpTransport = string -export type SocketTransport = string -export type SafeSigner = HexAddress | PrivateKey - -export interface SafeProviderConfig { - /** signerOrProvider - Ethers signer or provider */ - provider: Eip1193Provider | HttpTransport | SocketTransport - signer?: HexAddress | PrivateKey -} +export * from './contracts' +export * from './safeConfig' +export * from './safeProvider' +export * from './signing' +export * from './transactions' diff --git a/packages/protocol-kit/src/types/safeConfig.ts b/packages/protocol-kit/src/types/safeConfig.ts new file mode 100644 index 000000000..5e9f9b9ab --- /dev/null +++ b/packages/protocol-kit/src/types/safeConfig.ts @@ -0,0 +1,83 @@ +import { SafeVersion } from '@safe-global/safe-core-sdk-types' + +import { SafeProviderConfig } from './safeProvider' +import { ContractNetworksConfig } from './contracts' + +export type SafeAccountConfig = { + owners: string[] + threshold: number + to?: string + data?: string + fallbackHandler?: string + paymentToken?: string + payment?: number + paymentReceiver?: string +} + +export type SafeDeploymentConfig = { + saltNonce?: string + safeVersion?: SafeVersion +} + +export type PredictedSafeProps = { + safeAccountConfig: SafeAccountConfig + safeDeploymentConfig?: SafeDeploymentConfig +} + +type SafeConfigWithSafeAddressProps = { + /** safeAddress - The address of the Safe account to use */ + safeAddress: string + /** predictedSafe - The configuration of the Safe that is not yet deployed */ + predictedSafe?: never +} + +type SafeConfigWithPredictedSafeProps = { + /** safeAddress - The address of the Safe account to use */ + safeAddress?: never + /** predictedSafe - The configuration of the Safe that is not yet deployed */ + predictedSafe: PredictedSafeProps +} + +export type SafeConfigProps = { + provider: SafeProviderConfig['provider'] + signer?: SafeProviderConfig['signer'] + /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ + isL1SafeSingleton?: boolean + /** contractNetworks - Contract network configuration */ + contractNetworks?: ContractNetworksConfig +} + +export type SafeConfigWithSafeAddress = SafeConfigProps & SafeConfigWithSafeAddressProps +export type SafeConfigWithPredictedSafe = SafeConfigProps & SafeConfigWithPredictedSafeProps +export type SafeConfig = SafeConfigWithSafeAddress | SafeConfigWithPredictedSafe + +type ConnectSafeConfigWithSafeAddressProps = { + /** safeAddress - The address of the Safe account to use */ + safeAddress?: string + /** predictedSafe - The configuration of the Safe that is not yet deployed */ + predictedSafe?: never +} + +type ConnectSafeConfigWithPredictedSafeProps = { + /** safeAddress - The address of the Safe account to use */ + safeAddress?: never + /** predictedSafe - The configuration of the Safe that is not yet deployed */ + predictedSafe?: PredictedSafeProps +} + +type ConnectSafeConfigProps = { + provider?: SafeProviderConfig['provider'] + signer?: SafeProviderConfig['signer'] + /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ + isL1SafeSingleton?: boolean + /** contractNetworks - Contract network configuration */ + contractNetworks?: ContractNetworksConfig +} + +export type ConnectSafeConfigWithSafeAddress = ConnectSafeConfigProps & + ConnectSafeConfigWithSafeAddressProps +export type ConnectSafeConfigWithPredictedSafe = ConnectSafeConfigProps & + ConnectSafeConfigWithPredictedSafeProps +export type ConnectSafeConfig = + | ConnectSafeConfigWithSafeAddress + | ConnectSafeConfigWithPredictedSafe diff --git a/packages/protocol-kit/src/types/safeProvider.ts b/packages/protocol-kit/src/types/safeProvider.ts new file mode 100644 index 000000000..3e99c279c --- /dev/null +++ b/packages/protocol-kit/src/types/safeProvider.ts @@ -0,0 +1,31 @@ +export type RequestArguments = { + readonly method: string + readonly params?: readonly unknown[] | object +} + +export type Eip1193Provider = { + request: (args: RequestArguments) => Promise +} + +export type HexAddress = string +export type PrivateKey = string +export type HttpTransport = string +export type SocketTransport = string +export type SafeSigner = HexAddress | PrivateKey + +export type SafeProviderConfig = { + /** signerOrProvider - Ethers signer or provider */ + provider: Eip1193Provider | HttpTransport | SocketTransport + signer?: HexAddress | PrivateKey +} + +export type SafeProviderTransaction = { + to: string + from: string + data: string + value?: string + gasPrice?: number | string + gasLimit?: number | string + maxFeePerGas?: number | string + maxPriorityFeePerGas?: number | string +} diff --git a/packages/protocol-kit/src/types/signing.ts b/packages/protocol-kit/src/types/signing.ts new file mode 100644 index 000000000..3cb5f5792 --- /dev/null +++ b/packages/protocol-kit/src/types/signing.ts @@ -0,0 +1,9 @@ +export enum SigningMethod { + ETH_SIGN = 'eth_sign', + ETH_SIGN_TYPED_DATA = 'eth_signTypedData', + ETH_SIGN_TYPED_DATA_V3 = 'eth_signTypedData_v3', + ETH_SIGN_TYPED_DATA_V4 = 'eth_signTypedData_v4', + SAFE_SIGNATURE = 'safe_sign' +} + +export type SigningMethodType = SigningMethod | string diff --git a/packages/protocol-kit/src/types/transactions.ts b/packages/protocol-kit/src/types/transactions.ts new file mode 100644 index 000000000..15582c2fa --- /dev/null +++ b/packages/protocol-kit/src/types/transactions.ts @@ -0,0 +1,68 @@ +import { MetaTransactionData, SafeTransactionDataPartial } from '@safe-global/safe-core-sdk-types' +import { SafeTransactionOptionalProps } from '@safe-global/protocol-kit/utils/transactions' + +import { SafeProviderConfig } from './safeProvider' +import { SafeContractImplementationType } from './contracts' +import { ContractNetworksConfig } from './contracts' +import { PredictedSafeProps } from './safeConfig' + +export type CreateTransactionProps = { + /** transactions - The transaction array to process */ + transactions: MetaTransactionData[] + /** options - The transaction array optional properties */ + options?: SafeTransactionOptionalProps + /** onlyCalls - Forces the execution of the transaction array with MultiSendCallOnly contract */ + onlyCalls?: boolean +} + +type StandardizeSafeTxDataWithSafeContractProps = { + /** safeContract - The Safe contract to use */ + safeContract: SafeContractImplementationType + /** predictedSafe - The configuration of the Safe that is not yet deployed */ + predictedSafe?: never +} + +type StandardizeSafeTxDataWithPredictedSafeProps = { + /** safeContract - The Safe contract to use */ + safeContract?: never + /** predictedSafe - The configuration of the Safe that is not yet deployed */ + predictedSafe: PredictedSafeProps +} + +type StandardizeSafeTransactionData = { + provider: SafeProviderConfig['provider'] + signer?: SafeProviderConfig['signer'] + /** tx - Safe transaction */ + tx: SafeTransactionDataPartial + /** contractNetworks - Contract network configuration */ + contractNetworks?: ContractNetworksConfig +} + +export type StandardizeSafeTxDataWithSafeContract = StandardizeSafeTransactionData & + StandardizeSafeTxDataWithSafeContractProps +export type StandardizeSafeTxDataWithPredictedSafe = StandardizeSafeTransactionData & + StandardizeSafeTxDataWithPredictedSafeProps +export type StandardizeSafeTransactionDataProps = + | StandardizeSafeTxDataWithSafeContract + | StandardizeSafeTxDataWithPredictedSafe + +export type AddOwnerTxParams = { + /** ownerAddress - The address of the new owner */ + ownerAddress: string + /** threshold - The new threshold */ + threshold?: number +} + +export type RemoveOwnerTxParams = { + /** ownerAddress - The address of the owner that will be removed */ + ownerAddress: string + /** threshold - The new threshold */ + threshold?: number +} + +export type SwapOwnerTxParams = { + /** oldOwnerAddress - The old owner address */ + oldOwnerAddress: string + /** newOwnerAddress - The new owner address */ + newOwnerAddress: string +} From 6f23e0b2d3b4eff373cf098bae568d6d49b39ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 25 Apr 2024 13:03:00 +0200 Subject: [PATCH 065/112] Move SafeFactory types to types folder --- packages/protocol-kit/src/SafeFactory.ts | 45 +++---------------- packages/protocol-kit/src/index.ts | 4 +- packages/protocol-kit/src/types/index.ts | 1 + .../protocol-kit/src/types/safeFactory.ts | 35 +++++++++++++++ 4 files changed, 44 insertions(+), 41 deletions(-) create mode 100644 packages/protocol-kit/src/types/safeFactory.ts diff --git a/packages/protocol-kit/src/SafeFactory.ts b/packages/protocol-kit/src/SafeFactory.ts index 671897630..2e6bee9e6 100644 --- a/packages/protocol-kit/src/SafeFactory.ts +++ b/packages/protocol-kit/src/SafeFactory.ts @@ -13,57 +13,26 @@ import { } from '@safe-global/protocol-kit/contracts/utils' import { ContractNetworksConfig, - HexAddress, - HttpTransport, - PrivateKey, SafeAccountConfig, SafeContractImplementationType, SafeDeploymentConfig, SafeProxyFactoryContractImplementationType, - SocketTransport, - Eip1193Provider + SafeProviderConfig, + SafeFactoryConfig, + SafeFactoryInitConfig, + DeploySafeProps } from '@safe-global/protocol-kit/types' -import { SafeVersion, TransactionOptions } from '@safe-global/safe-core-sdk-types' +import { SafeVersion } from '@safe-global/safe-core-sdk-types' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' -export interface DeploySafeProps { - safeAccountConfig: SafeAccountConfig - saltNonce?: string - options?: TransactionOptions - callback?: (txHash: string) => void -} - -export interface SafeFactoryConfig { - provider: Eip1193Provider | HttpTransport | SocketTransport - signer?: HexAddress | PrivateKey - /** safeVersion - Versions of the Safe deployed by this Factory contract */ - safeVersion?: SafeVersion - /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ - isL1SafeSingleton?: boolean - /** contractNetworks - Contract network configuration */ - contractNetworks?: ContractNetworksConfig -} - -interface SafeFactoryInitConfig { - provider: Eip1193Provider | HttpTransport | SocketTransport - signer?: HexAddress | PrivateKey - privateKeyOrMnemonic?: string - /** safeVersion - Versions of the Safe deployed by this Factory contract */ - safeVersion: SafeVersion - /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ - isL1SafeSingleton?: boolean - /** contractNetworks - Contract network configuration */ - contractNetworks?: ContractNetworksConfig -} - class SafeFactory { #contractNetworks?: ContractNetworksConfig #isL1SafeSingleton?: boolean #safeVersion!: SafeVersion #safeProxyFactoryContract!: SafeProxyFactoryContractImplementationType #safeContract!: SafeContractImplementationType - #provider!: Eip1193Provider | HttpTransport | SocketTransport - #signer?: HexAddress | PrivateKey + #provider!: SafeProviderConfig['provider'] + #signer?: SafeFactoryConfig['signer'] #safeProvider!: SafeProvider static async create({ diff --git a/packages/protocol-kit/src/index.ts b/packages/protocol-kit/src/index.ts index 86ae0ad38..55f076393 100644 --- a/packages/protocol-kit/src/index.ts +++ b/packages/protocol-kit/src/index.ts @@ -26,7 +26,7 @@ import { getPredictedSafeAddressInitCode } from './contracts/utils' import ContractManager from './managers/contractManager' -import SafeFactory, { DeploySafeProps, SafeFactoryConfig } from './SafeFactory' +import SafeFactory from './SafeFactory' import { EthSafeSignature, estimateTxBaseGas, @@ -69,14 +69,12 @@ export { CreateCallBaseContract, createERC20TokenTransferTransaction, DEFAULT_SAFE_VERSION, - DeploySafeProps, EthSafeSignature, MultiSendCallOnlyBaseContract, MultiSendBaseContract, PREDETERMINED_SALT_NONCE, SafeBaseContract, SafeFactory, - SafeFactoryConfig, SafeProxyFactoryBaseContract, SafeTransactionOptionalProps, SignMessageLibBaseContract, diff --git a/packages/protocol-kit/src/types/index.ts b/packages/protocol-kit/src/types/index.ts index 77bcfa8ba..6fd85f361 100644 --- a/packages/protocol-kit/src/types/index.ts +++ b/packages/protocol-kit/src/types/index.ts @@ -1,5 +1,6 @@ export * from './contracts' export * from './safeConfig' +export * from './safeFactory' export * from './safeProvider' export * from './signing' export * from './transactions' diff --git a/packages/protocol-kit/src/types/safeFactory.ts b/packages/protocol-kit/src/types/safeFactory.ts new file mode 100644 index 000000000..f31d36df8 --- /dev/null +++ b/packages/protocol-kit/src/types/safeFactory.ts @@ -0,0 +1,35 @@ +import { SafeVersion, TransactionOptions } from '@safe-global/safe-core-sdk-types' + +import { SafeProviderConfig } from './safeProvider' +import { SafeAccountConfig } from './safeConfig' +import { ContractNetworksConfig } from './contracts' + +export type DeploySafeProps = { + safeAccountConfig: SafeAccountConfig + saltNonce?: string + options?: TransactionOptions + callback?: (txHash: string) => void +} + +export type SafeFactoryConfig = { + provider: SafeProviderConfig['provider'] + signer?: SafeProviderConfig['signer'] + /** safeVersion - Versions of the Safe deployed by this Factory contract */ + safeVersion?: SafeVersion + /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ + isL1SafeSingleton?: boolean + /** contractNetworks - Contract network configuration */ + contractNetworks?: ContractNetworksConfig +} + +export type SafeFactoryInitConfig = { + provider: SafeProviderConfig['provider'] + signer?: SafeProviderConfig['signer'] + privateKeyOrMnemonic?: string + /** safeVersion - Versions of the Safe deployed by this Factory contract */ + safeVersion: SafeVersion + /** isL1SafeSingleton - Forces to use the Safe L1 version of the contract instead of the L2 version */ + isL1SafeSingleton?: boolean + /** contractNetworks - Contract network configuration */ + contractNetworks?: ContractNetworksConfig +} From 7a0386dc7854bfae23b86c35ae819b111753094d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 25 Apr 2024 14:40:23 +0200 Subject: [PATCH 066/112] Remove EthersAdapter information --- guides/integrating-the-safe-core-sdk.md | 92 +++++++++++++------------ 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/guides/integrating-the-safe-core-sdk.md b/guides/integrating-the-safe-core-sdk.md index 75f350843..4ad3f5ec8 100644 --- a/guides/integrating-the-safe-core-sdk.md +++ b/guides/integrating-the-safe-core-sdk.md @@ -24,16 +24,17 @@ To integrate the [Safe Core SDK](https://github.com/safe-global/safe-core-sdk) i ## 2. Initialize the SDK’s -### Instantiate an EthAdapter +### Select your Ethereum `provider` and `signer` -First of all, we need to create an `EthAdapter`, which contains all the required utilities for the SDKs to interact with the blockchain. It acts as a wrapper for [web3.js](https://web3js.readthedocs.io/) or [ethers.js](https://docs.ethers.org/v6/) Ethereum libraries. +To use our kits, you need to provide an Ethereum provider and a signer. The provider is the connection to the Ethereum network, while the signer is the account that will sign the transactions (The safe owner). When using an injected provider like MetaMask, the signer is the account selected in the wallet. -Depending on the library used by the Dapp, there are two options: +In the examples below, you can see `provider` and `signer` properties, which represent: -- [Create an `EthersAdapter` instance](https://github.com/safe-global/safe-core-sdk/tree/main/packages/protocol-kit/src/adapters/ethers) -- [Create a `Web3Adapter` instance](https://github.com/safe-global/safe-core-sdk/tree/main/packages/protocol-kit/src/adapters/web3) +- `provider`: You can provide an EIP-1193 compatible provider or an HTTP/WebSocket RPC URL. +- `signer`: This is optional. If not provided, we will try to get the connected account of the provider. If you provide it, it represents either the provider's address you want to use or a private key, which we will use internally to retrieve the provider's address. + +````js -Once the instance of `EthersAdapter` or `Web3Adapter` is created, it can be used in the SDK initialization. ### Initialize the Safe API Kit @@ -43,7 +44,7 @@ As stated in the introduction, the [Safe API Kit](https://github.com/safe-global import SafeApiKit from '@safe-global/api-kit' const safeService = new SafeApiKit({ chainId }) -``` +```` Using the `chainId` is enough for chains where Safe runs a Transaction Service. For those chains where Safe doesn't run a service, use the `txServiceUrl` parameter to set the custom service endpoint. @@ -59,9 +60,9 @@ const safeService = new SafeApiKit({ ```js import Safe, { SafeFactory } from '@safe-global/protocol-kit' -const safeFactory = await SafeFactory.create({ ethAdapter }) +const safeFactory = await SafeFactory.create({ provider, signer }) -const safeSdk = await Safe.create({ ethAdapter, safeAddress }) +const safeSdk = await Safe.create({ provider, signer, safeAddress }) ``` There are two versions of the Safe contracts: [Safe.sol](https://github.com/safe-global/safe-contracts/blob/v1.4.1/contracts/Safe.sol) that does not trigger events in order to save gas and [SafeL2.sol](https://github.com/safe-global/safe-contracts/blob/v1.4.1/contracts/SafeL2.sol) that does, which is more appropriate for L2 networks. @@ -69,17 +70,18 @@ There are two versions of the Safe contracts: [Safe.sol](https://github.com/safe By default `Safe.sol` will be only used on Ethereum Mainnet. For the rest of the networks where the Safe contracts are already deployed, the `SafeL2.sol` contract will be used unless you add the property `isL1SafeSingleton` to force the use of the `Safe.sol` contract. ```js -const safeFactory = await SafeFactory.create({ ethAdapter, isL1SafeSingleton: true }) +const safeFactory = await SafeFactory.create({ provider, signer, isL1SafeSingleton: true }) -const safeSdk = await Safe.create({ ethAdapter, safeAddress, isL1SafeSingleton: true }) +const safeSdk = await Safe.create({ provider, signer, safeAddress, isL1SafeSingleton: true }) ``` If the Safe contracts are not deployed to your current network, the property `contractNetworks` will be required to point to the addresses of the Safe contracts previously deployed by you. ```js -import { ContractNetworksConfig } from '@safe-global/protocol-kit' +import { ContractNetworksConfig, SafeProvider } from '@safe-global/protocol-kit' -const chainId = await ethAdapter.getChainId() +const safeProvider = new SafeProvider({ provider, signer }) +const chainId = await safeProvider.getChainId() const contractNetworks: ContractNetworksConfig = { [chainId]: { safeSingletonAddress: '', @@ -101,16 +103,16 @@ const contractNetworks: ContractNetworksConfig = { } } -const safeFactory = await SafeFactory.create({ ethAdapter, contractNetworks }) +const safeFactory = await SafeFactory.create({ provider, signer, contractNetworks }) -const safeSdk = await Safe.create({ ethAdapter, safeAddress, contractNetworks }) +const safeSdk = await Safe.create({ provider, signer, safeAddress, contractNetworks }) ``` The `SafeFactory` constructor also accepts the property `safeVersion` to specify the Safe contract version that will be deployed. This string can take the values `1.0.0`, `1.1.1`, `1.2.0`, `1.3.0` or `1.4.1`. If not specified, the `DEFAULT_SAFE_VERSION` value will be used. ```js const safeVersion = 'X.Y.Z' -const safeFactory = await SafeFactory.create({ ethAdapter, safeVersion }) +const safeFactory = await SafeFactory.create({ provider, signer, safeVersion }) ``` ## 3. Deploy a new Safe @@ -140,37 +142,37 @@ This method takes an array of `MetaTransactionData` objects that represent the i When the array contains only one transaction, it is not wrapped in the MultiSend. - ```js - import { SafeTransactionOptionalProps } from '@safe-global/protocol-kit' - import { MetaTransactionData } from '@safe-global/safe-core-sdk-types' - - const transactions: MetaTransactionData[] = [ - { - to, - data, - value, - operation - }, - { - to, - data, - value, - operation - } - // ... - ] - - const options: SafeTransactionOptionalProps = { - safeTxGas, // Optional - baseGas, // Optional - gasPrice, // Optional - gasToken, // Optional - refundReceiver, // Optional - nonce // Optional +```js +import { SafeTransactionOptionalProps } from '@safe-global/protocol-kit' +import { MetaTransactionData } from '@safe-global/safe-core-sdk-types' + +const transactions: MetaTransactionData[] = [ + { + to, + data, + value, + operation + }, + { + to, + data, + value, + operation } + // ... +] + +const options: SafeTransactionOptionalProps = { + safeTxGas, // Optional + baseGas, // Optional + gasPrice, // Optional + gasToken, // Optional + refundReceiver, // Optional + nonce // Optional +} - const safeTransaction = await safeSdk.createTransaction({ transactions, options }) - ``` +const safeTransaction = await safeSdk.createTransaction({ transactions, options }) +``` We can specify the `nonce` of our Safe transaction as long as it is not lower than the current Safe nonce. If multiple transactions are created but not executed they will share the same `nonce` if no `nonce` is specified, validating the first executed transaction and invalidating all the rest. We can prevent this by calling the method `getNextNonce` from the Safe API Kit instance. This method takes all queued/pending transactions into account when calculating the next nonce, creating a unique one for all different transactions. From 0977866a097b7f514bace432f6ae7ebdc9429a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 25 Apr 2024 14:42:27 +0200 Subject: [PATCH 067/112] Remove EthAdapter from error message --- packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts b/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts index 1ebe24a0f..9e8c854fa 100644 --- a/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts +++ b/packages/relay-kit/src/packs/safe-4337/Safe4337Pack.ts @@ -428,7 +428,7 @@ export class Safe4337Pack extends RelayKitBasePack<{ const owners = await this.protocolKit.getOwners() const signerAddress = await this.protocolKit.getSafeProvider().getSignerAddress() if (!signerAddress) { - throw new Error('EthAdapter must be initialized with a signer to use this method') + throw new Error('There is no signer address available to sign the SafeOperation') } const addressIsOwner = owners.some( From a6ef23c6e619f0ee67d848f5b1780a17cadab2d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 25 Apr 2024 15:17:54 +0200 Subject: [PATCH 068/112] Remove imports --- playground/protocol-kit/deploy-safe.ts | 1 - playground/protocol-kit/eip1271.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/playground/protocol-kit/deploy-safe.ts b/playground/protocol-kit/deploy-safe.ts index db7f18f03..e68136e3a 100644 --- a/playground/protocol-kit/deploy-safe.ts +++ b/playground/protocol-kit/deploy-safe.ts @@ -1,6 +1,5 @@ import { SafeAccountConfig, SafeFactory } from '@safe-global/protocol-kit' import { SafeVersion } from '@safe-global/safe-core-sdk-types' -import { ethers } from 'ethers' // This file can be used to play around with the Safe Core SDK diff --git a/playground/protocol-kit/eip1271.ts b/playground/protocol-kit/eip1271.ts index 3578dee49..0fece8dc6 100644 --- a/playground/protocol-kit/eip1271.ts +++ b/playground/protocol-kit/eip1271.ts @@ -1,6 +1,5 @@ import Safe from '@safe-global/protocol-kit' import { hashSafeMessage } from '@safe-global/protocol-kit' -import { ethers, JsonRpcProvider } from 'ethers' // This file can be used to play around with the Safe Core SDK From 4cbd72be36f86194ed2569ac8b7ed0c5c1523ec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Thu, 25 Apr 2024 16:45:13 +0200 Subject: [PATCH 069/112] Fix protocol-kit playgrounds and improve eip1271 one --- playground/config/run.ts | 2 +- playground/protocol-kit/eip1271.ts | 56 ------------ .../protocol-kit/generate-safe-address.ts | 2 +- .../protocol-kit/validate-signatures.ts | 86 +++++++++++++++++++ 4 files changed, 88 insertions(+), 58 deletions(-) delete mode 100644 playground/protocol-kit/eip1271.ts create mode 100644 playground/protocol-kit/validate-signatures.ts diff --git a/playground/config/run.ts b/playground/config/run.ts index 726c12ebd..d295ee942 100644 --- a/playground/config/run.ts +++ b/playground/config/run.ts @@ -8,7 +8,7 @@ const playgroundProtocolKitPaths = { 'create-execute-transaction': 'protocol-kit/create-execute-transaction', 'deploy-safe': 'protocol-kit/deploy-safe', 'generate-safe-address': 'protocol-kit/generate-safe-address', - eip1271: 'protocol-kit/eip1271' + 'validate-signatures': 'protocol-kit/validate-signatures' } const playgroundApiKitPaths = { 'propose-transaction': 'api-kit/propose-transaction', diff --git a/playground/protocol-kit/eip1271.ts b/playground/protocol-kit/eip1271.ts deleted file mode 100644 index 0fece8dc6..000000000 --- a/playground/protocol-kit/eip1271.ts +++ /dev/null @@ -1,56 +0,0 @@ -import Safe from '@safe-global/protocol-kit' -import { hashSafeMessage } from '@safe-global/protocol-kit' - -// This file can be used to play around with the Safe Core SDK - -interface Config { - RPC_URL: string - OWNER1_PRIVATE_KEY: string - OWNER2_PRIVATE_KEY: string - OWNER3_PRIVATE_KEY: string - SAFE_2_3_ADDRESS: string -} - -const config: Config = { - RPC_URL: '', - // Create a Safe 2/3 with 3 owners and fill this info - OWNER1_PRIVATE_KEY: '', - OWNER2_PRIVATE_KEY: '', - OWNER3_PRIVATE_KEY: '', - SAFE_2_3_ADDRESS: '' -} - -async function main() { - // Create safeSdk instances - const safeSdk1 = await Safe.create({ - provider: config.RPC_URL, - signer: config.OWNER1_PRIVATE_KEY, - safeAddress: config.SAFE_2_3_ADDRESS - }) - - const safeSdk2 = await Safe.create({ - provider: config.RPC_URL, - signer: config.OWNER2_PRIVATE_KEY, - safeAddress: config.SAFE_2_3_ADDRESS - }) - - const MESSAGE_TO_SIGN = 'I am the owner of this Safe account' - - const messageHash = hashSafeMessage(MESSAGE_TO_SIGN) - const safeMessageHash = await safeSdk1.getSafeMessageHash(messageHash) - - const ethSignSig = await safeSdk1.signHash(safeMessageHash) - const typedDataSig = await safeSdk2.signTypedData(safeSdk2.createMessage(MESSAGE_TO_SIGN), 'v4') - - // Validate the signature sending the Safe message hash and the concatenated signatures - const isValid = await safeSdk1.isValidSignature(messageHash, [typedDataSig, ethSignSig]) - - console.log('Message: ', MESSAGE_TO_SIGN) - console.log('Message Hash: ', messageHash) - console.log('Safe Message Hash: ', safeMessageHash) - console.log('Signatures: ', ethSignSig, typedDataSig) - - console.log(`The signature is ${isValid ? 'valid' : 'invalid'}`) -} - -main() diff --git a/playground/protocol-kit/generate-safe-address.ts b/playground/protocol-kit/generate-safe-address.ts index 0b91618ac..8443f9946 100644 --- a/playground/protocol-kit/generate-safe-address.ts +++ b/playground/protocol-kit/generate-safe-address.ts @@ -11,7 +11,7 @@ import { SafeVersion } from '@safe-global/safe-core-sdk-types' const config: Config = { // REQUIRED PARAMETERS owners: ['0x680cde08860141F9D223cE4E620B10Cd6741037E'], - rpcUrl: 'https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161', + rpcUrl: 'https://rpc.ankr.com/eth_sepolia', // OPTIONAL PARAMETERS pattern: '0x5afe', safeVersion: '1.3.0', diff --git a/playground/protocol-kit/validate-signatures.ts b/playground/protocol-kit/validate-signatures.ts new file mode 100644 index 000000000..45d41b476 --- /dev/null +++ b/playground/protocol-kit/validate-signatures.ts @@ -0,0 +1,86 @@ +import Safe, { SigningMethod, buildContractSignature } from '@safe-global/protocol-kit' +import { hashSafeMessage } from '@safe-global/protocol-kit' + +// This file can be used to play around with the Safe Core SDK + +interface Config { + RPC_URL: string + OWNER1_PRIVATE_KEY: string + OWNER2_PRIVATE_KEY: string + SAFE_3_3_ADDRESS: string + SIGNER_SAFE_ADDRESS: string +} + +// To run this script, you need a Safe with the following configuration +// - 3/3 Safe with 3 owners and threshold 3 +// - Owner 1: public address from OWNER1_PRIVATE_KEY +// - Owner 2: public address from OWNER2_PRIVATE_KEY +// - Owner 3: SIGNER_SAFE_ADDRESS (1/1 with OWNER1_PRIVATE_KEY public address as owner) +const config: Config = { + RPC_URL: 'https://rpc.ankr.com/eth_sepolia', + OWNER1_PRIVATE_KEY: '', + OWNER2_PRIVATE_KEY: '', + SIGNER_SAFE_ADDRESS: '', + SAFE_3_3_ADDRESS: '' +} + +async function main() { + // Create safeSdk instances + let protocolKit = await Safe.create({ + provider: config.RPC_URL, + signer: config.OWNER1_PRIVATE_KEY, + safeAddress: config.SAFE_3_3_ADDRESS + }) + + const MESSAGE = 'I am the owner of this Safe account' + + let message = protocolKit.createMessage(MESSAGE) + + message = await protocolKit.signMessage(message) // Owner 1 signature + + protocolKit = await protocolKit.connect({ + signer: config.OWNER2_PRIVATE_KEY, + safeAddress: config.SAFE_3_3_ADDRESS + }) // Connect another owner + + message = await protocolKit.signMessage(message, SigningMethod.ETH_SIGN_TYPED_DATA_V4) // Owner 2 signature + + protocolKit = await protocolKit.connect({ + signer: config.OWNER1_PRIVATE_KEY, + safeAddress: config.SIGNER_SAFE_ADDRESS + }) + + let signerSafeMessage = protocolKit.createMessage(MESSAGE) + signerSafeMessage = await protocolKit.signMessage( + signerSafeMessage, + SigningMethod.SAFE_SIGNATURE, + config.SAFE_3_3_ADDRESS + ) + + message.addSignature( + await buildContractSignature( + Array.from(signerSafeMessage.signatures.values()), + config.SIGNER_SAFE_ADDRESS + ) + ) + + protocolKit = await protocolKit.connect({ + signer: config.OWNER1_PRIVATE_KEY, + safeAddress: config.SAFE_3_3_ADDRESS + }) + + // Validate the signature sending the Safe message hash and the concatenated signatures + const messageHash = hashSafeMessage(MESSAGE) + const safeMessageHash = await protocolKit.getSafeMessageHash(messageHash) + + const isValid = await protocolKit.isValidSignature(messageHash, message.encodedSignatures()) + + console.log('Message: ', MESSAGE) + console.log('Message Hash: ', messageHash) + console.log('Safe Message Hash: ', safeMessageHash) + console.log('Signatures: ', message.signatures.values()) + + console.log(`The signature is ${isValid ? 'valid' : 'invalid'}`) +} + +main() From 172b228c7d7e3a2585d3eefc0fb3185cba81b6b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 26 Apr 2024 09:15:53 +0200 Subject: [PATCH 070/112] Add viem support for api-kit testing --- .github/workflows/e2e-test.yml | 3 ++- packages/api-kit/hardhat.config.ts | 1 - packages/api-kit/package.json | 5 +++- packages/api-kit/tests/utils/setupKits.ts | 25 +++++++++++++++---- packages/protocol-kit/package.json | 1 - .../tests/e2e/utils/setupProvider.ts | 3 ++- yarn.lock | 16 +----------- 7 files changed, 29 insertions(+), 25 deletions(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 335e79660..a4afee0a0 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -11,6 +11,7 @@ jobs: strategy: matrix: node-version: [20.x] + provider: [ethers, web3, viem] steps: - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} @@ -21,4 +22,4 @@ jobs: - run: | yarn install --frozen-lockfile yarn build - yarn test:ci + yarn test:ci:${{ matrix.provider }} diff --git a/packages/api-kit/hardhat.config.ts b/packages/api-kit/hardhat.config.ts index 894ebfeb3..73eeaebd9 100644 --- a/packages/api-kit/hardhat.config.ts +++ b/packages/api-kit/hardhat.config.ts @@ -1,5 +1,4 @@ import '@nomicfoundation/hardhat-ethers' -import '@nomiclabs/hardhat-web3' import dotenv from 'dotenv' import { HardhatUserConfig, HttpNetworkUserConfig } from 'hardhat/types' import yargs from 'yargs' diff --git a/packages/api-kit/package.json b/packages/api-kit/package.json index c0f93a342..703467183 100644 --- a/packages/api-kit/package.json +++ b/packages/api-kit/package.json @@ -13,9 +13,11 @@ "scripts": { "test:web3": "export TESTS_PATH=tests/endpoint && export ETH_LIB=web3 && nyc hardhat test", "test:ethers": "export TESTS_PATH=tests/endpoint && export ETH_LIB=ethers && nyc --reporter=lcov hardhat test", + "test:viem": "export TESTS_PATH=tests/endpoint && export ETH_LIB=viem && nyc hardhat test", "test": "yarn test:ethers", "test:ci:web3": "export TESTS_PATH=tests/e2e && export ETH_LIB=web3 && nyc hardhat test", "test:ci:ethers": "export TESTS_PATH=tests/e2e && export ETH_LIB=ethers && nyc --reporter=lcov hardhat test", + "test:ci:viem": "export TESTS_PATH=tests/e2e && export ETH_LIB=viem && nyc --reporter=lcov hardhat test", "test:ci": "yarn test:ci:ethers", "format:check": "prettier --check \"*/**/*.{js,json,md,ts}\"", "format": "prettier --write \"*/**/*.{js,json,md,ts}\"", @@ -37,7 +39,6 @@ "homepage": "https://github.com/safe-global/safe-core-sdk#readme", "devDependencies": { "@nomicfoundation/hardhat-ethers": "^3.0.5", - "@nomiclabs/hardhat-web3": "^2.0.0", "@types/chai": "^4.3.11", "@types/chai-as-promised": "^7.1.8", "@types/mocha": "^10.0.6", @@ -52,6 +53,8 @@ "sinon": "^14.0.2", "sinon-chai": "^3.7.0", "tsconfig-paths": "^4.2.0", + "viem": "^2.9.19", + "web3": "^4.7.0", "yargs": "^17.7.2" }, "dependencies": { diff --git a/packages/api-kit/tests/utils/setupKits.ts b/packages/api-kit/tests/utils/setupKits.ts index 18052f3b4..f265861ba 100644 --- a/packages/api-kit/tests/utils/setupKits.ts +++ b/packages/api-kit/tests/utils/setupKits.ts @@ -1,6 +1,9 @@ +import hre, { ethers } from 'hardhat' +import Web3 from 'web3' +import { custom, createWalletClient } from 'viem' + import Safe, { SafeProviderConfig, Eip1193Provider } from '@safe-global/protocol-kit' import SafeApiKit from '@safe-global/api-kit/index' -import { ethers, web3 } from 'hardhat' import config from './config' @@ -15,18 +18,30 @@ type GetKitsOptions = { safeAddress: string } -function getEip1193Provider(): Eip1193Provider { +export function getEip1193Provider(): Eip1193Provider { switch (process.env.ETH_LIB) { + case 'viem': + const client = createWalletClient({ + transport: custom(hre.network.provider) + }) + + return { request: client.request } as Eip1193Provider + case 'web3': - return web3.currentProvider as Eip1193Provider + const web3Provider = new Web3(hre.network.provider) + + return web3Provider.currentProvider as Eip1193Provider + case 'ethers': + const browserProvider = new ethers.BrowserProvider(hre.network.provider) + return { request: async (request) => { - return ethers.provider.send(request.method, [...((request.params as unknown[]) ?? [])]) + return browserProvider.send(request.method, [...((request.params as unknown[]) ?? [])]) } } default: - throw new Error('Ethereum library not supported') + throw new Error('ETH_LIB not set') } } diff --git a/packages/protocol-kit/package.json b/packages/protocol-kit/package.json index f8b362031..e2caf078d 100644 --- a/packages/protocol-kit/package.json +++ b/packages/protocol-kit/package.json @@ -49,7 +49,6 @@ "devDependencies": { "@gnosis.pm/safe-contracts-v1.3.0": "npm:@gnosis.pm/safe-contracts@1.3.0", "@nomicfoundation/hardhat-ethers": "^3.0.5", - "@nomiclabs/hardhat-web3": "^2.0.0", "@openzeppelin/contracts": "^2.5.1", "@safe-global/safe-contracts-v1.4.1": "npm:@safe-global/safe-contracts@1.4.1", "@safe-global/safe-core-sdk-types": "^4.0.2", diff --git a/packages/protocol-kit/tests/e2e/utils/setupProvider.ts b/packages/protocol-kit/tests/e2e/utils/setupProvider.ts index 65847b7a8..bd24b0984 100644 --- a/packages/protocol-kit/tests/e2e/utils/setupProvider.ts +++ b/packages/protocol-kit/tests/e2e/utils/setupProvider.ts @@ -1,8 +1,9 @@ import hre, { ethers } from 'hardhat' import Web3 from 'web3' import { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers' -import { SafeProvider } from '@safe-global/protocol-kit/index' import { custom, createWalletClient } from 'viem' + +import { SafeProvider } from '@safe-global/protocol-kit/index' import { Eip1193Provider } from '@safe-global/protocol-kit/types' type Network = 'mainnet' | 'gnosis' | 'zksync' | 'goerli' | 'sepolia' diff --git a/yarn.lock b/yarn.lock index 0f13a03b5..fbcfdcf08 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1530,13 +1530,6 @@ "@nomicfoundation/solidity-analyzer-win32-ia32-msvc" "0.1.1" "@nomicfoundation/solidity-analyzer-win32-x64-msvc" "0.1.1" -"@nomiclabs/hardhat-web3@^2.0.0": - version "2.0.0" - resolved "https://registry.npmjs.org/@nomiclabs/hardhat-web3/-/hardhat-web3-2.0.0.tgz" - integrity sha512-zt4xN+D+fKl3wW2YlTX3k9APR3XZgPkxJYf36AcliJn3oujnKEVRZaHu0PhgLjO+gR+F/kiYayo9fgd2L8970Q== - dependencies: - "@types/bignumber.js" "^5.0.0" - "@npmcli/fs@^2.1.0": version "2.1.2" resolved "https://registry.npmjs.org/@npmcli/fs/-/fs-2.1.2.tgz" @@ -2236,13 +2229,6 @@ dependencies: "@babel/types" "^7.3.0" -"@types/bignumber.js@^5.0.0": - version "5.0.0" - resolved "https://registry.npmjs.org/@types/bignumber.js/-/bignumber.js-5.0.0.tgz" - integrity sha512-0DH7aPGCClywOFaxxjE6UwpN2kQYe9LwuDQMv+zYA97j5GkOMo8e66LYT+a8JYU7jfmUFRZLa9KycxHDsKXJCA== - dependencies: - bignumber.js "*" - "@types/bn.js@*", "@types/bn.js@^5.1.0": version "5.1.1" resolved "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz" @@ -3020,7 +3006,7 @@ bigint-crypto-utils@^3.0.23: resolved "https://registry.npmjs.org/bigint-crypto-utils/-/bigint-crypto-utils-3.2.2.tgz" integrity sha512-U1RbE3aX9ayCUVcIPHuPDPKcK3SFOXf93J1UK/iHlJuQB7bhagPIX06/CLpLEsDThJ7KA4Dhrnzynl+d2weTiw== -bignumber.js@*, bignumber.js@^9.1.2: +bignumber.js@^9.1.2: version "9.1.2" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== From 1085a535622733684ab00fd0881421a34f7ec64a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 26 Apr 2024 09:19:07 +0200 Subject: [PATCH 071/112] Remove import --- packages/protocol-kit/hardhat.config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/protocol-kit/hardhat.config.ts b/packages/protocol-kit/hardhat.config.ts index 50c9f1bd3..2e153c389 100644 --- a/packages/protocol-kit/hardhat.config.ts +++ b/packages/protocol-kit/hardhat.config.ts @@ -2,7 +2,6 @@ import '@nomicfoundation/hardhat-ethers' import 'hardhat-deploy' import 'hardhat-deploy-ethers' import 'tsconfig-paths/register' -import '@nomiclabs/hardhat-web3' import dotenv from 'dotenv' import { HardhatUserConfig, HttpNetworkUserConfig } from 'hardhat/types' import yargs from 'yargs' From dd0f6b272ec5e0431695effce2331bf26a79ba3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 26 Apr 2024 09:24:58 +0200 Subject: [PATCH 072/112] Fix issue --- .github/workflows/e2e-test.yml | 3 ++- .github/workflows/test.yml | 2 +- .github/workflows/test_contracts.yml | 2 +- package.json | 1 - 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index a4afee0a0..8ab3b38ec 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -1,4 +1,4 @@ -name: e2e Test +name: Api Kit E2E Testing on: pull_request: push: @@ -22,4 +22,5 @@ jobs: - run: | yarn install --frozen-lockfile yarn build + cd packages/protocol-kit yarn test:ci:${{ matrix.provider }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 63064b3cd..85d21ecef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Monorepo Test +name: Kits Unit Testing on: pull_request: push: diff --git a/.github/workflows/test_contracts.yml b/.github/workflows/test_contracts.yml index b7c0e614d..c80cb203b 100644 --- a/.github/workflows/test_contracts.yml +++ b/.github/workflows/test_contracts.yml @@ -1,4 +1,4 @@ -name: Safe Core SDK Test - Contracts +name: Protocol Kit E2E Testing on: pull_request: push: diff --git a/package.json b/package.json index 60111881e..318c21638 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "build": "lerna run build --stream", "lint:check": "eslint './packages/**/*.{js,jsx,ts,tsx}'", "test": "FORCE_COLOR=1 lerna run test --stream", - "test:ci": "FORCE_COLOR=1 lerna run test:ci --stream", "play": "ts-node ./playground/config/run.ts", "format": "lerna run format && prettier --write \"playground/**/*.ts\"", "prepare": "husky install" From 7a8d74cc40c1639b8a79da889e3bf6986a58a115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 26 Apr 2024 09:26:36 +0200 Subject: [PATCH 073/112] Wrong flow --- .github/workflows/e2e-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 8ab3b38ec..dc572e29e 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -22,5 +22,5 @@ jobs: - run: | yarn install --frozen-lockfile yarn build - cd packages/protocol-kit + cd packages/api-kit yarn test:ci:${{ matrix.provider }} From c23f26d8258c728101cc499981fbe11b03a7de34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 26 Apr 2024 09:31:09 +0200 Subject: [PATCH 074/112] Update action names --- .github/workflows/{e2e-test.yml => api-kit-e2e-test.yml} | 2 +- .../workflows/{test_contracts.yml => protocol-kit-e2e-test.yml} | 2 +- .github/workflows/{test.yml => sdk-test.yml} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename .github/workflows/{e2e-test.yml => api-kit-e2e-test.yml} (95%) rename .github/workflows/{test_contracts.yml => protocol-kit-e2e-test.yml} (96%) rename .github/workflows/{test.yml => sdk-test.yml} (97%) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/api-kit-e2e-test.yml similarity index 95% rename from .github/workflows/e2e-test.yml rename to .github/workflows/api-kit-e2e-test.yml index dc572e29e..d5eec53b7 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/api-kit-e2e-test.yml @@ -1,4 +1,4 @@ -name: Api Kit E2E Testing +name: API Kit - E2E Tests on: pull_request: push: diff --git a/.github/workflows/test_contracts.yml b/.github/workflows/protocol-kit-e2e-test.yml similarity index 96% rename from .github/workflows/test_contracts.yml rename to .github/workflows/protocol-kit-e2e-test.yml index c80cb203b..bddd20660 100644 --- a/.github/workflows/test_contracts.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -1,4 +1,4 @@ -name: Protocol Kit E2E Testing +name: Protocol Kit - E2E Tests on: pull_request: push: diff --git a/.github/workflows/test.yml b/.github/workflows/sdk-test.yml similarity index 97% rename from .github/workflows/test.yml rename to .github/workflows/sdk-test.yml index 85d21ecef..12c67aba2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/sdk-test.yml @@ -1,4 +1,4 @@ -name: Kits Unit Testing +name: SDK - Unit Tests on: pull_request: push: From 0129d528c5df2661875ba332c0ebe5d7dad2fe99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 26 Apr 2024 09:38:29 +0200 Subject: [PATCH 075/112] Try executing only ethers in api-kit --- .github/workflows/api-kit-e2e-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/api-kit-e2e-test.yml b/.github/workflows/api-kit-e2e-test.yml index d5eec53b7..7719a35e9 100644 --- a/.github/workflows/api-kit-e2e-test.yml +++ b/.github/workflows/api-kit-e2e-test.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: node-version: [20.x] - provider: [ethers, web3, viem] + provider: [ethers] steps: - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} From d654a667f186a57d5eb68b5a0702144bbc84f154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 26 Apr 2024 09:48:13 +0200 Subject: [PATCH 076/112] Try to execute in sequence --- .github/workflows/api-kit-e2e-test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/api-kit-e2e-test.yml b/.github/workflows/api-kit-e2e-test.yml index 7719a35e9..d1a47f8ee 100644 --- a/.github/workflows/api-kit-e2e-test.yml +++ b/.github/workflows/api-kit-e2e-test.yml @@ -11,7 +11,6 @@ jobs: strategy: matrix: node-version: [20.x] - provider: [ethers] steps: - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} @@ -23,4 +22,6 @@ jobs: yarn install --frozen-lockfile yarn build cd packages/api-kit - yarn test:ci:${{ matrix.provider }} + yarn test:ci:ethers + yarn test:ci:web3 + yarn test:ci:viem From 8c0a43e32abfdeeb56829b00077158021d238019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 26 Apr 2024 15:54:09 +0200 Subject: [PATCH 077/112] Remove EthersTransactionOptions and EthersTransactionResultTypes --- .../src/contracts/BaseContract.ts | 7 +-- .../v1.3.0/CreateCallContract_v1_3_0.ts | 49 ++++++++----------- .../v1.4.1/CreateCallContract_v1_4_1.ts | 49 ++++++++----------- .../Safe/v1.0.0/SafeContract_v1_0_0.ts | 15 +++--- .../Safe/v1.1.1/SafeContract_v1_1_1.ts | 15 +++--- .../Safe/v1.2.0/SafeContract_v1_2_0.ts | 18 +++---- .../Safe/v1.3.0/SafeContract_v1_3_0.ts | 18 +++---- .../Safe/v1.4.1/SafeContract_v1_4_1.ts | 18 +++---- .../SafeProxyFactoryBaseContract.ts | 4 +- .../v1.3.0/SignMessageLibContract_v1_3_0.ts | 22 ++++----- .../v1.4.1/SignMessageLibContract_v1_4_1.ts | 22 ++++----- packages/protocol-kit/src/contracts/utils.ts | 8 +-- .../protocol-kit/tests/e2e/execution.test.ts | 12 ++--- .../src/contracts/common/BaseContract.ts | 16 ++---- .../src/ethereumLibs/ethers/types.ts | 16 ------ packages/safe-core-sdk-types/src/index.ts | 1 - 16 files changed, 108 insertions(+), 182 deletions(-) delete mode 100644 packages/safe-core-sdk-types/src/ethereumLibs/ethers/types.ts diff --git a/packages/protocol-kit/src/contracts/BaseContract.ts b/packages/protocol-kit/src/contracts/BaseContract.ts index a5896a35d..2da1efa92 100644 --- a/packages/protocol-kit/src/contracts/BaseContract.ts +++ b/packages/protocol-kit/src/contracts/BaseContract.ts @@ -6,7 +6,6 @@ import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { EncodeFunction, EstimateGasFunction, - EthersTransactionOptions, GetAddressFunction, SafeVersion } from '@safe-global/safe-core-sdk-types' @@ -93,11 +92,7 @@ class BaseContract { return this.contract.interface.encodeFunctionData(functionToEncode, args as ReadonlyArray<[]>) } - estimateGas: EstimateGasFunction = ( - functionToEstimate, - args, - options = {} - ) => { + estimateGas: EstimateGasFunction = (functionToEstimate, args, options = {}) => { const contractMethodToEstimate = this.contract.getFunction(functionToEstimate) return contractMethodToEstimate.estimateGas(...(args as ReadonlyArray<[]>), options) } diff --git a/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts index 2d7f92e28..b8a546fca 100644 --- a/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts @@ -4,8 +4,7 @@ import { CreateCallContract_v1_3_0_Abi, CreateCallContract_v1_3_0_Contract, createCall_1_3_0_ContractArtifacts, - AdapterSpecificContractFunction, - EthersTransactionOptions + AdapterSpecificContractFunction } from '@safe-global/safe-core-sdk-types' import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' @@ -48,39 +47,33 @@ class CreateCallContract_v1_3_0 /** * @param args - Array[value, deploymentData] - * @param options - EthersTransactionOptions - * @returns Promise + * @param options - TransactionOptions + * @returns Promise */ - performCreate: AdapterSpecificContractFunction< - CreateCallContract_v1_3_0_Abi, - 'performCreate', - EthersTransactionOptions - > = async (args, options) => { - if (options && !options.gasLimit) { - options.gasLimit = ( - await this.estimateGas('performCreate', [...args], { ...options }) - ).toString() + performCreate: AdapterSpecificContractFunction = + async (args, options) => { + if (options && !options.gasLimit) { + options.gasLimit = ( + await this.estimateGas('performCreate', [...args], { ...options }) + ).toString() + } + const txResponse = await this.contract.performCreate(...args, { ...options }) + return toTxResult(txResponse, options) } - const txResponse = await this.contract.performCreate(...args, { ...options }) - return toTxResult(txResponse, options) - } /** * @param args - Array[value, deploymentData, salt] - * @param options - EthersTransactionOptions - * @returns Promise + * @param options - TransactionOptions + * @returns Promise */ - performCreate2: AdapterSpecificContractFunction< - CreateCallContract_v1_3_0_Abi, - 'performCreate2', - EthersTransactionOptions - > = async (args, options) => { - if (options && !options.gasLimit) { - options.gasLimit = (await this.estimateGas('performCreate2', args, options)).toString() + performCreate2: AdapterSpecificContractFunction = + async (args, options) => { + if (options && !options.gasLimit) { + options.gasLimit = (await this.estimateGas('performCreate2', args, options)).toString() + } + const txResponse = await this.contract.performCreate2(...args) + return toTxResult(txResponse, options) } - const txResponse = await this.contract.performCreate2(...args) - return toTxResult(txResponse, options) - } } export default CreateCallContract_v1_3_0 diff --git a/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts index 8cdfbae2b..e2c0aefc6 100644 --- a/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts @@ -5,8 +5,7 @@ import { CreateCallContract_v1_4_1_Abi, CreateCallContract_v1_4_1_Contract, createCall_1_4_1_ContractArtifacts, - AdapterSpecificContractFunction, - EthersTransactionOptions + AdapterSpecificContractFunction } from '@safe-global/safe-core-sdk-types' import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' @@ -48,39 +47,33 @@ class CreateCallContract_v1_4_1 /** * @param args - Array[value, deploymentData] - * @param options - EthersTransactionOptions - * @returns Promise + * @param options - TransactionOptions + * @returns Promise */ - performCreate: AdapterSpecificContractFunction< - CreateCallContract_v1_4_1_Abi, - 'performCreate', - EthersTransactionOptions - > = async (args, options) => { - if (options && !options.gasLimit) { - options.gasLimit = (await this.estimateGas('performCreate', args, options)).toString() + performCreate: AdapterSpecificContractFunction = + async (args, options) => { + if (options && !options.gasLimit) { + options.gasLimit = (await this.estimateGas('performCreate', args, options)).toString() + } + const txResponse = await this.contract.performCreate(...args, options) + return toTxResult(txResponse, options) } - const txResponse = await this.contract.performCreate(...args, options) - return toTxResult(txResponse, options) - } /** * @param args - Array[value, deploymentData, salt] - * @param options - EthersTransactionOptions - * @returns Promise + * @param options - TransactionOptions + * @returns Promise */ - performCreate2: AdapterSpecificContractFunction< - CreateCallContract_v1_4_1_Abi, - 'performCreate2', - EthersTransactionOptions - > = async (args, options) => { - if (options && !options.gasLimit) { - options.gasLimit = ( - await this.estimateGas('performCreate2', [...args], { ...options }) - ).toString() + performCreate2: AdapterSpecificContractFunction = + async (args, options) => { + if (options && !options.gasLimit) { + options.gasLimit = ( + await this.estimateGas('performCreate2', [...args], { ...options }) + ).toString() + } + const txResponse = await this.contract.performCreate2(...args) + return toTxResult(txResponse, options) } - const txResponse = await this.contract.performCreate2(...args) - return toTxResult(txResponse, options) - } } export default CreateCallContract_v1_4_1 diff --git a/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts b/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts index 2f96ac43b..8f6ff51ad 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts @@ -9,8 +9,8 @@ import { SafeTransaction, SafeContract_v1_0_0_Contract, safe_1_0_0_ContractArtifacts, - EthersTransactionOptions, - EthersTransactionResult + TransactionOptions, + TransactionResult } from '@safe-global/safe-core-sdk-types' import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/utils/constants' @@ -194,10 +194,7 @@ class SafeContract_v1_0_0 * @param options - Optional transaction options. * @returns Transaction result. */ - async approveHash( - hash: string, - options?: EthersTransactionOptions - ): Promise { + async approveHash(hash: string, options?: TransactionOptions): Promise { const gasLimit = options?.gasLimit || (await this.estimateGas('approveHash', [hash], options)) const txResponse = await this.contract.approveHash(hash, { ...options, gasLimit }) @@ -212,8 +209,8 @@ class SafeContract_v1_0_0 */ async execTransaction( safeTransaction: SafeTransaction, - options?: EthersTransactionOptions - ): Promise { + options?: TransactionOptions + ): Promise { const gasLimit = options?.gasLimit || (await this.estimateGas( @@ -283,7 +280,7 @@ class SafeContract_v1_0_0 */ async isValidTransaction( safeTransaction: SafeTransaction, - options: EthersTransactionOptions = {} + options: TransactionOptions = {} ): Promise { try { const gasLimit = diff --git a/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.ts b/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.ts index 550dc1f7b..970eb6b5a 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.ts @@ -9,8 +9,8 @@ import { SafeContract_v1_1_1_Function, SafeTransaction, safe_1_1_1_ContractArtifacts, - EthersTransactionOptions, - EthersTransactionResult + TransactionOptions, + TransactionResult } from '@safe-global/safe-core-sdk-types' /** @@ -180,10 +180,7 @@ class SafeContract_v1_1_1 * @param options - Optional transaction options. * @returns Transaction result. */ - async approveHash( - hash: string, - options?: EthersTransactionOptions - ): Promise { + async approveHash(hash: string, options?: TransactionOptions): Promise { const gasLimit = options?.gasLimit || (await this.estimateGas('approveHash', [hash], options)) const txResponse = await this.contract.approveHash(hash, { ...options, gasLimit }) @@ -198,8 +195,8 @@ class SafeContract_v1_1_1 */ async execTransaction( safeTransaction: SafeTransaction, - options?: EthersTransactionOptions - ): Promise { + options?: TransactionOptions + ): Promise { const gasLimit = options?.gasLimit || (await this.estimateGas( @@ -257,7 +254,7 @@ class SafeContract_v1_1_1 */ async isValidTransaction( safeTransaction: SafeTransaction, - options: EthersTransactionOptions = {} + options: TransactionOptions = {} ): Promise { try { const gasLimit = diff --git a/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts b/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts index a2f4c5c55..e6f130ad6 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts @@ -8,8 +8,8 @@ import { SafeContract_v1_2_0_Function, SafeTransaction, safe_1_2_0_ContractArtifacts, - EthersTransactionOptions, - EthersTransactionResult + TransactionOptions, + TransactionResult } from '@safe-global/safe-core-sdk-types' /** @@ -189,10 +189,7 @@ class SafeContract_v1_2_0 * @param options - Optional transaction options. * @returns Transaction result. */ - async approveHash( - hash: string, - options?: EthersTransactionOptions - ): Promise { + async approveHash(hash: string, options?: TransactionOptions): Promise { const gasLimit = options?.gasLimit || (await this.estimateGas('approveHash', [hash], options)) const txResponse = await this.contract.approveHash(hash, { ...options, gasLimit }) @@ -207,8 +204,8 @@ class SafeContract_v1_2_0 */ async execTransaction( safeTransaction: SafeTransaction, - options?: EthersTransactionOptions - ): Promise { + options?: TransactionOptions + ): Promise { const gasLimit = options?.gasLimit || (await this.estimateGas( @@ -259,10 +256,7 @@ class SafeContract_v1_2_0 * @param options - Optional transaction options. * @returns True, if the given transactions is valid. */ - async isValidTransaction( - safeTransaction: SafeTransaction, - options: EthersTransactionOptions = {} - ) { + async isValidTransaction(safeTransaction: SafeTransaction, options: TransactionOptions = {}) { try { const gasLimit = options?.gasLimit || diff --git a/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.ts index e49c49699..66d48071e 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.ts @@ -9,8 +9,8 @@ import { SafeContract_v1_3_0_Function, SafeTransaction, safe_1_3_0_ContractArtifacts, - EthersTransactionOptions, - EthersTransactionResult + TransactionOptions, + TransactionResult } from '@safe-global/safe-core-sdk-types' /** * SafeContract_v1_3_0 is the implementation specific to the Safe contract version 1.3.0. @@ -194,10 +194,7 @@ class SafeContract_v1_3_0 * @param options - Optional transaction options. * @returns True, if the given transactions is valid. */ - async isValidTransaction( - safeTransaction: SafeTransaction, - options: EthersTransactionOptions = {} - ) { + async isValidTransaction(safeTransaction: SafeTransaction, options: TransactionOptions = {}) { try { const gasLimit = options?.gasLimit || @@ -244,8 +241,8 @@ class SafeContract_v1_3_0 */ async execTransaction( safeTransaction: SafeTransaction, - options?: EthersTransactionOptions - ): Promise { + options?: TransactionOptions + ): Promise { const gasLimit = options?.gasLimit || (await this.estimateGas( @@ -297,10 +294,7 @@ class SafeContract_v1_3_0 * @param options - Optional transaction options. * @returns Transaction result. */ - async approveHash( - hash: string, - options?: EthersTransactionOptions - ): Promise { + async approveHash(hash: string, options?: TransactionOptions): Promise { const gasLimit = options?.gasLimit || (await this.estimateGas('approveHash', [hash], options)) const txResponse = await this.contract.approveHash(hash, { ...options, gasLimit }) diff --git a/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.ts index 6eac2325d..c77c1131a 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.ts @@ -9,8 +9,8 @@ import { SafeContract_v1_4_1_Function, SafeTransaction, safe_1_4_1_ContractArtifacts, - EthersTransactionOptions, - EthersTransactionResult + TransactionOptions, + TransactionResult } from '@safe-global/safe-core-sdk-types' /** @@ -195,10 +195,7 @@ class SafeContract_v1_4_1 * @param options - Optional transaction options. * @returns True, if the given transactions is valid. */ - async isValidTransaction( - safeTransaction: SafeTransaction, - options: EthersTransactionOptions = {} - ) { + async isValidTransaction(safeTransaction: SafeTransaction, options: TransactionOptions = {}) { try { const gasLimit = options?.gasLimit || @@ -245,8 +242,8 @@ class SafeContract_v1_4_1 */ async execTransaction( safeTransaction: SafeTransaction, - options?: EthersTransactionOptions - ): Promise { + options?: TransactionOptions + ): Promise { const gasLimit = options?.gasLimit || (await this.estimateGas( @@ -298,10 +295,7 @@ class SafeContract_v1_4_1 * @param options - Optional transaction options. * @returns Transaction result. */ - async approveHash( - hash: string, - options?: EthersTransactionOptions - ): Promise { + async approveHash(hash: string, options?: TransactionOptions): Promise { const gasLimit = options?.gasLimit || (await this.estimateGas('approveHash', [hash], options)) const txResponse = await this.contract.approveHash(hash, { ...options, gasLimit }) diff --git a/packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.ts b/packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.ts index ab35d4caa..67d8c9e4e 100644 --- a/packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.ts +++ b/packages/protocol-kit/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.ts @@ -4,13 +4,13 @@ import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import BaseContract from '@safe-global/protocol-kit/contracts/BaseContract' import { SafeVersion, - EthersTransactionOptions, + TransactionOptions, CreateProxyProps as CreateProxyPropsGeneral } from '@safe-global/safe-core-sdk-types' import { contractName } from '@safe-global/protocol-kit/contracts/config' export interface CreateProxyProps extends CreateProxyPropsGeneral { - options?: EthersTransactionOptions + options?: TransactionOptions } /** diff --git a/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts index f921666cc..ef91800f8 100644 --- a/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts @@ -7,8 +7,7 @@ import { SignMessageLibContract_v1_3_0_Abi, SignMessageLibContract_v1_3_0_Contract, SignMessageLibContract_v1_3_0_Function, - signMessageLib_1_3_0_ContractArtifacts, - EthersTransactionOptions + signMessageLib_1_3_0_ContractArtifacts } from '@safe-global/safe-core-sdk-types' /** @@ -56,19 +55,16 @@ class SignMessageLibContract_v1_3_0 /** * @param args - Array[data] */ - signMessage: AdapterSpecificContractFunction< - SignMessageLibContract_v1_3_0_Abi, - 'signMessage', - EthersTransactionOptions - > = async (data, options) => { - if (options && !options.gasLimit) { - options.gasLimit = Number(await this.estimateGas('signMessage', data, { ...options })) - } + signMessage: AdapterSpecificContractFunction = + async (data, options) => { + if (options && !options.gasLimit) { + options.gasLimit = Number(await this.estimateGas('signMessage', data, { ...options })) + } - const txResponse = await this.contract.signMessage(data, { ...options }) + const txResponse = await this.contract.signMessage(data, { ...options }) - return toTxResult(txResponse, options) - } + return toTxResult(txResponse, options) + } } export default SignMessageLibContract_v1_3_0 diff --git a/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts index bc21e510d..29d1ec62c 100644 --- a/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts @@ -7,8 +7,7 @@ import { SignMessageLibContract_v1_4_1_Abi, SignMessageLibContract_v1_4_1_Contract, SignMessageLibContract_v1_4_1_Function, - signMessageLib_1_4_1_ContractArtifacts, - EthersTransactionOptions + signMessageLib_1_4_1_ContractArtifacts } from '@safe-global/safe-core-sdk-types' /** @@ -57,19 +56,16 @@ class SignMessageLibContract_v1_4_1 /** * @param args - Array[data] */ - signMessage: AdapterSpecificContractFunction< - SignMessageLibContract_v1_4_1_Abi, - 'signMessage', - EthersTransactionOptions - > = async (data, options) => { - if (options && !options.gasLimit) { - options.gasLimit = Number(await this.estimateGas('signMessage', data, { ...options })) - } + signMessage: AdapterSpecificContractFunction = + async (data, options) => { + if (options && !options.gasLimit) { + options.gasLimit = Number(await this.estimateGas('signMessage', data, { ...options })) + } - const txResponse = await this.contract.signMessage(data, { ...options }) + const txResponse = await this.contract.signMessage(data, { ...options }) - return toTxResult(txResponse, options) - } + return toTxResult(txResponse, options) + } } export default SignMessageLibContract_v1_4_1 diff --git a/packages/protocol-kit/src/contracts/utils.ts b/packages/protocol-kit/src/contracts/utils.ts index a91c8facc..fd3a16a15 100644 --- a/packages/protocol-kit/src/contracts/utils.ts +++ b/packages/protocol-kit/src/contracts/utils.ts @@ -12,8 +12,8 @@ import { createMemoizedFunction } from '@safe-global/protocol-kit/utils/memoized import { SafeProxyFactoryContractType, SafeVersion, - EthersTransactionOptions, - EthersTransactionResult + TransactionOptions, + TransactionResult } from '@safe-global/safe-core-sdk-types' import { generateAddress2, keccak256, toBuffer } from 'ethereumjs-util' import semverSatisfies from 'semver/functions/satisfies' @@ -380,8 +380,8 @@ export function sameString(str1: string, str2: string): boolean { export function toTxResult( transactionResponse: ContractTransactionResponse, - options?: EthersTransactionOptions -): EthersTransactionResult { + options?: TransactionOptions +): TransactionResult { return { hash: transactionResponse.hash, options, diff --git a/packages/protocol-kit/tests/e2e/execution.test.ts b/packages/protocol-kit/tests/e2e/execution.test.ts index 3d723c97d..cd8b35d06 100644 --- a/packages/protocol-kit/tests/e2e/execution.test.ts +++ b/packages/protocol-kit/tests/e2e/execution.test.ts @@ -1,6 +1,6 @@ import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/deploy-contracts' import Safe, { SigningMethod } from '@safe-global/protocol-kit/index' -import { EthersTransactionOptions, MetaTransactionData } from '@safe-global/safe-core-sdk-types' +import { TransactionOptions, MetaTransactionData } from '@safe-global/safe-core-sdk-types' import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import { deployments } from 'hardhat' @@ -169,7 +169,7 @@ describe('Transactions execution', () => { .to.be.rejectedWith('There are 2 signatures missing') }) - it.only('should fail if the user tries to execute a transaction that was rejected', async () => { + it('should fail if the user tries to execute a transaction that was rejected', async () => { const { accounts, contractNetworks, provider } = await setupTests() const [account1, account2] = accounts const safe = await getSafeWithOwners([account1.address]) @@ -238,7 +238,7 @@ describe('Transactions execution', () => { data: '0x' } const tx = await safeSdk1.createTransaction({ transactions: [safeTransactionData] }) - const execOptions: EthersTransactionOptions = { nonce: 123456789 } + const execOptions: TransactionOptions = { nonce: 123456789 } await chai .expect(safeSdk1.executeTransaction(tx, execOptions)) .to.be.rejectedWith('Nonce too high') @@ -580,7 +580,7 @@ describe('Transactions execution', () => { data: '0x' } const tx = await safeSdk1.createTransaction({ transactions: [safeTransactionData] }) - const execOptions: EthersTransactionOptions = { gasLimit: 123456 } + const execOptions: TransactionOptions = { gasLimit: 123456 } const txResponse = await safeSdk1.executeTransaction(tx, execOptions) await waitSafeTxReceipt(txResponse) const txConfirmed = await safeSdk1.getSafeProvider().getTransaction(txResponse.hash) @@ -610,7 +610,7 @@ describe('Transactions execution', () => { data: '0x' } const tx = await safeSdk1.createTransaction({ transactions: [safeTransactionData] }) - const execOptions: EthersTransactionOptions = { + const execOptions: TransactionOptions = { gasLimit: 123456, gasPrice: 170000000 } @@ -748,7 +748,7 @@ describe('Transactions execution', () => { } const currentNonce = await safeSdk1.getSafeProvider().getNonce(account1.address, 'pending') const tx = await safeSdk1.createTransaction({ transactions: [safeTransactionData] }) - const execOptions: EthersTransactionOptions = { nonce: currentNonce } + const execOptions: TransactionOptions = { nonce: currentNonce } const txResponse = await safeSdk1.executeTransaction(tx, execOptions) await waitSafeTxReceipt(txResponse) const txConfirmed = await safeSdk1.getSafeProvider().getTransaction(txResponse.hash) diff --git a/packages/safe-core-sdk-types/src/contracts/common/BaseContract.ts b/packages/safe-core-sdk-types/src/contracts/common/BaseContract.ts index 2b4cec1ba..1cd661687 100644 --- a/packages/safe-core-sdk-types/src/contracts/common/BaseContract.ts +++ b/packages/safe-core-sdk-types/src/contracts/common/BaseContract.ts @@ -4,11 +4,11 @@ import { ExtractAbiFunction, ExtractAbiFunctionNames } from 'abitype' -import { SafeVersion } from '@safe-global/safe-core-sdk-types/types' import { - EthersTransactionOptions, - EthersTransactionResult -} from '@safe-global/safe-core-sdk-types/ethereumLibs/ethers/types' + SafeVersion, + TransactionOptions, + TransactionResult +} from '@safe-global/safe-core-sdk-types/types' /** * Extracts the names of read-only functions (view or pure) from a given contract ABI. @@ -69,12 +69,10 @@ export type EncodeFunction< * Estimates the gas required for a function call on a contract. * * @template ContractAbi - The ABI of the contract. - * @template TransactionOptions - The transaction options object. * @template ContractFunctionName - The function for which gas is being estimated, derived from the ABI. */ export type EstimateGasFunction< ContractAbi extends Abi, - TransactionOptions extends EthersTransactionOptions = EthersTransactionOptions, ContractFunctionName extends ExtractAbiFunctionNames = ExtractAbiFunctionNames > = ( @@ -108,15 +106,11 @@ export type ContractFunction< * * @template ContractAbi - The ABI of the contract. * @template ContractFunctionName - The function name, derived from the ABI. - * @template TransactionOptions - The transaction options type depending on the Adapter. - * @template TransactionResult - The transaction result type depending on the Adapter. */ export type AdapterSpecificContractFunction< ContractAbi extends Abi, ContractFunctionName extends - ExtractAbiFunctionNames = ExtractAbiFunctionNames, - TransactionOptions extends EthersTransactionOptions = EthersTransactionOptions, - TransactionResult extends EthersTransactionResult = EthersTransactionResult + ExtractAbiFunctionNames = ExtractAbiFunctionNames > = ( args: AbiParametersToPrimitiveTypes< ExtractAbiFunction['inputs'] diff --git a/packages/safe-core-sdk-types/src/ethereumLibs/ethers/types.ts b/packages/safe-core-sdk-types/src/ethereumLibs/ethers/types.ts deleted file mode 100644 index f30a84fe5..000000000 --- a/packages/safe-core-sdk-types/src/ethereumLibs/ethers/types.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ContractTransactionResponse } from 'ethers' -import { BaseTransactionResult } from '@safe-global/safe-core-sdk-types/types' - -export interface EthersTransactionOptions { - from?: string - gasLimit?: number | string - gasPrice?: number | string - maxFeePerGas?: number | string - maxPriorityFeePerGas?: number | string - nonce?: number -} - -export interface EthersTransactionResult extends BaseTransactionResult { - transactionResponse: ContractTransactionResponse - options?: EthersTransactionOptions -} diff --git a/packages/safe-core-sdk-types/src/index.ts b/packages/safe-core-sdk-types/src/index.ts index ba8199ead..ef9abd2ee 100644 --- a/packages/safe-core-sdk-types/src/index.ts +++ b/packages/safe-core-sdk-types/src/index.ts @@ -7,7 +7,6 @@ export * from './contracts/SignMessageLib' export * from './contracts/SimulateTxAccessor' export * from './contracts/common/BaseContract' export * from './contracts/assets' -export * from './ethereumLibs/ethers/types' export * from './types' // see docs: https://abitype.dev/config From ccb0f0eb2c19c1f311f33d912358dc445562f8c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 26 Apr 2024 16:01:06 +0200 Subject: [PATCH 078/112] Remove Adapter from the specific contract function --- .../v1.3.0/CreateCallContract_v1_3_0.ts | 38 ++++++++++--------- .../v1.4.1/CreateCallContract_v1_4_1.ts | 38 ++++++++++--------- .../v1.3.0/SignMessageLibContract_v1_3_0.ts | 20 +++++----- .../v1.4.1/SignMessageLibContract_v1_4_1.ts | 20 +++++----- .../CreateCall/CreateCallBaseContract.ts | 6 +-- .../SignMessageLibBaseContract.ts | 4 +- .../src/contracts/common/BaseContract.ts | 2 +- 7 files changed, 70 insertions(+), 58 deletions(-) diff --git a/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts index b8a546fca..9d44b93c7 100644 --- a/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.ts @@ -4,7 +4,7 @@ import { CreateCallContract_v1_3_0_Abi, CreateCallContract_v1_3_0_Contract, createCall_1_3_0_ContractArtifacts, - AdapterSpecificContractFunction + SafeContractFunction } from '@safe-global/safe-core-sdk-types' import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' @@ -50,30 +50,34 @@ class CreateCallContract_v1_3_0 * @param options - TransactionOptions * @returns Promise */ - performCreate: AdapterSpecificContractFunction = - async (args, options) => { - if (options && !options.gasLimit) { - options.gasLimit = ( - await this.estimateGas('performCreate', [...args], { ...options }) - ).toString() - } - const txResponse = await this.contract.performCreate(...args, { ...options }) - return toTxResult(txResponse, options) + performCreate: SafeContractFunction = async ( + args, + options + ) => { + if (options && !options.gasLimit) { + options.gasLimit = ( + await this.estimateGas('performCreate', [...args], { ...options }) + ).toString() } + const txResponse = await this.contract.performCreate(...args, { ...options }) + return toTxResult(txResponse, options) + } /** * @param args - Array[value, deploymentData, salt] * @param options - TransactionOptions * @returns Promise */ - performCreate2: AdapterSpecificContractFunction = - async (args, options) => { - if (options && !options.gasLimit) { - options.gasLimit = (await this.estimateGas('performCreate2', args, options)).toString() - } - const txResponse = await this.contract.performCreate2(...args) - return toTxResult(txResponse, options) + performCreate2: SafeContractFunction = async ( + args, + options + ) => { + if (options && !options.gasLimit) { + options.gasLimit = (await this.estimateGas('performCreate2', args, options)).toString() } + const txResponse = await this.contract.performCreate2(...args) + return toTxResult(txResponse, options) + } } export default CreateCallContract_v1_3_0 diff --git a/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts index e2c0aefc6..f9f1e0094 100644 --- a/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.ts @@ -5,7 +5,7 @@ import { CreateCallContract_v1_4_1_Abi, CreateCallContract_v1_4_1_Contract, createCall_1_4_1_ContractArtifacts, - AdapterSpecificContractFunction + SafeContractFunction } from '@safe-global/safe-core-sdk-types' import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' @@ -50,30 +50,34 @@ class CreateCallContract_v1_4_1 * @param options - TransactionOptions * @returns Promise */ - performCreate: AdapterSpecificContractFunction = - async (args, options) => { - if (options && !options.gasLimit) { - options.gasLimit = (await this.estimateGas('performCreate', args, options)).toString() - } - const txResponse = await this.contract.performCreate(...args, options) - return toTxResult(txResponse, options) + performCreate: SafeContractFunction = async ( + args, + options + ) => { + if (options && !options.gasLimit) { + options.gasLimit = (await this.estimateGas('performCreate', args, options)).toString() } + const txResponse = await this.contract.performCreate(...args, options) + return toTxResult(txResponse, options) + } /** * @param args - Array[value, deploymentData, salt] * @param options - TransactionOptions * @returns Promise */ - performCreate2: AdapterSpecificContractFunction = - async (args, options) => { - if (options && !options.gasLimit) { - options.gasLimit = ( - await this.estimateGas('performCreate2', [...args], { ...options }) - ).toString() - } - const txResponse = await this.contract.performCreate2(...args) - return toTxResult(txResponse, options) + performCreate2: SafeContractFunction = async ( + args, + options + ) => { + if (options && !options.gasLimit) { + options.gasLimit = ( + await this.estimateGas('performCreate2', [...args], { ...options }) + ).toString() } + const txResponse = await this.contract.performCreate2(...args) + return toTxResult(txResponse, options) + } } export default CreateCallContract_v1_4_1 diff --git a/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts b/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts index ef91800f8..f506a61de 100644 --- a/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts +++ b/packages/protocol-kit/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.ts @@ -3,7 +3,7 @@ import SignMessageLibBaseContract from '@safe-global/protocol-kit/contracts/Sign import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, - AdapterSpecificContractFunction, + SafeContractFunction, SignMessageLibContract_v1_3_0_Abi, SignMessageLibContract_v1_3_0_Contract, SignMessageLibContract_v1_3_0_Function, @@ -55,16 +55,18 @@ class SignMessageLibContract_v1_3_0 /** * @param args - Array[data] */ - signMessage: AdapterSpecificContractFunction = - async (data, options) => { - if (options && !options.gasLimit) { - options.gasLimit = Number(await this.estimateGas('signMessage', data, { ...options })) - } + signMessage: SafeContractFunction = async ( + data, + options + ) => { + if (options && !options.gasLimit) { + options.gasLimit = Number(await this.estimateGas('signMessage', data, { ...options })) + } - const txResponse = await this.contract.signMessage(data, { ...options }) + const txResponse = await this.contract.signMessage(data, { ...options }) - return toTxResult(txResponse, options) - } + return toTxResult(txResponse, options) + } } export default SignMessageLibContract_v1_3_0 diff --git a/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts b/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts index 29d1ec62c..e00dc2183 100644 --- a/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts +++ b/packages/protocol-kit/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.ts @@ -3,7 +3,7 @@ import SignMessageLibBaseContract from '@safe-global/protocol-kit/contracts/Sign import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { SafeVersion, - AdapterSpecificContractFunction, + SafeContractFunction, SignMessageLibContract_v1_4_1_Abi, SignMessageLibContract_v1_4_1_Contract, SignMessageLibContract_v1_4_1_Function, @@ -56,16 +56,18 @@ class SignMessageLibContract_v1_4_1 /** * @param args - Array[data] */ - signMessage: AdapterSpecificContractFunction = - async (data, options) => { - if (options && !options.gasLimit) { - options.gasLimit = Number(await this.estimateGas('signMessage', data, { ...options })) - } + signMessage: SafeContractFunction = async ( + data, + options + ) => { + if (options && !options.gasLimit) { + options.gasLimit = Number(await this.estimateGas('signMessage', data, { ...options })) + } - const txResponse = await this.contract.signMessage(data, { ...options }) + const txResponse = await this.contract.signMessage(data, { ...options }) - return toTxResult(txResponse, options) - } + return toTxResult(txResponse, options) + } } export default SignMessageLibContract_v1_4_1 diff --git a/packages/safe-core-sdk-types/src/contracts/CreateCall/CreateCallBaseContract.ts b/packages/safe-core-sdk-types/src/contracts/CreateCall/CreateCallBaseContract.ts index 61b985a44..c88aad08e 100644 --- a/packages/safe-core-sdk-types/src/contracts/CreateCall/CreateCallBaseContract.ts +++ b/packages/safe-core-sdk-types/src/contracts/CreateCall/CreateCallBaseContract.ts @@ -1,6 +1,6 @@ import { Abi } from 'abitype' import BaseContract, { - AdapterSpecificContractFunction, + SafeContractFunction, ContractReadFunctionNames, EstimateGasFunction } from '../common/BaseContract' @@ -16,8 +16,8 @@ export type CreateCallBaseContract = BaseCont ContractReadFunctionNames > & { estimateGas: EstimateGasFunction - performCreate: AdapterSpecificContractFunction - performCreate2: AdapterSpecificContractFunction + performCreate: SafeContractFunction + performCreate2: SafeContractFunction } export default CreateCallBaseContract diff --git a/packages/safe-core-sdk-types/src/contracts/SignMessageLib/SignMessageLibBaseContract.ts b/packages/safe-core-sdk-types/src/contracts/SignMessageLib/SignMessageLibBaseContract.ts index 296bb8edf..de869c05a 100644 --- a/packages/safe-core-sdk-types/src/contracts/SignMessageLib/SignMessageLibBaseContract.ts +++ b/packages/safe-core-sdk-types/src/contracts/SignMessageLib/SignMessageLibBaseContract.ts @@ -1,6 +1,6 @@ import { Abi } from 'abitype' import BaseContract, { - AdapterSpecificContractFunction, + SafeContractFunction, ContractReadFunctionNames, EstimateGasFunction } from '../common/BaseContract' @@ -16,7 +16,7 @@ type SignMessageLibBaseContract = BaseCon ContractReadFunctionNames > & { estimateGas: EstimateGasFunction - signMessage: AdapterSpecificContractFunction + signMessage: SafeContractFunction } export default SignMessageLibBaseContract diff --git a/packages/safe-core-sdk-types/src/contracts/common/BaseContract.ts b/packages/safe-core-sdk-types/src/contracts/common/BaseContract.ts index 1cd661687..a71fdb40b 100644 --- a/packages/safe-core-sdk-types/src/contracts/common/BaseContract.ts +++ b/packages/safe-core-sdk-types/src/contracts/common/BaseContract.ts @@ -107,7 +107,7 @@ export type ContractFunction< * @template ContractAbi - The ABI of the contract. * @template ContractFunctionName - The function name, derived from the ABI. */ -export type AdapterSpecificContractFunction< +export type SafeContractFunction< ContractAbi extends Abi, ContractFunctionName extends ExtractAbiFunctionNames = ExtractAbiFunctionNames From c72c439f90bcb1b04608b114ef998bf0029d4157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 26 Apr 2024 16:04:23 +0200 Subject: [PATCH 079/112] Remove ethers deps from types --- packages/safe-core-sdk-types/package.json | 3 +-- packages/safe-core-sdk-types/src/types.ts | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/safe-core-sdk-types/package.json b/packages/safe-core-sdk-types/package.json index e5cab6681..63bd9979d 100644 --- a/packages/safe-core-sdk-types/package.json +++ b/packages/safe-core-sdk-types/package.json @@ -29,8 +29,7 @@ ], "homepage": "https://github.com/safe-global/safe-core-sdk#readme", "dependencies": { - "@safe-global/safe-deployments": "^1.34.0", - "ethers": "^6.7.1" + "@safe-global/safe-deployments": "^1.34.0" }, "devDependencies": { "abitype": "^1.0.2" diff --git a/packages/safe-core-sdk-types/src/types.ts b/packages/safe-core-sdk-types/src/types.ts index b08a521a4..62634abf5 100644 --- a/packages/safe-core-sdk-types/src/types.ts +++ b/packages/safe-core-sdk-types/src/types.ts @@ -1,5 +1,3 @@ -import { ContractTransactionResponse } from 'ethers' - export type SafeVersion = '1.4.1' | '1.3.0' | '1.2.0' | '1.1.1' | '1.0.0' export enum OperationType { @@ -97,7 +95,7 @@ export interface BaseTransactionResult { } export interface TransactionResult extends BaseTransactionResult { - transactionResponse: ContractTransactionResponse + transactionResponse: unknown options?: TransactionOptions } From 858a6bd64a55af95f5b101e119ce274f5390789e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 26 Apr 2024 16:05:49 +0200 Subject: [PATCH 080/112] Update .github/workflows/api-kit-e2e-test.yml Co-authored-by: Daniel <25051234+dasanra@users.noreply.github.com> --- .github/workflows/api-kit-e2e-test.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/api-kit-e2e-test.yml b/.github/workflows/api-kit-e2e-test.yml index d1a47f8ee..b1e12d337 100644 --- a/.github/workflows/api-kit-e2e-test.yml +++ b/.github/workflows/api-kit-e2e-test.yml @@ -18,9 +18,14 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: yarn - - run: | - yarn install --frozen-lockfile - yarn build + - name: Yarn install + run: yarn install --frozen-lockfile + + - name: Build + run: yarn build + + - name: Test + run: | cd packages/api-kit yarn test:ci:ethers yarn test:ci:web3 From 8b9269176a575d888ebb03a6176e5f4927666d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 26 Apr 2024 16:22:33 +0200 Subject: [PATCH 081/112] try actions without web3 --- .github/workflows/protocol-kit-e2e-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index bddd20660..0369b9ff1 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: node-version: [20.x] - provider: [ethers, web3, viem] + provider: [ethers, viem] contract-version: [v1.0.0, v1.1.1, v1.2.0, v1.3.0, v1.4.1] steps: - uses: actions/checkout@v4 From 0bdf76b81f186db92780f373c7e93270b80cc417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 26 Apr 2024 16:32:50 +0200 Subject: [PATCH 082/112] Add web3 again --- .github/workflows/protocol-kit-e2e-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 0369b9ff1..bddd20660 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: node-version: [20.x] - provider: [ethers, viem] + provider: [ethers, web3, viem] contract-version: [v1.0.0, v1.1.1, v1.2.0, v1.3.0, v1.4.1] steps: - uses: actions/checkout@v4 From 10e0a938b9d30d8e218691d710046424c0ce6e82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 26 Apr 2024 18:02:00 +0200 Subject: [PATCH 083/112] Add replacer to the stringify function inside the createMemoizedFunction --- packages/protocol-kit/src/utils/memoized.ts | 22 ++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/protocol-kit/src/utils/memoized.ts b/packages/protocol-kit/src/utils/memoized.ts index 757707cd9..7e107b5e8 100644 --- a/packages/protocol-kit/src/utils/memoized.ts +++ b/packages/protocol-kit/src/utils/memoized.ts @@ -3,10 +3,30 @@ export function createMemoizedFunction) => Ret cache: Record> = {} ) { return (...args: Parameters): ReturnType => { - const key = JSON.stringify(args) + const key = JSON.stringify(args, bigIntSerializerReplacer) cache[key] = cache[key] || callback(...args) return cache[key] } } + +// EIP1193 providers from web3.currentProvider and hre.network.provider fail to serialize BigInts +function bigIntSerializerReplacer() { + const seen = new Set() + + return (_: string, value: unknown) => { + if (typeof value === 'object' && value !== null) { + if (seen.has(value)) { + return undefined + } + seen.add(value) + } + + if (typeof value === 'bigint') { + return value.toString() + } + + return value + } +} From 46c08562976d27e1cc75705f0b0135c0fa694d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Fri, 26 Apr 2024 18:17:04 +0200 Subject: [PATCH 084/112] Fix test --- packages/protocol-kit/tests/e2e/execution.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/protocol-kit/tests/e2e/execution.test.ts b/packages/protocol-kit/tests/e2e/execution.test.ts index cd8b35d06..fccd152da 100644 --- a/packages/protocol-kit/tests/e2e/execution.test.ts +++ b/packages/protocol-kit/tests/e2e/execution.test.ts @@ -376,6 +376,7 @@ describe('Transactions execution', () => { const txResponse2 = await safeSdk1.executeTransaction(signedTx) await waitSafeTxReceipt(txResponse2) + await new Promise((resolve) => setTimeout(resolve, 500)) const safeFinalBalance = await safeSdk1.getBalance() chai.expect(safeInitialBalance).to.be.eq(safeFinalBalance + BigInt(tx.data.value)) } From b3d0d8d155838de250d3f53e5328a7ffe1d9174f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 29 Apr 2024 10:57:49 +0200 Subject: [PATCH 085/112] Fix code snippet --- guides/integrating-the-safe-core-sdk.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/guides/integrating-the-safe-core-sdk.md b/guides/integrating-the-safe-core-sdk.md index 4ad3f5ec8..fc62a9b69 100644 --- a/guides/integrating-the-safe-core-sdk.md +++ b/guides/integrating-the-safe-core-sdk.md @@ -33,9 +33,6 @@ In the examples below, you can see `provider` and `signer` properties, which rep - `provider`: You can provide an EIP-1193 compatible provider or an HTTP/WebSocket RPC URL. - `signer`: This is optional. If not provided, we will try to get the connected account of the provider. If you provide it, it represents either the provider's address you want to use or a private key, which we will use internally to retrieve the provider's address. -````js - - ### Initialize the Safe API Kit As stated in the introduction, the [Safe API Kit](https://github.com/safe-global/safe-core-sdk/tree/main/packages/api-kit) consumes the [Safe Transaction Service API](https://github.com/safe-global/safe-transaction-service). To start using this library, create a new instance of the `SafeApiKit` class, imported from `@safe-global/api-kit` and pass the URL to the constructor of the Safe Transaction Service you want to use depending on the network. @@ -44,7 +41,7 @@ As stated in the introduction, the [Safe API Kit](https://github.com/safe-global import SafeApiKit from '@safe-global/api-kit' const safeService = new SafeApiKit({ chainId }) -```` +``` Using the `chainId` is enough for chains where Safe runs a Transaction Service. For those chains where Safe doesn't run a service, use the `txServiceUrl` parameter to set the custom service endpoint. From 14450862436728f518adbb0897c2c8fd9724f9d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 29 Apr 2024 12:08:56 +0200 Subject: [PATCH 086/112] Skip some tests --- .../tests/e2e/createTransaction.test.ts | 55 ++-- .../tests/e2e/utilsContracts.test.ts | 298 +++++++++--------- 2 files changed, 178 insertions(+), 175 deletions(-) diff --git a/packages/protocol-kit/tests/e2e/createTransaction.test.ts b/packages/protocol-kit/tests/e2e/createTransaction.test.ts index 814e796c2..188a915d7 100644 --- a/packages/protocol-kit/tests/e2e/createTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createTransaction.test.ts @@ -81,33 +81,34 @@ describe('Transactions creation', () => { } ) - itif(safeVersionDeployed >= '1.3.0')( - 'should return a transaction with estimated safeTxGas if safeVersion>=1.3.0 and gasPrice>0', - async () => { - const { accounts, contractNetworks, provider } = await setupTests() - const [account1, account2] = accounts - const safe = await getSafeWithOwners([account1.address]) - const safeAddress = await safe.getAddress() - const safeSdk = await Safe.create({ - provider, - safeAddress, - contractNetworks - }) - const txDataPartial: SafeTransactionDataPartial = { - to: account2.address, - value: '0', - data: '0x', - gasPrice: BASE_OPTIONS.gasPrice - } - const safeTxData = await standardizeSafeTransactionData({ - safeContract: safeSdk.getContractManager().safeContract as SafeContract, - provider, - tx: txDataPartial, - contractNetworks - }) - chai.expect(BigInt(safeTxData.safeTxGas) > 0).to.be.true - } - ) + //TODO: Fix add-eip1193-provider + // itif(safeVersionDeployed >= '1.3.0')( + // 'should return a transaction with estimated safeTxGas if safeVersion>=1.3.0 and gasPrice>0', + // async () => { + // const { accounts, contractNetworks, provider } = await setupTests() + // const [account1, account2] = accounts + // const safe = await getSafeWithOwners([account1.address]) + // const safeAddress = await safe.getAddress() + // const safeSdk = await Safe.create({ + // provider, + // safeAddress, + // contractNetworks + // }) + // const txDataPartial: SafeTransactionDataPartial = { + // to: account2.address, + // value: '0', + // data: '0x', + // gasPrice: BASE_OPTIONS.gasPrice + // } + // const safeTxData = await standardizeSafeTransactionData({ + // safeContract: safeSdk.getContractManager().safeContract as SafeContract, + // provider, + // tx: txDataPartial, + // contractNetworks + // }) + // chai.expect(BigInt(safeTxData.safeTxGas) > 0).to.be.true + // } + // ) itif(safeVersionDeployed >= '1.3.0')( 'should return a transaction with defined safeTxGas if safeVersion>=1.3.0', diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index cdd2d9bf3..26b5bff63 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -4,7 +4,7 @@ import { Eip1193Provider } from '@safe-global/safe-core-sdk-types' import { getAccounts } from './utils/setupTestNetwork' import { getContractNetworks } from './utils/setupContractNetworks' import { getDefaultCallbackHandler } from './utils/setupContracts' -import { getEip1193Provider, getSafeProviderFromNetwork } from './utils/setupProvider' +import { getEip1193Provider } from './utils/setupProvider' import { PREDETERMINED_SALT_NONCE, predictSafeAddress @@ -523,152 +523,154 @@ describe('Contract utils', () => { } ) - itif(safeVersionDeployed === '1.3.0')( - 'returns the predicted address for Safes deployed on zkSync Era', - async () => { - const { contractNetworks } = await setupTests() - - const safeVersion = safeVersionDeployed - // Create SafeProvider instance - const safeProvider = getSafeProviderFromNetwork('zksync') - const chainId = await safeProvider.getChainId() - const customContracts = contractNetworks[chainId.toString()] - - // We check real deployments from zksync return the expected address. - - // 1/1 Safe - const safeAccountConfig1: SafeAccountConfig = { - owners: ['0xc6b82bA149CFA113f8f48d5E3b1F78e933e16DfD'], - threshold: 1 - } - const safeDeploymentConfig1: SafeDeploymentConfig = { - safeVersion, - saltNonce: '1691490995332' - } - const expectedSafeAddress1 = '0x4e19dA81a54eFbaBeb9AD50646f7643076475D65' - - const firstPredictedSafeAddress = await predictSafeAddress({ - safeProvider, - chainId, - safeAccountConfig: safeAccountConfig1, - safeDeploymentConfig: safeDeploymentConfig1, - customContracts - }) - - // 1/2 Safe - const safeAccountConfig2: SafeAccountConfig = { - owners: [ - '0x7E5E1C1FC6d625C1e60d78fDAB1CCE91e32261e4', - '0x6994Dc2544C1137b355488A9fc7b4F6EC2Bfeb5D' - ], - threshold: 1 - } - const safeDeploymentConfig2: SafeDeploymentConfig = { - safeVersion, - saltNonce: '1690771277826' - } - const expectedSafeAddress2 = '0x60c7F13dE7C8Fb88b3845e58859658bdc44243F8' - - const secondPredictedSafeAddress = await predictSafeAddress({ - safeProvider, - chainId, - safeAccountConfig: safeAccountConfig2, - safeDeploymentConfig: safeDeploymentConfig2, - customContracts - }) - - // 2/3 Safe - const safeAccountConfig3: SafeAccountConfig = { - owners: [ - '0x99999A3C4cB8427c44294Ad36895b6a3A047060d', - '0x1234561fEd41DD2D867a038bBdB857f291864225', - '0xe2c1F5DDcc99B0D70584fB4aD9D52b49cD4Cab03' - ], - threshold: 2 - } - const safeDeploymentConfig3: SafeDeploymentConfig = { - safeVersion, - saltNonce: '1690944491662' - } - const expectedSafeAddress3 = '0xD971FAA20db3ad4d51D453047ca03Ce4ec164CE2' - - const thirdPredictedSafeAddress = await predictSafeAddress({ - safeProvider, - chainId, - safeAccountConfig: safeAccountConfig3, - safeDeploymentConfig: safeDeploymentConfig3, - customContracts - }) - - // returns the same predicted address each call - chai.expect(firstPredictedSafeAddress).to.be.equal(expectedSafeAddress1) - chai.expect(secondPredictedSafeAddress).to.be.equal(expectedSafeAddress2) - chai.expect(thirdPredictedSafeAddress).to.be.equal(expectedSafeAddress3) - } - ) - - itif(safeVersionDeployed === '1.3.0')( - // see: https://github.com/safe-global/safe-core-sdk/issues/598 - 'returns the correct predicted address for each chain', - async () => { - const { accounts } = await setupTests() - const [owner] = accounts - const safeVersion = safeVersionDeployed - - const gnosisSafeProvider = getSafeProviderFromNetwork('gnosis') - const zkSyncSafeProvider = getSafeProviderFromNetwork('zksync') - const sepoliaSafeProvider = getSafeProviderFromNetwork('sepolia') - const mainnetSafeProvider = getSafeProviderFromNetwork('mainnet') - - // 1/1 Safe - const safeAccountConfig: SafeAccountConfig = { - owners: [owner.address], - threshold: 1 - } - const safeDeploymentConfig: SafeDeploymentConfig = { - safeVersion, - saltNonce: '1691490995332' - } - - const gnosisPredictedSafeAddress = await predictSafeAddress({ - safeProvider: gnosisSafeProvider, - chainId: await gnosisSafeProvider.getChainId(), - safeAccountConfig: safeAccountConfig, - safeDeploymentConfig: safeDeploymentConfig - }) - - const zkSyncPredictedSafeAddress = await predictSafeAddress({ - safeProvider: zkSyncSafeProvider, - chainId: await zkSyncSafeProvider.getChainId(), - safeAccountConfig: safeAccountConfig, - safeDeploymentConfig: safeDeploymentConfig - }) - - const sepoliaPredictedSafeAddress = await predictSafeAddress({ - safeProvider: sepoliaSafeProvider, - chainId: await sepoliaSafeProvider.getChainId(), - safeAccountConfig: safeAccountConfig, - safeDeploymentConfig: safeDeploymentConfig - }) - - const mainnetPredictedSafeAddress = await predictSafeAddress({ - safeProvider: mainnetSafeProvider, - chainId: await mainnetSafeProvider.getChainId(), - safeAccountConfig: safeAccountConfig, - safeDeploymentConfig: safeDeploymentConfig - }) - - const expectedGnosisSafeAddress = '0x30421B2bE26942448CD6C690f21F551BF6C8A45F' - const expectedSkSyncSafeAddress = '0x4680B7AC23A98d5D68c21e3d6F8cBC9576A5920A' - const expectedSepoliaSafeAddress = '0x7f44E49C9E4C7D19fA2A704c2E66527Bd4688f99' - const expectedMainnetSafeAddress = '0x9C1C8c37a68242cEC6d68Ab091583c81FBF479C0' - - // returns the correct predicted address for each chain - chai.expect(gnosisPredictedSafeAddress).to.be.equal(expectedGnosisSafeAddress) - chai.expect(zkSyncPredictedSafeAddress).to.be.equal(expectedSkSyncSafeAddress) - chai.expect(sepoliaPredictedSafeAddress).to.be.equal(expectedSepoliaSafeAddress) - chai.expect(mainnetPredictedSafeAddress).to.be.equal(expectedMainnetSafeAddress) - } - ) + //TODO: Fix add-eip1193-provider + // itif(safeVersionDeployed === '1.3.0')( + // 'returns the predicted address for Safes deployed on zkSync Era', + // async () => { + // const { contractNetworks } = await setupTests() + + // const safeVersion = safeVersionDeployed + // // Create SafeProvider instance + // const safeProvider = getSafeProviderFromNetwork('zksync') + // const chainId = await safeProvider.getChainId() + // const customContracts = contractNetworks[chainId.toString()] + + // // We check real deployments from zksync return the expected address. + + // // 1/1 Safe + // const safeAccountConfig1: SafeAccountConfig = { + // owners: ['0xc6b82bA149CFA113f8f48d5E3b1F78e933e16DfD'], + // threshold: 1 + // } + // const safeDeploymentConfig1: SafeDeploymentConfig = { + // safeVersion, + // saltNonce: '1691490995332' + // } + // const expectedSafeAddress1 = '0x4e19dA81a54eFbaBeb9AD50646f7643076475D65' + + // const firstPredictedSafeAddress = await predictSafeAddress({ + // safeProvider, + // chainId, + // safeAccountConfig: safeAccountConfig1, + // safeDeploymentConfig: safeDeploymentConfig1, + // customContracts + // }) + + // // 1/2 Safe + // const safeAccountConfig2: SafeAccountConfig = { + // owners: [ + // '0x7E5E1C1FC6d625C1e60d78fDAB1CCE91e32261e4', + // '0x6994Dc2544C1137b355488A9fc7b4F6EC2Bfeb5D' + // ], + // threshold: 1 + // } + // const safeDeploymentConfig2: SafeDeploymentConfig = { + // safeVersion, + // saltNonce: '1690771277826' + // } + // const expectedSafeAddress2 = '0x60c7F13dE7C8Fb88b3845e58859658bdc44243F8' + + // const secondPredictedSafeAddress = await predictSafeAddress({ + // safeProvider, + // chainId, + // safeAccountConfig: safeAccountConfig2, + // safeDeploymentConfig: safeDeploymentConfig2, + // customContracts + // }) + + // // 2/3 Safe + // const safeAccountConfig3: SafeAccountConfig = { + // owners: [ + // '0x99999A3C4cB8427c44294Ad36895b6a3A047060d', + // '0x1234561fEd41DD2D867a038bBdB857f291864225', + // '0xe2c1F5DDcc99B0D70584fB4aD9D52b49cD4Cab03' + // ], + // threshold: 2 + // } + // const safeDeploymentConfig3: SafeDeploymentConfig = { + // safeVersion, + // saltNonce: '1690944491662' + // } + // const expectedSafeAddress3 = '0xD971FAA20db3ad4d51D453047ca03Ce4ec164CE2' + + // const thirdPredictedSafeAddress = await predictSafeAddress({ + // safeProvider, + // chainId, + // safeAccountConfig: safeAccountConfig3, + // safeDeploymentConfig: safeDeploymentConfig3, + // customContracts + // }) + + // // returns the same predicted address each call + // chai.expect(firstPredictedSafeAddress).to.be.equal(expectedSafeAddress1) + // chai.expect(secondPredictedSafeAddress).to.be.equal(expectedSafeAddress2) + // chai.expect(thirdPredictedSafeAddress).to.be.equal(expectedSafeAddress3) + // } + // ) + + //TODO: Fix add-eip1193-provider + // itif(safeVersionDeployed === '1.3.0')( + // // see: https://github.com/safe-global/safe-core-sdk/issues/598 + // 'returns the correct predicted address for each chain', + // async () => { + // const { accounts } = await setupTests() + // const [owner] = accounts + // const safeVersion = safeVersionDeployed + + // const gnosisSafeProvider = getSafeProviderFromNetwork('gnosis') + // const zkSyncSafeProvider = getSafeProviderFromNetwork('zksync') + // const sepoliaSafeProvider = getSafeProviderFromNetwork('sepolia') + // const mainnetSafeProvider = getSafeProviderFromNetwork('mainnet') + + // // 1/1 Safe + // const safeAccountConfig: SafeAccountConfig = { + // owners: [owner.address], + // threshold: 1 + // } + // const safeDeploymentConfig: SafeDeploymentConfig = { + // safeVersion, + // saltNonce: '1691490995332' + // } + + // const gnosisPredictedSafeAddress = await predictSafeAddress({ + // safeProvider: gnosisSafeProvider, + // chainId: await gnosisSafeProvider.getChainId(), + // safeAccountConfig: safeAccountConfig, + // safeDeploymentConfig: safeDeploymentConfig + // }) + + // const zkSyncPredictedSafeAddress = await predictSafeAddress({ + // safeProvider: zkSyncSafeProvider, + // chainId: await zkSyncSafeProvider.getChainId(), + // safeAccountConfig: safeAccountConfig, + // safeDeploymentConfig: safeDeploymentConfig + // }) + + // const sepoliaPredictedSafeAddress = await predictSafeAddress({ + // safeProvider: sepoliaSafeProvider, + // chainId: await sepoliaSafeProvider.getChainId(), + // safeAccountConfig: safeAccountConfig, + // safeDeploymentConfig: safeDeploymentConfig + // }) + + // const mainnetPredictedSafeAddress = await predictSafeAddress({ + // safeProvider: mainnetSafeProvider, + // chainId: await mainnetSafeProvider.getChainId(), + // safeAccountConfig: safeAccountConfig, + // safeDeploymentConfig: safeDeploymentConfig + // }) + + // const expectedGnosisSafeAddress = '0x30421B2bE26942448CD6C690f21F551BF6C8A45F' + // const expectedSkSyncSafeAddress = '0x4680B7AC23A98d5D68c21e3d6F8cBC9576A5920A' + // const expectedSepoliaSafeAddress = '0x7f44E49C9E4C7D19fA2A704c2E66527Bd4688f99' + // const expectedMainnetSafeAddress = '0x9C1C8c37a68242cEC6d68Ab091583c81FBF479C0' + + // // returns the correct predicted address for each chain + // chai.expect(gnosisPredictedSafeAddress).to.be.equal(expectedGnosisSafeAddress) + // chai.expect(zkSyncPredictedSafeAddress).to.be.equal(expectedSkSyncSafeAddress) + // chai.expect(sepoliaPredictedSafeAddress).to.be.equal(expectedSepoliaSafeAddress) + // chai.expect(mainnetPredictedSafeAddress).to.be.equal(expectedMainnetSafeAddress) + // } + // ) }) }) From f03d7937b3949edcde63f476bb6a9f2bac4fe5e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 29 Apr 2024 12:26:41 +0200 Subject: [PATCH 087/112] Revert "Skip some tests" This reverts commit 14450862436728f518adbb0897c2c8fd9724f9d4. --- .../tests/e2e/createTransaction.test.ts | 55 ++-- .../tests/e2e/utilsContracts.test.ts | 298 +++++++++--------- 2 files changed, 175 insertions(+), 178 deletions(-) diff --git a/packages/protocol-kit/tests/e2e/createTransaction.test.ts b/packages/protocol-kit/tests/e2e/createTransaction.test.ts index 188a915d7..814e796c2 100644 --- a/packages/protocol-kit/tests/e2e/createTransaction.test.ts +++ b/packages/protocol-kit/tests/e2e/createTransaction.test.ts @@ -81,34 +81,33 @@ describe('Transactions creation', () => { } ) - //TODO: Fix add-eip1193-provider - // itif(safeVersionDeployed >= '1.3.0')( - // 'should return a transaction with estimated safeTxGas if safeVersion>=1.3.0 and gasPrice>0', - // async () => { - // const { accounts, contractNetworks, provider } = await setupTests() - // const [account1, account2] = accounts - // const safe = await getSafeWithOwners([account1.address]) - // const safeAddress = await safe.getAddress() - // const safeSdk = await Safe.create({ - // provider, - // safeAddress, - // contractNetworks - // }) - // const txDataPartial: SafeTransactionDataPartial = { - // to: account2.address, - // value: '0', - // data: '0x', - // gasPrice: BASE_OPTIONS.gasPrice - // } - // const safeTxData = await standardizeSafeTransactionData({ - // safeContract: safeSdk.getContractManager().safeContract as SafeContract, - // provider, - // tx: txDataPartial, - // contractNetworks - // }) - // chai.expect(BigInt(safeTxData.safeTxGas) > 0).to.be.true - // } - // ) + itif(safeVersionDeployed >= '1.3.0')( + 'should return a transaction with estimated safeTxGas if safeVersion>=1.3.0 and gasPrice>0', + async () => { + const { accounts, contractNetworks, provider } = await setupTests() + const [account1, account2] = accounts + const safe = await getSafeWithOwners([account1.address]) + const safeAddress = await safe.getAddress() + const safeSdk = await Safe.create({ + provider, + safeAddress, + contractNetworks + }) + const txDataPartial: SafeTransactionDataPartial = { + to: account2.address, + value: '0', + data: '0x', + gasPrice: BASE_OPTIONS.gasPrice + } + const safeTxData = await standardizeSafeTransactionData({ + safeContract: safeSdk.getContractManager().safeContract as SafeContract, + provider, + tx: txDataPartial, + contractNetworks + }) + chai.expect(BigInt(safeTxData.safeTxGas) > 0).to.be.true + } + ) itif(safeVersionDeployed >= '1.3.0')( 'should return a transaction with defined safeTxGas if safeVersion>=1.3.0', diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index 26b5bff63..cdd2d9bf3 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -4,7 +4,7 @@ import { Eip1193Provider } from '@safe-global/safe-core-sdk-types' import { getAccounts } from './utils/setupTestNetwork' import { getContractNetworks } from './utils/setupContractNetworks' import { getDefaultCallbackHandler } from './utils/setupContracts' -import { getEip1193Provider } from './utils/setupProvider' +import { getEip1193Provider, getSafeProviderFromNetwork } from './utils/setupProvider' import { PREDETERMINED_SALT_NONCE, predictSafeAddress @@ -523,154 +523,152 @@ describe('Contract utils', () => { } ) - //TODO: Fix add-eip1193-provider - // itif(safeVersionDeployed === '1.3.0')( - // 'returns the predicted address for Safes deployed on zkSync Era', - // async () => { - // const { contractNetworks } = await setupTests() - - // const safeVersion = safeVersionDeployed - // // Create SafeProvider instance - // const safeProvider = getSafeProviderFromNetwork('zksync') - // const chainId = await safeProvider.getChainId() - // const customContracts = contractNetworks[chainId.toString()] - - // // We check real deployments from zksync return the expected address. - - // // 1/1 Safe - // const safeAccountConfig1: SafeAccountConfig = { - // owners: ['0xc6b82bA149CFA113f8f48d5E3b1F78e933e16DfD'], - // threshold: 1 - // } - // const safeDeploymentConfig1: SafeDeploymentConfig = { - // safeVersion, - // saltNonce: '1691490995332' - // } - // const expectedSafeAddress1 = '0x4e19dA81a54eFbaBeb9AD50646f7643076475D65' - - // const firstPredictedSafeAddress = await predictSafeAddress({ - // safeProvider, - // chainId, - // safeAccountConfig: safeAccountConfig1, - // safeDeploymentConfig: safeDeploymentConfig1, - // customContracts - // }) - - // // 1/2 Safe - // const safeAccountConfig2: SafeAccountConfig = { - // owners: [ - // '0x7E5E1C1FC6d625C1e60d78fDAB1CCE91e32261e4', - // '0x6994Dc2544C1137b355488A9fc7b4F6EC2Bfeb5D' - // ], - // threshold: 1 - // } - // const safeDeploymentConfig2: SafeDeploymentConfig = { - // safeVersion, - // saltNonce: '1690771277826' - // } - // const expectedSafeAddress2 = '0x60c7F13dE7C8Fb88b3845e58859658bdc44243F8' - - // const secondPredictedSafeAddress = await predictSafeAddress({ - // safeProvider, - // chainId, - // safeAccountConfig: safeAccountConfig2, - // safeDeploymentConfig: safeDeploymentConfig2, - // customContracts - // }) - - // // 2/3 Safe - // const safeAccountConfig3: SafeAccountConfig = { - // owners: [ - // '0x99999A3C4cB8427c44294Ad36895b6a3A047060d', - // '0x1234561fEd41DD2D867a038bBdB857f291864225', - // '0xe2c1F5DDcc99B0D70584fB4aD9D52b49cD4Cab03' - // ], - // threshold: 2 - // } - // const safeDeploymentConfig3: SafeDeploymentConfig = { - // safeVersion, - // saltNonce: '1690944491662' - // } - // const expectedSafeAddress3 = '0xD971FAA20db3ad4d51D453047ca03Ce4ec164CE2' - - // const thirdPredictedSafeAddress = await predictSafeAddress({ - // safeProvider, - // chainId, - // safeAccountConfig: safeAccountConfig3, - // safeDeploymentConfig: safeDeploymentConfig3, - // customContracts - // }) - - // // returns the same predicted address each call - // chai.expect(firstPredictedSafeAddress).to.be.equal(expectedSafeAddress1) - // chai.expect(secondPredictedSafeAddress).to.be.equal(expectedSafeAddress2) - // chai.expect(thirdPredictedSafeAddress).to.be.equal(expectedSafeAddress3) - // } - // ) - - //TODO: Fix add-eip1193-provider - // itif(safeVersionDeployed === '1.3.0')( - // // see: https://github.com/safe-global/safe-core-sdk/issues/598 - // 'returns the correct predicted address for each chain', - // async () => { - // const { accounts } = await setupTests() - // const [owner] = accounts - // const safeVersion = safeVersionDeployed - - // const gnosisSafeProvider = getSafeProviderFromNetwork('gnosis') - // const zkSyncSafeProvider = getSafeProviderFromNetwork('zksync') - // const sepoliaSafeProvider = getSafeProviderFromNetwork('sepolia') - // const mainnetSafeProvider = getSafeProviderFromNetwork('mainnet') - - // // 1/1 Safe - // const safeAccountConfig: SafeAccountConfig = { - // owners: [owner.address], - // threshold: 1 - // } - // const safeDeploymentConfig: SafeDeploymentConfig = { - // safeVersion, - // saltNonce: '1691490995332' - // } - - // const gnosisPredictedSafeAddress = await predictSafeAddress({ - // safeProvider: gnosisSafeProvider, - // chainId: await gnosisSafeProvider.getChainId(), - // safeAccountConfig: safeAccountConfig, - // safeDeploymentConfig: safeDeploymentConfig - // }) - - // const zkSyncPredictedSafeAddress = await predictSafeAddress({ - // safeProvider: zkSyncSafeProvider, - // chainId: await zkSyncSafeProvider.getChainId(), - // safeAccountConfig: safeAccountConfig, - // safeDeploymentConfig: safeDeploymentConfig - // }) - - // const sepoliaPredictedSafeAddress = await predictSafeAddress({ - // safeProvider: sepoliaSafeProvider, - // chainId: await sepoliaSafeProvider.getChainId(), - // safeAccountConfig: safeAccountConfig, - // safeDeploymentConfig: safeDeploymentConfig - // }) - - // const mainnetPredictedSafeAddress = await predictSafeAddress({ - // safeProvider: mainnetSafeProvider, - // chainId: await mainnetSafeProvider.getChainId(), - // safeAccountConfig: safeAccountConfig, - // safeDeploymentConfig: safeDeploymentConfig - // }) - - // const expectedGnosisSafeAddress = '0x30421B2bE26942448CD6C690f21F551BF6C8A45F' - // const expectedSkSyncSafeAddress = '0x4680B7AC23A98d5D68c21e3d6F8cBC9576A5920A' - // const expectedSepoliaSafeAddress = '0x7f44E49C9E4C7D19fA2A704c2E66527Bd4688f99' - // const expectedMainnetSafeAddress = '0x9C1C8c37a68242cEC6d68Ab091583c81FBF479C0' - - // // returns the correct predicted address for each chain - // chai.expect(gnosisPredictedSafeAddress).to.be.equal(expectedGnosisSafeAddress) - // chai.expect(zkSyncPredictedSafeAddress).to.be.equal(expectedSkSyncSafeAddress) - // chai.expect(sepoliaPredictedSafeAddress).to.be.equal(expectedSepoliaSafeAddress) - // chai.expect(mainnetPredictedSafeAddress).to.be.equal(expectedMainnetSafeAddress) - // } - // ) + itif(safeVersionDeployed === '1.3.0')( + 'returns the predicted address for Safes deployed on zkSync Era', + async () => { + const { contractNetworks } = await setupTests() + + const safeVersion = safeVersionDeployed + // Create SafeProvider instance + const safeProvider = getSafeProviderFromNetwork('zksync') + const chainId = await safeProvider.getChainId() + const customContracts = contractNetworks[chainId.toString()] + + // We check real deployments from zksync return the expected address. + + // 1/1 Safe + const safeAccountConfig1: SafeAccountConfig = { + owners: ['0xc6b82bA149CFA113f8f48d5E3b1F78e933e16DfD'], + threshold: 1 + } + const safeDeploymentConfig1: SafeDeploymentConfig = { + safeVersion, + saltNonce: '1691490995332' + } + const expectedSafeAddress1 = '0x4e19dA81a54eFbaBeb9AD50646f7643076475D65' + + const firstPredictedSafeAddress = await predictSafeAddress({ + safeProvider, + chainId, + safeAccountConfig: safeAccountConfig1, + safeDeploymentConfig: safeDeploymentConfig1, + customContracts + }) + + // 1/2 Safe + const safeAccountConfig2: SafeAccountConfig = { + owners: [ + '0x7E5E1C1FC6d625C1e60d78fDAB1CCE91e32261e4', + '0x6994Dc2544C1137b355488A9fc7b4F6EC2Bfeb5D' + ], + threshold: 1 + } + const safeDeploymentConfig2: SafeDeploymentConfig = { + safeVersion, + saltNonce: '1690771277826' + } + const expectedSafeAddress2 = '0x60c7F13dE7C8Fb88b3845e58859658bdc44243F8' + + const secondPredictedSafeAddress = await predictSafeAddress({ + safeProvider, + chainId, + safeAccountConfig: safeAccountConfig2, + safeDeploymentConfig: safeDeploymentConfig2, + customContracts + }) + + // 2/3 Safe + const safeAccountConfig3: SafeAccountConfig = { + owners: [ + '0x99999A3C4cB8427c44294Ad36895b6a3A047060d', + '0x1234561fEd41DD2D867a038bBdB857f291864225', + '0xe2c1F5DDcc99B0D70584fB4aD9D52b49cD4Cab03' + ], + threshold: 2 + } + const safeDeploymentConfig3: SafeDeploymentConfig = { + safeVersion, + saltNonce: '1690944491662' + } + const expectedSafeAddress3 = '0xD971FAA20db3ad4d51D453047ca03Ce4ec164CE2' + + const thirdPredictedSafeAddress = await predictSafeAddress({ + safeProvider, + chainId, + safeAccountConfig: safeAccountConfig3, + safeDeploymentConfig: safeDeploymentConfig3, + customContracts + }) + + // returns the same predicted address each call + chai.expect(firstPredictedSafeAddress).to.be.equal(expectedSafeAddress1) + chai.expect(secondPredictedSafeAddress).to.be.equal(expectedSafeAddress2) + chai.expect(thirdPredictedSafeAddress).to.be.equal(expectedSafeAddress3) + } + ) + + itif(safeVersionDeployed === '1.3.0')( + // see: https://github.com/safe-global/safe-core-sdk/issues/598 + 'returns the correct predicted address for each chain', + async () => { + const { accounts } = await setupTests() + const [owner] = accounts + const safeVersion = safeVersionDeployed + + const gnosisSafeProvider = getSafeProviderFromNetwork('gnosis') + const zkSyncSafeProvider = getSafeProviderFromNetwork('zksync') + const sepoliaSafeProvider = getSafeProviderFromNetwork('sepolia') + const mainnetSafeProvider = getSafeProviderFromNetwork('mainnet') + + // 1/1 Safe + const safeAccountConfig: SafeAccountConfig = { + owners: [owner.address], + threshold: 1 + } + const safeDeploymentConfig: SafeDeploymentConfig = { + safeVersion, + saltNonce: '1691490995332' + } + + const gnosisPredictedSafeAddress = await predictSafeAddress({ + safeProvider: gnosisSafeProvider, + chainId: await gnosisSafeProvider.getChainId(), + safeAccountConfig: safeAccountConfig, + safeDeploymentConfig: safeDeploymentConfig + }) + + const zkSyncPredictedSafeAddress = await predictSafeAddress({ + safeProvider: zkSyncSafeProvider, + chainId: await zkSyncSafeProvider.getChainId(), + safeAccountConfig: safeAccountConfig, + safeDeploymentConfig: safeDeploymentConfig + }) + + const sepoliaPredictedSafeAddress = await predictSafeAddress({ + safeProvider: sepoliaSafeProvider, + chainId: await sepoliaSafeProvider.getChainId(), + safeAccountConfig: safeAccountConfig, + safeDeploymentConfig: safeDeploymentConfig + }) + + const mainnetPredictedSafeAddress = await predictSafeAddress({ + safeProvider: mainnetSafeProvider, + chainId: await mainnetSafeProvider.getChainId(), + safeAccountConfig: safeAccountConfig, + safeDeploymentConfig: safeDeploymentConfig + }) + + const expectedGnosisSafeAddress = '0x30421B2bE26942448CD6C690f21F551BF6C8A45F' + const expectedSkSyncSafeAddress = '0x4680B7AC23A98d5D68c21e3d6F8cBC9576A5920A' + const expectedSepoliaSafeAddress = '0x7f44E49C9E4C7D19fA2A704c2E66527Bd4688f99' + const expectedMainnetSafeAddress = '0x9C1C8c37a68242cEC6d68Ab091583c81FBF479C0' + + // returns the correct predicted address for each chain + chai.expect(gnosisPredictedSafeAddress).to.be.equal(expectedGnosisSafeAddress) + chai.expect(zkSyncPredictedSafeAddress).to.be.equal(expectedSkSyncSafeAddress) + chai.expect(sepoliaPredictedSafeAddress).to.be.equal(expectedSepoliaSafeAddress) + chai.expect(mainnetPredictedSafeAddress).to.be.equal(expectedMainnetSafeAddress) + } + ) }) }) From bd782aa6b8b6460a4737789decac7ece2292607e Mon Sep 17 00:00:00 2001 From: Tim <4171783+tmjssz@users.noreply.github.com> Date: Mon, 29 Apr 2024 14:18:30 +0200 Subject: [PATCH 088/112] fix(auth-kit/onramp-kit): Migrate to Sepolia + various small fixes (#788) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(onramp-kit): Use valid mock contract address to fix unit test * Bump `@monerium/sdk` to v2.12.0 for Sepolia support * Switch chain for onramp-kit example app from görli to sepolia * fix(onramp-kit): Fix unit test to use sepolia instead of goerli * feat(onramp-kit): Show loader for monerium demo only while order is pending * docs(auth-kit): Update broken links in README --- packages/auth-kit/README.md | 4 ++-- packages/auth-kit/example/README.md | 3 +-- packages/onramp-kit/example/client/.env.sample | 1 + packages/onramp-kit/example/client/package.json | 2 +- packages/onramp-kit/example/client/src/AuthContext.tsx | 2 +- .../example/client/src/components/monerium/Connected.tsx | 4 +++- packages/onramp-kit/package.json | 2 +- .../src/packs/monerium/SafeMoneriumClient.test.ts | 8 ++++---- 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/auth-kit/README.md b/packages/auth-kit/README.md index d72f26e16..85b924c62 100644 --- a/packages/auth-kit/README.md +++ b/packages/auth-kit/README.md @@ -8,9 +8,9 @@ The Auth Kit provides a way to authenticate blockchain accounts using email addr ## Reference -- [Auth Kit integration guides](https://docs.safe.global/safe-core-aa-sdk/auth-kit) +- [Auth Kit integration guides](https://docs.safe.global/sdk/auth-kit) -- [Auth Kit reference](https://docs.safe.global/reference/auth-kit) +- [Auth Kit reference](https://docs.safe.global/sdk/auth-kit/reference) ## Example diff --git a/packages/auth-kit/example/README.md b/packages/auth-kit/example/README.md index dbd6c2456..633607dee 100644 --- a/packages/auth-kit/example/README.md +++ b/packages/auth-kit/example/README.md @@ -23,5 +23,4 @@ To use the example properly in your local machine follow these steps: **In the auth-kit example root folder** 3. `yarn install` -4. Configure `.env` following `.env.sample` -5. `yarn start` +4. `yarn start` diff --git a/packages/onramp-kit/example/client/.env.sample b/packages/onramp-kit/example/client/.env.sample index b3166dbe1..cbe051c43 100644 --- a/packages/onramp-kit/example/client/.env.sample +++ b/packages/onramp-kit/example/client/.env.sample @@ -8,6 +8,7 @@ VITE_STRIPE_PUBLIC_KEY= VITE_SAFE_STRIPE_BACKEND_BASE_URL= # Configure the Monerium client ID. You need to get one from Monerium. +# Add the client ID for the authorization code flow here (not the one for the client credentials flow). # More info here: # https://monerium.dev/docs/getting-started/create-app VITE_MONERIUM_CLIENT_ID= diff --git a/packages/onramp-kit/example/client/package.json b/packages/onramp-kit/example/client/package.json index c54925480..32a3674ae 100644 --- a/packages/onramp-kit/example/client/package.json +++ b/packages/onramp-kit/example/client/package.json @@ -11,7 +11,7 @@ "dependencies": { "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", - "@monerium/sdk": "^2.9.0", + "@monerium/sdk": "^2.12.0", "@mui/material": "^5.15.15", "@safe-global/auth-kit": "file:../../../auth-kit", "@safe-global/onramp-kit": "file:../../", diff --git a/packages/onramp-kit/example/client/src/AuthContext.tsx b/packages/onramp-kit/example/client/src/AuthContext.tsx index d1f3c5430..b1d431b41 100644 --- a/packages/onramp-kit/example/client/src/AuthContext.tsx +++ b/packages/onramp-kit/example/client/src/AuthContext.tsx @@ -38,7 +38,7 @@ const AuthProvider = ({ children }: AuthContextProviderProps) => { const options: SafeAuthInitOptions = { enableLogging: true, showWidgetButton: false, - chainConfig: { chainId: '0x5', rpcTarget: 'https://rpc.ankr.com/eth_goerli' } + chainConfig: { chainId: '0xaa36a7', rpcTarget: 'https://rpc.ankr.com/eth_sepolia' } } await authPack.init(options) diff --git a/packages/onramp-kit/example/client/src/components/monerium/Connected.tsx b/packages/onramp-kit/example/client/src/components/monerium/Connected.tsx index 8e6e0630b..969f063a1 100644 --- a/packages/onramp-kit/example/client/src/components/monerium/Connected.tsx +++ b/packages/onramp-kit/example/client/src/components/monerium/Connected.tsx @@ -31,7 +31,9 @@ function Connected({ authContext, orderState, safe, onLogout, onTransfer }: Conn {isLoading ? ( - + {orderState && [OrderState.placed, OrderState.pending].includes(orderState) && ( + + )} {orderState && ( <> {orderState === OrderState.placed && Order placed} diff --git a/packages/onramp-kit/package.json b/packages/onramp-kit/package.json index 009972f42..b34fd817b 100644 --- a/packages/onramp-kit/package.json +++ b/packages/onramp-kit/package.json @@ -35,7 +35,7 @@ "access": "public" }, "dependencies": { - "@monerium/sdk": "^2.9.0", + "@monerium/sdk": "^2.12.0", "@safe-global/api-kit": "^2.3.0", "@safe-global/protocol-kit": "3.1.0-alpha.0", "@safe-global/safe-core-sdk-types": "^4.0.2", diff --git a/packages/onramp-kit/src/packs/monerium/SafeMoneriumClient.test.ts b/packages/onramp-kit/src/packs/monerium/SafeMoneriumClient.test.ts index 172c4fad0..fd29fbd2d 100644 --- a/packages/onramp-kit/src/packs/monerium/SafeMoneriumClient.test.ts +++ b/packages/onramp-kit/src/packs/monerium/SafeMoneriumClient.test.ts @@ -225,7 +225,7 @@ describe('SafeMoneriumClient', () => { jest.spyOn(protocolKitPackage, 'getSignMessageLibContract').mockResolvedValueOnce({ safeVersion: '1.3.0', contractName: 'signMessageLibVersion', - contract: new Contract('target', []), + contract: new Contract('0x0000000000000000000000000000000000000001', []), safeProvider: protocolKit.getSafeProvider() as protocolKitPackage.SafeProvider, encode: jest.fn(), contractAbi: signMessageLib_1_4_1_ContractArtifacts.abi, @@ -268,7 +268,7 @@ describe('SafeMoneriumClient', () => { it('should map the protocol kit chainId to the Monerium Chain types', async () => { protocolKit.getChainId = jest.fn().mockResolvedValueOnce(1n) expect(await safeMoneriumClient.getChain()).toBe('ethereum') - protocolKit.getChainId = jest.fn().mockResolvedValueOnce(5n) + protocolKit.getChainId = jest.fn().mockResolvedValueOnce(11155111n) expect(await safeMoneriumClient.getChain()).toBe('ethereum') protocolKit.getChainId = jest.fn().mockResolvedValueOnce(100n) expect(await safeMoneriumClient.getChain()).toBe('gnosis') @@ -285,8 +285,8 @@ describe('SafeMoneriumClient', () => { it('should map the protocol kit chainId to the Monerium Network types', async () => { protocolKit.getChainId = jest.fn().mockResolvedValueOnce(1n) expect(await safeMoneriumClient.getNetwork()).toBe('mainnet') - protocolKit.getChainId = jest.fn().mockResolvedValueOnce(5n) - expect(await safeMoneriumClient.getNetwork()).toBe('goerli') + protocolKit.getChainId = jest.fn().mockResolvedValueOnce(11155111n) + expect(await safeMoneriumClient.getNetwork()).toBe('sepolia') protocolKit.getChainId = jest.fn().mockResolvedValueOnce(100n) expect(await safeMoneriumClient.getNetwork()).toBe('mainnet') protocolKit.getChainId = jest.fn().mockResolvedValueOnce(10200n) From 26e5fff1c1de73adb07f0fd1eb60379ef736b973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 29 Apr 2024 17:29:07 +0200 Subject: [PATCH 089/112] Fix BaseContract not selecting specific chain deployments --- packages/protocol-kit/src/contracts/BaseContract.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/protocol-kit/src/contracts/BaseContract.ts b/packages/protocol-kit/src/contracts/BaseContract.ts index 2da1efa92..3e553421e 100644 --- a/packages/protocol-kit/src/contracts/BaseContract.ts +++ b/packages/protocol-kit/src/contracts/BaseContract.ts @@ -58,7 +58,10 @@ class BaseContract { ) { const deployment = getContractDeployment(safeVersion, chainId, contractName) - const contractAddress = customContractAddress || deployment?.defaultAddress + const contractAddress = + customContractAddress || + deployment?.networkAddresses[chainId.toString()] || + deployment?.defaultAddress if (!contractAddress) { throw new Error(`Invalid ${contractName.replace('Version', '')} contract address`) From 707c1ec45ea6775870bd453a6826db9601346964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 29 Apr 2024 17:30:13 +0200 Subject: [PATCH 090/112] Fix deploySafe --- packages/protocol-kit/tests/e2e/utilsContracts.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index cdd2d9bf3..92c7e8e5f 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -1,6 +1,5 @@ import chai from 'chai' import { deployments } from 'hardhat' -import { Eip1193Provider } from '@safe-global/safe-core-sdk-types' import { getAccounts } from './utils/setupTestNetwork' import { getContractNetworks } from './utils/setupContractNetworks' import { getDefaultCallbackHandler } from './utils/setupContracts' @@ -13,7 +12,8 @@ import { safeVersionDeployed } from '@safe-global/protocol-kit/hardhat/deploy/de import { SafeDeploymentConfig, SafeAccountConfig, - ContractNetworksConfig + ContractNetworksConfig, + Eip1193Provider } from '@safe-global/protocol-kit/types' import Safe, { SafeFactory, DeploySafeProps } from '@safe-global/protocol-kit/index' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' @@ -28,7 +28,7 @@ async function deploySafe( ): Promise { const safeFactory = await SafeFactory.create({ provider, - signerAddress, + signer: signerAddress, safeVersion: safeVersionDeployed, contractNetworks }) From 9090d939c118079f1f2bb51b1b1e0aaa24398a5a Mon Sep 17 00:00:00 2001 From: Daniel Somoza Date: Mon, 29 Apr 2024 17:41:04 +0200 Subject: [PATCH 091/112] Fix safeTxGas estimation for viem --- packages/protocol-kit/src/utils/transactions/gas.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/protocol-kit/src/utils/transactions/gas.ts b/packages/protocol-kit/src/utils/transactions/gas.ts index 420d673be..dff83c07b 100644 --- a/packages/protocol-kit/src/utils/transactions/gas.ts +++ b/packages/protocol-kit/src/utils/transactions/gas.ts @@ -400,7 +400,11 @@ function decodeSafeTxGas(encodedDataResponse: string): string { type GnosisChainEstimationError = { info: { error: { data: string | { data: string } } } } type EthersEstimationError = { data: string } -type EstimationError = Error & EthersEstimationError & GnosisChainEstimationError +type ViemEstimationError = { info: { error: { message: string } } } +type EstimationError = Error & + EthersEstimationError & + GnosisChainEstimationError & + ViemEstimationError /** * Parses the SafeTxGas estimation response from different providers. @@ -417,6 +421,12 @@ function parseSafeTxGasErrorResponse(error: EstimationError) { return decodeSafeTxGas(ethersData) } + // viem + const viemError = error?.info?.error?.message + if (viemError) { + return decodeSafeTxGas(viemError) + } + // gnosis-chain const gnosisChainProviderData = error?.info?.error?.data From 595dc90226e3bc8cd7ddc7e6717bbc1f81e0d2c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 30 Apr 2024 09:05:55 +0200 Subject: [PATCH 092/112] Update contracts being memoized in the dev branch. Now seems to be working --- packages/protocol-kit/tests/e2e/utilsContracts.test.ts | 6 +++--- yarn.lock | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts index 92c7e8e5f..f2a6cdf0e 100644 --- a/packages/protocol-kit/tests/e2e/utilsContracts.test.ts +++ b/packages/protocol-kit/tests/e2e/utilsContracts.test.ts @@ -658,10 +658,10 @@ describe('Contract utils', () => { safeDeploymentConfig: safeDeploymentConfig }) - const expectedGnosisSafeAddress = '0x30421B2bE26942448CD6C690f21F551BF6C8A45F' + const expectedGnosisSafeAddress = '0x39aC50A7B35c43429397D0481EBa8769B5e4b9a6' const expectedSkSyncSafeAddress = '0x4680B7AC23A98d5D68c21e3d6F8cBC9576A5920A' - const expectedSepoliaSafeAddress = '0x7f44E49C9E4C7D19fA2A704c2E66527Bd4688f99' - const expectedMainnetSafeAddress = '0x9C1C8c37a68242cEC6d68Ab091583c81FBF479C0' + const expectedSepoliaSafeAddress = '0x643bD5C3Fd6c546c1452A16f978C350F8a0A2a8D' + const expectedMainnetSafeAddress = '0x22b257EABfA3B8BC9e0C5f6BA03400933834675B' // returns the correct predicted address for each chain chai.expect(gnosisPredictedSafeAddress).to.be.equal(expectedGnosisSafeAddress) diff --git a/yarn.lock b/yarn.lock index fbcfdcf08..b610f419c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1250,10 +1250,10 @@ semver "^7.5.4" superstruct "^1.0.3" -"@monerium/sdk@^2.9.0": - version "2.9.0" - resolved "https://registry.yarnpkg.com/@monerium/sdk/-/sdk-2.9.0.tgz#ec7296623853acd0b7477b1b088f8c8fae42f197" - integrity sha512-6tr1fWau5tca2xjgIB/7NLJQFoVLcRvGQh6gqzgPJZCS9kRIVlupGk1MaejFdGWOmoEqJSFVUzi0TGhEJK+VcA== +"@monerium/sdk@^2.12.0": + version "2.12.0" + resolved "https://registry.yarnpkg.com/@monerium/sdk/-/sdk-2.12.0.tgz#57ccc1668a354c28d083c29928690f15fe11c479" + integrity sha512-tZxQNAlUpCbVkZfWIVB2yWYjyYZGKckEfzUZbWQyDdxUo487iNJQRr1Z64MZofJ/gKCPfOPJbiZzUGWbl8eLQA== dependencies: crypto-js "^4.2.0" From 80b80e7f5ac4d2e88420a1462c3f68f185c7ce8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 30 Apr 2024 09:19:15 +0200 Subject: [PATCH 093/112] Remove memoization resolver --- packages/protocol-kit/src/utils/memoized.ts | 22 +-------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/packages/protocol-kit/src/utils/memoized.ts b/packages/protocol-kit/src/utils/memoized.ts index 7e107b5e8..757707cd9 100644 --- a/packages/protocol-kit/src/utils/memoized.ts +++ b/packages/protocol-kit/src/utils/memoized.ts @@ -3,30 +3,10 @@ export function createMemoizedFunction) => Ret cache: Record> = {} ) { return (...args: Parameters): ReturnType => { - const key = JSON.stringify(args, bigIntSerializerReplacer) + const key = JSON.stringify(args) cache[key] = cache[key] || callback(...args) return cache[key] } } - -// EIP1193 providers from web3.currentProvider and hre.network.provider fail to serialize BigInts -function bigIntSerializerReplacer() { - const seen = new Set() - - return (_: string, value: unknown) => { - if (typeof value === 'object' && value !== null) { - if (seen.has(value)) { - return undefined - } - seen.add(value) - } - - if (typeof value === 'bigint') { - return value.toString() - } - - return value - } -} From 783abf4dbfbc60bbf08eea22f53e082d590038a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 30 Apr 2024 09:45:55 +0200 Subject: [PATCH 094/112] Add memoize again --- packages/protocol-kit/src/utils/memoized.ts | 22 ++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/protocol-kit/src/utils/memoized.ts b/packages/protocol-kit/src/utils/memoized.ts index 757707cd9..7e107b5e8 100644 --- a/packages/protocol-kit/src/utils/memoized.ts +++ b/packages/protocol-kit/src/utils/memoized.ts @@ -3,10 +3,30 @@ export function createMemoizedFunction) => Ret cache: Record> = {} ) { return (...args: Parameters): ReturnType => { - const key = JSON.stringify(args) + const key = JSON.stringify(args, bigIntSerializerReplacer) cache[key] = cache[key] || callback(...args) return cache[key] } } + +// EIP1193 providers from web3.currentProvider and hre.network.provider fail to serialize BigInts +function bigIntSerializerReplacer() { + const seen = new Set() + + return (_: string, value: unknown) => { + if (typeof value === 'object' && value !== null) { + if (seen.has(value)) { + return undefined + } + seen.add(value) + } + + if (typeof value === 'bigint') { + return value.toString() + } + + return value + } +} From 9d832253737d3b09132aa6ab6229687eab1485c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 30 Apr 2024 09:54:13 +0200 Subject: [PATCH 095/112] Fix replacer --- packages/protocol-kit/src/utils/memoized.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/protocol-kit/src/utils/memoized.ts b/packages/protocol-kit/src/utils/memoized.ts index 7e107b5e8..201e81547 100644 --- a/packages/protocol-kit/src/utils/memoized.ts +++ b/packages/protocol-kit/src/utils/memoized.ts @@ -2,8 +2,9 @@ export function createMemoizedFunction) => Ret callback: T, cache: Record> = {} ) { + const replacer = createBigIntSerializerReplacer() return (...args: Parameters): ReturnType => { - const key = JSON.stringify(args, bigIntSerializerReplacer) + const key = JSON.stringify(args, replacer) cache[key] = cache[key] || callback(...args) @@ -12,7 +13,7 @@ export function createMemoizedFunction) => Ret } // EIP1193 providers from web3.currentProvider and hre.network.provider fail to serialize BigInts -function bigIntSerializerReplacer() { +function createBigIntSerializerReplacer() { const seen = new Set() return (_: string, value: unknown) => { From 46b05156c4851132ddcb15262251ff9eb42cfeb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 30 Apr 2024 10:10:34 +0200 Subject: [PATCH 096/112] Allow tests to continue on error to see all the errors in the actions --- .github/workflows/protocol-kit-e2e-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index bddd20660..2d2b5b028 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -24,6 +24,7 @@ jobs: yarn install --frozen-lockfile yarn build - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} + continue-on-error: true run: | - cd packages/protocol-kit + cd packages/protocol-kit yarn test:hardhat:${{ matrix.provider }}:${{ matrix.contract-version }} From 4641a8e5aaeb8df32049d31c908bf6090011df6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 30 Apr 2024 10:28:34 +0200 Subject: [PATCH 097/112] Remove continue-onerror --- .github/workflows/protocol-kit-e2e-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 2d2b5b028..3b321bd0a 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -24,7 +24,6 @@ jobs: yarn install --frozen-lockfile yarn build - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} - continue-on-error: true run: | cd packages/protocol-kit yarn test:hardhat:${{ matrix.provider }}:${{ matrix.contract-version }} From e10c7e7392d1d04d13e7c07da0dc20c80f54d0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 30 Apr 2024 11:07:54 +0200 Subject: [PATCH 098/112] Remove spaces --- .github/workflows/protocol-kit-e2e-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index 3b321bd0a..bddd20660 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -25,5 +25,5 @@ jobs: yarn build - name: Test ${{ matrix.provider }} - Safe ${{ matrix.contract-version }} run: | - cd packages/protocol-kit + cd packages/protocol-kit yarn test:hardhat:${{ matrix.provider }}:${{ matrix.contract-version }} From 4d94af61abbcda0d91a1b46bb072fd95fcfcb0ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 30 Apr 2024 13:37:29 +0200 Subject: [PATCH 099/112] Improve memoizing --- packages/protocol-kit/src/utils/memoized.ts | 24 +++++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/packages/protocol-kit/src/utils/memoized.ts b/packages/protocol-kit/src/utils/memoized.ts index 201e81547..703d018a7 100644 --- a/packages/protocol-kit/src/utils/memoized.ts +++ b/packages/protocol-kit/src/utils/memoized.ts @@ -1,8 +1,10 @@ +import SafeProvider from '../SafeProvider' + export function createMemoizedFunction) => ReturnType>( callback: T, cache: Record> = {} ) { - const replacer = createBigIntSerializerReplacer() + const replacer = createSafeContractSerializerReplacer() return (...args: Parameters): ReturnType => { const key = JSON.stringify(args, replacer) @@ -13,19 +15,27 @@ export function createMemoizedFunction) => Ret } // EIP1193 providers from web3.currentProvider and hre.network.provider fail to serialize BigInts -function createBigIntSerializerReplacer() { +function createSafeContractSerializerReplacer() { const seen = new Set() return (_: string, value: unknown) => { - if (typeof value === 'object' && value !== null) { + // Serialize Bigints as strings + if (typeof value === 'bigint') { + return value.toString() + } + + // Avoid circular references + if (value instanceof SafeProvider && value !== null) { if (seen.has(value)) { return undefined } seen.add(value) - } - - if (typeof value === 'bigint') { - return value.toString() + return { + $safeProvider: { + provider: typeof value.provider === 'object' ? 'EIP1193Provider' : value.provider, + signer: value.signer + } + } } return value From e087a6bfd137849505b9f7c165d7b369c6b79e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Tue, 30 Apr 2024 14:25:19 +0200 Subject: [PATCH 100/112] Add workflow_dispatch for e2e in protocol-kit --- .github/workflows/protocol-kit-e2e-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/protocol-kit-e2e-test.yml b/.github/workflows/protocol-kit-e2e-test.yml index bddd20660..7e790f43f 100644 --- a/.github/workflows/protocol-kit-e2e-test.yml +++ b/.github/workflows/protocol-kit-e2e-test.yml @@ -1,5 +1,6 @@ name: Protocol Kit - E2E Tests on: + workflow_dispatch: pull_request: push: branches: From b6ec4c820c4f795fd467ff01c28a21d9d264831e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 6 May 2024 13:13:20 +0200 Subject: [PATCH 101/112] Fix account abstraction kit tests --- .../src/AccountAbstraction.test.ts | 62 ++++++++++--------- .../src/AccountAbstraction.ts | 2 +- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/packages/account-abstraction-kit/src/AccountAbstraction.test.ts b/packages/account-abstraction-kit/src/AccountAbstraction.test.ts index e4d54fda4..2c82eebfb 100644 --- a/packages/account-abstraction-kit/src/AccountAbstraction.test.ts +++ b/packages/account-abstraction-kit/src/AccountAbstraction.test.ts @@ -1,4 +1,4 @@ -import Safe, { predictSafeAddress } from '@safe-global/protocol-kit' +import Safe, { predictSafeAddress, SafeProvider } from '@safe-global/protocol-kit' import { GelatoRelayPack } from '@safe-global/relay-kit' import { SafeTransaction } from '@safe-global/safe-core-sdk-types' import AccountAbstraction from './AccountAbstraction' @@ -9,70 +9,72 @@ jest.mock('@safe-global/relay-kit') const GelatoRelayPackMock = GelatoRelayPack as jest.MockedClass const predictSafeAddressMock = predictSafeAddress as jest.MockedFunction const SafeMock = Safe as jest.MockedClass +const SafeProviderMock = SafeProvider as jest.MockedClass describe('AccountAbstraction', () => { const provider = { request: jest.fn() } - const safeProvider = { - getSignerAddress: jest.fn(), - isContractDeployed: jest.fn(), - getChainId: jest.fn() - } + const signerAddress = '0xSignerAddress' const predictSafeAddress = '0xPredictSafeAddressMock' beforeEach(() => { jest.clearAllMocks() - safeProvider.getSignerAddress.mockResolvedValue(signerAddress) predictSafeAddressMock.mockResolvedValue(predictSafeAddress) + SafeProviderMock.prototype.getSignerAddress.mockResolvedValue(signerAddress) }) describe('init', () => { - const accountAbstraction = new AccountAbstraction({ provider }) + const accountAbstraction = new AccountAbstraction({ provider, signer: signerAddress }) it('should initialize a Safe instance with its address if contract is deployed already', async () => { - safeProvider.isContractDeployed.mockResolvedValueOnce(true) + SafeProviderMock.prototype.isContractDeployed.mockResolvedValueOnce(true) await accountAbstraction.init() - expect(safeProvider.getSignerAddress).toHaveBeenCalledTimes(1) + expect(SafeProviderMock.prototype.getSignerAddress).toHaveBeenCalledTimes(1) expect(predictSafeAddressMock).toHaveBeenCalledTimes(1) - expect(predictSafeAddressMock).toHaveBeenCalledWith({ - safeProvider, - safeAccountConfig: { owners: ['0xSignerAddress'], threshold: 1 } - }) + expect(predictSafeAddressMock).toHaveBeenCalledWith( + expect.objectContaining({ + safeAccountConfig: { owners: ['0xSignerAddress'], threshold: 1 } + }) + ) expect(SafeMock.create).toHaveBeenCalledTimes(1) - expect(SafeMock.create).toHaveBeenCalledWith({ - safeProvider, - safeAddress: predictSafeAddress - }) + expect(SafeMock.create).toHaveBeenCalledWith( + expect.objectContaining({ + safeAddress: predictSafeAddress + }) + ) }) it('should initialize a Safe instance with a config if contract is NOT deployed yet', async () => { - safeProvider.isContractDeployed.mockResolvedValueOnce(false) + SafeProviderMock.prototype.isContractDeployed.mockResolvedValueOnce(false) await accountAbstraction.init() - expect(safeProvider.getSignerAddress).toHaveBeenCalledTimes(1) + expect(SafeProviderMock.prototype.getSignerAddress).toHaveBeenCalledTimes(1) expect(predictSafeAddressMock).toHaveBeenCalledTimes(1) - expect(predictSafeAddressMock).toHaveBeenCalledWith({ - safeProvider, - safeAccountConfig: { owners: ['0xSignerAddress'], threshold: 1 } - }) + expect(predictSafeAddressMock).toHaveBeenCalledWith( + expect.objectContaining({ + safeAccountConfig: { owners: ['0xSignerAddress'], threshold: 1 } + }) + ) expect(SafeMock.create).toHaveBeenCalledTimes(1) - expect(SafeMock.create).toHaveBeenCalledWith({ - safeProvider, - predictedSafe: { safeAccountConfig: { owners: ['0xSignerAddress'], threshold: 1 } } - }) + expect(SafeMock.create).toHaveBeenCalledWith( + expect.objectContaining({ + predictedSafe: { safeAccountConfig: { owners: ['0xSignerAddress'], threshold: 1 } } + }) + ) }) it('should throw an error if the provider has not a signer', async () => { - safeProvider.getSignerAddress.mockResolvedValueOnce(undefined) + SafeProviderMock.prototype.getSignerAddress.mockResolvedValueOnce(undefined) expect(accountAbstraction.init()).rejects.toThrow( - `There's no signer in the provided SafeProvider` + `There's no signer available with the provided config (provider, signer)` ) + expect(SafeMock.create).not.toHaveBeenCalled() }) }) diff --git a/packages/account-abstraction-kit/src/AccountAbstraction.ts b/packages/account-abstraction-kit/src/AccountAbstraction.ts index 09711ac54..d8badc7f1 100644 --- a/packages/account-abstraction-kit/src/AccountAbstraction.ts +++ b/packages/account-abstraction-kit/src/AccountAbstraction.ts @@ -35,7 +35,7 @@ class AccountAbstraction { const signer = await safeProvider.getSignerAddress() if (!signer) { - throw new Error("There's no signer available in the provided config") + throw new Error("There's no signer available with the provided config (provider, signer)") } const owners = [signer] From cf5b5ee7f5e12d9954172adbfd2a43f179dfb5f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 6 May 2024 15:44:29 +0200 Subject: [PATCH 102/112] Remove RPC from playground config and use fixed sepolia one --- playground/relay-kit/paid-transaction.ts | 7 ++++--- playground/relay-kit/sponsored-transaction.ts | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/playground/relay-kit/paid-transaction.ts b/playground/relay-kit/paid-transaction.ts index d9309ed68..b6528947c 100644 --- a/playground/relay-kit/paid-transaction.ts +++ b/playground/relay-kit/paid-transaction.ts @@ -14,10 +14,11 @@ import { ethers } from 'ethers' // https://goerli.etherscan.io/tx/ const config = { - SAFE_SIGNER_PRIVATE_KEY: '', - RPC_URL: 'https://goerli.infura.io/v3/' + SAFE_SIGNER_PRIVATE_KEY: '' } +const RPC_URL = 'https://rpc.ankr.com/eth_sepolia' + const mockOnRampConfig = { ADDRESS: '
', PRIVATE_KEY: '' @@ -38,7 +39,7 @@ async function main() { // SDK Initialization const safeAccountAbstraction = new AccountAbstraction({ - provider: config.RPC_URL, + provider: RPC_URL, signer: config.SAFE_SIGNER_PRIVATE_KEY }) diff --git a/playground/relay-kit/sponsored-transaction.ts b/playground/relay-kit/sponsored-transaction.ts index 1ba02227e..95b334956 100644 --- a/playground/relay-kit/sponsored-transaction.ts +++ b/playground/relay-kit/sponsored-transaction.ts @@ -18,10 +18,11 @@ import { ethers } from 'ethers' const config = { SAFE_SIGNER_PRIVATE_KEY: '', - RPC_URL: 'https://goerli.infura.io/v3/', RELAY_API_KEY: '' } +const RPC_URL = 'https://rpc.ankr.com/eth_sepolia' + const mockOnRampConfig = { ADDRESS: '
', PRIVATE_KEY: '' @@ -39,7 +40,7 @@ async function main() { // SDK Initialization const safeAccountAbstraction = new AccountAbstraction({ - provider: config.RPC_URL, + provider: RPC_URL, signer: config.SAFE_SIGNER_PRIVATE_KEY }) From 21c8ab74728e76337835c1fcf57bf68af7429e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 6 May 2024 15:46:14 +0200 Subject: [PATCH 103/112] remove goerli etherscan url's --- playground/relay-kit/paid-transaction.ts | 2 +- playground/relay-kit/sponsored-transaction.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/playground/relay-kit/paid-transaction.ts b/playground/relay-kit/paid-transaction.ts index b6528947c..2d82913b2 100644 --- a/playground/relay-kit/paid-transaction.ts +++ b/playground/relay-kit/paid-transaction.ts @@ -11,7 +11,7 @@ import { ethers } from 'ethers' // https://relay.gelato.digital/tasks/status/ // Check the status of a transaction after it is executed: -// https://goerli.etherscan.io/tx/ +// https://sepolia.etherscan.io/tx/ const config = { SAFE_SIGNER_PRIVATE_KEY: '' diff --git a/playground/relay-kit/sponsored-transaction.ts b/playground/relay-kit/sponsored-transaction.ts index 95b334956..d450adc5a 100644 --- a/playground/relay-kit/sponsored-transaction.ts +++ b/playground/relay-kit/sponsored-transaction.ts @@ -14,7 +14,7 @@ import { ethers } from 'ethers' // https://relay.gelato.digital/tasks/status/ // Check the status of a transaction after it is executed: -// https://goerli.etherscan.io/tx/ +// https://sepolia.etherscan.io/tx/ const config = { SAFE_SIGNER_PRIVATE_KEY: '', From c28de44be41bc0f4da7dd6da138be2f8bb8a3000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Mon, 6 May 2024 16:03:03 +0200 Subject: [PATCH 104/112] Fix signer not propagated --- packages/account-abstraction-kit/src/AccountAbstraction.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/account-abstraction-kit/src/AccountAbstraction.ts b/packages/account-abstraction-kit/src/AccountAbstraction.ts index d8badc7f1..62d50bb7f 100644 --- a/packages/account-abstraction-kit/src/AccountAbstraction.ts +++ b/packages/account-abstraction-kit/src/AccountAbstraction.ts @@ -55,10 +55,15 @@ class AccountAbstraction { const isSafeDeployed = await safeProvider.isContractDeployed(safeAddress) if (isSafeDeployed) { - this.protocolKit = await Safe.create({ provider: this.#provider, safeAddress }) + this.protocolKit = await Safe.create({ + provider: this.#provider, + signer: this.#signer, + safeAddress + }) } else { this.protocolKit = await Safe.create({ provider: this.#provider, + signer: this.#signer, predictedSafe: { safeAccountConfig } }) } From cf8908bbce9bd77758dd28d55ca6d0027042d87e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 8 May 2024 10:03:24 +0200 Subject: [PATCH 105/112] Add delay in flaky test --- packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts b/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts index 421ba1770..1af49cb0f 100644 --- a/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts +++ b/packages/protocol-kit/tests/e2e/fallbackHandlerManager.test.ts @@ -383,6 +383,7 @@ describe('Fallback handler manager', () => { ) const txResponse = await safeSdk.executeTransaction(tx) await waitSafeTxReceipt(txResponse) + await new Promise((resolve) => setTimeout(resolve, 500)) chai .expect(await safeSdk.getFallbackHandler()) .to.be.eq(await defaultCallbackHandler.getAddress()) From 51ff27ba7e49544051d2ca6eb9a06266c1e17d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 8 May 2024 11:38:29 +0200 Subject: [PATCH 106/112] Update guides/integrating-the-safe-core-sdk.md Co-authored-by: Daniel <25051234+dasanra@users.noreply.github.com> --- guides/integrating-the-safe-core-sdk.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/integrating-the-safe-core-sdk.md b/guides/integrating-the-safe-core-sdk.md index fc62a9b69..fb5d229b0 100644 --- a/guides/integrating-the-safe-core-sdk.md +++ b/guides/integrating-the-safe-core-sdk.md @@ -26,7 +26,7 @@ To integrate the [Safe Core SDK](https://github.com/safe-global/safe-core-sdk) i ### Select your Ethereum `provider` and `signer` -To use our kits, you need to provide an Ethereum provider and a signer. The provider is the connection to the Ethereum network, while the signer is the account that will sign the transactions (The safe owner). When using an injected provider like MetaMask, the signer is the account selected in the wallet. +To use our kits, you need to provide an Ethereum provider and a signer. The provider is the connection to the Ethereum network, while the signer is an account that will sign the transactions (a Safe owner). When using an injected provider like MetaMask, the signer is the account selected in the wallet. In the examples below, you can see `provider` and `signer` properties, which represent: From d967c32ed3b17275c6eec5c04859bdc16b057319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 8 May 2024 12:08:18 +0200 Subject: [PATCH 107/112] Update guides/integrating-the-safe-core-sdk.md Co-authored-by: Daniel <25051234+dasanra@users.noreply.github.com> --- guides/integrating-the-safe-core-sdk.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/integrating-the-safe-core-sdk.md b/guides/integrating-the-safe-core-sdk.md index fb5d229b0..7cfc86b34 100644 --- a/guides/integrating-the-safe-core-sdk.md +++ b/guides/integrating-the-safe-core-sdk.md @@ -31,7 +31,7 @@ To use our kits, you need to provide an Ethereum provider and a signer. The prov In the examples below, you can see `provider` and `signer` properties, which represent: - `provider`: You can provide an EIP-1193 compatible provider or an HTTP/WebSocket RPC URL. -- `signer`: This is optional. If not provided, we will try to get the connected account of the provider. If you provide it, it represents either the provider's address you want to use or a private key, which we will use internally to retrieve the provider's address. +- `signer`: This is an optional parameter. It should be the provider's address you want to use or a private key. If not set, it will try to fetch a connected account from the provider. ### Initialize the Safe API Kit From 4dba88187bb604ae36bc5387dced23a03579d127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 8 May 2024 12:13:42 +0200 Subject: [PATCH 108/112] Remove unnecessary ethers specific itifs --- .../tests/e2e/offChainSignatures.test.ts | 78 +++++++++---------- 1 file changed, 36 insertions(+), 42 deletions(-) diff --git a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts index 00bc18932..75d97c6ae 100644 --- a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts @@ -215,51 +215,45 @@ describe('Off-chain signatures', () => { } ) - itif(process.env.ETH_LIB === 'ethers')( - 'should add the signature of the current signer using eth_signTypedData with ethers provider', - async () => { - const { safe, contractNetworks, provider } = await setupTests() - const safeAddress = await safe.getAddress() - const safeSdk = await Safe.create({ - provider, - safeAddress, - contractNetworks - }) - const safeTransactionData = { - to: safeAddress, - value: '0', - data: '0x' - } - const tx = await safeSdk.createTransaction({ transactions: [safeTransactionData] }) - chai.expect(tx.signatures.size).to.be.eq(0) - const signedTx = await safeSdk.signTransaction(tx, SigningMethod.ETH_SIGN_TYPED_DATA) - chai.expect(tx.signatures.size).to.be.eq(0) - chai.expect(signedTx.signatures.size).to.be.eq(1) + it('should add the signature of the current signer using eth_signTypedData with ethers provider', async () => { + const { safe, contractNetworks, provider } = await setupTests() + const safeAddress = await safe.getAddress() + const safeSdk = await Safe.create({ + provider, + safeAddress, + contractNetworks + }) + const safeTransactionData = { + to: safeAddress, + value: '0', + data: '0x' } - ) + const tx = await safeSdk.createTransaction({ transactions: [safeTransactionData] }) + chai.expect(tx.signatures.size).to.be.eq(0) + const signedTx = await safeSdk.signTransaction(tx, SigningMethod.ETH_SIGN_TYPED_DATA) + chai.expect(tx.signatures.size).to.be.eq(0) + chai.expect(signedTx.signatures.size).to.be.eq(1) + }) - itif(process.env.ETH_LIB === 'ethers')( - 'should add the signature of the current signer using eth_signTypedData_v3 with ethers provider', - async () => { - const { safe, contractNetworks, provider } = await setupTests() - const safeAddress = await safe.getAddress() - const safeSdk = await Safe.create({ - provider, - safeAddress, - contractNetworks - }) - const safeTransactionData = { - to: safeAddress, - value: '0', - data: '0x' - } - const tx = await safeSdk.createTransaction({ transactions: [safeTransactionData] }) - chai.expect(tx.signatures.size).to.be.eq(0) - const signedTx = await safeSdk.signTransaction(tx, SigningMethod.ETH_SIGN_TYPED_DATA_V3) - chai.expect(tx.signatures.size).to.be.eq(0) - chai.expect(signedTx.signatures.size).to.be.eq(1) + it('should add the signature of the current signer using eth_signTypedData_v3 with ethers provider', async () => { + const { safe, contractNetworks, provider } = await setupTests() + const safeAddress = await safe.getAddress() + const safeSdk = await Safe.create({ + provider, + safeAddress, + contractNetworks + }) + const safeTransactionData = { + to: safeAddress, + value: '0', + data: '0x' } - ) + const tx = await safeSdk.createTransaction({ transactions: [safeTransactionData] }) + chai.expect(tx.signatures.size).to.be.eq(0) + const signedTx = await safeSdk.signTransaction(tx, SigningMethod.ETH_SIGN_TYPED_DATA_V3) + chai.expect(tx.signatures.size).to.be.eq(0) + chai.expect(signedTx.signatures.size).to.be.eq(1) + }) it('should add the signature of the current signer using eth_signTypedData_v4', async () => { const { safe, contractNetworks, provider } = await setupTests() From 729fecb823f5c6c387c667a518df3ef8f56bb7e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 8 May 2024 12:38:02 +0200 Subject: [PATCH 109/112] Update packages/protocol-kit/tests/e2e/offChainSignatures.test.ts Co-authored-by: Daniel <25051234+dasanra@users.noreply.github.com> --- packages/protocol-kit/tests/e2e/offChainSignatures.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts index 75d97c6ae..2a5f00077 100644 --- a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts @@ -215,7 +215,7 @@ describe('Off-chain signatures', () => { } ) - it('should add the signature of the current signer using eth_signTypedData with ethers provider', async () => { + it('should add the signature of the current signer using eth_signTypedData', async () => { const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ From 6e3ca0acb8e1ddbba944e36c2ccb71e0dd663fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 8 May 2024 12:38:10 +0200 Subject: [PATCH 110/112] Update packages/protocol-kit/tests/e2e/offChainSignatures.test.ts Co-authored-by: Daniel <25051234+dasanra@users.noreply.github.com> --- packages/protocol-kit/tests/e2e/offChainSignatures.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts index 2a5f00077..a20f15366 100644 --- a/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts +++ b/packages/protocol-kit/tests/e2e/offChainSignatures.test.ts @@ -235,7 +235,7 @@ describe('Off-chain signatures', () => { chai.expect(signedTx.signatures.size).to.be.eq(1) }) - it('should add the signature of the current signer using eth_signTypedData_v3 with ethers provider', async () => { + it('should add the signature of the current signer using eth_signTypedData_v3', async () => { const { safe, contractNetworks, provider } = await setupTests() const safeAddress = await safe.getAddress() const safeSdk = await Safe.create({ From 85d19589f64e76d85d75050eba3f80a6993f0fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 8 May 2024 12:44:52 +0200 Subject: [PATCH 111/112] Restore test --- .../api-kit/tests/e2e/getTransactionConfirmations.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/api-kit/tests/e2e/getTransactionConfirmations.test.ts b/packages/api-kit/tests/e2e/getTransactionConfirmations.test.ts index caf585c58..ecd877baa 100644 --- a/packages/api-kit/tests/e2e/getTransactionConfirmations.test.ts +++ b/packages/api-kit/tests/e2e/getTransactionConfirmations.test.ts @@ -19,6 +19,13 @@ describe('getTransactionConfirmations', () => { .to.be.rejectedWith('Invalid safeTxHash') }) + it('should return an empty array if the safeTxHash is not found', async () => { + const safeTxHash = '0x317834aea988fd3cfa54fd8b2be2c96b4fd70a14d8c9470a7110576b01e6480b' + const transactionConfirmations = await safeApiKit.getTransactionConfirmations(safeTxHash) + chai.expect(transactionConfirmations.count).to.be.equal(0) + chai.expect(transactionConfirmations.results.length).to.be.equal(0) + }) + it('should return the transaction with the given safeTxHash', async () => { const safeTxHash = '0x317834aea988fd3cfa54fd8b2be2c96b4fd70a14d8c9470a7110576b01e6480a' const transactionConfirmations = await safeApiKit.getTransactionConfirmations(safeTxHash) From e0aeefd411fa68ed4b19536bba07e1f6398a5dd0 Mon Sep 17 00:00:00 2001 From: leonardotc Date: Wed, 8 May 2024 13:30:21 +0200 Subject: [PATCH 112/112] fix(protocol kit): Get modules paginated incorrect interface (#787) --- .../hardhat/deploy/deploy-contracts.ts | 14 ++ packages/protocol-kit/src/Safe.ts | 5 +- .../Safe/v1.0.0/SafeContract_v1_0_0.ts | 20 ++- .../src/managers/moduleManager.ts | 21 ++- .../protocol-kit/src/types/safeProvider.ts | 5 + packages/protocol-kit/src/utils/address.ts | 2 +- .../tests/e2e/moduleManager.test.ts | 142 ++++++++++++++---- .../tests/e2e/utils/setupContracts.ts | 12 ++ 8 files changed, 170 insertions(+), 51 deletions(-) diff --git a/packages/protocol-kit/hardhat/deploy/deploy-contracts.ts b/packages/protocol-kit/hardhat/deploy/deploy-contracts.ts index 7fc9e21d0..28789b6e7 100644 --- a/packages/protocol-kit/hardhat/deploy/deploy-contracts.ts +++ b/packages/protocol-kit/hardhat/deploy/deploy-contracts.ts @@ -188,6 +188,20 @@ const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment): Promise { + async getModulesPaginated(start: string, pageSize: number = 10): Promise { return this.#moduleManager.getModulesPaginated(start, pageSize) } diff --git a/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts b/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts index 8f6ff51ad..c969d0446 100644 --- a/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts +++ b/packages/protocol-kit/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.ts @@ -1,7 +1,7 @@ import SafeBaseContract from '@safe-global/protocol-kit/contracts/Safe/SafeBaseContract' import SafeProvider from '@safe-global/protocol-kit/SafeProvider' import { toTxResult } from '@safe-global/protocol-kit/contracts/utils' -import { sameString } from '@safe-global/protocol-kit/utils' +import { sameString, isSentinelAddress } from '@safe-global/protocol-kit/utils' import { SafeVersion, SafeContract_v1_0_0_Abi, @@ -247,15 +247,25 @@ class SafeContract_v1_0_0 return toTxResult(txResponse, options) } - async getModulesPaginated(start: string, pageSize: bigint): Promise { + async getModulesPaginated([start, pageSize]: [string, bigint]): Promise<[string[], string]> { if (pageSize <= 0) throw new Error('Invalid page size for fetching paginated modules') + const size = Number(pageSize) const [array] = await this.getModules() - if (start === SENTINEL_ADDRESS) { - return array.slice(0, Number(pageSize)) + + if (isSentinelAddress(start)) { + const next = pageSize < array.length ? array[size] : SENTINEL_ADDRESS + return [array.slice(0, size), next] } else { const moduleIndex = array.findIndex((module: string) => sameString(module, start)) - return moduleIndex === -1 ? [] : array.slice(moduleIndex + 1, Number(pageSize)) + if (moduleIndex === -1) { + return [[], SENTINEL_ADDRESS] + } + + const nextElementIndex = moduleIndex + 1 + const nextPageAddress = + nextElementIndex + size < array.length ? array[nextElementIndex + size] : SENTINEL_ADDRESS + return [array.slice(moduleIndex + 1, nextElementIndex + size), nextPageAddress] } } diff --git a/packages/protocol-kit/src/managers/moduleManager.ts b/packages/protocol-kit/src/managers/moduleManager.ts index ef036492c..0e91160d7 100644 --- a/packages/protocol-kit/src/managers/moduleManager.ts +++ b/packages/protocol-kit/src/managers/moduleManager.ts @@ -1,6 +1,9 @@ import { isRestrictedAddress, sameString } from '@safe-global/protocol-kit/utils/address' import { SENTINEL_ADDRESS } from '@safe-global/protocol-kit/utils/constants' -import { SafeContractImplementationType } from '@safe-global/protocol-kit/types' +import { + SafeContractImplementationType, + SafeModulesPaginated +} from '@safe-global/protocol-kit/types' import SafeProvider from '../SafeProvider' class ModuleManager { @@ -46,17 +49,13 @@ class ModuleManager { return [...modules] } - //TODO: Implement getModulesPaginated in the new code - async getModulesPaginated(start: string, pageSize: number): Promise { - console.log('getModulesPaginated', start, pageSize) - return [] - // if (!this.#safeContract) { - // throw new Error('Safe is not deployed') - // } - - // const [modules] = await this.#safeContract.getModulesPaginated(start, pageSize) + async getModulesPaginated(start: string, pageSize: number): Promise { + if (!this.#safeContract) { + throw new Error('Safe is not deployed') + } - // return [...modules] + const [modules, next] = await this.#safeContract.getModulesPaginated([start, BigInt(pageSize)]) + return { modules: modules as string[], next } } async isModuleEnabled(moduleAddress: string): Promise { diff --git a/packages/protocol-kit/src/types/safeProvider.ts b/packages/protocol-kit/src/types/safeProvider.ts index 3e99c279c..af47b84bb 100644 --- a/packages/protocol-kit/src/types/safeProvider.ts +++ b/packages/protocol-kit/src/types/safeProvider.ts @@ -29,3 +29,8 @@ export type SafeProviderTransaction = { maxFeePerGas?: number | string maxPriorityFeePerGas?: number | string } + +export type SafeModulesPaginated = { + modules: string[] + next: string +} diff --git a/packages/protocol-kit/src/utils/address.ts b/packages/protocol-kit/src/utils/address.ts index 5906f3c8b..472011460 100644 --- a/packages/protocol-kit/src/utils/address.ts +++ b/packages/protocol-kit/src/utils/address.ts @@ -8,7 +8,7 @@ export function isZeroAddress(address: string): boolean { return sameString(address, ZERO_ADDRESS) } -function isSentinelAddress(address: string): boolean { +export function isSentinelAddress(address: string): boolean { return sameString(address, SENTINEL_ADDRESS) } diff --git a/packages/protocol-kit/tests/e2e/moduleManager.test.ts b/packages/protocol-kit/tests/e2e/moduleManager.test.ts index bb0e53b82..62513be7c 100644 --- a/packages/protocol-kit/tests/e2e/moduleManager.test.ts +++ b/packages/protocol-kit/tests/e2e/moduleManager.test.ts @@ -11,11 +11,14 @@ import { getContractNetworks } from './utils/setupContractNetworks' import { getDailyLimitModule, getSafeWithOwners, - getSocialRecoveryModule + getSocialRecoveryModule, + getStateChannelModule, + getWhiteListModule } from './utils/setupContracts' import { getEip1193Provider } from './utils/setupProvider' import { getAccounts } from './utils/setupTestNetwork' import { waitSafeTxReceipt } from './utils/transactions' +import semverSatisfies from 'semver/functions/satisfies' chai.use(chaiAsPromised) @@ -39,6 +42,8 @@ describe('Safe modules manager', () => { return { dailyLimitModule: await getDailyLimitModule(), socialRecoveryModule: await getSocialRecoveryModule(), + stateChannelModule: await getStateChannelModule(), + whiteListModule: await getWhiteListModule(), safe: await getSafeWithOwners([accounts[0].address]), accounts, contractNetworks, @@ -86,8 +91,7 @@ describe('Safe modules manager', () => { }) }) - //TODO: Fix getModulesPaginated tests - describe.skip('getModulesPaginated', async () => { + describe('getModulesPaginated', async () => { it('should fail if the Safe is not deployed', async () => { const { predictedSafe, contractNetworks, provider } = await setupTests() const safeSdk = await Safe.create({ @@ -108,62 +112,136 @@ describe('Safe modules manager', () => { safeAddress, contractNetworks }) - chai.expect((await safeSdk.getModulesPaginated(SENTINEL_ADDRESS, 10)).length).to.be.eq(0) + + const emptyModuleList = await safeSdk.getModulesPaginated(SENTINEL_ADDRESS, 10) const tx = await safeSdk.createEnableModuleTx(await dailyLimitModule.getAddress()) const txResponse = await safeSdk.executeTransaction(tx) await waitSafeTxReceipt(txResponse) - chai.expect((await safeSdk.getModulesPaginated(SENTINEL_ADDRESS, 10)).length).to.be.eq(1) + const moduleList = await safeSdk.getModulesPaginated(SENTINEL_ADDRESS, 10) + + chai.expect(emptyModuleList.modules.length).to.be.eq(0) + chai.expect(emptyModuleList.next).to.be.eq(SENTINEL_ADDRESS) + chai.expect(moduleList.modules.length).to.be.eq(1) + chai.expect(emptyModuleList.next).to.be.eq(SENTINEL_ADDRESS) }) it('should constraint returned modules by pageSize', async () => { - const { safe, dailyLimitModule, contractNetworks, socialRecoveryModule, provider } = - await setupTests() + const { + safe, + dailyLimitModule, + contractNetworks, + socialRecoveryModule, + stateChannelModule, + whiteListModule, + provider + } = await setupTests() const safeAddress = await safe.getAddress() const dailyLimitsAddress = await dailyLimitModule.getAddress() const socialRecoveryAddress = await socialRecoveryModule.getAddress() + const stateChannelAddress = await stateChannelModule.getAddress() + const whiteListAddress = await whiteListModule.getAddress() const safeSdk = await Safe.create({ provider, safeAddress, contractNetworks }) + const currentPageNext = semverSatisfies(await safeSdk.getContractVersion(), '>=1.4.1') + + chai + .expect((await safeSdk.getModulesPaginated(SENTINEL_ADDRESS, 10)).modules.length) + .to.be.eq(0) + + const moduleDeployment = [ + dailyLimitsAddress, + socialRecoveryAddress, + stateChannelAddress, + whiteListAddress + ].map(async (moduleAddress) => { + const txModule = await safeSdk.createEnableModuleTx(moduleAddress) + const moduleResponse = await safeSdk.executeTransaction(txModule) + await waitSafeTxReceipt(moduleResponse) + }) + + await Promise.all(moduleDeployment) + + const modules1 = await safeSdk.getModulesPaginated(SENTINEL_ADDRESS, 10) + const modules2 = await safeSdk.getModulesPaginated(SENTINEL_ADDRESS, 1) + const modules3 = await safeSdk.getModulesPaginated(SENTINEL_ADDRESS, 2) - chai.expect((await safeSdk.getModulesPaginated(SENTINEL_ADDRESS, 10)).length).to.be.eq(0) - const txDailyLimits = await safeSdk.createEnableModuleTx(dailyLimitsAddress) - const dailyLimitsResponse = await safeSdk.executeTransaction(txDailyLimits) - await waitSafeTxReceipt(dailyLimitsResponse) - const txSocialRecovery = await safeSdk.createEnableModuleTx(socialRecoveryAddress) - const soecialRecoveryResponse = await safeSdk.executeTransaction(txSocialRecovery) - await waitSafeTxReceipt(soecialRecoveryResponse) - - chai.expect((await safeSdk.getModulesPaginated(SENTINEL_ADDRESS, 10)).length).to.be.eq(2) - chai.expect((await safeSdk.getModulesPaginated(SENTINEL_ADDRESS, 1)).length).to.be.eq(1) - chai.expect((await safeSdk.getModulesPaginated(SENTINEL_ADDRESS, 1)).length).to.be.eq(1) + chai.expect(modules1.modules.length).to.be.eq(4) + chai + .expect(modules1.modules) + .to.deep.eq([ + whiteListAddress, + stateChannelAddress, + socialRecoveryAddress, + dailyLimitsAddress + ]) + chai.expect(modules1.next).to.be.eq(SENTINEL_ADDRESS) + + chai.expect(modules2.modules.length).to.be.eq(1) + chai.expect(modules2.modules).to.deep.eq([whiteListAddress]) + chai.expect(modules2.next).to.be.eq(currentPageNext ? whiteListAddress : stateChannelAddress) + + chai.expect(modules3.modules.length).to.be.eq(2) + chai.expect(modules3.modules).to.deep.eq([whiteListAddress, stateChannelAddress]) + chai + .expect(modules3.next) + .to.be.eq(currentPageNext ? stateChannelAddress : socialRecoveryAddress) }) it('should offset the returned modules', async () => { - const { safe, dailyLimitModule, contractNetworks, socialRecoveryModule, provider } = - await setupTests() + const { + safe, + dailyLimitModule, + contractNetworks, + socialRecoveryModule, + stateChannelModule, + whiteListModule, + provider + } = await setupTests() const safeAddress = await safe.getAddress() - const dailyLimitsAddress = await await dailyLimitModule.getAddress() - const socialRecoveryAddress = await await socialRecoveryModule.getAddress() + const dailyLimitsAddress = await dailyLimitModule.getAddress() + const socialRecoveryAddress = await socialRecoveryModule.getAddress() + const stateChannelAddress = await stateChannelModule.getAddress() + const whiteListAddress = await whiteListModule.getAddress() const safeSdk = await Safe.create({ provider, safeAddress, contractNetworks }) + const currentPageNext = semverSatisfies(await safeSdk.getContractVersion(), '>=1.4.1') + + const moduleDeployment = [ + dailyLimitsAddress, + socialRecoveryAddress, + stateChannelAddress, + whiteListAddress + ].map(async (moduleAddress) => { + const txModule = await safeSdk.createEnableModuleTx(moduleAddress) + const moduleResponse = await safeSdk.executeTransaction(txModule) + await waitSafeTxReceipt(moduleResponse) + }) - const txDailyLimits = await safeSdk.createEnableModuleTx(dailyLimitsAddress) - const dailyLimitsResponse = await safeSdk.executeTransaction(txDailyLimits) - await waitSafeTxReceipt(dailyLimitsResponse) - const txSocialRecovery = await safeSdk.createEnableModuleTx(socialRecoveryAddress) - const soecialRecoveryResponse = await safeSdk.executeTransaction(txSocialRecovery) - await waitSafeTxReceipt(soecialRecoveryResponse) + await Promise.all(moduleDeployment) - const [firstModule, secondModule] = await safeSdk.getModulesPaginated(SENTINEL_ADDRESS, 10) + const { + modules: [firstModule, secondModule, thirdModule, fourthModule] + } = await safeSdk.getModulesPaginated(SENTINEL_ADDRESS, 10) - chai.expect((await safeSdk.getModulesPaginated(SENTINEL_ADDRESS, 10)).length).to.be.eq(2) - chai.expect((await safeSdk.getModulesPaginated(firstModule, 10)).length).to.be.eq(1) - chai.expect((await safeSdk.getModulesPaginated(secondModule, 10)).length).to.be.eq(0) + const modules1 = await safeSdk.getModulesPaginated(firstModule, 10) + const modules2 = await safeSdk.getModulesPaginated(firstModule, 2) + const modules3 = await safeSdk.getModulesPaginated(firstModule, 3) + + chai + .expect((await safeSdk.getModulesPaginated(SENTINEL_ADDRESS, 10)).modules.length) + .to.be.eq(4) + chai.expect(modules1.modules).to.deep.eq([secondModule, thirdModule, fourthModule]) + chai.expect(modules1.next).to.be.eq(SENTINEL_ADDRESS) + chai.expect(modules2.modules).to.deep.eq([secondModule, thirdModule]) + chai.expect(modules2.next).to.be.eq(currentPageNext ? thirdModule : fourthModule) + chai.expect(modules3.modules).to.deep.eq([secondModule, thirdModule, fourthModule]) + chai.expect(modules3.next).to.be.eq(SENTINEL_ADDRESS) }) it('should fail if pageSize is invalid', async () => { diff --git a/packages/protocol-kit/tests/e2e/utils/setupContracts.ts b/packages/protocol-kit/tests/e2e/utils/setupContracts.ts index 986d657a3..af82e3ba7 100644 --- a/packages/protocol-kit/tests/e2e/utils/setupContracts.ts +++ b/packages/protocol-kit/tests/e2e/utils/setupContracts.ts @@ -175,6 +175,18 @@ export const getSocialRecoveryModule = async (): Promise => { return SocialRecoveryModule.attach(SocialRecoveryModuleDeployment.address) } +export const getStateChannelModule = async (): Promise => { + const StateChannelModuleDeployment = await deployments.get('StateChannelModule') + const StateChannelModule = await ethers.getContractFactory('StateChannelModule') + return StateChannelModule.attach(StateChannelModuleDeployment.address) +} + +export const getWhiteListModule = async (): Promise => { + const WhiteListModuleDeployment = await deployments.get('WhitelistModule') + const WhiteListModule = await ethers.getContractFactory('WhitelistModule') + return WhiteListModule.attach(WhiteListModuleDeployment.address) +} + export const getERC20Mintable = async (): Promise => { const ERC20MintableDeployment = await deployments.get('ERC20Mintable') const ERC20Mintable = await ethers.getContractFactory('ERC20Mintable')