コード例 #1
0
    public void OnClickNewCLAddress()
    {
        string strPath;
        string strCLAddress;

        strPath = m_ifKeyPath.text;
        if (string.IsNullOrEmpty(strPath))
        {
            strCLAddress = m_kCLB.GenerateNewMCLAddress(m_strMasterKeyName);
        }
        else
        {
            string strCelAddress = m_kCLB.GetCelAddressByPath(m_strMasterKeyName, strPath);
            if (string.IsNullOrEmpty(strCelAddress))
            {
                TextOut("GetCelAddressByPath error, path: " + strPath, "red");
                return;
            }

            strCLAddress = m_kCLB.EncodeMCLAddress(m_strMasterKeyName, strPath, strCelAddress);
        }

        if (string.IsNullOrEmpty(strCLAddress))
        {
            TextOut("Generate new MCL address error!", "red");
            return;
        }

        m_ifCLAddr.text = strCLAddress;

        string strName;
        string strBTAddress;

        if (m_kCLB.DecodeMCLAddress(strCLAddress, out strName, out strPath, out strBTAddress))
        {
            m_ifBTAddr.text        = strBTAddress;
            m_ifMasterKeyName.text = strName;

            ExtKey kEKey     = m_kCLB.GetExtKeyByPath(m_strMasterKeyName, strPath);
            string strPriKey = kEKey.PrivateKey.GetWif(m_kCLB.network).ToWif();
            m_ifPriKey.text = strPriKey;

            TextOut("Generate new MCL address succeed.");
        }
    }