neo3.wallet.wallet
Containers following the NEP-6 wallet standard.
DiskWallet
— Specialised wallet for persisting to media.Wallet
— Base container.
neo3.wallet.wallet.
DiskWallet
(
path
, name=None
, version='1.0'
, scrypt_params=None
, accounts=None
, default_account=None
, extra=None
)
Specialised wallet for persisting to media.
account_default
(Optional) — Return the default account if at least one account is present.
account_add
(
acc
,is_default
)
(bool) — Add account in the wallet.account_delete
(
acc
)
(bool) — Remove an account from the wallet.account_delete_by_label
(
label
)
(bool) — Remove an account from the wallet given its label.account_get_by_label
(
label
)
(Optional) — Get an account given its label. Returns None if not found.account_new
(
password
,label
,is_default
)
(Account) — Create a new account and adds it in the wallet.import_multisig_address
(
signing_threshold
,public_keys
)
(Account) — Import a multi-signature account into the container.save
(
)
— Persist the wallet to disk.to_json
(
)
(dict) — Convert object into JSON representation.default
(
path
,name
)
(DiskWallet) — Create a new wallet with the default settings.from_file
(
path
,passwords
)
— Load wallet from file.from_json
(
json
,passwords
)
— Parse object out of JSON data.
default
(
path='./wallet.json'
, name='wallet.json'
)
→ DiskWallet
Create a new wallet with the default settings.
path
(str, optional) — the JSON's path.name
(Optional, optional) — the wallet name.
from_file
(
path
, passwords=None
)
Load wallet from file.
path
(str) — path as passed toopen()
.passwords
(Optional, optional) — the password to decrypt the account data.
from_json
(
json
, passwords=None
)
Parse object out of JSON data.
json
(dict) — a dictionary.passwords
(Optional, optional) — the password to decrypt the account data.
KeyError
— if the data supplied does not contain the necessary keys.ValueError
— if theversion
property is under 1.0 or is not a valid string.
save
(
)
Persist the wallet to disk.
account_add
(
acc
, is_default=False
)
→ bool
Add account in the wallet.
acc
(Account) — the account to be added.is_default
(optional) — set the created account as the default.
ValueError
— if the account's label is already used by another one.
account_delete
(
acc
)
→ bool
Remove an account from the wallet.
acc
(Account) — the account to be removed.
account_delete_by_label
(
label
)
→ bool
Remove an account from the wallet given its label.
label
(str) — unique identifier of the account.
account_get_by_label
(
label
)
→ Optional
Get an account given its label. Returns None if not found.
label
(str) — unique identifier of the account.
account_new
(
password
, label=None
, is_default=False
)
→ Account
Create a new account and adds it in the wallet.
password
(str) — the password to encrypt the account.label
(Optional, optional) — optional label to identify the account.is_default
(optional) — set the created account as the default.
import_multisig_address
(
signing_threshold
, public_keys
)
→ Account
Import a multi-signature account into the container.
signing_threshold
(int) — minimum number of keys required for signing.public_keys
(Sequence) — the public keys the multisignature address consists off.
ValueError
— if the signing treshold exceeds 1024.if the signing treshold exceeds the number of public_keys.
to_json
(
)
→ dict
Convert object into JSON representation.
neo3.wallet.wallet.
Wallet
(
name=None
, version='1.0'
, scrypt_params=None
, accounts=None
, default_account=None
, extra=None
)
Base container.
account_default
(Optional) — Return the default account if at least one account is present.
account_add
(
acc
,is_default
)
(bool) — Add account in the wallet.account_delete
(
acc
)
(bool) — Remove an account from the wallet.account_delete_by_label
(
label
)
(bool) — Remove an account from the wallet given its label.account_get_by_label
(
label
)
(Optional) — Get an account given its label. Returns None if not found.account_new
(
password
,label
,is_default
)
(Account) — Create a new account and adds it in the wallet.import_multisig_address
(
signing_threshold
,public_keys
)
(Account) — Import a multi-signature account into the container.save
(
)
— Save the wallet.to_json
(
)
(dict) — Convert object into JSON representation.from_file
(
path
,passwords
)
— Load wallet from file.from_json
(
json
,passwords
)
— Parse object out of JSON data.
account_add
(
acc
, is_default=False
)
→ bool
Add account in the wallet.
acc
(Account) — the account to be added.is_default
(optional) — set the created account as the default.
ValueError
— if the account's label is already used by another one.
account_delete
(
acc
)
→ bool
Remove an account from the wallet.
acc
(Account) — the account to be removed.
account_delete_by_label
(
label
)
→ bool
Remove an account from the wallet given its label.
label
(str) — unique identifier of the account.
account_get_by_label
(
label
)
→ Optional
Get an account given its label. Returns None if not found.
label
(str) — unique identifier of the account.
account_new
(
password
, label=None
, is_default=False
)
→ Account
Create a new account and adds it in the wallet.
password
(str) — the password to encrypt the account.label
(Optional, optional) — optional label to identify the account.is_default
(optional) — set the created account as the default.
from_file
(
path
, passwords=None
)
Load wallet from file.
path
(str) — path as passed toopen()
.passwords
(Optional, optional) — the password to decrypt the account data.
from_json
(
json
, passwords=None
)
Parse object out of JSON data.
json
(dict) — a dictionary.passwords
(Optional, optional) — the password to decrypt the account data.
KeyError
— if the data supplied does not contain the necessary keys.ValueError
— if theversion
property is under 1.0 or is not a valid string.
import_multisig_address
(
signing_threshold
, public_keys
)
→ Account
Import a multi-signature account into the container.
signing_threshold
(int) — minimum number of keys required for signing.public_keys
(Sequence) — the public keys the multisignature address consists off.
ValueError
— if the signing treshold exceeds 1024.if the signing treshold exceeds the number of public_keys.
save
(
)
Save the wallet.
This is called automatically when using the context manager.
to_json
(
)
→ dict
Convert object into JSON representation.