Skip to content
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
16 changes: 16 additions & 0 deletions src/blindpay/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
from blindpay.resources.payouts.payouts import PayoutsResource, PayoutsResourceSync
from blindpay.resources.quotes.quotes import QuotesResource, QuotesResourceSync
from blindpay.resources.receivers.receivers import ReceiversResource, ReceiversResourceSync
from blindpay.resources.terms_of_service.terms_of_service import (
TermsOfServiceResource,
TermsOfServiceResourceSync,
)
from blindpay.resources.virtual_accounts.virtual_accounts import (
VirtualAccountsResource,
VirtualAccountsResourceSync,
Expand Down Expand Up @@ -161,6 +165,12 @@ def webhook_endpoints(self) -> "WebhookEndpointsResource":

return create_webhook_endpoints_resource(self._instance_id, self._api)

@cached_property
def terms_of_service(self) -> "TermsOfServiceResource":
from blindpay.resources.terms_of_service import create_terms_of_service_resource

return create_terms_of_service_resource(self._instance_id, self._api)

def __getattr__(self, name: str) -> Any:
return getattr(self._base, name)

Expand Down Expand Up @@ -355,6 +365,12 @@ def webhook_endpoints(self) -> "WebhookEndpointsResourceSync":

return create_webhook_endpoints_resource_sync(self._instance_id, self._api)

@cached_property
def terms_of_service(self) -> "TermsOfServiceResourceSync":
from blindpay.resources.terms_of_service import create_terms_of_service_resource_sync

return create_terms_of_service_resource_sync(self._instance_id, self._api)

def __getattr__(self, name: str) -> Any:
return getattr(self._base, name)

Expand Down
2 changes: 2 additions & 0 deletions src/blindpay/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from .payouts import create_payouts_resource
from .quotes import create_quotes_resource
from .receivers import create_receivers_resource
from .terms_of_service import create_terms_of_service_resource
from .virtual_accounts import create_virtual_accounts_resource
from .wallets import create_blockchain_wallets_resource, create_offramp_wallets_resource
from .webhooks import create_webhook_endpoints_resource
Expand All @@ -22,6 +23,7 @@
"create_payouts_resource",
"create_quotes_resource",
"create_receivers_resource",
"create_terms_of_service_resource",
"create_virtual_accounts_resource",
"create_blockchain_wallets_resource",
"create_offramp_wallets_resource",
Expand Down
17 changes: 17 additions & 0 deletions src/blindpay/resources/terms_of_service/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from .terms_of_service import (
InitiateInput,
InitiateResponse,
TermsOfServiceResource,
TermsOfServiceResourceSync,
create_terms_of_service_resource,
create_terms_of_service_resource_sync,
)

__all__ = [
"create_terms_of_service_resource",
"create_terms_of_service_resource_sync",
"TermsOfServiceResource",
"TermsOfServiceResourceSync",
"InitiateInput",
"InitiateResponse",
]
42 changes: 42 additions & 0 deletions src/blindpay/resources/terms_of_service/terms_of_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from typing_extensions import Optional, TypedDict

from ..._internal.api_client import InternalApiClient, InternalApiClientSync
from ...types import BlindpayApiResponse


class InitiateInput(TypedDict):
idempotency_key: str
receiver_id: Optional[str]
redirect_url: Optional[str]


class InitiateResponse(TypedDict):
url: str


class TermsOfServiceResource:
def __init__(self, instance_id: str, client: InternalApiClient):
self._instance_id = instance_id
self._client = client

async def initiate(self, data: InitiateInput) -> BlindpayApiResponse[InitiateResponse]:
return await self._client.post(f"/e/instances/{self._instance_id}/tos", data)


class TermsOfServiceResourceSync:
def __init__(self, instance_id: str, client: InternalApiClientSync):
self._instance_id = instance_id
self._client = client

def initiate(self, data: InitiateInput) -> BlindpayApiResponse[InitiateResponse]:
return self._client.post(f"/e/instances/{self._instance_id}/tos", data)


def create_terms_of_service_resource(instance_id: str, client: InternalApiClient) -> TermsOfServiceResource:
return TermsOfServiceResource(instance_id, client)


def create_terms_of_service_resource_sync(
instance_id: str, client: InternalApiClientSync
) -> TermsOfServiceResourceSync:
return TermsOfServiceResourceSync(instance_id, client)
29 changes: 29 additions & 0 deletions src/blindpay/resources/wallets/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,27 @@ class MintUsdbStellarInput(TypedDict):
signedXdr: str


class MintUsdbSolanaInput(TypedDict):
address: str
amount: str


class MintUsdbSolanaResponse(TypedDict):
success: bool
signature: str


class PrepareSolanaDelegationTransactionInput(TypedDict):
amount: str
owner_address: str
token_address: str


class PrepareSolanaDelegationTransactionResponse(TypedDict):
success: bool
transaction: str


class BlockchainWalletsResource:
def __init__(self, instance_id: str, client: InternalApiClient):
self._instance_id = instance_id
Expand Down Expand Up @@ -110,6 +131,14 @@ async def create_asset_trustline(self, address: str) -> BlindpayApiResponse[Crea
async def mint_usdb_stellar(self, data: MintUsdbStellarInput) -> BlindpayApiResponse[None]:
return await self._client.post(f"/instances/{self._instance_id}/mint-usdb-stellar", data)

async def mint_usdb_solana(self, data: MintUsdbSolanaInput) -> BlindpayApiResponse[MintUsdbSolanaResponse]:
return await self._client.post(f"/instances/{self._instance_id}/mint-usdb-solana", data)

async def prepare_solana_delegation_transaction(
self, data: PrepareSolanaDelegationTransactionInput
) -> BlindpayApiResponse[PrepareSolanaDelegationTransactionResponse]:
return await self._client.post(f"/instances/{self._instance_id}/prepare-delegate-solana", data)


class BlockchainWalletsResourceSync:
def __init__(self, instance_id: str, client: InternalApiClientSync):
Expand Down