internal static RelatedTransaction DeserializeRelatedTransaction(JsonElement element)
        {
            Optional <NetworkIdentifier> networkIdentifier     = default;
            TransactionIdentifier        transactionIdentifier = default;
            Direction direction = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("network_identifier"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    networkIdentifier = NetworkIdentifier.DeserializeNetworkIdentifier(property.Value);
                    continue;
                }
                if (property.NameEquals("transaction_identifier"))
                {
                    transactionIdentifier = TransactionIdentifier.DeserializeTransactionIdentifier(property.Value);
                    continue;
                }
                if (property.NameEquals("direction"))
                {
                    direction = new Direction(property.Value.GetString());
                    continue;
                }
            }
            return(new RelatedTransaction(networkIdentifier.Value, transactionIdentifier, direction));
        }
Ejemplo n.º 2
0
        public NetworkRequest(NetworkIdentifier networkIdentifier)
        {
            if (networkIdentifier == null)
            {
                throw new ArgumentNullException(nameof(networkIdentifier));
            }

            NetworkIdentifier = networkIdentifier;
        }
Ejemplo n.º 3
0
        public ConstructionMetadataRequest(NetworkIdentifier networkIdentifier)
        {
            if (networkIdentifier == null)
            {
                throw new ArgumentNullException(nameof(networkIdentifier));
            }

            NetworkIdentifier = networkIdentifier;
            PublicKeys        = new ChangeTrackingList <PublicKey>();
        }
Ejemplo n.º 4
0
        public ConstructionDeriveRequest(NetworkIdentifier networkIdentifier, PublicKey publicKey)
        {
            if (networkIdentifier == null)
            {
                throw new ArgumentNullException(nameof(networkIdentifier));
            }
            if (publicKey == null)
            {
                throw new ArgumentNullException(nameof(publicKey));
            }

            NetworkIdentifier = networkIdentifier;
            PublicKey         = publicKey;
        }
Ejemplo n.º 5
0
        public MempoolTransactionRequest(NetworkIdentifier networkIdentifier, TransactionIdentifier transactionIdentifier)
        {
            if (networkIdentifier == null)
            {
                throw new ArgumentNullException(nameof(networkIdentifier));
            }
            if (transactionIdentifier == null)
            {
                throw new ArgumentNullException(nameof(transactionIdentifier));
            }

            NetworkIdentifier     = networkIdentifier;
            TransactionIdentifier = transactionIdentifier;
        }
        public ConstructionSubmitRequest(NetworkIdentifier networkIdentifier, string signedTransaction)
        {
            if (networkIdentifier == null)
            {
                throw new ArgumentNullException(nameof(networkIdentifier));
            }
            if (signedTransaction == null)
            {
                throw new ArgumentNullException(nameof(signedTransaction));
            }

            NetworkIdentifier = networkIdentifier;
            SignedTransaction = signedTransaction;
        }
Ejemplo n.º 7
0
        public BlockRequest(NetworkIdentifier networkIdentifier, PartialBlockIdentifier blockIdentifier)
        {
            if (networkIdentifier == null)
            {
                throw new ArgumentNullException(nameof(networkIdentifier));
            }
            if (blockIdentifier == null)
            {
                throw new ArgumentNullException(nameof(blockIdentifier));
            }

            NetworkIdentifier = networkIdentifier;
            BlockIdentifier   = blockIdentifier;
        }
        public ConstructionParseRequest(NetworkIdentifier networkIdentifier, bool signed, string transaction)
        {
            if (networkIdentifier == null)
            {
                throw new ArgumentNullException(nameof(networkIdentifier));
            }
            if (transaction == null)
            {
                throw new ArgumentNullException(nameof(transaction));
            }

            NetworkIdentifier = networkIdentifier;
            Signed            = signed;
            Transaction       = transaction;
        }
Ejemplo n.º 9
0
        public ConstructionPreprocessRequest(NetworkIdentifier networkIdentifier, IEnumerable <Operation> operations)
        {
            if (networkIdentifier == null)
            {
                throw new ArgumentNullException(nameof(networkIdentifier));
            }
            if (operations == null)
            {
                throw new ArgumentNullException(nameof(operations));
            }

            NetworkIdentifier = networkIdentifier;
            Operations        = operations.ToList();
            MaxFee            = new ChangeTrackingList <Amount>();
        }
Ejemplo n.º 10
0
        public ConstructionPayloadsRequest(NetworkIdentifier networkIdentifier, IEnumerable <Operation> operations)
        {
            if (networkIdentifier == null)
            {
                throw new ArgumentNullException(nameof(networkIdentifier));
            }
            if (operations == null)
            {
                throw new ArgumentNullException(nameof(operations));
            }

            NetworkIdentifier = networkIdentifier;
            Operations        = operations.ToList();
            PublicKeys        = new ChangeTrackingList <PublicKey>();
        }
Ejemplo n.º 11
0
        public AccountBalanceRequest(NetworkIdentifier networkIdentifier, AccountIdentifier accountIdentifier)
        {
            if (networkIdentifier == null)
            {
                throw new ArgumentNullException(nameof(networkIdentifier));
            }
            if (accountIdentifier == null)
            {
                throw new ArgumentNullException(nameof(accountIdentifier));
            }

            NetworkIdentifier = networkIdentifier;
            AccountIdentifier = accountIdentifier;
            Currencies        = new ChangeTrackingList <Currency>();
        }
        public AccountCoinsRequest(NetworkIdentifier networkIdentifier, AccountIdentifier accountIdentifier, bool includeMempool)
        {
            if (networkIdentifier == null)
            {
                throw new ArgumentNullException(nameof(networkIdentifier));
            }
            if (accountIdentifier == null)
            {
                throw new ArgumentNullException(nameof(accountIdentifier));
            }

            NetworkIdentifier = networkIdentifier;
            AccountIdentifier = accountIdentifier;
            IncludeMempool    = includeMempool;
            Currencies        = new ChangeTrackingList <Currency>();
        }
Ejemplo n.º 13
0
        internal static NetworkListResponse DeserializeNetworkListResponse(JsonElement element)
        {
            IReadOnlyList <NetworkIdentifier> networkIdentifiers = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("network_identifiers"))
                {
                    List <NetworkIdentifier> array = new List <NetworkIdentifier>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(NetworkIdentifier.DeserializeNetworkIdentifier(item));
                    }
                    networkIdentifiers = array;
                    continue;
                }
            }
            return(new NetworkListResponse(networkIdentifiers));
        }
Ejemplo n.º 14
0
        public CallRequest(NetworkIdentifier networkIdentifier, string method, object parameters)
        {
            if (networkIdentifier == null)
            {
                throw new ArgumentNullException(nameof(networkIdentifier));
            }
            if (method == null)
            {
                throw new ArgumentNullException(nameof(method));
            }
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            NetworkIdentifier = networkIdentifier;
            Method            = method;
            Parameters        = parameters;
        }
Ejemplo n.º 15
0
        public ConstructionCombineRequest(NetworkIdentifier networkIdentifier, string unsignedTransaction, IEnumerable <Signature> signatures)
        {
            if (networkIdentifier == null)
            {
                throw new ArgumentNullException(nameof(networkIdentifier));
            }
            if (unsignedTransaction == null)
            {
                throw new ArgumentNullException(nameof(unsignedTransaction));
            }
            if (signatures == null)
            {
                throw new ArgumentNullException(nameof(signatures));
            }

            NetworkIdentifier   = networkIdentifier;
            UnsignedTransaction = unsignedTransaction;
            Signatures          = signatures.ToList();
        }
 internal RelatedTransaction(NetworkIdentifier networkIdentifier, TransactionIdentifier transactionIdentifier, Direction direction)
 {
     NetworkIdentifier     = networkIdentifier;
     TransactionIdentifier = transactionIdentifier;
     Direction             = direction;
 }