public async Task <byte[]> GetStateAsync(UInt256 rootHash, UInt160 scriptHash, byte[] key) { var result = await rpcClient.RpcSendAsync(RpcClient.GetRpcName(), rootHash.ToString(), scriptHash.ToString(), Convert.ToBase64String(key)).ConfigureAwait(false); return(Convert.FromBase64String(result.AsString())); }
public async Task <RpcFoundStates> FindStatesAsync(UInt256 rootHash, UInt160 scriptHash, ReadOnlyMemory <byte> prefix, ReadOnlyMemory <byte> from = default, int?count = null) { var @params = MakeFindStatesParams(rootHash, scriptHash, prefix.Span, from.Span, count); var result = await rpcClient.RpcSendAsync(RpcClient.GetRpcName(), @params).ConfigureAwait(false); return(RpcFoundStates.FromJson(result)); }
public async Task <byte[]> VerifyProofAsync(UInt256 rootHash, byte[] proofBytes) { var result = await rpcClient.RpcSendAsync(RpcClient.GetRpcName(), rootHash.ToString(), Convert.ToBase64String(proofBytes)).ConfigureAwait(false); return(Convert.FromBase64String(result.AsString())); }
public async Task <(uint?localRootIndex, uint?validatedRootIndex)> GetStateHeightAsync() { var result = await rpcClient.RpcSendAsync(RpcClient.GetRpcName()).ConfigureAwait(false); var localRootIndex = ToNullableUint(result["localrootindex"]); var validatedRootIndex = ToNullableUint(result["validatedrootindex"]); return(localRootIndex, validatedRootIndex); }
public async Task <RpcStateRoot> GetStateRootAsync(uint index) { var result = await rpcClient.RpcSendAsync(RpcClient.GetRpcName(), index).ConfigureAwait(false); return(RpcStateRoot.FromJson(result)); }