deployed contract name support in getContractState
Summary or problem description getcontractstate supports retrieving contract state by invocation hash (i.e. the new script hash that doesn't change when the contract is updated), or by native contract name or native contract id. There is no way to retrieve the contract state of a non-native deployed contract except by invocation hash.
Do you have any solution you want to propose? Update GetContractState to support query of deployed contracts by name. Note, since it's possible for multiple contracts to have the same name, this means returning an array of contract states when querying by name.
Neo-express is creating a custom express-specific RPC endpoint with this behavior (https://github.com/neo-project/neo-express/pull/92). But it would be best for neo visual devtracker for this behavior to be standard on all RPC nodes.
Where in the software does this update applies to?
- RPC (HTTP)
Update GetContractState to support query of deployed contracts by name.
It seems we can not do that, as there is no name -> contractstate table in neo-core.
Update GetContractState to support query of deployed contracts by name.
It seems we can not do that, as there is no
name -> contractstatetable in neo-core.
we have list all contracts function, can filter the result by name.
public IEnumerable<ContractState> ListContracts(StoreView snapshot)
{
byte[] listContractsPrefix = CreateStorageKey(Prefix_Contract).ToArray();
return snapshot.Storages.Find(listContractsPrefix).Select(kvp => kvp.Value.GetInteroperable<ContractState>());
}
Sorry, clicked the close button by accident