Skip to content

Commit

Permalink
[PSDK-500] Contract Invocation Support
Browse files Browse the repository at this point in the history
  • Loading branch information
John-peterson-coinbase committed Sep 29, 2024
1 parent 105bc8c commit 4786f45
Show file tree
Hide file tree
Showing 9 changed files with 954 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Added

- Contract invocation support.

## [0.0.3] - 2024-09-25

### Added
Expand Down
2 changes: 2 additions & 0 deletions cdp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from cdp.balance import Balance
from cdp.balance_map import BalanceMap
from cdp.cdp import Cdp
from cdp.contract_invocation import ContractInvocation
from cdp.faucet_transaction import FaucetTransaction
from cdp.sponsored_send import SponsoredSend
from cdp.trade import Trade
Expand All @@ -15,6 +16,7 @@
__all__ = [
"__version__",
"Cdp",
"ContractInvocation",
"Wallet",
"WalletData",
"Asset",
Expand Down
18 changes: 18 additions & 0 deletions cdp/api_clients.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from cdp.cdp_api_client import CdpApiClient
from cdp.client.api.addresses_api import AddressesApi
from cdp.client.api.assets_api import AssetsApi
from cdp.client.api.contract_invocations_api import ContractInvocationsApi
from cdp.client.api.external_addresses_api import ExternalAddressesApi
from cdp.client.api.networks_api import NetworksApi
from cdp.client.api.trades_api import TradesApi
Expand All @@ -23,6 +24,7 @@ class ApiClients:
_networks (Optional[NetworksApi]): The NetworksApi client instance.
_assets (Optional[AssetsApi]): The AssetsApi client instance.
_trades (Optional[TradesApi]): The TradesApi client instance.
_contract_invocations (Optional[ContractInvocationsApi]): The ContractInvocationsApi client instance.
"""

Expand All @@ -41,6 +43,7 @@ def __init__(self, cdp_client: CdpApiClient) -> None:
self._networks: NetworksApi | None = None
self._assets: AssetsApi | None = None
self._trades: TradesApi | None = None
self._contract_invocations: ContractInvocationsApi | None = None

@property
def wallets(self) -> WalletsApi:
Expand Down Expand Up @@ -146,3 +149,18 @@ def trades(self) -> TradesApi:
if self._trades is None:
self._trades = TradesApi(api_client=self._cdp_client)
return self._trades

@property
def contract_invocations(self) -> ContractInvocationsApi:
"""Get the ContractInvocationsApi client instance.
Returns:
ContractInvocationsApi: The ContractInvocationsApi client instance.
Note:
This property lazily initializes the ContractInvocationsApi client on first access.
"""
if self._contract_invocations is None:
self._contract_invocations = ContractInvocationsApi(api_client=self._cdp_client)
return self._contract_invocations
Loading

0 comments on commit 4786f45

Please sign in to comment.