Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.80 KB | None | 0 0
  1.     public class BlockChainTransactionUnit {
  2.         /// <summary>
  3.         /// Transaction senders address
  4.         /// </summary>
  5.         [JsonProperty("from")]
  6.         public string From {
  7.             get;
  8.             protected set;
  9.         }
  10.         /// <summary>
  11.         /// Transaction recipient address
  12.         /// </summary>
  13.         [JsonProperty("to")]
  14.         public string To {
  15.             get;
  16.             protected set;
  17.         }
  18.         /// <summary>
  19.         /// Unit currency or token
  20.         /// </summary>
  21.         [JsonProperty("currency")]
  22.         public string Currency {
  23.             get;
  24.             protected set;
  25.         }
  26.         /// <summary>
  27.         /// Amount asset
  28.         /// </summary>
  29.         [JsonProperty("amount")]
  30.         public string Amount {
  31.             get;
  32.             protected set;
  33.         }
  34.         /// <summary>
  35.         /// Fee asset
  36.         /// </summary>
  37.         [JsonProperty("fee")]
  38.         public string Fee {
  39.             get;
  40.             protected set;
  41.         }
  42.         /// <summary>
  43.         /// Transaction data field
  44.         /// </summary>
  45.         [JsonProperty("data")]
  46.         public string Data {
  47.             get;
  48.             protected set;
  49.         }
  50.     }
  51.  
  52.     public class BlockChainTransaction {
  53.         /// <summary>
  54.         /// Available transaction states
  55.         /// </summary>
  56.         public enum TransactionState {
  57.             None,
  58.             Created,
  59.             Accepted,
  60.             Published,
  61.             Pending,
  62.             Suspended,
  63.             Irreversible,
  64.             Rejected
  65.         }
  66.         /// <summary>
  67.         /// Binary transaction representation
  68.         /// </summary>
  69.         public class TrxBody {
  70.             [JsonProperty("address")]
  71.             public string Address;
  72.             [JsonProperty("body")]
  73.             public string Body;
  74.             [JsonProperty("sign", NullValueHandling = NullValueHandling.Ignore)]
  75.             public string Sign = null;
  76.             [JsonProperty("context", NullValueHandling = NullValueHandling.Ignore)]
  77.             public string Context = null;
  78.         }
  79.         /// <summary>
  80.         /// Current transaction state
  81.         /// </summary>
  82.         [JsonProperty("state")]
  83.         public TransactionState State {
  84.             get;
  85.             protected set;
  86.         }
  87.         /// <summary>
  88.         /// Transaction id according to blockchain specification
  89.         /// </summary>
  90.         [JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)]
  91.         public string Id {
  92.             get;
  93.             protected set;
  94.         }
  95.         /// <summary>
  96.         /// Transaction reference block
  97.         /// </summary>
  98.         [JsonProperty("block")]
  99.         public long Block {
  100.             get;
  101.             protected set;
  102.         }
  103.         /// <summary>
  104.         /// Transaction creation or appear time
  105.         /// </summary>
  106.         [JsonProperty("created")]
  107.         public int Created {
  108.             get;
  109.             protected set;
  110.         }
  111.         /// <summary>
  112.         /// Transaction units
  113.         /// </summary>
  114.         [JsonProperty("units", NullValueHandling = NullValueHandling.Ignore)]
  115.         public List<BlockChainTransactionUnit> Units {
  116.             get;
  117.             protected set;
  118.         }
  119.         /// <summary>
  120.         /// Transaction binary bodies and signatures
  121.         /// </summary>
  122.         [JsonProperty("signatures", NullValueHandling = NullValueHandling.Ignore)]
  123.         public List<TrxBody> Body {
  124.             get;
  125.             protected set;
  126.         }
  127.       }
  128.  
  129.         /// <summary>
  130.         /// Transaction details
  131.         /// </summary>
  132.         public class DetailedTransaction : BlockChainTransaction {
  133.             [JsonProperty("seq")]
  134.             public long Sequence;
  135.             [JsonProperty("src_account", NullValueHandling = NullValueHandling.Ignore)]
  136.             public List<string> AccountFrom;
  137.             [JsonProperty("dst_account", NullValueHandling = NullValueHandling.Ignore)]
  138.             public List<string> AccountTo;
  139.             [JsonProperty("src_agent", NullValueHandling = NullValueHandling.Ignore)]
  140.             public List<string> AgentFrom;
  141.             [JsonProperty("dst_agent", NullValueHandling = NullValueHandling.Ignore)]
  142.             public List<string> AgentTo;
  143.             [JsonProperty("order_id", NullValueHandling = NullValueHandling.Ignore)]
  144.             public string OrderId;
  145.             /// <summary>
  146.             /// Base CTOR
  147.             /// </summary>
  148.             public DetailedTransaction() {
  149.             }
  150.             /// <summary>
  151.             /// Copy CTOR
  152.             /// </summary>
  153.             public DetailedTransaction(BlockChainTransaction trx) : base(trx) {
  154.             }
  155.             /// <summary>
  156.             /// Forced state setup
  157.             /// </summary>
  158.             public void ForceState(TransactionState state) {
  159.                 State = state;
  160.             }
  161.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement