Пример #1
0
 public StackItem ToStackItem(ReferenceCounter referenceCounter)
 {
     return(new Struct(referenceCounter)
     {
         Name,
         new Array(referenceCounter, Groups.Select(p => p.ToStackItem(referenceCounter))),
         new Array(referenceCounter, SupportedStandards.Select(p => (StackItem)p)),
         Abi.ToStackItem(referenceCounter),
         new Array(referenceCounter, Permissions.Select(p => p.ToStackItem(referenceCounter))),
         Trusts.IsWildcard ? StackItem.Null : new Array(referenceCounter, Trusts.Select(p => (StackItem)p.ToArray())),
         Extra is null ? "null" : Extra.ToByteArray(false)
     });
Пример #2
0
 /// <summary
 /// To json
 /// </summary>
 public JObject ToJson()
 {
     return(new JObject
     {
         ["groups"] = Groups.Select(u => u.ToJson()).ToArray(),
         ["supportedstandards"] = SupportedStandards.Select(u => new JString(u)).ToArray(),
         ["abi"] = Abi.ToJson(),
         ["permissions"] = Permissions.Select(p => p.ToJson()).ToArray(),
         ["trusts"] = Trusts.ToJson(),
         ["safemethods"] = SafeMethods.ToJson(),
         ["extra"] = Extra
     });
 }
Пример #3
0
 /// <summary
 /// To json
 /// </summary>
 public JObject ToJson()
 {
     return(new JObject
     {
         ["groups"] = Groups.Select(u => u.ToJson()).ToArray(),
         ["features"] = new JObject
         {
             ["storage"] = Features.HasFlag(ContractFeatures.HasStorage),
             ["payable"] = Features.HasFlag(ContractFeatures.Payable)
         },
         ["supportedstandards"] = SupportedStandards.Select(u => new JString(u)).ToArray(),
         ["abi"] = Abi.ToJson(),
         ["permissions"] = Permissions.Select(p => p.ToJson()).ToArray(),
         ["trusts"] = Trusts.ToJson(),
         ["safemethods"] = SafeMethods.ToJson(),
         ["extra"] = Extra
     });
 }