Skip to content

Commit

Permalink
wallet webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
howard-at-cb committed Oct 18, 2024
1 parent bf7da70 commit ac912ff
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions cdp/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from cdp.address import Address
from cdp.balance_map import BalanceMap
from cdp.cdp import Cdp
from cdp.client.models.create_wallet_webhook_request import CreateWalletWebhookRequest
from cdp.client.models.address import Address as AddressModel
from cdp.client.models.create_address_request import CreateAddressRequest
from cdp.client.models.create_wallet_request import (
Expand All @@ -33,6 +34,7 @@
from cdp.trade import Trade
from cdp.wallet_address import WalletAddress
from cdp.wallet_data import WalletData
from cdp.webhook import Webhook


class Wallet:
Expand Down Expand Up @@ -286,6 +288,24 @@ def create_address(self) -> "WalletAddress":

return wallet_address

def create_webhook(self, notification_uri: str) -> "Webhook":
"""Create a new webhook for the wallet.
Returns:
Webhook: The created webhook object.
Raises:
Exception: If there's an error creating the webhook.
"""

create_wallet_webhook_request = CreateWalletWebhookRequest(notification_uri = notification_uri)
model = Cdp.api_clients.webhooks.create_wallet_webhook(
wallet_id=self.id, create_wallet_webhook_request=create_wallet_webhook_request
)

return Webhook(model)

def faucet(self, asset_id: str | None = None) -> FaucetTransaction:
"""Request faucet funds.
Expand Down
2 changes: 1 addition & 1 deletion cdp/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def update(
notification_uri: str | None = None,
event_type_filter: WebhookEventTypeFilter | None = None
) -> "Webhook":
"""Updates the webhook with a new notification URI, and/or a new list of addresses to monitor.
"""Update the webhook with a new notification URI, and/or a new list of addresses to monitor.
Args:
notification_uri (str): The new URI for webhook notifications.
Expand Down

0 comments on commit ac912ff

Please sign in to comment.