diff --git a/README.md b/README.md index 21aa910..1be6ebd 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# Golem Base +# GolemDB -This is part of the [Golem Base](https://github.com/Golem-Base) project, which is designed as a Layer2 Network deployed on Ethereum, acting as a gateway to various Layer 3 Database Chains (DB-Chains). +This is part of the [GolemDB](https://github.com/Golem-Base) project, which is designed as a Layer2 Network deployed on Ethereum, acting as a gateway to various Layer 3 Database Chains (DB-Chains). -> **For an overview of Golem Base, check out our [Litepaper](https://golem-base.io/wp-content/uploads/2025/03/GolemBase-Litepaper.pdf).** +> **For an overview of GolemDB, check out our [Litepaper](https://golem-base.io/wp-content/uploads/2025/03/GolemDB-Litepaper.pdf).** -# GolemBase SDK for Python +# GolemDB SDK for Python -This SDK allows you to use [GolemBase](https://github.com/Golem-Base) from Python. It is available [on PyPI](https://pypi.org/project/golem-base-sdk/). +This SDK allows you to use [GolemDB](https://github.com/Golem-Base) from Python. It is available [on PyPI](https://pypi.org/project/golem-base-sdk/). We also publish [generated documentation](https://golem-base.github.io/python-sdk/). @@ -50,7 +50,7 @@ python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` -Next, install the GolemBase SDK from PyPI: +Next, install the GolemDB SDK from PyPI: ```bash pip install golem-base-sdk @@ -62,9 +62,9 @@ This is a basic Python application that: - Imports several items from the SDK (`golem_base_sdk`), including: - * `GolemBaseClient`: A class that creates a client to interact with GolemBase - * `GolemBaseCreate`: A class representing a create transaction in GolemBase - * `GolemBaseExtend`: A class for extending entity lifetime + * `GolemDBClient`: A class that creates a client to interact with GolemDB + * `GolemDBCreate`: A class representing a create transaction in GolemDB + * `GolemDBExtend`: A class for extending entity lifetime * `Annotation`: A class for key-value annotations - Reads the private key, which it locates using the `xdg` module. @@ -75,7 +75,7 @@ This is a basic Python application that: The `main` function demonstrates how to create, extend, and query entities: -- Creates a client object that connects to the GolemBase network (e.g., Kaolin testnet) using `rpc` and `ws` URLs, and your private key. +- Creates a client object that connects to the GolemDB network (e.g., Kaolin testnet) using `rpc` and `ws` URLs, and your private key. - Subscribes to log events from the network (create, update, delete, extend). diff --git a/example/golem_base_sdk_example/__init__.py b/example/golem_base_sdk_example/__init__.py index 624b965..0dfe044 100755 --- a/example/golem_base_sdk_example/__init__.py +++ b/example/golem_base_sdk_example/__init__.py @@ -1,4 +1,4 @@ -"""GolemBase Python SDK.""" +"""GolemDB Python SDK.""" import argparse import asyncio @@ -7,11 +7,11 @@ from golem_base_sdk import ( Annotation, - GolemBaseClient, - GolemBaseCreate, - GolemBaseDelete, - GolemBaseExtend, - GolemBaseUpdate, + GolemDBClient, + GolemDBCreate, + GolemDBDelete, + GolemDBExtend, + GolemDBUpdate, WalletError, decrypt_wallet, ) @@ -66,7 +66,7 @@ async def run_example(instance: str) -> None: # noqa: PLR0915 except KeyboardInterrupt: print("\nOperation cancelled by user.") - client = await GolemBaseClient.create( + client = await GolemDBClient.create( rpc_url=INSTANCE_URLS[instance]["rpc"], ws_url=INSTANCE_URLS[instance]["ws"], private_key=key_bytes, @@ -123,7 +123,7 @@ async def run_example(instance: str) -> None: # noqa: PLR0915 """) create_receipt = await client.create_entities( - [GolemBaseCreate(b"hello", 60, [Annotation("app", "demo")], [])] + [GolemDBCreate(b"hello", 60, [Annotation("app", "demo")], [])] ) entity_key = create_receipt[0].entity_key logger.info("receipt: %s", create_receipt) @@ -146,9 +146,7 @@ async def run_example(instance: str) -> None: # noqa: PLR0915 await client.get_entities_to_expire_at_block(metadata.expires_at_block), ) - [extend_receipt] = await client.extend_entities( - [GolemBaseExtend(entity_key, 60)] - ) + [extend_receipt] = await client.extend_entities([GolemDBExtend(entity_key, 60)]) logger.info("receipt: %s", extend_receipt) logger.info( @@ -175,7 +173,7 @@ async def run_example(instance: str) -> None: # noqa: PLR0915 "block number: %s", await client.http_client().eth.get_block_number() ) [update_receipt] = await client.update_entities( - [GolemBaseUpdate(entity_key, b"hello", 60, [Annotation("app", "demo")], [])] + [GolemDBUpdate(entity_key, b"hello", 60, [Annotation("app", "demo")], [])] ) logger.info("receipt: %s", update_receipt) entity_key = update_receipt.entity_key @@ -202,7 +200,7 @@ async def run_example(instance: str) -> None: # noqa: PLR0915 "block number: %s", await client.http_client().eth.get_block_number() ) - receipt = await client.delete_entities([GolemBaseDelete(entity_key)]) + receipt = await client.delete_entities([GolemDBDelete(entity_key)]) logger.info("receipt: %s", receipt) logger.info( @@ -224,7 +222,7 @@ async def run_example(instance: str) -> None: # noqa: PLR0915 """) create_receipt = await client.create_entities( - [GolemBaseCreate(b"hello", 60, [Annotation("app", "demo")], [])] + [GolemDBCreate(b"hello", 60, [Annotation("app", "demo")], [])] ) entity_key = create_receipt[0].entity_key logger.info("receipt: %s", create_receipt) @@ -235,7 +233,7 @@ async def run_example(instance: str) -> None: # noqa: PLR0915 metadata = await client.get_entity_metadata(entity_key) logger.info("entity metadata: %s", metadata) - await client.delete_entities([GolemBaseDelete(entity_key)]) + await client.delete_entities([GolemDBDelete(entity_key)]) else: logger.warning("Could not connect to the API...") @@ -244,7 +242,7 @@ async def run_example(instance: str) -> None: # noqa: PLR0915 def main() -> None: """Run the example.""" - parser = argparse.ArgumentParser(description="GolemBase Python SDK Example") + parser = argparse.ArgumentParser(description="GolemDB Python SDK Example") parser.add_argument( "--instance", choices=INSTANCE_URLS.keys(), diff --git a/example/uv.lock b/example/uv.lock index f97cc82..59a393e 100644 --- a/example/uv.lock +++ b/example/uv.lock @@ -718,7 +718,7 @@ wheels = [ [[package]] name = "golem-base-sdk" -version = "0.1.0" +version = "0.2.0" source = { editable = "../" } dependencies = [ { name = "anyio" }, diff --git a/golem_base_sdk/__init__.py b/golem_base_sdk/__init__.py index 6ba6fa6..8d3d155 100755 --- a/golem_base_sdk/__init__.py +++ b/golem_base_sdk/__init__.py @@ -1,4 +1,4 @@ -"""GolemBase Python SDK.""" +"""GolemDB Python SDK.""" import asyncio import base64 @@ -40,12 +40,12 @@ EntityMetadata, ExtendEntityReturnType, GenericBytes, - GolemBaseCreate, - GolemBaseDelete, - GolemBaseExtend, - GolemBaseTransaction, - GolemBaseTransactionReceipt, - GolemBaseUpdate, + GolemDBCreate, + GolemDBDelete, + GolemDBExtend, + GolemDBTransaction, + GolemDBTransactionReceipt, + GolemDBUpdate, QueryEntitiesResult, UpdateEntityReturnType, WatchLogsHandle, @@ -65,12 +65,12 @@ "EntityMetadata", "ExtendEntityReturnType", "GenericBytes", - "GolemBaseCreate", - "GolemBaseDelete", - "GolemBaseExtend", - "GolemBaseTransaction", - "GolemBaseTransactionReceipt", - "GolemBaseUpdate", + "GolemDBCreate", + "GolemDBDelete", + "GolemDBExtend", + "GolemDBTransaction", + "GolemDBTransactionReceipt", + "GolemDBUpdate", "QueryEntitiesResult", "UpdateEntityReturnType", "WatchLogsHandle", @@ -81,7 +81,7 @@ "decrypt_wallet", "WalletError", # Exports from this file - "GolemBaseClient", + "GolemDBClient", # Re-exports "Wei", ] @@ -91,8 +91,8 @@ """@private""" -class GolemBaseHttpClient(AsyncWeb3): - """Subclass of AsyncWeb3 with added Golem Base methods.""" +class GolemDBHttpClient(AsyncWeb3): + """Subclass of AsyncWeb3 with added GolemDB methods.""" def __init__(self, rpc_url: str): super().__init__( @@ -178,11 +178,11 @@ async def get_entities_to_expire_at_block( ) async def get_entity_count(self) -> int: - """Get the total entity count in Golem Base.""" + """Get the total entity count in GolemDB.""" return cast(int, await self.eth.get_entity_count()) # type: ignore[attr-defined] async def get_all_entity_keys(self) -> Sequence[EntityKey]: - """Get all entity keys in Golem Base.""" + """Get all entity keys in GolemDB.""" return list( map( lambda e: EntityKey(GenericBytes.from_hex_string(e)), @@ -202,7 +202,7 @@ async def get_entities_of_owner( ) async def query_entities(self, query: str) -> Sequence[QueryEntitiesResult]: - """Get all entities that satisfy the given Golem Base query.""" + """Get all entities that satisfy the given GolemDB query.""" return list( map( lambda result: QueryEntitiesResult( @@ -213,22 +213,20 @@ async def query_entities(self, query: str) -> Sequence[QueryEntitiesResult]: ) -class GolemBaseROClient: - _http_client: GolemBaseHttpClient +class GolemDBROClient: + _http_client: GolemDBHttpClient _ws_client: AsyncWeb3 - _golem_base_contract: AsyncContract + _golemdb_contract: AsyncContract _background_tasks: set[asyncio.Task[None]] @staticmethod - async def create_ro_client(rpc_url: str, ws_url: str) -> "GolemBaseROClient": + async def create_ro_client(rpc_url: str, ws_url: str) -> "GolemDBROClient": """ - Create a `GolemBaseClient` instance. + Create a `GolemDBClient` instance. This is the preferred method to create an instance. """ - return GolemBaseROClient( - rpc_url, await GolemBaseROClient._create_ws_client(ws_url) - ) + return GolemDBROClient(rpc_url, await GolemDBROClient._create_ws_client(ws_url)) @staticmethod async def _create_ws_client(ws_url: str) -> "AsyncWeb3": @@ -236,8 +234,8 @@ async def _create_ws_client(ws_url: str) -> "AsyncWeb3": return ws_client def __init__(self, rpc_url: str, ws_client: AsyncWeb3) -> None: - """Initialise the GolemBaseClient instance.""" - self._http_client = GolemBaseHttpClient(rpc_url) + """Initialise the GolemDBClient instance.""" + self._http_client = GolemDBHttpClient(rpc_url) self._ws_client = ws_client # Keep references to async tasks we created @@ -280,16 +278,16 @@ async def inner(show_traceback: bool) -> bool: # https://github.com/pylint-dev/pylint/issues/3162 # pylint: disable=no-member - self.golem_base_contract = self.http_client().eth.contract( + self.golemdb_contract = self.http_client().eth.contract( address=STORAGE_ADDRESS.as_address(), abi=GOLEM_BASE_ABI, ) - for event in self.golem_base_contract.all_events(): + for event in self.golemdb_contract.all_events(): logger.debug( "Registered event %s with hash %s", event.signature, event.topic ) - def http_client(self) -> GolemBaseHttpClient: + def http_client(self) -> GolemDBHttpClient: """Get the underlying web3 http client.""" return self._http_client @@ -327,11 +325,11 @@ async def get_entities_to_expire_at_block( return await self.http_client().get_entities_to_expire_at_block(block_number) async def get_entity_count(self) -> int: - """Get the total entity count in Golem Base.""" + """Get the total entity count in GolemDB.""" return await self.http_client().get_entity_count() async def get_all_entity_keys(self) -> Sequence[EntityKey]: - """Get all entity keys in Golem Base.""" + """Get all entity keys in GolemDB.""" return await self.http_client().get_all_entity_keys() async def get_entities_of_owner( @@ -341,7 +339,7 @@ async def get_entities_of_owner( return await self.http_client().get_entities_of_owner(owner) async def query_entities(self, query: str) -> Sequence[QueryEntitiesResult]: - """Get all entities that satisfy the given Golem Base query.""" + """Get all entities that satisfy the given GolemDB query.""" return await self.http_client().query_entities(query) async def watch_logs( @@ -354,7 +352,7 @@ async def watch_logs( extend_callback: Callable[[ExtendEntityReturnType], None] | None = None, ) -> WatchLogsHandle: """ - Subscribe to events on Golem Base. + Subscribe to events on GolemDB. You can pass in four different callbacks, and the right one will be invoked for every create, update, delete, and extend operation. @@ -367,7 +365,7 @@ async def log_handler( # TypeDicts cannot be checked at runtime log_receipt = typing.cast(LogReceipt, handler_context.result) logger.debug("New log: %s", log_receipt) - res = await self._process_golem_base_log_receipt(log_receipt) + res = await self._process_golemdb_log_receipt(log_receipt) if create_callback: for create in res.creates: @@ -384,8 +382,8 @@ async def log_handler( def create_subscription(topic: HexStr) -> LogsSubscription: return LogsSubscription( - label=f"Golem Base subscription to topic {topic} with label {label}", - address=self.golem_base_contract.address, + label=f"GolemDB subscription to topic {topic} with label {label}", + address=self.golemdb_contract.address, topics=[topic], handler=log_handler, # optional `handler_context` args to help parse a response @@ -405,7 +403,7 @@ def create_subscription(topic: HexStr) -> LogsSubscription: events = list( map( lambda event_name: create_subscription( - self.golem_base_contract.get_event_by_name(event_name).topic + self.golemdb_contract.get_event_by_name(event_name).topic ), event_names, ) @@ -441,16 +439,16 @@ def task_done(task: asyncio.Task[None]) -> None: task.add_done_callback(task_done) - async def _process_golem_base_log_receipt( + async def _process_golemdb_log_receipt( self, log_receipt: LogReceipt, - ) -> GolemBaseTransactionReceipt: + ) -> GolemDBTransactionReceipt: # Read the first entry of the topics array, # which is the hash of the event signature, identifying the event topic = AsyncWeb3.to_hex(log_receipt["topics"][0]) # Look up the corresponding event # If there is no such event in the ABI, it probably needs to be added - event = self.golem_base_contract.get_event_by_topic(topic) + event = self.golemdb_contract.get_event_by_topic(topic) # Use the event to process the whole log event_data = event.process_log(log_receipt) @@ -503,16 +501,16 @@ async def _process_golem_base_log_receipt( ) ) - return GolemBaseTransactionReceipt( + return GolemDBTransactionReceipt( creates=creates, updates=updates, deletes=deletes, extensions=extensions, ) - async def _process_golem_base_receipt( + async def _process_golemdb_receipt( self, receipt: TxReceipt - ) -> GolemBaseTransactionReceipt: + ) -> GolemDBTransactionReceipt: # There doesn't seem to be a method for this in the web3 lib. # The only option in the lib is to iterate over the events in the ABI # and call process_receipt on each of them to try and decode the logs. @@ -521,9 +519,9 @@ async def _process_golem_base_receipt( # we do here. async def process_receipt( receipt: TxReceipt, - ) -> AsyncGenerator[GolemBaseTransactionReceipt, None]: + ) -> AsyncGenerator[GolemDBTransactionReceipt, None]: for log in receipt["logs"]: - yield await self._process_golem_base_log_receipt(log) + yield await self._process_golemdb_log_receipt(log) creates: list[CreateEntityReturnType] = [] updates: list[UpdateEntityReturnType] = [] @@ -536,7 +534,7 @@ async def process_receipt( deletes.extend(res.deletes) extensions.extend(res.extensions) - return GolemBaseTransactionReceipt( + return GolemDBTransactionReceipt( creates=creates, updates=updates, deletes=deletes, @@ -544,43 +542,41 @@ async def process_receipt( ) -class GolemBaseClient(GolemBaseROClient): +class GolemDBClient(GolemDBROClient): """ - The Golem Base client used to interact with Golem Base. + The GolemDB client used to interact with GolemDB. Many useful methods are implemented directly on this type, while more generic ethereum methods can be accessed through the underlying web3 client that you can access with the - `GolemBaseClient.http_client()` + `GolemDBClient.http_client()` method. """ @staticmethod async def create_rw_client( rpc_url: str, ws_url: str, private_key: bytes - ) -> "GolemBaseClient": + ) -> "GolemDBClient": """ - Create a read-write Golem Base client. + Create a read-write GolemDB client. This is the preferred method to create an instance. """ - return GolemBaseClient( - rpc_url, await GolemBaseROClient._create_ws_client(ws_url), private_key + return GolemDBClient( + rpc_url, await GolemDBROClient._create_ws_client(ws_url), private_key ) @staticmethod - async def create( - rpc_url: str, ws_url: str, private_key: bytes - ) -> "GolemBaseClient": + async def create(rpc_url: str, ws_url: str, private_key: bytes) -> "GolemDBClient": """ - Create a read-write Golem Base client. + Create a read-write GolemDB client. - This method is deprecated in favour of `GolemBaseClient.create_rw_client()`. + This method is deprecated in favour of `GolemDBClient.create_rw_client()`. """ - return await GolemBaseClient.create_rw_client(rpc_url, ws_url, private_key) + return await GolemDBClient.create_rw_client(rpc_url, ws_url, private_key) def __init__(self, rpc_url: str, ws_client: AsyncWeb3, private_key: bytes) -> None: - """Initialise the GolemBaseClient instance.""" + """Initialise the GolemDBClient instance.""" super().__init__(rpc_url, ws_client) # Set up the ethereum account @@ -604,13 +600,13 @@ def get_account_address(self) -> ChecksumAddress: async def create_entities( self, - creates: Sequence[GolemBaseCreate], + creates: Sequence[GolemDBCreate], *, gas: int | None = None, maxFeePerGas: Wei | None = None, maxPriorityFeePerGas: Wei | None = None, ) -> Sequence[CreateEntityReturnType]: - """Create entities in Golem Base.""" + """Create entities in GolemDB.""" return ( await self.send_transaction( creates=creates, @@ -622,13 +618,13 @@ async def create_entities( async def update_entities( self, - updates: Sequence[GolemBaseUpdate], + updates: Sequence[GolemDBUpdate], *, gas: int | None = None, maxFeePerGas: Wei | None = None, maxPriorityFeePerGas: Wei | None = None, ) -> Sequence[UpdateEntityReturnType]: - """Update entities in Golem Base.""" + """Update entities in GolemDB.""" return ( await self.send_transaction( updates=updates, @@ -640,13 +636,13 @@ async def update_entities( async def delete_entities( self, - deletes: Sequence[GolemBaseDelete], + deletes: Sequence[GolemDBDelete], *, gas: int | None = None, maxFeePerGas: Wei | None = None, maxPriorityFeePerGas: Wei | None = None, ) -> Sequence[EntityKey]: - """Delete entities from Golem Base.""" + """Delete entities from GolemDB.""" return ( await self.send_transaction( deletes=deletes, @@ -658,13 +654,13 @@ async def delete_entities( async def extend_entities( self, - extensions: Sequence[GolemBaseExtend], + extensions: Sequence[GolemDBExtend], *, gas: int | None = None, maxFeePerGas: Wei | None = None, maxPriorityFeePerGas: Wei | None = None, ) -> Sequence[ExtendEntityReturnType]: - """Extend the BTL of entities in Golem Base.""" + """Extend the BTL of entities in GolemDB.""" return ( await self.send_transaction( extensions=extensions, @@ -677,21 +673,21 @@ async def extend_entities( async def send_transaction( self, *, - creates: Sequence[GolemBaseCreate] | None = None, - updates: Sequence[GolemBaseUpdate] | None = None, - deletes: Sequence[GolemBaseDelete] | None = None, - extensions: Sequence[GolemBaseExtend] | None = None, + creates: Sequence[GolemDBCreate] | None = None, + updates: Sequence[GolemDBUpdate] | None = None, + deletes: Sequence[GolemDBDelete] | None = None, + extensions: Sequence[GolemDBExtend] | None = None, gas: int | None = None, maxFeePerGas: Wei | None = None, maxPriorityFeePerGas: Wei | None = None, - ) -> GolemBaseTransactionReceipt: + ) -> GolemDBTransactionReceipt: """ - Send a generic transaction to Golem Base. + Send a generic transaction to GolemDB. This transaction can contain multiple create, update, delete and extend operations. """ - tx = GolemBaseTransaction( + tx = GolemDBTransaction( creates=creates, updates=updates, deletes=deletes, @@ -703,8 +699,8 @@ async def send_transaction( return await self._send_gb_transaction(tx) async def _send_gb_transaction( - self, tx: GolemBaseTransaction - ) -> GolemBaseTransactionReceipt: + self, tx: GolemDBTransaction + ) -> GolemDBTransactionReceipt: txData: TxParams = { # https://github.com/pylint-dev/pylint/issues/3162 # pylint: disable=no-member @@ -747,4 +743,4 @@ async def _send_gb_transaction( else: raise e - return await self._process_golem_base_receipt(receipt) + return await self._process_golemdb_receipt(receipt) diff --git a/golem_base_sdk/types.py b/golem_base_sdk/types.py index c00a5e5..1fa30d7 100644 --- a/golem_base_sdk/types.py +++ b/golem_base_sdk/types.py @@ -1,4 +1,4 @@ -"""Golem Base SDK Types.""" +"""GolemDB SDK Types.""" from collections.abc import Callable, Coroutine, Sequence from dataclasses import dataclass @@ -64,8 +64,8 @@ def __repr__(self) -> str: @dataclass(frozen=True) -class GolemBaseCreate: - """Class to represent a create operation in Golem Base.""" +class GolemDBCreate: + """Class to represent a create operation in Golem DB.""" data: bytes btl: int @@ -74,8 +74,8 @@ class GolemBaseCreate: @dataclass(frozen=True) -class GolemBaseUpdate: - """Class to represent an update operation in Golem Base.""" +class GolemDBUpdate: + """Class to represent an update operation in Golem DB.""" entity_key: EntityKey data: bytes @@ -85,45 +85,45 @@ class GolemBaseUpdate: @dataclass(frozen=True) -class GolemBaseDelete: - """Class to represent a delete operation in Golem Base.""" +class GolemDBDelete: + """Class to represent a delete operation in Golem DB.""" entity_key: EntityKey @dataclass(frozen=True) -class GolemBaseExtend: - """Class to represent a BTL extend operation in Golem Base.""" +class GolemDBExtend: + """Class to represent a BTL extend operation in Golem DB.""" entity_key: EntityKey number_of_blocks: int @dataclass(frozen=True) -class GolemBaseTransaction: +class GolemDBTransaction: """ - Class to represent a transaction in Golem Base. + Class to represent a transaction in Golem DB. A transaction consist of one or more - `GolemBaseCreate`, - `GolemBaseUpdate`, - `GolemBaseDelete` and - `GolemBaseExtend` + `GolemDBCreate`, + `GolemDBUpdate`, + `GolemDBDelete` and + `GolemDBExtend` operations. """ def __init__( self, *, - creates: Sequence[GolemBaseCreate] | None = None, - updates: Sequence[GolemBaseUpdate] | None = None, - deletes: Sequence[GolemBaseDelete] | None = None, - extensions: Sequence[GolemBaseExtend] | None = None, + creates: Sequence[GolemDBCreate] | None = None, + updates: Sequence[GolemDBUpdate] | None = None, + deletes: Sequence[GolemDBDelete] | None = None, + extensions: Sequence[GolemDBExtend] | None = None, gas: int | None = None, maxFeePerGas: Wei | None = None, maxPriorityFeePerGas: Wei | None = None, ): - """Initialise the GolemBaseTransaction instance.""" + """Initialise the GolemDBTransaction instance.""" object.__setattr__(self, "creates", creates or []) object.__setattr__(self, "updates", updates or []) object.__setattr__(self, "deletes", deletes or []) @@ -132,10 +132,10 @@ def __init__( object.__setattr__(self, "maxFeePerGas", maxFeePerGas) object.__setattr__(self, "maxPriorityFeePerGas", maxPriorityFeePerGas) - creates: Sequence[GolemBaseCreate] - updates: Sequence[GolemBaseUpdate] - deletes: Sequence[GolemBaseDelete] - extensions: Sequence[GolemBaseExtend] + creates: Sequence[GolemDBCreate] + updates: Sequence[GolemDBUpdate] + deletes: Sequence[GolemDBDelete] + extensions: Sequence[GolemDBExtend] gas: int | None maxFeePerGas: Wei | None maxPriorityFeePerGas: Wei | None @@ -143,7 +143,7 @@ def __init__( @dataclass(frozen=True) class CreateEntityReturnType: - """The return type of a Golem Base create operation.""" + """The return type of a GolemDB create operation.""" expiration_block: int entity_key: EntityKey @@ -151,7 +151,7 @@ class CreateEntityReturnType: @dataclass(frozen=True) class UpdateEntityReturnType: - """The return type of a Golem Base update operation.""" + """The return type of a GolemDB update operation.""" expiration_block: int entity_key: EntityKey @@ -159,7 +159,7 @@ class UpdateEntityReturnType: @dataclass(frozen=True) class ExtendEntityReturnType: - """The return type of a Golem Base extend operation.""" + """The return type of a GolemDB extend operation.""" old_expiration_block: int new_expiration_block: int @@ -167,8 +167,8 @@ class ExtendEntityReturnType: @dataclass(frozen=True) -class GolemBaseTransactionReceipt: - """The return type of a Golem Base transaction.""" +class GolemDBTransactionReceipt: + """The return type of a GolemDB transaction.""" creates: Sequence[CreateEntityReturnType] updates: Sequence[UpdateEntityReturnType] @@ -189,7 +189,7 @@ class EntityMetadata: @dataclass(frozen=True) class QueryEntitiesResult: - """A class representing the return value of a Golem Base query.""" + """A class representing the return value of a GolemDB query.""" entity_key: EntityKey storage_value: bytes @@ -198,7 +198,7 @@ class QueryEntitiesResult: @dataclass(frozen=True) class WatchLogsHandle: """ - Class returned by `GolemBaseClient.watch_logs`. + Class returned by `GolemDBClient.watch_logs`. Allows you to unsubscribe from the associated subscription. """ diff --git a/golem_base_sdk/utils.py b/golem_base_sdk/utils.py index 4e3a32f..92185ea 100644 --- a/golem_base_sdk/utils.py +++ b/golem_base_sdk/utils.py @@ -7,15 +7,15 @@ from .types import ( Annotation, - GolemBaseTransaction, + GolemDBTransaction, ) logger = logging.getLogger(__name__) """@private""" -def rlp_encode_transaction(tx: GolemBaseTransaction) -> bytes: - """Encode a Golem Base transaction in RLP.""" +def rlp_encode_transaction(tx: GolemDBTransaction) -> bytes: + """Encode a GolemDB transaction in RLP.""" # TODO: use new generic syntax once we can bump to python 3.12 or higher T = TypeVar("T") diff --git a/pyproject.toml b/pyproject.toml index db303fc..add6089 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ name = "golem-base-sdk" authors = [ {name = "rvdp", email = "online@well-founded.dev"}, ] -version = "0.1.0" +version = "0.2.0" readme = "README.md" license = "GPL-3.0-only" requires-python = ">=3.10" diff --git a/uv.lock b/uv.lock index f4f97b4..b075f0d 100644 --- a/uv.lock +++ b/uv.lock @@ -718,7 +718,7 @@ wheels = [ [[package]] name = "golem-base-sdk" -version = "0.1.0" +version = "0.2.0" source = { editable = "." } dependencies = [ { name = "anyio" },