Skip to content
Snippets Groups Projects
Commit c81ad1b4 authored by Jakub Ziebinski's avatar Jakub Ziebinski
Browse files

Add the wax_options module

parent 8566d8df
No related branches found
No related tags found
1 merge request!230Implementation of the python wax interface
......@@ -72,11 +72,13 @@ from .wax_result import (
)
from .interfaces import IWaxBaseInterface
from .wax_factory import create_wax_foundation
from .wax_options import WaxOptions
__version__ = "0.0.0"
__all__ = [
"IWaxBaseInterface",
"WaxOptions",
"create_wax_foundation",
"python_error_code",
"python_result",
......
......@@ -15,7 +15,7 @@ if TYPE_CHECKING:
NaiAsset,
VestsNaiAssetConvertible,
)
from wax._private.models.basic import AccountName, Hex, PublicKey, Signature
from wax._private.models.basic import AccountName, ChainId, Hex, PublicKey, Signature
from wax._private.models.brain_key_data import BrainKeyData
from wax._private.models.operations import Operation
from wax._private.models.private_key_data import PrivateKeyData
......@@ -37,6 +37,11 @@ class IManabarData(ABC):
class IWaxBaseInterface(ABC):
@property
@abstractmethod
def chain_id(self) -> ChainId:
"""Returns the chain id."""
@property
@abstractmethod
def config(self) -> ChainConfig:
......
......@@ -3,11 +3,14 @@ from __future__ import annotations
from typing import TYPE_CHECKING
from wax._private.base_api import WaxBaseApi
from wax.wax_options import WaxOptions
if TYPE_CHECKING:
from wax.interfaces import IWaxBaseInterface
def create_wax_foundation() -> IWaxBaseInterface:
def create_wax_foundation(options: WaxOptions | None = None) -> IWaxBaseInterface:
"""Factory function to provide wax base interface functionality."""
return WaxBaseApi(_private=True)
chain_id = options.chain_id if options is not None else WaxOptions().chain_id
return WaxBaseApi(chain_id, _private=True)
from __future__ import annotations
from dataclasses import dataclass, field
from wax._private.models.basic import ChainId
@dataclass
class WaxOptions:
chain_id: ChainId = field(
default_factory=lambda: ChainId("18dcf0a285365fc58b71f18b3d3fec954aa0c141c44e4e5cb4cf777b9eab274e")
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment