pypergraph.keyring package¶
Subpackages¶
- pypergraph.keyring.accounts package
- Submodules
- pypergraph.keyring.accounts.dag_account module
DagAccountDagAccount.assetsDagAccount.bip44_indexDagAccount.decimalsDagAccount.get_address()DagAccount.get_address_from_public_key()DagAccount.get_public_key()DagAccount.has_token_supportDagAccount.labelDagAccount.model_configDagAccount.network_idDagAccount.providerDagAccount.sha256()DagAccount.supported_assetsDagAccount.tokensDagAccount.validate_address()DagAccount.verify_message()DagAccount.wallet
- pypergraph.keyring.accounts.ecdsa_account module
EcdsaAccountEcdsaAccount.assetsEcdsaAccount.bip44_indexEcdsaAccount.create()EcdsaAccount.decimalsEcdsaAccount.deserialize()EcdsaAccount.get_address()EcdsaAccount.get_bip44_index()EcdsaAccount.get_decimals()EcdsaAccount.get_label()EcdsaAccount.get_network_id()EcdsaAccount.get_private_key()EcdsaAccount.get_private_key_buffer()EcdsaAccount.get_public_key()EcdsaAccount.get_state()EcdsaAccount.get_tokens()EcdsaAccount.get_web3_provider()EcdsaAccount.has_token_supportEcdsaAccount.labelEcdsaAccount.model_configEcdsaAccount.network_idEcdsaAccount.providerEcdsaAccount.recover_signed_msg_public_key()EcdsaAccount.save_token_info()EcdsaAccount.serialize()EcdsaAccount.set_tokens()EcdsaAccount.set_web3_provider()EcdsaAccount.supported_assetsEcdsaAccount.tokensEcdsaAccount.verify_message()EcdsaAccount.wallet
- pypergraph.keyring.accounts.eth_account module
EthAccountEthAccount.assetsEthAccount.bip44_indexEthAccount.decimalsEthAccount.get_address_from_public_key()EthAccount.get_encryption_public_key()EthAccount.has_token_supportEthAccount.labelEthAccount.model_configEthAccount.network_idEthAccount.providerEthAccount.save_token_info()EthAccount.sign_transaction()EthAccount.supported_assetsEthAccount.tokensEthAccount.validate_address()EthAccount.verify_message()EthAccount.wallet
- Module contents
AssetLibraryDagAccountDagAccount.assetsDagAccount.bip44_indexDagAccount.decimalsDagAccount.get_address()DagAccount.get_address_from_public_key()DagAccount.get_public_key()DagAccount.has_token_supportDagAccount.labelDagAccount.model_configDagAccount.network_idDagAccount.providerDagAccount.sha256()DagAccount.supported_assetsDagAccount.tokensDagAccount.validate_address()DagAccount.verify_message()DagAccount.wallet
DagAssetLibraryEcdsaAccountEcdsaAccount.assetsEcdsaAccount.bip44_indexEcdsaAccount.create()EcdsaAccount.decimalsEcdsaAccount.deserialize()EcdsaAccount.get_address()EcdsaAccount.get_bip44_index()EcdsaAccount.get_decimals()EcdsaAccount.get_label()EcdsaAccount.get_network_id()EcdsaAccount.get_private_key()EcdsaAccount.get_private_key_buffer()EcdsaAccount.get_public_key()EcdsaAccount.get_state()EcdsaAccount.get_tokens()EcdsaAccount.get_web3_provider()EcdsaAccount.has_token_supportEcdsaAccount.labelEcdsaAccount.model_configEcdsaAccount.network_idEcdsaAccount.providerEcdsaAccount.recover_signed_msg_public_key()EcdsaAccount.save_token_info()EcdsaAccount.serialize()EcdsaAccount.set_tokens()EcdsaAccount.set_web3_provider()EcdsaAccount.supported_assetsEcdsaAccount.tokensEcdsaAccount.verify_message()EcdsaAccount.wallet
EthAccountEthAccount.assetsEthAccount.bip44_indexEthAccount.decimalsEthAccount.get_address_from_public_key()EthAccount.get_encryption_public_key()EthAccount.has_token_supportEthAccount.labelEthAccount.model_configEthAccount.network_idEthAccount.providerEthAccount.save_token_info()EthAccount.sign_transaction()EthAccount.supported_assetsEthAccount.tokensEthAccount.validate_address()EthAccount.verify_message()EthAccount.wallet
EthAssetLibrary
- pypergraph.keyring.bip_helpers package
- pypergraph.keyring.keyrings package
- Submodules
- pypergraph.keyring.keyrings.hd_keyring module
HdKeyringHdKeyring.accountsHdKeyring.add_account_at()HdKeyring.create()HdKeyring.create_accounts()HdKeyring.create_from_extended_key()HdKeyring.deserialize()HdKeyring.export_account()HdKeyring.extended_keyHdKeyring.get_account_by_address()HdKeyring.get_accounts()HdKeyring.get_extended_public_key()HdKeyring.get_hd_path()HdKeyring.get_network()HdKeyring.hd_pathHdKeyring.mnemonicHdKeyring.model_configHdKeyring.model_serialize()HdKeyring.networkHdKeyring.remove_account()HdKeyring.remove_last_added_account()HdKeyring.root_key
- pypergraph.keyring.keyrings.registry module
- pypergraph.keyring.keyrings.simple_keyring module
SimpleKeyringSimpleKeyring.accountSimpleKeyring.add_account_at()SimpleKeyring.create_for_network()SimpleKeyring.deserialize()SimpleKeyring.get_account_by_address()SimpleKeyring.get_accounts()SimpleKeyring.get_state()SimpleKeyring.model_configSimpleKeyring.model_serialize()SimpleKeyring.networkSimpleKeyring.remove_account()
- Module contents
- pypergraph.keyring.storage package
- pypergraph.keyring.tests package
- pypergraph.keyring.wallets package
- Submodules
- pypergraph.keyring.wallets.multi_account_wallet module
MultiAccountWalletMultiAccountWallet.add_account()MultiAccountWallet.compute_id()MultiAccountWallet.create()MultiAccountWallet.deserialize()MultiAccountWallet.export_secret_key()MultiAccountWallet.get_account_by_address()MultiAccountWallet.get_accounts()MultiAccountWallet.get_label()MultiAccountWallet.get_network()MultiAccountWallet.get_state()MultiAccountWallet.idMultiAccountWallet.import_account()MultiAccountWallet.keyringMultiAccountWallet.labelMultiAccountWallet.mnemonicMultiAccountWallet.model_configMultiAccountWallet.model_serialize()MultiAccountWallet.networkMultiAccountWallet.remove_account()MultiAccountWallet.reset_sid()MultiAccountWallet.set_label()MultiAccountWallet.set_num_of_accounts()MultiAccountWallet.supported_assetsMultiAccountWallet.type
- pypergraph.keyring.wallets.multi_chain_wallet module
MultiChainWalletMultiChainWallet.compute_id()MultiChainWallet.create()MultiChainWallet.deserialize()MultiChainWallet.export_secret_key()MultiChainWallet.get_account_by_address()MultiChainWallet.get_accounts()MultiChainWallet.get_label()MultiChainWallet.get_network()MultiChainWallet.get_state()MultiChainWallet.idMultiChainWallet.import_account()MultiChainWallet.keyringsMultiChainWallet.labelMultiChainWallet.mnemonicMultiChainWallet.model_configMultiChainWallet.model_serialize()MultiChainWallet.remove_account()MultiChainWallet.reset_sid()MultiChainWallet.set_label()MultiChainWallet.supported_assetsMultiChainWallet.type
- pypergraph.keyring.wallets.multi_key_wallet module
MultiKeyWalletMultiKeyWallet.compute_id()MultiKeyWallet.create()MultiKeyWallet.deserialize()MultiKeyWallet.export_secret_key()MultiKeyWallet.get_account_by_address()MultiKeyWallet.get_accounts()MultiKeyWallet.get_label()MultiKeyWallet.get_network()MultiKeyWallet.get_state()MultiKeyWallet.idMultiKeyWallet.import_account()MultiKeyWallet.keyringsMultiKeyWallet.labelMultiKeyWallet.model_configMultiKeyWallet.model_serialize()MultiKeyWallet.networkMultiKeyWallet.remove_account()MultiKeyWallet.reset_sid()MultiKeyWallet.set_label()MultiKeyWallet.supported_assetsMultiKeyWallet.type
- pypergraph.keyring.wallets.shared module
- pypergraph.keyring.wallets.single_account_wallet module
SingleAccountWalletSingleAccountWallet.compute_id()SingleAccountWallet.create()SingleAccountWallet.deserialize()SingleAccountWallet.export_secret_key()SingleAccountWallet.get_account_by_address()SingleAccountWallet.get_accounts()SingleAccountWallet.get_label()SingleAccountWallet.get_network()SingleAccountWallet.get_state()SingleAccountWallet.idSingleAccountWallet.import_account()SingleAccountWallet.keyringSingleAccountWallet.labelSingleAccountWallet.model_configSingleAccountWallet.model_serialize()SingleAccountWallet.networkSingleAccountWallet.remove_account()SingleAccountWallet.reset_sid()SingleAccountWallet.set_label()SingleAccountWallet.supported_assetsSingleAccountWallet.type
- Module contents
Submodules¶
pypergraph.keyring.encryptor module¶
- class pypergraph.keyring.encryptor.AsyncAesGcmEncryptor[source]¶
Bases:
object
pypergraph.keyring.manager module¶
- class pypergraph.keyring.manager.KeyringManager(storage_file_path: str | None = None)[source]¶
Bases:
object- async create_multi_chain_hd_wallet(label: str | None = None, seed: str | None = None) MultiChainWallet[source]¶
This is the next step in creating or restoring a wallet, by default.
- Parameters:
label – Wallet name.
seed – Seed phrase.
- Returns:
- async create_or_restore_vault(password: str, label: str | None = None, seed: str | None = None) MultiChainWallet[source]¶
First step, creating or restoring a wallet. This is the default wallet type when creating a new wallet.
- Parameters:
label – The name of the wallet.
seed – Seed phrase.
password – A string of characters.
- Returns:
- async create_single_account_wallet(label: str, private_key: str, network: Constellation | Ethereum | None = None) SingleAccountWallet[source]¶
- get_accounts() List[DagAccount | EthAccount][source]¶
- get_wallet_by_id(id: str) MultiChainWallet | SingleAccountWallet | MultiAccountWallet | MultiKeyWallet[source]¶
- get_wallet_for_account(address: str) MultiChainWallet | SingleAccountWallet | MultiAccountWallet | MultiKeyWallet[source]¶
Module contents¶
- pypergraph.keyring.Encryptor¶
alias of
AsyncAesGcmEncryptor
- class pypergraph.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¶
- class pypergraph.keyring.KeyringAssetInfo(id: str, label: str, symbol: str, decimals: int, native: bool | None = None, network: str | None = None, address: str | None = None)[source]¶
Bases:
object- address: str | None = None¶
- decimals: int¶
- id: str¶
- label: str¶
- native: bool | None = None¶
- network: str | None = None¶
- symbol: str¶
- class pypergraph.keyring.KeyringManager(storage_file_path: str | None = None)[source]¶
Bases:
object- async create_multi_chain_hd_wallet(label: str | None = None, seed: str | None = None) MultiChainWallet[source]¶
This is the next step in creating or restoring a wallet, by default.
- Parameters:
label – Wallet name.
seed – Seed phrase.
- Returns:
- async create_or_restore_vault(password: str, label: str | None = None, seed: str | None = None) MultiChainWallet[source]¶
First step, creating or restoring a wallet. This is the default wallet type when creating a new wallet.
- Parameters:
label – The name of the wallet.
seed – Seed phrase.
password – A string of characters.
- Returns:
- async create_single_account_wallet(label: str, private_key: str, network: Constellation | Ethereum | None = None) SingleAccountWallet[source]¶
- get_accounts() List[DagAccount | EthAccount][source]¶
- get_wallet_by_id(id: str) MultiChainWallet | SingleAccountWallet | MultiAccountWallet | MultiKeyWallet[source]¶
- get_wallet_for_account(address: str) MultiChainWallet | SingleAccountWallet | MultiAccountWallet | MultiKeyWallet[source]¶
- class pypergraph.keyring.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¶
- class pypergraph.keyring.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¶
- class pypergraph.keyring.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¶
- class pypergraph.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¶
- class pypergraph.keyring.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¶