pypergraph.keyring.wallets package¶
Submodules¶
pypergraph.keyring.wallets.multi_account_wallet module¶
- class pypergraph.keyring.wallets.multi_account_wallet.MultiAccountWallet(*, type: str = 'MAW', id: str = None, supported_assets: List[str] = [], label: Annotated[str | None, MaxLen(max_length=12)] = None, keyring: HdKeyring = None, mnemonic: str | None = None, network: str = None)[source]¶
Bases:
BaseModel- create(network: str, label: str, num_of_accounts: int = 1, mnemonic: str | None = None)[source]¶
Creates a wallet with a keyring of hierarchical deterministic accounts based on the number BIP44 indexes (num_of_accounts).
- Parameters:
network – “Constellation” or “Ethereum”.
label – Name of the wallet.
num_of_accounts – Number of BIP44 indexes (accounts) to create.
mnemonic – Mnemonic phrase.
- deserialize(label: str, network: str, secret: str, num_of_accounts: int, rings: List | None = None)[source]¶
- get_account_by_address(address: str)[source]¶
Get the account matching the specified address.
- Parameters:
address – The address for the wanted account.
- get_accounts() List[source]¶
Get list of MAW accounts.
- Returns:
List of MAW accounts with signing key.
- id: str¶
- label: str | None¶
- mnemonic: str | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- network: str¶
- remove_account(account)[source]¶
Remove a specific account.
- Parameters:
account – The account to be removed.
- supported_assets: List[str]¶
- type: str¶
pypergraph.keyring.wallets.multi_chain_wallet module¶
- class pypergraph.keyring.wallets.multi_chain_wallet.MultiChainWallet(*, type: str = 'MCW', id: str = None, supported_assets: List[str] = [], label: Annotated[str | None, MaxLen(max_length=12)] = None, keyrings: List[HdKeyring] = [], mnemonic: str | None = None)[source]¶
Bases:
BaseModel- create(label: str, mnemonic: str | None = None, rings: list | None = None)[source]¶
If mnemonic is set, restore the wallet. Else, generate mnemonic and create new wallet.
- Parameters:
label – Name of the wallet.
mnemonic – Seed phrase.
rings – Keyrings.
- get_account_by_address(address: str) DagAccount | EthAccount[source]¶
- get_accounts() List[DagAccount | EthAccount][source]¶
Get all MCW accounts.
- Returns:
List of accounts with signing key.
- id: str¶
- label: str | None¶
- mnemonic: str | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- set_label(label: str)[source]¶
Set the name of the wallet.
- Parameters:
label – Sets the name of the wallet.
- supported_assets: List[str]¶
- type: str¶
pypergraph.keyring.wallets.multi_key_wallet module¶
- class pypergraph.keyring.wallets.multi_key_wallet.MultiKeyWallet(*, type: str = 'MKW', id: str = None, supported_assets: List[str] = [], label: Annotated[str | None, MaxLen(max_length=12)] = None, keyrings: List[SimpleKeyring] = [], network: str | None = None)[source]¶
Bases:
BaseModel- create(network: str, label: str)[source]¶
Create new multi key wallet. Accounts must be imported.
- Parameters:
network – “Constellation” or “Ethereum”
label – The wallet name.
- get_account_by_address(address: str) DagAccount | EthAccount[source]¶
Get the account matching the specified address.
- Parameters:
address – The address matching the account.
- get_accounts() List[DagAccount | EthAccount][source]¶
Get a list of all MKW accounts.
- Returns:
List of imported MKW accounts.
- id: str¶
- import_account(private_key: str, label: str) DagAccount | EthAccount[source]¶
Imports an account using private key, sets a label, creates a keyring and adds it to the list of keyrings.
- Parameters:
private_key – The private key of the account to import.
label – Name of the account.
- Returns:
The account.
- keyrings: List[SimpleKeyring]¶
- label: str | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- network: str | None¶
- supported_assets: List[str]¶
- type: str¶
pypergraph.keyring.wallets.single_account_wallet module¶
- class pypergraph.keyring.wallets.single_account_wallet.SingleAccountWallet(*, type: str = 'SAW', id: str = None, supported_assets: ~typing.List = <factory>, label: ~typing.Annotated[str | None, ~annotated_types.MaxLen(max_length=12)] = None, keyring: ~pypergraph.keyring.keyrings.simple_keyring.SimpleKeyring | None = None, network: str | None = None)[source]¶
Bases:
BaseModel- create(network: str, label: str, private_key: str = None)[source]¶
Initiates the creation of a new single key wallet.
- Parameters:
network – “Constellation” or “Ethereum”.
private_key – Optional, the private key to create account for. Leaving empty will create a new account from new private key.
label – The name of the wallet.
- export_secret_key() str[source]¶
Get the privat key.
- Returns:
Private key in hexadecimal string format.
- get_account_by_address(address: str) DagAccount | EthAccount[source]¶
Get the account matching a specific address.
- Parameters:
address – The account address.
- Returns:
The account matching the address.
- get_accounts() List[DagAccount | EthAccount][source]¶
- id: str¶
- keyring: SimpleKeyring | None¶
- label: str | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- network: str | None¶
- supported_assets: List¶
- type: str¶