//[ReflectionProtect]
    private void GetConfirmationWords()
    {
        string[] correctWords;
        int[]    numbers = dynamicDataCache.GetData("confirmation numbers");

        List <int>    randomIntList = numbers.ToList();
        List <string> words         = WalletUtils.GetMnemonicWords((string)dynamicDataCache.GetData("mnemonic")).ToList();

        correctWords = words.Where(word => numbers.Contains(words.IndexOf(word) + 1))
                       .OrderBy(word => randomIntList.IndexOf(words.IndexOf(word) + 1))
                       .ToArray();

        dynamicDataCache.SetData("confirmation words", correctWords);
    }
Esempio n. 2
0
    //[ReflectionProtect]
    private void StartWordAnimation()
    {
        mnemonicWords = WalletUtils.GetMnemonicWords(dynamicDataCache.GetData("mnemonic"));

        wordFields.ForEach(f => f.AnimateColor(UIColors.White, 0.1f));

        Animating = true;
        Random rand = new Random();

        List <GameObject> randomizedWordList = new List <GameObject>(words);

        randomizedWordList.Sort((_, __) => rand.Next(-1, 1));

        ProcessWordAnimation(randomizedWordList, 0);
    }
    private void UpdateWordFields()
    {
        for (int i = 0; i < objects.Length; i++)
        {
            wordFields.Add(objects[i].GetComponent <TMP_InputField>());
        }

        string[] splitWords = WalletUtils.GetMnemonicWords(dynamicDataCache.GetData("mnemonic"));

        for (int i = 0; i < objects.Length; i++)
        {
            wordFields[i].text = splitWords[i];
        }

        for (int i = 0; i < 12; i++)
        {
            wordFieldSelectables.Add(wordFields[i]);
        }
    }
Esempio n. 4
0
    /// <summary>
    /// Splits the copied string on the clipboard into an array and sets them individually during the animations
    /// </summary>
    private void PastePhraseClicked()
    {
        string clipboard = ClipboardUtils.GetClipboardString();

        wordStrings = WalletUtils.GetMnemonicWords(clipboard);

        if (!string.IsNullOrEmpty(clipboard.Trim()))
        {
            int numOfWords = wordStrings.Length;
            wordCountSection.GetComponent <SingleChoiceButtonsBase>().ButtonClicked(numOfWords <= 12 ? 0 : numOfWords <= 15 ? 1 : numOfWords <= 18 ? 2 : numOfWords <= 21 ? 3 : 4);

            AnimateIcon(pasteButtonCheckMarkIcon);
            StartWordAnimation();
        }

        else
        {
            if (!animatingIcon)
            {
                AnimateIcon(pasteButtonErrorIcon);
            }
        }
    }