Closed marekyggdrasil closed 3 years ago
grin-wallet owner_api
Password:
20201220 07:55:46.473 WARN grin_wallet_controller::controller - Starting HTTP Foreign API on Owner server at 127.0.0.1:3420.
20201220 07:55:46.473 WARN grin_wallet_controller::controller - Starting HTTP Owner API server at 127.0.0.1:3420.
20201220 07:55:46.473 WARN grin_wallet_controller::controller - HTTP Owner listener started
HTTP Owner successfully started.
Before runnning the script, we need to make sure to edit the configuration.
api_sercet_file = '/Users/path/.grin/main/.owner_api_secret'
wallet_password = 'xxx'
pp.pprint(wallet.create_wallet("password", "wallet2", None, mnemonic_length=32))
python3 /Users/workstation/Downloads/grin.py
Traceback (most recent call last):
File "/Users/workstation/Downloads/grin.py", line 471, in <module>
pp.pprint(wallet.create_wallet("password", "wallet3", None, mnemonic_length=32))
File "/Users/workstation/Downloads/grin.py", line 437, in create_wallet
resp = self.post_encrypted('create_wallet', params)
File "/Users/workstation/Downloads/grin.py", line 93, in post_encrypted
raise WalletError(method, params, response_json["error"]["code"], response_json["error"]["message"])
__main__.WalletError: Callng create_wallet with params {'password': 'password', 'name': 'wallet3', 'mnemonic': None, 'mnemonic_length': 32} failed with error code -32099 because: WalletSeedExists: Wallet seed already exists at: /Users/workstation/.grin/main/wallet_data
the command seems to work fine, but i already have an existing wallet. we need to add another function maybe to have the option to choose another path
in the python file, please check line 435 and replace 'mnemonic_length=':
by 'mnemonic_length':
@bladedoyle , @mojitoo made some suggestions for the API wrapper, would you review and if you find them reasonable, make update?
https://github.com/grinfans/grin.py/blob/df41a7f51b44481eb8675433feaa67b5ce071f14/wallet_v3.py#L435
Sorry, misunderstood initially @mojitoo. Closing. Thanks!
Description Testing the create wallet method from the Owner API
Prerequisites
Test procedure
Expected result: Creates a new wallet seed and empty wallet database in the wallet_data directory of the top level directory. Provide requests and response full payloads as well as wallet and node logs.
Include the output of command
and your environment