ContractFactory
An ethers Contract Factory. Given a ContractList, the ContractFactory will initialize ethers Contracts and easily provide Providers or Signers.
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new ContractFactory(signersOrProviders
, contractList
)
Create an instance of a ContractFactory by providing Signers or Providers keyed by their chain ids and a list of contract metadata.
Parameters
Name | Type | Description |
---|---|---|
signersOrProviders | SignersOrProviders | signers or providers keyed by their chain ids |
contractList | ContractList | a list of contract metadata |
Defined in
Properties
contractList
• Readonly
contractList: ContractList
Defined in
signersOrProviders
• Readonly
signersOrProviders: SignersOrProviders
Defined in
Methods
getContract
▸ getContract(chainId
, address
): Contract
Creates an ethers Contract for the contract identifier provided using the ContractList and Signers or Providers provided on initialization.
Parameters
Name | Type | Description |
---|---|---|
chainId | number | the chain id the contract was deployed on |
address | string | the address of the contract to create |
Returns
Contract
an ethers contract for the provided contract identifier
Defined in
getContractList
▸ getContractList(): ContractList
Getter for the ContractList provided on initialization.
Returns
the contract list the contract factory was initialized with
Defined in
getContracts
▸ getContracts(contractIdentifiers
): Contract
[]
Creates multiple ethers Contracts for the identifiers provided using the ContractList and Signers or Providers provided on initialization.
Parameters
Name | Type | Description |
---|---|---|
contractIdentifiers | ContractIdentifier [] | a list of unique identifiers for contracts to create |
Returns
Contract
[]
a list of ethers contracts for the provided conract identifiers
Defined in
getSignerOrProvider
▸ getSignerOrProvider(chainId
): Signer
| Provider
Gets a Signer or Provider for the chain id requested from the Signers or Providers prodiced on initialization.
Parameters
Name | Type | Description |
---|---|---|
chainId | number | the chain id to get a signer or provider for |
Returns
Signer
| Provider
the signer or provider for the chain id requested
Defined in
getSignersOrProviders
▸ getSignersOrProviders(): SignersOrProviders
Getter for the Signers or Providers provided on initialization.
Returns
the signers or providers the contract factory was initialized with