Beispiel #1
0
        /// <summary>
        /// Callback entry for request.
        /// </summary>
        /// <param name="callback">The callback for the request result.</param>
        public void Submit(MessageCallback <T> callback = null)
        {
            foreach (KeyValuePair <string, object> pair in _message)
            {
                if (pair.Value is Exception exception)
                {
                    callback(new MessageResult <T>(null, exception));
                    return;
                }
            }

            _remote.Submit(_command, _message, _filter, callback);
        }
Beispiel #2
0
        /// <summary>
        /// Submits entry for transaction.
        /// </summary>
        /// <param name="callback">The callback.</param>
        public void Submit(MessageCallback <T> callback)
        {
            if (_txJson.Exception != null)
            {
                callback(new MessageResult <T>(null, _txJson.Exception));
                return;
            }

            if (_type == TransactionType.Signer || _localSigned)//直接将blob传给底层
            {
                dynamic data = new ExpandoObject();
                data.tx_blob = _txJson.Blob;
                _remote.Submit("submit", data, _filter, callback);
            }
            else if (_remote.LocalSign)//签名之后传给底层
            {
                Sign(r =>
                {
                    if (r.Exception != null)
                    {
                        callback(new MessageResult <T>("sign error: ", r.Exception));
                    }

                    dynamic data = new ExpandoObject();
                    data.tx_blob = r.Result;
                    _remote.Submit("submit", data, _filter, callback);
                });
            }
            else//不签名交易传给底层
            {
                dynamic data = new ExpandoObject();
                data.secret  = _secret;
                data.tx_json = _txJson;
                _remote.Submit("submit", data, _filter, callback);
            }
        }