-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Same contract & ABI, many networks #115
Comments
Ended up using You could say to go directly to Example: // Custom helper function for fetching network-based contract SDK without generating separate TypeChain/SDK for all the networks.
export const getContractSdk = (
chainId: number,
providerOrSigner: providers.Provider | Signer
) => {
const network = findNetworkByChainId(chainId);
const networkContractAddress = network?.contractAddress;
const doesNetworkSupportContract = !!networkContractAddress;
if (!doesNetworkSupportContract) {
throw new Error(
`Contract not available for network [${chainId}:${network?.name}].`
);
}
// A specific network's TypeChain Factory used as the base for other networks.
return Contract__factory.connect(
networkContractAddress,
providerOrSigner
);
}; NOTE: For some reason, using Fortunately, using the direct imports |
I have a similar situation. I have the same contract & ABI, deployed MANY times on one network. I don't want to have a duplicate abi file 30+ times 🤣 |
I'm wondering if there's any special support for same contract & ABI deployed on many networks? Currently, many types are created that have are effectively duplicates. Not a big issue but I would imagine nowadays it's a common use-case where same contract is deployed to many networks.
The text was updated successfully, but these errors were encountered: