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

feat(PSDK-782): allow users to send sponsored transactions immediately #73

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# CDP Python SDK Changelog

## [0.14.0] - 2025-01-16
## Unreleased

### Added
- Add `Webhook.delete_webhook` instance method to delete a webhook instance.
- Add `skip_batching` option to `Wallet.transfer` to allow for lower latency gasless transfers.

### Deprecated
- Deprecate `Webhook.delete` static method in `Webhook` which deletes a webhook by its ID.
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pip install cdp-sdk
```

if you prefer to manage dependencies with Poetry:

```bash
poetry add cdp-sdk
```
Expand Down Expand Up @@ -155,6 +156,12 @@ print(f"Faucet transaction successfully completed: {usdc_faucet_tx}")
transfer = wallet1.transfer(0.00001, "usdc", wallet3, gasless=True).wait()
```

By default, gasless transfers are batched with other transfers, and might take longer to submit. If you want to opt out of batching, you can set the `skip_batching` option to `True`, which will submit the transaction immediately.

```python
transfer = wallet1.transfer(0.00001, "usdc", wallet3, gasless=True, skip_batching=True).wait()
```

### Listing Transfers

```python
Expand Down Expand Up @@ -239,7 +246,9 @@ fetched_wallet.load_seed(file_path)
```

### Creating a Webhook

A webhook is a way to provide other applications with real-time information from the blockchain. When an event occurs on a blockchain address, it can send a POST request to a URL you specify. You can create a webhook to receive notifications about events that occur in your wallet or crypto address, such as when a user makes a transfer.

```python
from cdp.client.models.webhook import WebhookEventType
from cdp.client.models.webhook import WebhookEventFilter
Expand All @@ -252,10 +261,13 @@ wh1 = Webhook.create(
)
print(wh1)
```

In the above example, parameter `network_id` is optional, if not provided, the default network is `base-sepolia`. Today we support Base mainnet and Base Sepolia networks.

### Creating a Webhook On A Wallet

A webhook can be attached to an existing wallet to monitor events that occur on the wallet, i.e. all addresses associated with this wallet. A list of supported blockchain events can be found [here](https://docs.cdp.coinbase.com/get-started/docs/webhooks/event-types).

```python
import cdp

Expand All @@ -265,9 +277,9 @@ print(wh1)
```

## Examples

Examples, demo apps, and further code samples can be found in the [CDP SDK Python Documentation](https://docs.cdp.coinbase.com/cdp-apis/docs/welcome).

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for more information.

2 changes: 2 additions & 0 deletions cdp/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
from cdp.client.models.asset import Asset
from cdp.client.models.balance import Balance
from cdp.client.models.broadcast_contract_invocation_request import BroadcastContractInvocationRequest
from cdp.client.models.broadcast_external_transfer_request import BroadcastExternalTransferRequest
from cdp.client.models.broadcast_staking_operation_request import BroadcastStakingOperationRequest
from cdp.client.models.broadcast_trade_request import BroadcastTradeRequest
from cdp.client.models.broadcast_transfer_request import BroadcastTransferRequest
Expand All @@ -70,6 +71,7 @@
from cdp.client.models.contract_invocation_list import ContractInvocationList
from cdp.client.models.create_address_request import CreateAddressRequest
from cdp.client.models.create_contract_invocation_request import CreateContractInvocationRequest
from cdp.client.models.create_external_transfer_request import CreateExternalTransferRequest
from cdp.client.models.create_fund_operation_request import CreateFundOperationRequest
from cdp.client.models.create_fund_quote_request import CreateFundQuoteRequest
from cdp.client.models.create_payload_signature_request import CreatePayloadSignatureRequest
Expand Down
Loading
Loading