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

add_account()[source]
compute_id()[source]

Automatically computes the id based on injected SID value.

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]
export_secret_key() str[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.

get_label() str[source]

Get the name of the wallet.

Returns:

The wallet name.

get_network() str[source]
get_state() Dict[str, Any][source]
id: str
static import_account()[source]

Importing is not supported.

keyring: HdKeyring
label: str | None
mnemonic: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_serialize() Dict[str, Any][source]

Returns a serialized version of the object.

network: str
remove_account(account)[source]

Remove a specific account.

Parameters:

account – The account to be removed.

static reset_sid()[source]
set_label(val: str)[source]

Sets the name of the wallet.

Parameters:

val – The name of the wallet.

set_num_of_accounts(num: int)[source]
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

compute_id()[source]

Automatically computes the id based on injected SID value.

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.

deserialize(label: str, secret: str, rings: list | None = None)[source]
export_secret_key() str[source]

Export mnemonic seed phrase.

Returns:

Mnemonic seed phrase.

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.

get_label() str[source]

Get the name on the wallet.

Returns:

The name of the wallet.

static get_network()[source]
get_state() Dict[str, Any][source]
id: str
static import_account()[source]

Importing MCW account is not supported.

keyrings: List[HdKeyring]
label: str | None
mnemonic: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_serialize() Dict[str, Any][source]
static remove_account()[source]

Remove MCW not supported.

static reset_sid()[source]
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

compute_id()[source]

Automatically computes the id based on injected SID value.

create(network: str, label: str)[source]

Create new multi key wallet. Accounts must be imported.

Parameters:
  • network – “Constellation” or “Ethereum”

  • label – The wallet name.

deserialize(label: str, network: str, accounts: list | None = None)[source]
static export_secret_key()[source]

Not supported by MKW.

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.

get_label() str[source]

Get the name of the wallet.

Returns:

The wallet name.

static get_network()[source]

Not supported by MKW.

get_state() Dict[str, Any][source]
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].

model_serialize() Dict[str, Any][source]
network: str | None
static remove_account()[source]

Not supported by MKW.

static reset_sid()[source]
set_label(val: str)[source]

Set the name of the wallet.

Parameters:

val – The wallet name.

supported_assets: List[str]
type: str

pypergraph.keyring.wallets.shared module

class pypergraph.keyring.wallets.shared.SIDManager[source]

Bases: object

next_sid(prefix: str) str[source]
reset_sid()[source]

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

compute_id()[source]

Automatically computes the id based on injected SID value.

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.

deserialize(network: str, label: str, secret: str)[source]
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]
get_label() str[source]

Get the name of the wallet.

Returns:

The wallet name.

get_network() str[source]
get_state() Dict[str, Any][source]
id: str
static import_account()[source]

Not supported for SingleAccountWallet.

keyring: SimpleKeyring | None
label: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_serialize() Dict[str, Any][source]
network: str | None
remove_account(account)[source]

Not supported by SAW.

static reset_sid()[source]
set_label(label: str)[source]

Set the name of the wallet.

Parameters:

label – The wallet name.

supported_assets: List
type: str

Module contents