iotaledger/wallet.rs

Iota Library for python. Recovery wallet, which has already created by phrase working incorrect.

Closed this issue · 3 comments

Bug description

import os
import shutil
import random

import iota_wallet

path = "static/user_wallets/test"
mnemonic = 'park target phrase cheese agent turn lunch wolf broccoli glance famous camp orient maid ribbon observe decrease cave subway possible hire puppy leader chronic'


def get(password):
    account_manager = iota_wallet.AccountManager(path)
    account_manager.set_stronghold_password(password)
    wallet = account_manager.get_account('Wallet')
    wallet.sync().execute()
    print(wallet.latest_address()["address"]["inner"])


def creating(password):
    if os.path.exists(path):
        iota_wallet.AccountManager(path).stop_background_sync()
        shutil.rmtree(path)
    account_manager = iota_wallet.AccountManager(storage_path=path)
    account_manager.set_stronghold_password(password)
    account_manager.store_mnemonic("Stronghold", mnemonic)
    client_options = {"nodes": [
        {
            "url": "https://api.lb-0.h.chrysalis-devnet.iota.cafe/",
            "auth": None,
            "disabled": False
        }
    ], "local_pow": True}
    account_initializer = account_manager.create_account(client_options)
    account_initializer.alias('Wallet')
    account: iota_wallet.AccountHandle = account_initializer.initialise()
    account.sync().execute()


password = "1234"
for i in range(3):
    password += random.choice("1234")
    creating(password)
    get(password)
    print(f"Get {i}")

Rust version

No version, boys

  • Rust version:

No version, boys

Which version of the library are you using?

Hardware specification

What hardware are you using?

Macbook air M2 ⚠️⚠️⚠️⚠️

  • Operating system:
  • RAM: 8gb
  • Cores: 8
  • Device: Macbook air M2

Steps To reproduce the bug

Explain how the maintainer can reproduce the bug.

  1. Download the lib, install that on your computer
  2. Copy this code and paste to .py file
  3. Execute and get error

Expected behaviour

In the directory in which the wallet has already been created, delete the folder with files and create a new wallet by mnemonic

Actual behaviour

Drops the random error

Errors

Screenshot_2023-01-16_at_3 49 51_PM

@abcen7 Hi, please can you try the given branch to check if it's working for you? Thanks in advance.

@thibault-martinez Working, thx