示例#1
0
        public static Transaction GetDestroyAssetTransaction(Address manager, long?assetId, TransactionParametersResponse trans, string message = "")
        {
            var tx = Transaction.CreateAssetDestroyTransaction(manager, 1, (ulong?)trans.LastRound, (ulong?)trans.LastRound + 1000,
                                                               Encoding.UTF8.GetBytes(message), new Digest(trans.GenesisHash), (ulong?)assetId);

            Account.SetFeeByFeePerByte(tx, (ulong?)trans.Fee);
            return(tx);
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="from"></param>
        /// <param name="to"></param>
        /// <param name="amount"></param>
        /// <param name="message"></param>
        /// <param name="fee"></param>
        /// <param name="lastRound"></param>
        /// <param name="genesisId"></param>
        /// <param name="genesishashb64"></param>
        /// <returns></returns>
        public static Transaction GetPaymentTransactionWithInfo(Address from, Address to, ulong?amount, string message,
                                                                ulong?fee, ulong?lastRound, string genesisId, string genesishashb64)
        {
            var tx = GetPaymentTransactionWithFlatFee(from, to, amount, message, fee, lastRound, genesisId, genesishashb64);

            Account.SetFeeByFeePerByte(tx, fee);
            return(tx);
        }
示例#3
0
        public static Transaction GetFreezeAssetTransaction(Address sender, Address toFreeze, long?assetId, bool freezeState,
                                                            TransactionParametersResponse trans, string message = "")
        {
            var tx = Transaction.CreateAssetFreezeTransaction(sender, toFreeze, freezeState, 1, (ulong?)trans.LastRound,
                                                              (ulong?)trans.LastRound + 1000, Encoding.UTF8.GetBytes(message), new Digest(trans.GenesisHash), (ulong?)assetId);

            Account.SetFeeByFeePerByte(tx, (ulong?)trans.Fee);
            return(tx);
        }
示例#4
0
        public static Transaction GetAssetOptingInTransaction(Address sender, long?assetID, TransactionParametersResponse trans, string message = "")
        {
            var tx = Transaction.CreateAssetAcceptTransaction(sender, 1, (ulong?)trans.LastRound,
                                                              (ulong?)trans.LastRound + 1000, Encoding.UTF8.GetBytes(message), trans.GenesisId,
                                                              new Digest(trans.GenesisHash), (ulong?)assetID);

            Account.SetFeeByFeePerByte(tx, (ulong?)trans.Fee);
            return(tx);
        }
示例#5
0
        /// <summary>
        /// Generate an opting in asset transaction
        /// All accounts that want recieve the new asset have to opt in
        /// </summary>
        /// <param name="sender">The account want to opt in</param>
        /// <param name="assetId">Asset ID</param>
        /// <param name="trans">The blockchain infomation</param>
        /// <param name="message">The message for the transaction(have no affect to the assect)</param>
        /// <returns>transaction</returns>
        public static Transaction GetAssetOptingInTransaction(Address sender, ulong?assetId, TransactionParams trans, string message = "")
        {
            var tx = Transaction.CreateAssetAcceptTransaction(sender, 1, trans.LastRound,
                                                              trans.LastRound + 1000, Encoding.UTF8.GetBytes(message), trans.GenesisID,
                                                              new Digest(trans.Genesishashb64), assetId);

            Account.SetFeeByFeePerByte(tx, trans.Fee);
            return(tx);
        }
示例#6
0
        public static Transaction GetRevokeAssetTransaction(Address reserve, Address revokedFrom, Address receiver, long?assetId,
                                                            ulong amount, TransactionParametersResponse trans, string message = "")
        {
            var tx = Transaction.CreateAssetRevokeTransaction(reserve, revokedFrom, receiver, amount, 1, (ulong?)trans.LastRound,
                                                              (ulong?)trans.LastRound + 1000, Encoding.UTF8.GetBytes(message), trans.GenesisId,
                                                              new Digest(trans.GenesisHash), (ulong?)assetId);

            Account.SetFeeByFeePerByte(tx, (ulong?)trans.Fee);
            return(tx);
        }
示例#7
0
        public static Transaction GetTransferAssetTransaction(Address from, Address to, long?assetId, ulong amount,
                                                              TransactionParametersResponse trans, Address closeTo = null, string message = "")
        {
            var tx = Transaction.CreateAssetTransferTransaction(from, to, closeTo, amount, 1,
                                                                (ulong?)trans.LastRound, (ulong?)trans.LastRound + 1000, Encoding.UTF8.GetBytes(message), trans.GenesisId,
                                                                new Digest(trans.GenesisHash), (ulong?)assetId);

            Account.SetFeeByFeePerByte(tx, (ulong?)trans.Fee);
            return(tx);
        }
示例#8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="from"></param>
        /// <param name="to"></param>
        /// <param name="amount"></param>
        /// <param name="message"></param>
        /// <param name="fee"></param>
        /// <param name="lastRound"></param>
        /// <param name="genesisId"></param>
        /// <param name="genesishashb64"></param>
        /// <returns></returns>
        public static Transaction GetPaymentTransactionWithInfo(Address from, Address to, ulong?amount, string message,
                                                                ulong?fee, ulong?lastRound, string genesisId, string genesishashb64)
        {
            var notes = Encoding.UTF8.GetBytes(message);
            var tx    = new Transaction(from, fee, lastRound, lastRound + 1000,
                                        notes, amount, to, genesisId, new Digest(genesishashb64));

            Account.SetFeeByFeePerByte(tx, fee);
            return(tx);
        }
示例#9
0
        public static Transaction GetConfigAssetTransaction(Address sender, V2.Model.Asset asset, TransactionParametersResponse trans, string message = "")
        {
            ValidateAsset(asset.Params);
            //sender must be manager
            var tx = Transaction.CreateAssetConfigureTransaction(sender, 1,
                                                                 (ulong?)trans.LastRound, (ulong?)trans.LastRound + 1000, Encoding.UTF8.GetBytes(message), trans.GenesisId,
                                                                 new Digest(trans.GenesisHash), (ulong?)asset.Index, new Address(asset.Params.Manager),
                                                                 new Address(asset.Params.Reserve), new Address(asset.Params.Freeze), new Address(asset.Params.Clawback), false);

            Account.SetFeeByFeePerByte(tx, (ulong?)trans.Fee);
            return(tx);
        }
示例#10
0
        /// <summary>
        /// Generate an asset config transaction
        /// </summary>
        /// <param name="sender">The sender of the transaction, should be the manager of the asset.</param>
        /// <param name="assetId">Asset ID</param>
        /// <param name="asset">Asset infomation</param>
        /// <param name="trans">The blockchain infomation</param>
        /// <param name="message">The message for the transaction(have no affect to the assect)</param>
        /// <returns>transaction</returns>
        public static Transaction GetConfigAssetTransaction(Address sender, ulong?assetId, AssetParams asset, TransactionParams trans, string message = "")
        {
            ValidateAsset(asset);
            //sender must be manager
            var tx = Transaction.CreateAssetConfigureTransaction(sender, 1,
                                                                 trans.LastRound, trans.LastRound + 1000, Encoding.UTF8.GetBytes(message), trans.GenesisID,
                                                                 new Digest(trans.Genesishashb64), assetId, new Address(asset.Managerkey),
                                                                 new Address(asset.Reserveaddr), new Address(asset.Freezeaddr), new Address(asset.Clawbackaddr), false);

            Account.SetFeeByFeePerByte(tx, trans.Fee);
            return(tx);
        }
示例#11
0
        /// <summary>
        /// Generate a create asset transaction V2
        /// </summary>
        /// <param name="asset">The asset infomation</param>
        /// <param name="trans">The blockchain infomation</param>
        /// <param name="message">The message for the transaction(have no affect to the assect)</param>
        /// <param name="decimals">A value of 0 represents an asset that is not divisible,
        /// while a value of 1 represents an asset that is divisible into tenths and so on, i.e,
        /// the number of digits to display after the decimal place when displaying the asset.
        /// This value must be between 0 and 19</param>
        /// <returns>transaction</returns>
        public static Transaction GetCreateAssetTransaction(V2.Model.AssetParams asset, V2.Model.TransactionParametersResponse trans, string message = "")
        {
            ValidateAsset(asset);
            // assetDecimals is not exist in api, so set as zero in this version
            var tx = Transaction.CreateAssetCreateTransaction(new Address(asset.Creator), (ulong?)trans.Fee, (ulong?)trans.LastRound, (ulong?)trans.LastRound + 1000,
                                                              Encoding.UTF8.GetBytes(message), trans.GenesisId, new Digest(trans.GenesisHash),
                                                              asset.Total, (int)asset.Decimals, (bool)asset.DefaultFrozen, asset.UnitName, asset.Name, asset.Url,
                                                              asset.MetadataHash, new Address(asset.Manager), new Address(asset.Reserve),
                                                              new Address(asset.Freeze), new Address(asset.Clawback));

            Account.SetFeeByFeePerByte(tx, (ulong?)trans.Fee);
            return(tx);
        }
示例#12
0
        /// <summary>
        /// Generate a create asset transaction
        /// </summary>
        /// <param name="asset">The asset infomation</param>
        /// <param name="trans">The blockchain infomation</param>
        /// <param name="message">The message for the transaction(have no affect to the assect)</param>
        /// <param name="decimals">A value of 0 represents an asset that is not divisible,
        /// while a value of 1 represents an asset that is divisible into tenths and so on, i.e,
        /// the number of digits to display after the decimal place when displaying the asset.
        /// This value must be between 0 and 19</param>
        /// <returns>transaction</returns>
        public static Transaction GetCreateAssetTransaction(AssetParams asset, TransactionParams trans, string message = "", int decimals = 0)
        {
            ValidateAsset(asset);
            // assetDecimals is not exist in api, so set as zero in this version
            var tx = Transaction.CreateAssetCreateTransaction(new Address(asset.Creator), trans.Fee, trans.LastRound, trans.LastRound + 1000,
                                                              Encoding.UTF8.GetBytes(message), trans.GenesisID, new Digest(trans.Genesishashb64),
                                                              asset.Total, decimals, (bool)asset.Defaultfrozen, asset.Unitname, asset.Assetname, asset.Url,
                                                              Convert.FromBase64String(asset.Metadatahash), new Address(asset.Managerkey), new Address(asset.Reserveaddr),
                                                              new Address(asset.Freezeaddr), new Address(asset.Clawbackaddr));

            Account.SetFeeByFeePerByte(tx, trans.Fee);
            return(tx);
        }