Skip to content
Open
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
163 changes: 163 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10413,6 +10413,92 @@ components:
- action
- operation
- criteria
RateLimitingCriterion:
x-audience: development
type: object
title: RateLimitingCriterion
description: A criterion that limits the number or value of operations within a time window. When the limit is exceeded, subsequent operations matching this criterion will be rejected until the window resets.
properties:
type:
type: string
description: The type of criterion to use. This should be `rateLimiting`.
example: rateLimiting
enum:
- rateLimiting
window:
type: string
description: The time window for the rate limit. Operations are counted within this rolling window.
example: 4d2h45m
maxCount:
type: integer
description: The maximum number of operations allowed within the window. When the count is exceeded, subsequent operations will be rejected. Mutually exclusive with `maxValueCents`.
example: 10
maxValueCents:
type: integer
description: The maximum cumulative USD value in cents of operations allowed within the window. When the value is exceeded, subsequent operations will be rejected. Mutually exclusive with `maxCount`.
example: 100000
required:
- type
- window
SendEndUserEvmAssetCriteria:
x-audience: development
type: array
description: A schema for specifying criteria for the sendEndUserEvmAsset operation.
items:
oneOf:
- $ref: '#/components/schemas/EthValueCriterion'
- $ref: '#/components/schemas/EvmAddressCriterion'
- $ref: '#/components/schemas/EvmNetworkCriterion'
- $ref: '#/components/schemas/EvmDataCriterion'
- $ref: '#/components/schemas/NetUSDChangeCriterion'
- $ref: '#/components/schemas/RateLimitingCriterion'
example:
- type: ethValue
ethValue: '1000000'
operator: '>='
- type: evmAddress
addresses:
- '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
operator: in
- type: evmNetwork
networks:
- base
- ethereum
operator: in
- type: evmData
abi: erc20
conditions:
- function: transfer
params:
- name: value
operator: <=
value: '10000'
- type: netUSDChange
changeCents: 10000
operator: <=
SendEndUserEvmAssetRule:
x-audience: development
title: SendEndUserEvmAssetRule
properties:
action:
type: string
description: Whether matching the rule will cause the request to be rejected or accepted.
example: accept
enum:
- reject
- accept
operation:
type: string
description: The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
example: sendEndUserEvmAsset
enum:
- sendEndUserEvmAsset
criteria:
$ref: '#/components/schemas/SendEndUserEvmAssetCriteria'
required:
- action
- operation
- criteria
SignEndUserEvmMessageCriteria:
x-audience: public
type: array
Expand Down Expand Up @@ -10652,6 +10738,81 @@ components:
- action
- operation
- criteria
SendEndUserSolAssetCriteria:
x-audience: development
type: array
description: A schema for specifying criteria for the sendEndUserSolAsset operation.
items:
oneOf:
- $ref: '#/components/schemas/SolAddressCriterion'
- $ref: '#/components/schemas/SolValueCriterion'
- $ref: '#/components/schemas/SplAddressCriterion'
- $ref: '#/components/schemas/SplValueCriterion'
- $ref: '#/components/schemas/MintAddressCriterion'
- $ref: '#/components/schemas/SolDataCriterion'
- $ref: '#/components/schemas/ProgramIdCriterion'
- $ref: '#/components/schemas/SolNetworkCriterion'
- $ref: '#/components/schemas/RateLimitingCriterion'
example:
- type: solAddress
addresses:
- HpabPRRCFbBKSuJr5PdkVvQc85FyxyTWkFM2obBRSvHT
operator: in
- type: solValue
solValue: '1000000000000000000'
operator: <=
- type: splAddress
addresses:
- HpabPRRCFbBKSuJr5PdkVvQc85FyxyTWkFM2obBRSvHT
operator: in
- type: splValue
splValue: '1000000000000000000'
operator: <=
- type: mintAddress
addresses:
- HpabPRRCFbBKSuJr5PdkVvQc85FyxyTWkFM2obBRSvHT
operator: in
- type: solData
idls:
- SystemProgram
conditions:
- instruction: transfer_checked
params:
- name: lamports
operator: <=
value: '1000000'
- type: programId
programIds:
- TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
operator: in
- type: solNetwork
networks:
- solana-devnet
- solana
operator: in
SendEndUserSolAssetRule:
x-audience: development
title: SendEndUserSolAssetRule
properties:
action:
type: string
description: Whether matching the rule will cause the request to be rejected or accepted.
example: accept
enum:
- reject
- accept
operation:
type: string
description: The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
example: sendEndUserSolAsset
enum:
- sendEndUserSolAsset
criteria:
$ref: '#/components/schemas/SendEndUserSolAssetCriteria'
required:
- action
- operation
- criteria
SignEndUserSolMessageCriteria:
x-audience: public
type: array
Expand Down Expand Up @@ -10706,6 +10867,8 @@ components:
- $ref: '#/components/schemas/SignEndUserSolTransactionRule'
- $ref: '#/components/schemas/SendEndUserSolTransactionRule'
- $ref: '#/components/schemas/SignEndUserSolMessageRule'
- $ref: '#/components/schemas/SendEndUserEvmAssetRule'
- $ref: '#/components/schemas/SendEndUserSolAssetRule'
example:
action: accept
operation: signEvmTransaction
Expand Down
5 changes: 5 additions & 0 deletions python/cdp/openapi_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,18 @@
from cdp.openapi_client.models.prepare_user_operation_rule import PrepareUserOperationRule
from cdp.openapi_client.models.program_id_criterion import ProgramIdCriterion
from cdp.openapi_client.models.query_result_cache_configuration import QueryResultCacheConfiguration
from cdp.openapi_client.models.rate_limiting_criterion import RateLimitingCriterion
from cdp.openapi_client.models.request_evm_faucet200_response import RequestEvmFaucet200Response
from cdp.openapi_client.models.request_evm_faucet_request import RequestEvmFaucetRequest
from cdp.openapi_client.models.request_solana_faucet200_response import RequestSolanaFaucet200Response
from cdp.openapi_client.models.request_solana_faucet_request import RequestSolanaFaucetRequest
from cdp.openapi_client.models.revoke_spend_permission_request import RevokeSpendPermissionRequest
from cdp.openapi_client.models.rule import Rule
from cdp.openapi_client.models.send_end_user_evm_asset_criteria_inner import SendEndUserEvmAssetCriteriaInner
from cdp.openapi_client.models.send_end_user_evm_asset_rule import SendEndUserEvmAssetRule
from cdp.openapi_client.models.send_end_user_evm_transaction_rule import SendEndUserEvmTransactionRule
from cdp.openapi_client.models.send_end_user_sol_asset_criteria_inner import SendEndUserSolAssetCriteriaInner
from cdp.openapi_client.models.send_end_user_sol_asset_rule import SendEndUserSolAssetRule
from cdp.openapi_client.models.send_end_user_sol_transaction_rule import SendEndUserSolTransactionRule
from cdp.openapi_client.models.send_evm_transaction200_response import SendEvmTransaction200Response
from cdp.openapi_client.models.send_evm_transaction_criteria_inner import SendEvmTransactionCriteriaInner
Expand Down
5 changes: 5 additions & 0 deletions python/cdp/openapi_client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,18 @@
from cdp.openapi_client.models.prepare_user_operation_rule import PrepareUserOperationRule
from cdp.openapi_client.models.program_id_criterion import ProgramIdCriterion
from cdp.openapi_client.models.query_result_cache_configuration import QueryResultCacheConfiguration
from cdp.openapi_client.models.rate_limiting_criterion import RateLimitingCriterion
from cdp.openapi_client.models.request_evm_faucet200_response import RequestEvmFaucet200Response
from cdp.openapi_client.models.request_evm_faucet_request import RequestEvmFaucetRequest
from cdp.openapi_client.models.request_solana_faucet200_response import RequestSolanaFaucet200Response
from cdp.openapi_client.models.request_solana_faucet_request import RequestSolanaFaucetRequest
from cdp.openapi_client.models.revoke_spend_permission_request import RevokeSpendPermissionRequest
from cdp.openapi_client.models.rule import Rule
from cdp.openapi_client.models.send_end_user_evm_asset_criteria_inner import SendEndUserEvmAssetCriteriaInner
from cdp.openapi_client.models.send_end_user_evm_asset_rule import SendEndUserEvmAssetRule
from cdp.openapi_client.models.send_end_user_evm_transaction_rule import SendEndUserEvmTransactionRule
from cdp.openapi_client.models.send_end_user_sol_asset_criteria_inner import SendEndUserSolAssetCriteriaInner
from cdp.openapi_client.models.send_end_user_sol_asset_rule import SendEndUserSolAssetRule
from cdp.openapi_client.models.send_end_user_sol_transaction_rule import SendEndUserSolTransactionRule
from cdp.openapi_client.models.send_evm_transaction200_response import SendEvmTransaction200Response
from cdp.openapi_client.models.send_evm_transaction_criteria_inner import SendEvmTransactionCriteriaInner
Expand Down
101 changes: 101 additions & 0 deletions python/cdp/openapi_client/models/rate_limiting_criterion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# coding: utf-8

"""
Coinbase Developer Platform APIs

The Coinbase Developer Platform APIs - leading the world's transition onchain.

The version of the OpenAPI document: 2.0.0
Contact: cdp@coinbase.com
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
""" # noqa: E501


from __future__ import annotations
import pprint
import re # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class RateLimitingCriterion(BaseModel):
"""
A criterion that limits the number or value of operations within a time window. When the limit is exceeded, subsequent operations matching this criterion will be rejected until the window resets.
""" # noqa: E501
type: StrictStr = Field(description="The type of criterion to use. This should be `rateLimiting`.")
window: StrictStr = Field(description="The time window for the rate limit. Operations are counted within this rolling window.")
max_count: Optional[StrictInt] = Field(default=None, description="The maximum number of operations allowed within the window. When the count is exceeded, subsequent operations will be rejected. Mutually exclusive with `maxValueCents`.", alias="maxCount")
max_value_cents: Optional[StrictInt] = Field(default=None, description="The maximum cumulative USD value in cents of operations allowed within the window. When the value is exceeded, subsequent operations will be rejected. Mutually exclusive with `maxCount`.", alias="maxValueCents")
__properties: ClassVar[List[str]] = ["type", "window", "maxCount", "maxValueCents"]

@field_validator('type')
def type_validate_enum(cls, value):
"""Validates the enum"""
if value not in set(['rateLimiting']):
raise ValueError("must be one of enum values ('rateLimiting')")
return value

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
)


def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of RateLimitingCriterion from a JSON string"""
return cls.from_dict(json.loads(json_str))

def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:

* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])

_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
return _dict

@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of RateLimitingCriterion from a dict"""
if obj is None:
return None

if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate({
"type": obj.get("type"),
"window": obj.get("window"),
"maxCount": obj.get("maxCount"),
"maxValueCents": obj.get("maxValueCents")
})
return _obj


Loading
Loading