AddressBook

AddressBook

class AddressBook(**kwargs)

Implements the addressbook api endpoints.

add(address: str | Address, label: str, **kwargs) AddressBookEntryModel

Adds an entry to the address book.

Parameters:
  • address (str, Address) – The address to add to the address book.

  • label (str) – The address label.

Returns:

The address book entry.

Return type:

AddressBookEntryModel

Raises:

APIError – Error thrown by node API. See message for details.

remove(label: str, **kwargs) AddressBookEntryModel

Removes an entry from the address book.

Parameters:

label (str) – The label to remove.

Returns:

The address book entry.

Return type:

AddressBookEntryModel

Raises:

APIError – Error thrown by node API. See message for details.

__call__(skip: int | None = None, take: int | None = None, **kwargs) List[AddressBookEntryModel]

Gets the address book entries with option to implement pagination.

Parameters:
  • skip (int, optional) – The number of entries to skip.

  • take (int, optional) – The maximum number of entries to take.

Returns:

A list of address book entries.

Return type:

List[AddressBookEntryModel]

Raises:

APIError – Error thrown by node API. See message for details.

Note

If neither skip or take arguments are specified, returns the entire address book. An address book can be accessed from a wallet, but it is a standalone feature, which is not attached to any wallet.

AddressBookEntryModel

class AddressBookEntryModel(*, address: Address, label: str)

A pydantic model representing an address book entry.

address: Address

An address validated for the current network.

label: str

A label for the given address.