is this related to you other thread? How to connect to Local aeternity instance for testing smart contract from React/Angular Frontend?
anyway, if your contract is already deployed you can also initialize the contract instance via aci
and the contractAddress
(ct_…) like described here:
dealing with aci
only is currently not 100% convenient and we will definitely improve our onboarding journey to provide you with good examples in that regards.
already had a conversation with somebody else on Discord this morning. here a snippet that shows you how to obtain the aci
using SDK and how to (re-)use it by initializing a new contract instance by just aci
and contractAddress
:
// initialize the contract instance
contract = await aeSdk.getContractInstance({ source, fileSystem });
// deploy the contract with instance initialized via sourceCode
await contract.deploy([
collectionMetadata.name,
collectionMetadata.symbol
]);
let aci = JSON.stringify(contract._aci); // obtain and save the ACI
let contractAddress = contract.deployInfo.address; // obtain and save the contract address
let aciContraceInstance = await aeSdk.getContractInstance({aci: JSON.parse(aci), contractAddress}); // initialize the contract instance with ACI and contract address only
console.log((await aciContraceInstance.methods.meta_info()).decodedResult); // any entrypoint call you'd like which is covered by the ACI :)