Example #1
0
        public static async Task <string> DeleteName(
            string name,
            ITransactionSender transactionSender,
            TransactionOptions options)
        {
            var nonce = options.Nonce ?? (await transactionSender.GetNonceAsync()).Nonce.GetValueOrDefault();

            var payload = TransactionFactory.MakeDeleteNamePayload(transactionSender.PublicKey, name);

            var tx = transactionSender.CreateTransaction(payload, nonce, options);

            return(await transactionSender.SendTransactionAsync(tx));
        }
Example #2
0
        public static string RegisterName(
            string name,
            ITransactionSender transactionSender,
            TransactionOptions options)
        {
            var nonce = options.Nonce ?? (transactionSender.GetNonceAsync()).Nonce.GetValueOrDefault();

            var payload = TransactionFactory.MakeRegisterNamePayload(transactionSender.PublicKey, name, options.Fee.GetValueOrDefault());

            var tx = transactionSender.CreateTransaction(payload, nonce, options);

            return(transactionSender.SendTransactionAsync(tx));
        }
Example #3
0
        public static async Task <string> Unsubscribe(
            string topic,
            string identifier,
            ITransactionSender transactionSender,
            TransactionOptions options)
        {
            var nonce = options.Nonce ?? (await transactionSender.GetNonceAsync()).Nonce.GetValueOrDefault();

            var payload = TransactionFactory.MakeUnsubscribePayload(transactionSender.PublicKey, topic, identifier);

            var tx = transactionSender.CreateTransaction(payload, nonce, options);

            return(await transactionSender.SendTransactionAsync(tx));
        }
Example #4
0
        public static string Subscribe(
            string topic,
            int duration,
            string identifier,
            string meta,
            ITransactionSender transactionSender,
            TransactionOptions options)
        {
            var nonce = options.Nonce ?? (transactionSender.GetNonceAsync()).Nonce.GetValueOrDefault();

            var payload = TransactionFactory.MakeSubscribePayload(transactionSender.PublicKey, identifier, topic, duration, meta);

            var tx = transactionSender.CreateTransaction(payload, nonce, options);

            return(transactionSender.SendTransactionAsync(tx));
        }
Example #5
0
        public static async Task <string> TransferTo(
            string toAddress,
            Amount amount,
            ITransactionSender transactionSender,
            TransactionOptions options)
        {
            if (Address.Verify(toAddress) == false)
            {
                throw new Exception();
            }

            var nonce = options.Nonce ?? (await transactionSender.GetNonceAsync()).Nonce.GetValueOrDefault();

            var signatureRedeem = Address.PublicKeyToSignatureRedeem(transactionSender.PublicKey);

            var programHash = Address.HexStringToProgramHash(signatureRedeem);

            var payload = TransactionFactory.MakeTransferPayload(programHash, Address.ToProgramHash(toAddress), amount.Value);

            var tx = transactionSender.CreateTransaction(payload, nonce, options);

            return(await transactionSender.SendTransactionAsync(tx));
        }