Example #1
0
        public static string EmailVerifyResponseUrl()
        {
            UInt160           scriptHash = UInt160.Parse(plugin_profile.ContractScriptHash);
            ApplicationEngine engine     = SmartContractHelper.LocalExec(scriptHash, "emailVerifyRespUrl");

            return(System.Text.Encoding.UTF8.GetString(engine.EvaluationStack.Peek().GetByteArray()));
        }
Example #2
0
        public static bool Grant(string email, string owner)
        {
            UInt160 scriptHash = UInt160.Parse(plugin_profile.ContractScriptHash);

            byte[] ownerScriptHash = Wallet.ToScriptHash(owner).ToArray();
            return(SmartContractHelper.Exec(plugin_profile.api.CurrentWallet, plugin_profile.api.LocalNode, scriptHash, null, "grant", email, ownerScriptHash, new byte[0]));
        }
Example #3
0
        public static byte[] ContractOwnerPublicKey()
        {
            UInt160           scriptHash = UInt160.Parse(plugin_profile.ContractScriptHash);
            ApplicationEngine engine     = SmartContractHelper.LocalExec(scriptHash, "contractOwner");

            return(engine.EvaluationStack.Peek().GetByteArray());
        }
Example #4
0
        public static bool Register(string profile, string owner)
        {
            UInt160 scriptHash   = UInt160.Parse(plugin_profile.ContractScriptHash);
            UInt160 ownerAddress = Wallet.ToScriptHash(owner);

            byte[] ownerScriptHash = ownerAddress.ToArray();
            return(SmartContractHelper.Exec(plugin_profile.api.CurrentWallet, plugin_profile.api.LocalNode, scriptHash, ownerAddress, "register", profile, ownerScriptHash));
        }
Example #5
0
        public static JObject Query(string email)
        {
            UInt160           scriptHash = UInt160.Parse(plugin_profile.ContractScriptHash);
            ApplicationEngine engine     = SmartContractHelper.LocalExec(scriptHash, "query", email);
            string            result     = System.Text.Encoding.UTF8.GetString(engine.EvaluationStack.Peek().GetByteArray());

            return(ParseProfile(result));
        }
Example #6
0
        public static JObject QueryByAccount(string owner)
        {
            UInt160 scriptHash = UInt160.Parse(plugin_profile.ContractScriptHash);

            byte[]            ownerScriptHash = Wallet.ToScriptHash(owner).ToArray();
            ApplicationEngine engine          = SmartContractHelper.LocalExec(scriptHash, "queryByAccount", ownerScriptHash);
            string            result          = System.Text.Encoding.UTF8.GetString(engine.EvaluationStack.Peek().GetByteArray());

            return(ParseProfile(result));
        }
Example #7
0
        public static string QueryOwner(string email)
        {
            UInt160           scriptHash = UInt160.Parse(plugin_profile.ContractScriptHash);
            ApplicationEngine engine     = SmartContractHelper.LocalExec(scriptHash, "queryOwner", email);

            byte[] owner = engine.EvaluationStack.Peek().GetByteArray();
            try
            {
                UInt160 ownerScriptHash = new UInt160(owner);
                return(Wallet.ToAddress(ownerScriptHash));
            }
            catch (Exception)
            {
                return("");
            }
        }