Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PSDK-500] Contract Invocation Support #13

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading