pypergraph.keyring.keyrings package¶
Submodules¶
pypergraph.keyring.keyrings.hd_keyring module¶
- class pypergraph.keyring.keyrings.hd_keyring.HdKeyring(*, accounts: ~typing.List[~pypergraph.keyring.accounts.ecdsa_account.EcdsaAccount] = <factory>, hd_path: str | None = None, mnemonic: str | None = None, extended_key: str | None = None, root_key: ~bip32utils.BIP32Key.BIP32Key | None = None, network: str | None = None)[source]¶
Bases:
BaseModelHierarchical Deterministic Keyring: BIP32
- accounts: List[EcdsaAccount]¶
- add_account_at(index: int = 0) DagAccount | EthAccount | EcdsaAccount[source]¶
Add account class object with a signing key to the keyring being constructed.
- Parameters:
index – Account number (bipIndex).
- Returns:
EcdsaAccount or DagAccount class object (dag_keyring.accounts) with signing key at self.wallet.
- create(mnemonic: str, hd_path: str, network: str, number_of_accounts: int = 1) Self[source]¶
Create a hierarchical deterministic keyring.
- Parameters:
mnemonic – Mnemonic phrase.
hd_path – The derivation path for the coin chain (without index).
network – The network associated with the coin.
number_of_accounts – How many accounts (indexes) to create.
- Returns:
Hierarchical deterministic keyring.
- create_accounts(number_of_accounts: int = 0) List[Dict][source]¶
When adding an account (after accounts have been removed), it will add back the ones removed first.
- Parameters:
number_of_accounts – The number of accounts to create.
- Returns List[dict]:
A list of dictionaries with bip44 index.
- create_from_extended_key(extended_key: str, network: NetworkId, number_of_accounts: int) Self[source]¶
- deserialize(data: dict)[source]¶
Deserialize then add account (bip44_index) to the keyring being constructed.
- Parameters:
data
- extended_key: str | None¶
- get_account_by_address(address: str) DagAccount | EthAccount[source]¶
- hd_path: str | None¶
- mnemonic: str | None¶
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- network: str | None¶
- root_key: BIP32Key | None¶
pypergraph.keyring.keyrings.registry module¶
- class pypergraph.keyring.keyrings.registry.AccountRegistry[source]¶
Bases:
object- add_account(network: str, account: EcdsaAccount)[source]¶
Add account to registry.
- Parameters:
network – New chain name (network id).
account – New account inheriting from EcdsaAccount.
- create_account(network: str) EcdsaAccount[source]¶
Determine the account class dependent on network.
- Parameters:
network – E.g. KeyringNetwork.Constellation.value
- Returns:
Account class.
pypergraph.keyring.keyrings.simple_keyring module¶
- class pypergraph.keyring.keyrings.simple_keyring.SimpleKeyring(*, account: EcdsaAccount = None, network: str = 'Constellation')[source]¶
Bases:
BaseModel- account: EcdsaAccount¶
- get_account_by_address(address: str)[source]¶
Get the account matching the specified address.
- Returns:
Account class or None is nothing matches.
- get_accounts() List[DagAccount | EthAccount | Any][source]¶
Get all accounts in the simple keyring.
- Returns:
List of account classes (only one).
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- network: str¶