Exemple #1
0
        /// <summary>
        /// Parse ContractManifestGroup from json
        /// </summary>
        /// <param name="json">Json</param>
        /// <returns>Return ContractManifestGroup</returns>
        public static ContractGroup FromJson(JObject json)
        {
            ContractGroup group = new ContractGroup
            {
                PubKey    = ECPoint.Parse(json["pubkey"].AsString(), ECCurve.Secp256r1),
                Signature = Convert.FromBase64String(json["signature"].AsString()),
            };

            if (group.Signature.Length != 64)
            {
                throw new FormatException();
            }
            return(group);
        }
Exemple #2
0
        private void DeserializeFromJson(JObject json)
        {
            Abi         = ContractAbi.FromJson(json["abi"]);
            Groups      = ((JArray)json["groups"]).Select(u => ContractGroup.FromJson(u)).ToArray();
            Features    = ContractFeatures.NoProperty;
            Permissions = ((JArray)json["permissions"]).Select(u => ContractPermission.FromJson(u)).ToArray();
            Trusts      = WildCardContainer <UInt160> .FromJson(json["trusts"], u => UInt160.Parse(u.AsString()));

            SafeMethods = WildCardContainer <string> .FromJson(json["safeMethods"], u => u.AsString());

            if (json["features"]["storage"].AsBoolean())
            {
                Features |= ContractFeatures.HasStorage;
            }
            if (json["features"]["payable"].AsBoolean())
            {
                Features |= ContractFeatures.Payable;
            }
        }