コード例 #1
0
        private Task <RawTransaction> SendMoneyAsync(string publicKey, string secretPhrase, string recipient, string recipientPublicKey, decimal amount, Message comment)
        {
            EncryptedMessage encryptedMessage       = comment.Encrypt(recipientPublicKey, secretPhrase);
            EncryptedMessage encryptedToSelfMessage = comment.Encrypt(publicKey, secretPhrase);

            return(SendRequestAsync <RawTransaction>("sendMoney", ("deadline", "1440"),
                                                     ("amountNQT", Convert.AmountToCoins(amount).ToString()),
                                                     ("feeNQT", "5"),
                                                     ("messageToEncryptIsText", "true"),
                                                     ("messageToEncryptToSelfIsText", "true"),
                                                     ("permanent_message", "1"),
                                                     ("phased", "2"),
                                                     ("phasingHashedSecret", ""),
                                                     ("phasingHashedSecretAlgorithm", "2"),
                                                     ("phasingLinkedFullHash", ""),
                                                     ("publicKey", publicKey),
                                                     ("recipient", recipient),
                                                     ("recipientPublicKey", recipientPublicKey),
                                                     ("encryptToSelfMessageData", encryptedToSelfMessage.HexData),
                                                     ("encryptToSelfMessageNonce", encryptedToSelfMessage.HexSalt),
                                                     ("encryptedMessageData", encryptedMessage.HexData),
                                                     ("encryptedMessageNonce", encryptedMessage.HexSalt)));
        }
コード例 #2
0
        private async IAsyncEnumerable <RawTransactionDetails> GetBlockchainTransactionsAsync(BigInteger accountId, int numberOfConfirmations, long timestamp, TransactionType type, int bucketSize)
        {
            int firstIndex = -bucketSize;
            int lastIndex  = -1;

            numberOfConfirmations = Math.Max(numberOfConfirmations, 0);
            timestamp             = Math.Max(timestamp, 0);

            do
            {
                firstIndex += bucketSize;
                lastIndex  += bucketSize;
                RawTransactionsContainer container = await SendRequestAsync <RawTransactionsContainer>("getBlockchainTransactions", ("account", accountId),
                                                                                                       ("numberOfConfirmations", numberOfConfirmations),
                                                                                                       ("timestamp", timestamp),
                                                                                                       ("firstIndex", firstIndex),
                                                                                                       ("lastIndex", lastIndex));

                if (container.Transactions.Length == 0)
                {
                    yield break;
                }

                IEnumerable <RawTransactionDetails> transactions = type switch
                {
                    TransactionType.Incoming => container.Transactions.Where(x => x.Recipient == accountId),
                    TransactionType.Outgoing => container.Transactions.Where(x => x.Sender == accountId),
                    TransactionType.Paramining => container.Transactions.Where(x => x.Sender == Account.Genesis.Id),
                    _ => container.Transactions
                };
                foreach (RawTransactionDetails details in transactions)
                {
                    yield return(details);
                }
            }while (true);
        }
コード例 #3
0
 private Task <BroadcastedTransaction> BroadcastTransactionAsync(string attachment, string bytes) => SendRequestAsync <BroadcastedTransaction>("broadcastTransaction", ("prunableAttachmentJSON", attachment), ("transactionBytes", bytes));
コード例 #4
0
 public Task <Account> GetAccountAsync(string address) => SendRequestAsync <Account>("getAccount", ("account", address));