Ejemplo n.º 1
0
        public async Task <EthereumResponse <bool> > IsSignValid(Guid id, string sign, IAsset asset, string fromAddress, string toAddress, decimal amount)
        {
            var response = await _ethereumApi.ApiExchangeCheckSignPostAsync(new CheckSignModel
            {
                Amount             = EthServiceHelpers.ConvertToContract(amount, asset.MultiplierPower, asset.Accuracy),
                CoinAdapterAddress = asset.AssetAddress,
                ToAddress          = toAddress,
                FromAddress        = fromAddress,
                Id   = id,
                Sign = sign
            });

            var error = response as ApiException;

            if (error != null)
            {
                return(new EthereumResponse <bool>
                {
                    Error = new ErrorResponse {
                        Code = error.Error.Code, Message = error.Error.Message
                    }
                });
            }

            var res = response as CheckSignResponse;

            if (res != null)
            {
                return(new EthereumResponse <bool>
                {
                    Result = res.SignIsCorrect.GetValueOrDefault()
                });
            }

            throw new Exception("Unknown response");
        }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='model'>
 /// </param>
 public static object ApiExchangeCheckSignPost(this IEthereumApi operations, CheckSignModel model = default(CheckSignModel))
 {
     return(operations.ApiExchangeCheckSignPostAsync(model).GetAwaiter().GetResult());
 }