Exemple #1
0
        private static AliasTransaction ToAliasTransaction(JObject tx, TransactionInfo txInfo)
        {
            var transaction = tx["transaction"].ToObject <JObject>();
            var version     = transaction["version"];


            //Bug - It seems the dotnetcore does not
            //understand the Integer.
            //The workaround it to double cast the version
            int versionValue;

            try
            {
                versionValue = (int)((uint)version);
            }
            catch (Exception)
            {
                versionValue = (int)version;
            }

            var network   = TransactionMappingUtils.ExtractNetworkType(versionValue);
            var txVersion = TransactionMappingUtils.ExtractTransactionVersion(versionValue);

            var deadline  = new Deadline(transaction["deadline"].ToObject <UInt64DTO>().ToUInt64());
            var maxFee    = transaction["maxFee"]?.ToObject <UInt64DTO>().ToUInt64();
            var signature = transaction["signature"].ToObject <string>();
            var signer    = new PublicAccount(transaction["signer"].ToObject <string>(), network);

            var namespaceId = new NamespaceId(transaction["namespaceId"].ToObject <UInt64DTO>().ToUInt64());
            var type        = EntityTypeExtension.GetRawValue(transaction["type"].ToObject <int>());
            var actionType  = TransactionMappingHelper.ExtractActionType(tx);

            AliasTransaction aliasTransaction = null;

            switch (type)
            {
            case EntityType.ADDRESS_ALIAS:
                var addressHex = transaction["address"].ToObject <string>();
                var address    = Address.CreateFromHex(addressHex);
                aliasTransaction = new AliasTransaction(network, txVersion, deadline, maxFee, type,
                                                        namespaceId, actionType, null, address, signature, signer, txInfo);
                break;

            case EntityType.MOSAIC_ALIAS:
                var mosaic = new MosaicId(transaction["mosaicId"].ToObject <UInt64DTO>().ToUInt64());
                aliasTransaction = new AliasTransaction(network, txVersion, deadline, maxFee, type,
                                                        namespaceId, actionType, mosaic, null, signature, signer, txInfo);
                break;
            }

            return(aliasTransaction);
        }
        private static MosaicDefinitionTransaction ToMosaicDefinitionTransaction(JObject tx, TransactionInfo txInfo)
        {
            var transaction = tx["transaction"].ToObject <JObject>();

            var mosaicProperties = transaction["properties"];
            var flags            = "00" + Convert.ToString((int)mosaicProperties[0].ExtractBigInteger("value"), 2);
            var bitMapFlags      = flags.Substring(flags.Length - 3, 3);

            var properties = new MosaicProperties(
                bitMapFlags.ToCharArray()[2] == '1',
                bitMapFlags.ToCharArray()[1] == '1',
                bitMapFlags.ToCharArray()[0] == '1',
                (int)mosaicProperties[1].ExtractBigInteger("value"),
                mosaicProperties.ToList().Count == 3 ? mosaicProperties[2].ExtractBigInteger("value") : 0);

            var version = transaction["version"];

            //Bug - It seems the dotnetcore does not
            //understand the Integer.
            //The workaround it to double cast the version
            int versionValue;

            try
            {
                versionValue = (int)((uint)version);
            }
            catch (Exception)
            {
                versionValue = (int)version;
            }

            var network   = TransactionMappingUtils.ExtractNetworkType(versionValue);
            var txVersion = TransactionMappingUtils.ExtractTransactionVersion(versionValue);

            var deadline    = new Deadline(transaction["deadline"].ToObject <UInt64DTO>().ToUInt64());
            var maxFee      = transaction["maxFee"]?.ToObject <UInt64DTO>().ToUInt64() ?? 0;
            var mosaicNonce = TransactionMappingHelper.ExtractMosaicNonce(tx);
            var mosaicId    = new MosaicId(transaction["mosaicId"].ToObject <UInt64DTO>().ToUInt64());
            var signature   = transaction["signature"].ToObject <string>();
            var signer      = new PublicAccount(transaction["signer"].ToObject <string>(), network);

            return(new MosaicDefinitionTransaction(
                       network, txVersion, deadline, maxFee, mosaicNonce, mosaicId, properties, signature, signer, txInfo));
        }
Exemple #3
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ModifyAccountPropertyTransaction&lt;MosaicId&gt;" /> class.
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public new ModifyAccountPropertyTransaction <IUInt64Id> Apply(JObject input)
 {
     return(ToModifyAccountPropertyTransaction(input, TransactionMappingHelper.CreateTransactionInfo(input)));
 }
 public new AggregateTransaction Apply(JObject input)
 {
     return(ToAggregateTransactionTransaction(input, TransactionMappingHelper.CreateTransactionInfo(input)));
 }
Exemple #5
0
 public new ExchangeOfferTransaction Apply(JObject input)
 {
     return(ToExchangeOfferTransaction(input, TransactionMappingHelper.CreateTransactionInfo(input)));
 }
 public new MosaicSupplyChangeTransaction Apply(JObject input)
 {
     return(ToMosaicSupplyChangeTransaction(input, TransactionMappingHelper.CreateTransactionInfo(input)));
 }
 /// <summary>
 /// Applies the AccountLinkTransactionMapping
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public new ModifyMosaicLevyTransaction Apply(JObject input)
 {
     return(ToMosaicModifyLevyTransaction(input, TransactionMappingHelper.CreateTransactionInfo(input)));
 }
 public new LockFundsTransaction Apply(JObject input)
 {
     return(ToLockFundsTransaction(input, TransactionMappingHelper.CreateTransactionInfo(input)));
 }
Exemple #9
0
 /// <summary>
 /// Applies the AccountLinkTransactionMapping
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public new RemoveMosaicLevyTransaction Apply(JObject input)
 {
     return(ToMosaicRemoveLevyTransaction(input, TransactionMappingHelper.CreateTransactionInfo(input)));
 }
 public new MosaicMetadataTransaction Apply(JObject input)
 {
     return(ToMetadataTransaction(input, TransactionMappingHelper.CreateTransactionInfo(input)));
 }
 /// <summary>
 ///     Apply SecretProofTransaction
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public new SecretProofTransaction Apply(JObject input)
 {
     return(ToSecretProofTransaction(input, TransactionMappingHelper.CreateTransactionInfo(input)));
 }
Exemple #12
0
 public new ModifyMultisigAccountTransaction Apply(JObject input)
 {
     return(ToModifyMultisigAccountTransaction(input, TransactionMappingHelper.CreateTransactionInfo(input)));
 }
 /// <summary>
 /// Applies the AccountLinkTransactionMapping
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public new AccountLinkTransaction Apply(JObject input)
 {
     return(ToAccountLinkTransaction(input, TransactionMappingHelper.CreateTransactionInfo(input)));
 }
 public new RegisterNamespaceTransaction Apply(JObject input)
 {
     return(ToRegisterNamespaceTransaction(input, TransactionMappingHelper.CreateTransactionInfo(input)));
 }