pypergraph.keyring.accounts package¶
Submodules¶
pypergraph.keyring.accounts.dag_account module¶
- class pypergraph.keyring.accounts.dag_account.DagAccount(*, tokens: ~typing.Dict[str, dict] = <factory>, wallet: ~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey | None = None, assets: ~typing.List[~typing.Any] = <factory>, bip44_index: int | None = None, provider: ~typing.Any = None, label: str | None = None)[source]¶
Bases:
EcdsaAccount- assets: List[Any]¶
- bip44_index: int | None¶
- property decimals: int¶
- get_address_from_public_key(public_key_hex: str) str[source]¶
- Parameters:
public_key_hex – The private key as a hexadecimal string.
- Returns:
The DAG address corresponding to the public key (node ID).
- property has_token_support: bool¶
- label: str | None¶
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property network_id: str¶
- provider: Any¶
- property supported_assets: List[str]¶
- tokens: Dict[str, dict]¶
- wallet: ec.EllipticCurvePrivateKey | None¶
pypergraph.keyring.accounts.ecdsa_account module¶
- class pypergraph.keyring.accounts.ecdsa_account.EcdsaAccount(*, tokens: ~typing.Dict[str, dict] = <factory>, wallet: ~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey | None = None, assets: ~typing.List[~typing.Any] = <factory>, bip44_index: int | None = None, provider: ~typing.Any = None, label: str | None = None)[source]¶
Bases:
BaseModel,ABC- assets: List[Any]¶
- bip44_index: int | None¶
- abstract property decimals: int¶
- deserialize(bip44_index: int | None = None, label: str | None = None, private_key: str | None = None, public_key: str | None = None, tokens: List[str] | None = None)[source]¶
- abstract property has_token_support: bool¶
- label: str | None¶
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- abstract property network_id: str¶
- provider: Any¶
- abstract property supported_assets: List[str]¶
- tokens: Dict[str, dict]¶
- wallet: EllipticCurvePrivateKey | None¶
pypergraph.keyring.accounts.eth_account module¶
- class pypergraph.keyring.accounts.eth_account.EthAccount(*, tokens: ~typing.List[str] = ['0xa393473d64d2F9F026B60b6Df7859A689715d092'], wallet: ~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey | None = None, assets: ~typing.List[~typing.Any] = <factory>, bip44_index: int | None = None, provider: ~typing.Any = None, label: str | None = None)[source]¶
Bases:
EcdsaAccount- assets: List[Any]¶
- bip44_index: int | None¶
- property decimals: int¶
- get_address_from_public_key(public_key: str) str[source]¶
Derive the Ethereum address from the public key.
- property has_token_support: bool¶
- label: str | None¶
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property network_id: str¶
- provider: Any¶
- save_token_info(address: str)[source]¶
Save the token info if not already present in the tokens list.
- sign_transaction(tx)[source]¶
Sign an Ethereum transaction with the account’s private key.
tx is an instance of the transaction object from a library like web3.eth.account.
- property supported_assets: List[str]¶
- tokens: List[str]¶
- verify_message(msg: str, signature: str, says_address: str) bool[source]¶
Verify if a signed message matches the provided address.
- wallet: ec.EllipticCurvePrivateKey | None¶
Module contents¶
- class pypergraph.keyring.accounts.AssetLibrary[source]¶
Bases:
ABC- abstract property default_assets: List[str]¶
Returns a list of default asset symbols.
- abstract property default_assets_map: Dict[str, KeyringAssetInfo]¶
Returns the default asset map (i.e., a dict mapping symbols to asset info).
- deserialize(assets: Dict[str, KeyringAssetInfo]) None[source]¶
Loads a previously saved asset map.
- get_asset_by_symbol(symbol: str) KeyringAssetInfo | None[source]¶
Looks up an asset by symbol. First checks the default assets, then any imported tokens.
- import_token(token: KeyringAssetInfo) bool[source]¶
Imports a new token. Returns True if the token was added (i.e. did not exist before), otherwise returns False.
- class pypergraph.keyring.accounts.DagAccount(*, tokens: ~typing.Dict[str, dict] = <factory>, wallet: ~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey | None = None, assets: ~typing.List[~typing.Any] = <factory>, bip44_index: int | None = None, provider: ~typing.Any = None, label: str | None = None)[source]¶
Bases:
EcdsaAccount- assets: List[Any]¶
- bip44_index: int | None¶
- property decimals: int¶
- get_address_from_public_key(public_key_hex: str) str[source]¶
- Parameters:
public_key_hex – The private key as a hexadecimal string.
- Returns:
The DAG address corresponding to the public key (node ID).
- property has_token_support: bool¶
- label: str | None¶
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property network_id: str¶
- provider: Any¶
- property supported_assets: List[str]¶
- tokens: Dict[str, dict]¶
- wallet: ec.EllipticCurvePrivateKey | None¶
- class pypergraph.keyring.accounts.DagAssetLibrary[source]¶
Bases:
AssetLibrary- property default_assets: List[str]¶
Returns a list of default asset symbols.
- property default_assets_map: Dict[str, KeyringAssetInfo]¶
Returns the default asset map (i.e., a dict mapping symbols to asset info).
- class pypergraph.keyring.accounts.EcdsaAccount(*, tokens: ~typing.Dict[str, dict] = <factory>, wallet: ~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey | None = None, assets: ~typing.List[~typing.Any] = <factory>, bip44_index: int | None = None, provider: ~typing.Any = None, label: str | None = None)[source]¶
Bases:
BaseModel,ABC- assets: List[Any]¶
- bip44_index: int | None¶
- abstract property decimals: int¶
- deserialize(bip44_index: int | None = None, label: str | None = None, private_key: str | None = None, public_key: str | None = None, tokens: List[str] | None = None)[source]¶
- abstract property has_token_support: bool¶
- label: str | None¶
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- abstract property network_id: str¶
- provider: Any¶
- abstract property supported_assets: List[str]¶
- tokens: Dict[str, dict]¶
- wallet: EllipticCurvePrivateKey | None¶
- class pypergraph.keyring.accounts.EthAccount(*, tokens: ~typing.List[str] = ['0xa393473d64d2F9F026B60b6Df7859A689715d092'], wallet: ~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey | None = None, assets: ~typing.List[~typing.Any] = <factory>, bip44_index: int | None = None, provider: ~typing.Any = None, label: str | None = None)[source]¶
Bases:
EcdsaAccount- assets: List[Any]¶
- bip44_index: int | None¶
- property decimals: int¶
- get_address_from_public_key(public_key: str) str[source]¶
Derive the Ethereum address from the public key.
- property has_token_support: bool¶
- label: str | None¶
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property network_id: str¶
- provider: Any¶
- save_token_info(address: str)[source]¶
Save the token info if not already present in the tokens list.
- sign_transaction(tx)[source]¶
Sign an Ethereum transaction with the account’s private key.
tx is an instance of the transaction object from a library like web3.eth.account.
- property supported_assets: List[str]¶
- tokens: List[str]¶
- verify_message(msg: str, signature: str, says_address: str) bool[source]¶
Verify if a signed message matches the provided address.
- wallet: ec.EllipticCurvePrivateKey | None¶
- class pypergraph.keyring.accounts.EthAssetLibrary[source]¶
Bases:
AssetLibrary- property default_assets: List[str]¶
Returns a list of default asset symbols.
- property default_assets_map: Dict[str, KeyringAssetInfo]¶
Returns the default asset map (i.e., a dict mapping symbols to asset info).