コード例 #1
0
    /// <summary>
    /// Checks if data already exists in the DynamicDataCache.
    /// If the data is equal to the mnemonic entered in the input fields, display the ConfirmMnemonicMenu.
    /// </summary>
    /// <returns> True if the mnemonic was unique and the wallet can be directly imported. </returns>
    private bool CheckCreatedMnemonic()
    {
        Wallet wallet = null;

        string newMnemonic = string.Join(" ", wordFields.Select(field => field.Text)).Trim();

        byte[] seed = (byte[])dynamicDataCache.GetData("seed");

        try
        {
            wallet = new Wallet(newMnemonic, null, WalletUtils.DetermineCorrectPath(newMnemonic));
            nextButton.GetComponent <InteractableButton>().OnCustomPointerExit();
        }
        catch
        {
            nextButton.interactable = false;
            importMneomonicMenuAnimator.AnimateIcon(importMneomonicMenuAnimator.nextButtonErrorIcon);
            importMneomonicMenuAnimator.AnimateIcon(importMneomonicMenuAnimator.nextButtonErrorMessage);
            importMneomonicMenuAnimator.OpeningWallet = false;
            return(false);
        }

        if (seed?.SequenceEqual(wallet.Seed) == true)
        {
            uiManager.OpenMenu <ConfirmMnemonicMenu>();
            return(false);
        }
        else
        {
            SetWalletInfo(wallet);
            return(true);
        }
    }