Exemplo n.º 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()));
        }
Exemplo n.º 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]));
        }
Exemplo n.º 3
0
        public static byte[] ContractOwnerPublicKey()
        {
            UInt160           scriptHash = UInt160.Parse(plugin_profile.ContractScriptHash);
            ApplicationEngine engine     = SmartContractHelper.LocalExec(scriptHash, "contractOwner");

            return(engine.EvaluationStack.Peek().GetByteArray());
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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("");
            }
        }