예제 #1
0
        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()));
        }
예제 #2
0
        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));
        }
예제 #3
0
        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()));
        }
예제 #4
0
        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);
        }
예제 #5
0
        public async Task <RpcStateRoot> GetStateRootAsync(uint index)
        {
            var result = await rpcClient.RpcSendAsync(RpcClient.GetRpcName(), index).ConfigureAwait(false);

            return(RpcStateRoot.FromJson(result));
        }