From a3694a33269995d1d3e32859273d2f22bca67265 Mon Sep 17 00:00:00 2001 From: fireblocks_dx_team Date: Mon, 17 Mar 2025 09:57:54 +0000 Subject: [PATCH] Generated SDK #645 --- .openapi-generator/FILES | 3 + README.md | 6 +- docs/ContractUploadRequest.md | 2 +- docs/InternalWalletsApi.md | 175 +++++++++++++++++- docs/PaginatedAssetsResponse.md | 31 ++++ docs/TransactionOperation.md | 4 +- fireblocks/__init__.py | 1 + fireblocks/api/internal_wallets_api.py | 170 +++++++++++++++-- fireblocks/models/__init__.py | 1 + fireblocks/models/contract_upload_request.py | 5 +- .../models/paginated_assets_response.py | 96 ++++++++++ fireblocks/models/transaction_operation.py | 3 +- test/test_contract_upload_request.py | 1 + test/test_internal_wallets_api.py | 11 +- test/test_paginated_assets_response.py | 83 +++++++++ 15 files changed, 562 insertions(+), 30 deletions(-) create mode 100644 docs/PaginatedAssetsResponse.md create mode 100644 fireblocks/models/paginated_assets_response.py create mode 100644 test/test_paginated_assets_response.py diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index e89f3268..8a06beda 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -297,6 +297,7 @@ docs/PaginatedAddressResponse.md docs/PaginatedAddressResponsePaging.md docs/PaginatedAssetWalletResponse.md docs/PaginatedAssetWalletResponsePaging.md +docs/PaginatedAssetsResponse.md docs/Paging.md docs/PairApiKeyRequest.md docs/PairApiKeyResponse.md @@ -898,6 +899,7 @@ fireblocks/models/paginated_address_response.py fireblocks/models/paginated_address_response_paging.py fireblocks/models/paginated_asset_wallet_response.py fireblocks/models/paginated_asset_wallet_response_paging.py +fireblocks/models/paginated_assets_response.py fireblocks/models/paging.py fireblocks/models/pair_api_key_request.py fireblocks/models/pair_api_key_response.py @@ -1478,6 +1480,7 @@ test/test_paginated_address_response.py test/test_paginated_address_response_paging.py test/test_paginated_asset_wallet_response.py test/test_paginated_asset_wallet_response_paging.py +test/test_paginated_assets_response.py test/test_paging.py test/test_pair_api_key_request.py test/test_pair_api_key_response.py diff --git a/README.md b/README.md index b14f1eb6..724e6255 100644 --- a/README.md +++ b/README.md @@ -318,9 +318,10 @@ Class | Method | HTTP request | Description *InternalWalletsApi* | [**create_internal_wallet**](docs/InternalWalletsApi.md#create_internal_wallet) | **POST** /internal_wallets | Create an internal wallet *InternalWalletsApi* | [**create_internal_wallet_asset**](docs/InternalWalletsApi.md#create_internal_wallet_asset) | **POST** /internal_wallets/{walletId}/{assetId} | Add an asset to an internal wallet *InternalWalletsApi* | [**delete_internal_wallet**](docs/InternalWalletsApi.md#delete_internal_wallet) | **DELETE** /internal_wallets/{walletId} | Delete an internal wallet -*InternalWalletsApi* | [**delete_internal_wallet_asset**](docs/InternalWalletsApi.md#delete_internal_wallet_asset) | **DELETE** /internal_wallets/{walletId}/{assetId} | Delete a whitelisted address from an internal wallet -*InternalWalletsApi* | [**get_internal_wallet**](docs/InternalWalletsApi.md#get_internal_wallet) | **GET** /internal_wallets/{walletId} | Get assets for internal wallet +*InternalWalletsApi* | [**delete_internal_wallet_asset**](docs/InternalWalletsApi.md#delete_internal_wallet_asset) | **DELETE** /internal_wallets/{walletId}/{assetId} | Delete a whitelisted address +*InternalWalletsApi* | [**get_internal_wallet**](docs/InternalWalletsApi.md#get_internal_wallet) | **GET** /internal_wallets/{walletId} | Get an asset from an internal wallet *InternalWalletsApi* | [**get_internal_wallet_asset**](docs/InternalWalletsApi.md#get_internal_wallet_asset) | **GET** /internal_wallets/{walletId}/{assetId} | Get an asset from an internal wallet +*InternalWalletsApi* | [**get_internal_wallet_assets_paginated**](docs/InternalWalletsApi.md#get_internal_wallet_assets_paginated) | **GET** /internal_wallets/{walletId}/assets | List assets in an internal wallet (Paginated) *InternalWalletsApi* | [**get_internal_wallets**](docs/InternalWalletsApi.md#get_internal_wallets) | **GET** /internal_wallets | List internal wallets *InternalWalletsApi* | [**set_customer_ref_id_for_internal_wallet**](docs/InternalWalletsApi.md#set_customer_ref_id_for_internal_wallet) | **POST** /internal_wallets/{walletId}/set_customer_ref_id | Set an AML/KYT customer reference ID for an internal wallet *JobManagementApi* | [**cancel_job**](docs/JobManagementApi.md#cancel_job) | **POST** /batch/{jobId}/cancel | Cancel a running job @@ -765,6 +766,7 @@ Class | Method | HTTP request | Description - [PaginatedAddressResponsePaging](docs/PaginatedAddressResponsePaging.md) - [PaginatedAssetWalletResponse](docs/PaginatedAssetWalletResponse.md) - [PaginatedAssetWalletResponsePaging](docs/PaginatedAssetWalletResponsePaging.md) + - [PaginatedAssetsResponse](docs/PaginatedAssetsResponse.md) - [Paging](docs/Paging.md) - [PairApiKeyRequest](docs/PairApiKeyRequest.md) - [PairApiKeyResponse](docs/PairApiKeyResponse.md) diff --git a/docs/ContractUploadRequest.md b/docs/ContractUploadRequest.md index 449fdd2c..d16a54d5 100644 --- a/docs/ContractUploadRequest.md +++ b/docs/ContractUploadRequest.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **long_description** | **str** | A full description of the contract template. May contain to break the lines | [optional] **bytecode** | **str** | The compiled artifact of this smart contract. Used for deployment of this contract template | **sourcecode** | **str** | The source code of the contract. Optional. | [optional] -**type** | **str** | The type of the contract template | [optional] +**type** | **str** | The type of the contract template | **docs** | [**ContractDoc**](ContractDoc.md) | A `natspec` compliant documentation json. Can be retrieved from the output json after compilation | [optional] **abi** | [**List[AbiFunction]**](AbiFunction.md) | The abi of the contract template. Necessary for displaying and for after deployment encoding | **attributes** | [**ContractAttributes**](ContractAttributes.md) | The attributes related to this contract template. It will be displayed in the tokenization page | [optional] diff --git a/docs/InternalWalletsApi.md b/docs/InternalWalletsApi.md index 2e1a8978..b33b02b1 100644 --- a/docs/InternalWalletsApi.md +++ b/docs/InternalWalletsApi.md @@ -7,9 +7,10 @@ Method | HTTP request | Description [**create_internal_wallet**](InternalWalletsApi.md#create_internal_wallet) | **POST** /internal_wallets | Create an internal wallet [**create_internal_wallet_asset**](InternalWalletsApi.md#create_internal_wallet_asset) | **POST** /internal_wallets/{walletId}/{assetId} | Add an asset to an internal wallet [**delete_internal_wallet**](InternalWalletsApi.md#delete_internal_wallet) | **DELETE** /internal_wallets/{walletId} | Delete an internal wallet -[**delete_internal_wallet_asset**](InternalWalletsApi.md#delete_internal_wallet_asset) | **DELETE** /internal_wallets/{walletId}/{assetId} | Delete a whitelisted address from an internal wallet -[**get_internal_wallet**](InternalWalletsApi.md#get_internal_wallet) | **GET** /internal_wallets/{walletId} | Get assets for internal wallet +[**delete_internal_wallet_asset**](InternalWalletsApi.md#delete_internal_wallet_asset) | **DELETE** /internal_wallets/{walletId}/{assetId} | Delete a whitelisted address +[**get_internal_wallet**](InternalWalletsApi.md#get_internal_wallet) | **GET** /internal_wallets/{walletId} | Get an asset from an internal wallet [**get_internal_wallet_asset**](InternalWalletsApi.md#get_internal_wallet_asset) | **GET** /internal_wallets/{walletId}/{assetId} | Get an asset from an internal wallet +[**get_internal_wallet_assets_paginated**](InternalWalletsApi.md#get_internal_wallet_assets_paginated) | **GET** /internal_wallets/{walletId}/assets | List assets in an internal wallet (Paginated) [**get_internal_wallets**](InternalWalletsApi.md#get_internal_wallets) | **GET** /internal_wallets | List internal wallets [**set_customer_ref_id_for_internal_wallet**](InternalWalletsApi.md#set_customer_ref_id_for_internal_wallet) | **POST** /internal_wallets/{walletId}/set_customer_ref_id | Set an AML/KYT customer reference ID for an internal wallet @@ -21,6 +22,10 @@ Create an internal wallet Creates a new internal wallet with the requested name. +Learn more about Whitelisted Internal Addresses [here](https://developers.fireblocks.com/docs/whitelist-addresses#internal-wallets) + +Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor. + ### Example @@ -98,6 +103,16 @@ Add an asset to an internal wallet Adds an asset to an existing internal wallet. +Internal Wallets are whitelisted wallets that belong to you outside of Fireblocks. + + - You can see the balance of the Internal Wallet via Fireblocks + - You cannot initiate transactions from Internal Wallets through Fireblocks + + Learn more about Whitelisted Internal Addresses +[here](https://developers.fireblocks.com/docs/whitelist-addresses#internal-wallets) + +Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor. + ### Example @@ -178,6 +193,12 @@ No authorization required Delete an internal wallet Deletes an internal wallet by ID. +Internal Wallets are whitelisted wallets that belong to you outside of Fireblocks. + + - You can see the balance of the Internal Wallet via Fireblocks + - You cannot initiate transactions from Internal Wallets through Fireblocks + +Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor. ### Example @@ -245,10 +266,19 @@ No authorization required # **delete_internal_wallet_asset** > delete_internal_wallet_asset(wallet_id, asset_id) -Delete a whitelisted address from an internal wallet +Delete a whitelisted address Deletes a whitelisted address (for an asset) from an internal wallet. +Internal Wallets are whitelisted wallets that belong to you outside of Fireblocks. + + - You can see the balance of the Internal Wallet via Fireblocks + - You cannot initiate transactions from Internal Wallets through Fireblocks + +Learn more about Whitelisted Internal Addresses [here](https://developers.fireblocks.com/docs/whitelist-addresses#internal-wallets) + +Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor. + ### Example @@ -276,7 +306,7 @@ with Fireblocks(configuration) as fireblocks: asset_id = 'asset_id_example' # str | The ID of the asset to delete try: - # Delete a whitelisted address from an internal wallet + # Delete a whitelisted address fireblocks.internal_wallets.delete_internal_wallet_asset(wallet_id, asset_id).result() except Exception as e: print("Exception when calling InternalWalletsApi->delete_internal_wallet_asset: %s\n" % e) @@ -317,9 +347,18 @@ No authorization required # **get_internal_wallet** > UnmanagedWallet get_internal_wallet(wallet_id) -Get assets for internal wallet +Get an asset from an internal wallet + +Returns information for an asset in an internal wallet. + +This endpoint will be deprecated after 6 months.
As part of the depreciation process this endpoint will no longer return balances, only addresses.
Until it is deprecated, this endpoint will behave the same way. + +Internal Wallets are whitelisted wallets that belong to you outside of Fireblocks. + + - You can see the balance of the Internal Wallet via Fireblocks + - You cannot initiate transactions from Internal Wallets through Fireblocks -Returns all assets in an internal wallet by ID. +Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer. ### Example @@ -349,7 +388,7 @@ with Fireblocks(configuration) as fireblocks: wallet_id = 'wallet_id_example' # str | The ID of the wallet to return try: - # Get assets for internal wallet + # Get an asset from an internal wallet api_response = fireblocks.internal_wallets.get_internal_wallet(wallet_id).result() print("The response of InternalWalletsApi->get_internal_wallet:\n") pprint(api_response) @@ -395,6 +434,15 @@ Get an asset from an internal wallet Returns information for an asset in an internal wallet. +Internal Wallets are whitelisted wallets that belong to you outside of Fireblocks. + + - You can see the balance of the Internal Wallet via Fireblocks + - You cannot initiate transactions from Internal Wallets through Fireblocks + +Learn more about Whitelisted Internal Addresses [here](https://developers.fireblocks.com/docs/whitelist-addresses#internal-wallets) + +Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer. + ### Example @@ -464,6 +512,95 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **get_internal_wallet_assets_paginated** +> PaginatedAssetsResponse get_internal_wallet_assets_paginated(wallet_id, page_size=page_size, page_cursor=page_cursor) + +List assets in an internal wallet (Paginated) + +Returns a paginated response of assets in an internal wallet. + +This is a new paginated endpoint that gets all the assets from the wallet container with balances.
This endpoint returns a limited amount of results with a quick response time. + +Internal Wallets are whitelisted wallets that belong to you outside of Fireblocks. + + - You can see the balance of the Internal Wallet via Fireblocks + - You cannot initiate transactions from Internal Wallets through Fireblocks + +Learn more about Whitelisted Internal Addresses [here](https://developers.fireblocks.com/docs/whitelist-addresses#internal-wallets) + +Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer. + +### Example + + +```python +from fireblocks.models.paginated_assets_response import PaginatedAssetsResponse +from fireblocks.client import Fireblocks +from fireblocks.client_configuration import ClientConfiguration +from fireblocks.exceptions import ApiException +from fireblocks.base_path import BasePath +from pprint import pprint + +# load the secret key content from a file +with open('your_secret_key_file_path', 'r') as file: + secret_key_value = file.read() + +# build the configuration +configuration = ClientConfiguration( + api_key="your_api_key", + secret_key=secret_key_value, + base_path=BasePath.Sandbox, # or set it directly to a string "https://sandbox-api.fireblocks.io/v1" +) + + +# Enter a context with an instance of the API client +with Fireblocks(configuration) as fireblocks: + wallet_id = 'wallet_id_example' # str | The ID of the internal wallet to return assets for + page_size = 50 # float | (optional) (default to 50) + page_cursor = 'page_cursor_example' # str | (optional) + + try: + # List assets in an internal wallet (Paginated) + api_response = fireblocks.internal_wallets.get_internal_wallet_assets_paginated(wallet_id, page_size=page_size, page_cursor=page_cursor).result() + print("The response of InternalWalletsApi->get_internal_wallet_assets_paginated:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling InternalWalletsApi->get_internal_wallet_assets_paginated: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **wallet_id** | **str**| The ID of the internal wallet to return assets for | + **page_size** | **float**| | [optional] [default to 50] + **page_cursor** | **str**| | [optional] + +### Return type + +[**PaginatedAssetsResponse**](PaginatedAssetsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A paginated response of assets for the internal wallet | * X-Request-ID -
| +**0** | Error Response | * X-Request-ID -
| + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **get_internal_wallets** > List[UnmanagedWallet] get_internal_wallets() @@ -471,8 +608,21 @@ List internal wallets Gets a list of internal wallets. -**Note**: BTC-based assets belonging to whitelisted addresses cannot be retrieved between 00:00 UTC and 00:01 UTC daily due to third-party provider, Blockchair, being unavailable for this 60 second period. Please wait until the next minute to retrieve BTC-based assets. + **Note**: +- BTC-based assets belonging to whitelisted addresses cannot be + retrieved between 00:00 UTC and 00:01 UTC daily due to third-party + provider, Blockchain, being unavailable for this 60 second period. +
Please wait until the next minute to retrieve BTC-based assets. +- The list of assets returned will NOT include the balances anymore. + +Internal Wallets are whitelisted wallets that belong to you outside of Fireblocks. + - You can see the balance of the Internal Wallet via Fireblocks + - You cannot initiate transactions from Internal Wallets through Fireblocks + +Learn more about Whitelisted Internal Addresses [here](https://developers.fireblocks.com/docs/whitelist-addresses#internal-wallets) + +Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer. ### Example @@ -544,6 +694,15 @@ Set an AML/KYT customer reference ID for an internal wallet Sets an AML/KYT customer reference ID for the specific internal wallet. +Internal Wallets are whitelisted wallets that belong to you outside of Fireblocks. + + - You can see the balance of the Internal Wallet via Fireblocks + - You cannot initiate transactions from Internal Wallets through Fireblocks + +Learn more about Whitelisted Internal Addresses [here](https://developers.fireblocks.com/docs/whitelist-addresses#internal-wallets) + +Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor. + ### Example diff --git a/docs/PaginatedAssetsResponse.md b/docs/PaginatedAssetsResponse.md new file mode 100644 index 00000000..90bdd79b --- /dev/null +++ b/docs/PaginatedAssetsResponse.md @@ -0,0 +1,31 @@ +# PaginatedAssetsResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total** | **float** | Total number of assets in the internal wallet | [optional] +**data** | [**UnmanagedWallet**](UnmanagedWallet.md) | | +**next** | **str** | Cursor for the next page of results | [optional] + +## Example + +```python +from fireblocks.models.paginated_assets_response import PaginatedAssetsResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of PaginatedAssetsResponse from a JSON string +paginated_assets_response_instance = PaginatedAssetsResponse.from_json(json) +# print the JSON string representation of the object +print(PaginatedAssetsResponse.to_json()) + +# convert the object into a dict +paginated_assets_response_dict = paginated_assets_response_instance.to_dict() +# create an instance of PaginatedAssetsResponse from a dict +paginated_assets_response_from_dict = PaginatedAssetsResponse.from_dict(paginated_assets_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TransactionOperation.md b/docs/TransactionOperation.md index 5ba57ebd..1fdf8e37 100644 --- a/docs/TransactionOperation.md +++ b/docs/TransactionOperation.md @@ -1,6 +1,6 @@ # TransactionOperation -* `TRANSFER` - The default value for an operation. Transfers funds from one account to another. UTXO blockchains allow multi-input and multi-output transfers. All other blockchains allow transfers with one source address and one destination address. * `MINT` - Mints new tokens. Supported for Stellar, Ripple and EVM-based blockchains. * `BURN` - Burns tokens. Supported for Stellar, Ripple and EVM-based blockchains. * `CONTRACT_CALL` - Calls a smart contract method for web3 operations on any EVM blockchain. The Fireblocks [development libraries](https://developers.fireblocks.com/docs/ethereum-development#convenience-libraries) are recommended for building contract call transactions. * `PROGRAM_CALL` - Execute multiple instructions on Solana blockchain. The @solana/web3.js library is recommended for building program call transactions. Currently in beta and disabled * `TYPED_MESSAGE` - An off-chain message in either Ethereum Personal Message or EIP712 format. Use it to sign specific readable messages that are not actual transactions. [Learn more about typed messages](https://developers.fireblocks.com/docs/typed-message-signing). * `RAW` - An off-chain message with no predefined format. Use it to sign any message with your private key, including protocols such as blockchains and custom transaction types that are not natively supported by Fireblocks. [Learn more about raw signing transactions.](https://developers.fireblocks.com/docs/raw-message-signing) +* `TRANSFER` - The default value for an operation. Transfers funds from one account to another. UTXO blockchains allow multi-input and multi-output transfers. All other blockchains allow transfers with one source address and one destination address. * `MINT` - Mints new tokens. Supported for Stellar, Ripple and EVM-based blockchains. * `BURN` - Burns tokens. Supported for Stellar, Ripple and EVM-based blockchains. * `CONTRACT_CALL` - Calls a smart contract method for web3 operations on any EVM blockchain. The Fireblocks [development libraries](https://developers.fireblocks.com/docs/ethereum-development#convenience-libraries) are recommended for building contract call transactions. * `PROGRAM_CALL` - Execute multiple instructions on Solana blockchain. The @solana/web3.js library is recommended for building program call transactions. Currently in beta and disabled * `TYPED_MESSAGE` - An off-chain message in either Ethereum Personal Message or EIP712 format. Use it to sign specific readable messages that are not actual transactions. [Learn more about typed messages](https://developers.fireblocks.com/docs/typed-message-signing). * `RAW` - An off-chain message with no predefined format. Use it to sign any message with your private key, including protocols such as blockchains and custom transaction types that are not natively supported by Fireblocks. [Learn more about raw signing transactions.](https://developers.fireblocks.com/docs/raw-message-signing) * `APPROVE` - Enables the approve function for a smart contract or wallet to withdraw from a designated wallet. [Learn more](https://support.fireblocks.io/hc/en-us/articles/4404616097426-Amount-Cap-for-Approve-transactions). ## Enum @@ -18,6 +18,8 @@ * `TYPED_MESSAGE` (value: `'TYPED_MESSAGE'`) +* `APPROVE` (value: `'APPROVE'`) + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/fireblocks/__init__.py b/fireblocks/__init__.py index a0a1f2c4..0a0f4ae8 100644 --- a/fireblocks/__init__.py +++ b/fireblocks/__init__.py @@ -496,6 +496,7 @@ from fireblocks.models.paginated_asset_wallet_response_paging import ( PaginatedAssetWalletResponsePaging, ) +from fireblocks.models.paginated_assets_response import PaginatedAssetsResponse from fireblocks.models.paging import Paging from fireblocks.models.pair_api_key_request import PairApiKeyRequest from fireblocks.models.pair_api_key_response import PairApiKeyResponse diff --git a/fireblocks/api/internal_wallets_api.py b/fireblocks/api/internal_wallets_api.py index 029d51ee..a021cc90 100644 --- a/fireblocks/api/internal_wallets_api.py +++ b/fireblocks/api/internal_wallets_api.py @@ -19,10 +19,11 @@ from typing_extensions import Annotated from pydantic import Field, StrictStr -from typing import List, Optional +from typing import List, Optional, Union from typing_extensions import Annotated from fireblocks.models.create_internal_wallet_asset_request import CreateInternalWalletAssetRequest from fireblocks.models.create_wallet_request import CreateWalletRequest +from fireblocks.models.paginated_assets_response import PaginatedAssetsResponse from fireblocks.models.set_customer_ref_id_request import SetCustomerRefIdRequest from fireblocks.models.unmanaged_wallet import UnmanagedWallet from fireblocks.models.wallet_asset import WalletAsset @@ -66,7 +67,7 @@ def create_internal_wallet( ) -> Future[ApiResponse[UnmanagedWallet]]: """Create an internal wallet - Creates a new internal wallet with the requested name. + Creates a new internal wallet with the requested name. Learn more about Whitelisted Internal Addresses [here](https://developers.fireblocks.com/docs/whitelist-addresses#internal-wallets) Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor. :param idempotency_key: A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. :type idempotency_key: str @@ -216,7 +217,7 @@ def create_internal_wallet_asset( ) -> Future[ApiResponse[WalletAsset]]: """Add an asset to an internal wallet - Adds an asset to an existing internal wallet. + Adds an asset to an existing internal wallet. Internal Wallets are whitelisted wallets that belong to you outside of Fireblocks. - You can see the balance of the Internal Wallet via Fireblocks - You cannot initiate transactions from Internal Wallets through Fireblocks Learn more about Whitelisted Internal Addresses [here](https://developers.fireblocks.com/docs/whitelist-addresses#internal-wallets) Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor. :param wallet_id: The ID of the wallet (required) :type wallet_id: str @@ -377,7 +378,7 @@ def delete_internal_wallet( ) -> Future[ApiResponse[None]]: """Delete an internal wallet - Deletes an internal wallet by ID. + Deletes an internal wallet by ID. Internal Wallets are whitelisted wallets that belong to you outside of Fireblocks. - You can see the balance of the Internal Wallet via Fireblocks - You cannot initiate transactions from Internal Wallets through Fireblocks Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor. :param wallet_id: The ID of the wallet to delete (required) :type wallet_id: str @@ -505,9 +506,9 @@ def delete_internal_wallet_asset( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> Future[ApiResponse[None]]: - """Delete a whitelisted address from an internal wallet + """Delete a whitelisted address - Deletes a whitelisted address (for an asset) from an internal wallet. + Deletes a whitelisted address (for an asset) from an internal wallet. Internal Wallets are whitelisted wallets that belong to you outside of Fireblocks. - You can see the balance of the Internal Wallet via Fireblocks - You cannot initiate transactions from Internal Wallets through Fireblocks Learn more about Whitelisted Internal Addresses [here](https://developers.fireblocks.com/docs/whitelist-addresses#internal-wallets) Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor. :param wallet_id: The ID of the wallet (required) :type wallet_id: str @@ -641,9 +642,9 @@ def get_internal_wallet( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> Future[ApiResponse[UnmanagedWallet]]: - """Get assets for internal wallet + """Get an asset from an internal wallet - Returns all assets in an internal wallet by ID. + Returns information for an asset in an internal wallet. This endpoint will be deprecated after 6 months.
As part of the depreciation process this endpoint will no longer return balances, only addresses.
Until it is deprecated, this endpoint will behave the same way. Internal Wallets are whitelisted wallets that belong to you outside of Fireblocks. - You can see the balance of the Internal Wallet via Fireblocks - You cannot initiate transactions from Internal Wallets through Fireblocks Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer. :param wallet_id: The ID of the wallet to return (required) :type wallet_id: str @@ -773,7 +774,7 @@ def get_internal_wallet_asset( ) -> Future[ApiResponse[WalletAsset]]: """Get an asset from an internal wallet - Returns information for an asset in an internal wallet. + Returns information for an asset in an internal wallet. Internal Wallets are whitelisted wallets that belong to you outside of Fireblocks. - You can see the balance of the Internal Wallet via Fireblocks - You cannot initiate transactions from Internal Wallets through Fireblocks Learn more about Whitelisted Internal Addresses [here](https://developers.fireblocks.com/docs/whitelist-addresses#internal-wallets) Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer. :param wallet_id: The ID of the wallet (required) :type wallet_id: str @@ -890,6 +891,153 @@ def _get_internal_wallet_asset_serialize( + @validate_call + def get_internal_wallet_assets_paginated( + self, + wallet_id: Annotated[StrictStr, Field(description="The ID of the internal wallet to return assets for")], + page_size: Optional[Union[Annotated[float, Field(le=200, strict=True, ge=1)], Annotated[int, Field(le=200, strict=True, ge=1)]]] = None, + page_cursor: Optional[StrictStr] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Future[ApiResponse[PaginatedAssetsResponse]]: + """List assets in an internal wallet (Paginated) + + Returns a paginated response of assets in an internal wallet. This is a new paginated endpoint that gets all the assets from the wallet container with balances.
This endpoint returns a limited amount of results with a quick response time. Internal Wallets are whitelisted wallets that belong to you outside of Fireblocks. - You can see the balance of the Internal Wallet via Fireblocks - You cannot initiate transactions from Internal Wallets through Fireblocks Learn more about Whitelisted Internal Addresses [here](https://developers.fireblocks.com/docs/whitelist-addresses#internal-wallets) Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer. + + :param wallet_id: The ID of the internal wallet to return assets for (required) + :type wallet_id: str + :param page_size: + :type page_size: float + :param page_cursor: + :type page_cursor: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + validate_not_empty_string(function_name="get_internal_wallet_assets_paginated", param_name="wallet_id", param_value=wallet_id) + + _param = self._get_internal_wallet_assets_paginated_serialize( + wallet_id=wallet_id, + page_size=page_size, + page_cursor=page_cursor, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PaginatedAssetsResponse", + 'default': "ErrorSchema", + } + + return self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + _response_types_map=_response_types_map, + ) + + def _get_internal_wallet_assets_paginated_serialize( + self, + wallet_id, + page_size, + page_cursor, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if wallet_id is not None: + _path_params['walletId'] = wallet_id + # process the query parameters + if page_size is not None: + + _query_params.append(('pageSize', page_size)) + + if page_cursor is not None: + + _query_params.append(('pageCursor', page_cursor)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/internal_wallets/{walletId}/assets', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call def get_internal_wallets( self, @@ -908,7 +1056,7 @@ def get_internal_wallets( ) -> Future[ApiResponse[List[UnmanagedWallet]]]: """List internal wallets - Gets a list of internal wallets. **Note**: BTC-based assets belonging to whitelisted addresses cannot be retrieved between 00:00 UTC and 00:01 UTC daily due to third-party provider, Blockchair, being unavailable for this 60 second period. Please wait until the next minute to retrieve BTC-based assets. + Gets a list of internal wallets. **Note**: - BTC-based assets belonging to whitelisted addresses cannot be retrieved between 00:00 UTC and 00:01 UTC daily due to third-party provider, Blockchain, being unavailable for this 60 second period.
Please wait until the next minute to retrieve BTC-based assets. - The list of assets returned will NOT include the balances anymore. Internal Wallets are whitelisted wallets that belong to you outside of Fireblocks. - You can see the balance of the Internal Wallet via Fireblocks - You cannot initiate transactions from Internal Wallets through Fireblocks Learn more about Whitelisted Internal Addresses [here](https://developers.fireblocks.com/docs/whitelist-addresses#internal-wallets) Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -1032,7 +1180,7 @@ def set_customer_ref_id_for_internal_wallet( ) -> Future[ApiResponse[None]]: """Set an AML/KYT customer reference ID for an internal wallet - Sets an AML/KYT customer reference ID for the specific internal wallet. + Sets an AML/KYT customer reference ID for the specific internal wallet. Internal Wallets are whitelisted wallets that belong to you outside of Fireblocks. - You can see the balance of the Internal Wallet via Fireblocks - You cannot initiate transactions from Internal Wallets through Fireblocks Learn more about Whitelisted Internal Addresses [here](https://developers.fireblocks.com/docs/whitelist-addresses#internal-wallets) Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor. :param wallet_id: The wallet ID (required) :type wallet_id: str diff --git a/fireblocks/models/__init__.py b/fireblocks/models/__init__.py index fa6e26e1..fde61090 100644 --- a/fireblocks/models/__init__.py +++ b/fireblocks/models/__init__.py @@ -284,6 +284,7 @@ from fireblocks.models.paginated_address_response_paging import PaginatedAddressResponsePaging from fireblocks.models.paginated_asset_wallet_response import PaginatedAssetWalletResponse from fireblocks.models.paginated_asset_wallet_response_paging import PaginatedAssetWalletResponsePaging +from fireblocks.models.paginated_assets_response import PaginatedAssetsResponse from fireblocks.models.paging import Paging from fireblocks.models.pair_api_key_request import PairApiKeyRequest from fireblocks.models.pair_api_key_response import PairApiKeyResponse diff --git a/fireblocks/models/contract_upload_request.py b/fireblocks/models/contract_upload_request.py index 8f4619c4..fb7e5a17 100644 --- a/fireblocks/models/contract_upload_request.py +++ b/fireblocks/models/contract_upload_request.py @@ -35,7 +35,7 @@ class ContractUploadRequest(BaseModel): long_description: Optional[StrictStr] = Field(default=None, description="A full description of the contract template. May contain to break the lines", alias="longDescription") bytecode: StrictStr = Field(description="The compiled artifact of this smart contract. Used for deployment of this contract template") sourcecode: Optional[StrictStr] = Field(default=None, description="The source code of the contract. Optional.") - type: Optional[StrictStr] = Field(default=None, description="The type of the contract template") + type: StrictStr = Field(description="The type of the contract template") docs: Optional[ContractDoc] = Field(default=None, description="A `natspec` compliant documentation json. Can be retrieved from the output json after compilation") abi: List[AbiFunction] = Field(description="The abi of the contract template. Necessary for displaying and for after deployment encoding") attributes: Optional[ContractAttributes] = Field(default=None, description="The attributes related to this contract template. It will be displayed in the tokenization page") @@ -44,9 +44,6 @@ class ContractUploadRequest(BaseModel): @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - if value not in set(['FUNGIBLE_TOKEN', 'NON_FUNGIBLE_TOKEN', 'NON_TOKEN', 'TOKEN_EXTENSION', 'TOKEN_UTILITY']): raise ValueError("must be one of enum values ('FUNGIBLE_TOKEN', 'NON_FUNGIBLE_TOKEN', 'NON_TOKEN', 'TOKEN_EXTENSION', 'TOKEN_UTILITY')") return value diff --git a/fireblocks/models/paginated_assets_response.py b/fireblocks/models/paginated_assets_response.py new file mode 100644 index 00000000..5c76e48d --- /dev/null +++ b/fireblocks/models/paginated_assets_response.py @@ -0,0 +1,96 @@ +# coding: utf-8 + +""" + Fireblocks API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.6.2 + Contact: support@fireblocks.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, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from fireblocks.models.unmanaged_wallet import UnmanagedWallet +from typing import Optional, Set +from typing_extensions import Self + +class PaginatedAssetsResponse(BaseModel): + """ + PaginatedAssetsResponse + """ # noqa: E501 + total: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Total number of assets in the internal wallet") + data: UnmanagedWallet + next: Optional[StrictStr] = Field(default=None, description="Cursor for the next page of results") + __properties: ClassVar[List[str]] = ["total", "data", "next"] + + 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 PaginatedAssetsResponse 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, + ) + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PaginatedAssetsResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total": obj.get("total"), + "data": UnmanagedWallet.from_dict(obj["data"]) if obj.get("data") is not None else None, + "next": obj.get("next") + }) + return _obj + + diff --git a/fireblocks/models/transaction_operation.py b/fireblocks/models/transaction_operation.py index 4e717535..f9426918 100644 --- a/fireblocks/models/transaction_operation.py +++ b/fireblocks/models/transaction_operation.py @@ -21,7 +21,7 @@ class TransactionOperation(str, Enum): """ - * `TRANSFER` - The default value for an operation. Transfers funds from one account to another. UTXO blockchains allow multi-input and multi-output transfers. All other blockchains allow transfers with one source address and one destination address. * `MINT` - Mints new tokens. Supported for Stellar, Ripple and EVM-based blockchains. * `BURN` - Burns tokens. Supported for Stellar, Ripple and EVM-based blockchains. * `CONTRACT_CALL` - Calls a smart contract method for web3 operations on any EVM blockchain. The Fireblocks [development libraries](https://developers.fireblocks.com/docs/ethereum-development#convenience-libraries) are recommended for building contract call transactions. * `PROGRAM_CALL` - Execute multiple instructions on Solana blockchain. The @solana/web3.js library is recommended for building program call transactions. Currently in beta and disabled * `TYPED_MESSAGE` - An off-chain message in either Ethereum Personal Message or EIP712 format. Use it to sign specific readable messages that are not actual transactions. [Learn more about typed messages](https://developers.fireblocks.com/docs/typed-message-signing). * `RAW` - An off-chain message with no predefined format. Use it to sign any message with your private key, including protocols such as blockchains and custom transaction types that are not natively supported by Fireblocks. [Learn more about raw signing transactions.](https://developers.fireblocks.com/docs/raw-message-signing) + * `TRANSFER` - The default value for an operation. Transfers funds from one account to another. UTXO blockchains allow multi-input and multi-output transfers. All other blockchains allow transfers with one source address and one destination address. * `MINT` - Mints new tokens. Supported for Stellar, Ripple and EVM-based blockchains. * `BURN` - Burns tokens. Supported for Stellar, Ripple and EVM-based blockchains. * `CONTRACT_CALL` - Calls a smart contract method for web3 operations on any EVM blockchain. The Fireblocks [development libraries](https://developers.fireblocks.com/docs/ethereum-development#convenience-libraries) are recommended for building contract call transactions. * `PROGRAM_CALL` - Execute multiple instructions on Solana blockchain. The @solana/web3.js library is recommended for building program call transactions. Currently in beta and disabled * `TYPED_MESSAGE` - An off-chain message in either Ethereum Personal Message or EIP712 format. Use it to sign specific readable messages that are not actual transactions. [Learn more about typed messages](https://developers.fireblocks.com/docs/typed-message-signing). * `RAW` - An off-chain message with no predefined format. Use it to sign any message with your private key, including protocols such as blockchains and custom transaction types that are not natively supported by Fireblocks. [Learn more about raw signing transactions.](https://developers.fireblocks.com/docs/raw-message-signing) * `APPROVE` - Enables the approve function for a smart contract or wallet to withdraw from a designated wallet. [Learn more](https://support.fireblocks.io/hc/en-us/articles/4404616097426-Amount-Cap-for-Approve-transactions). """ """ @@ -34,6 +34,7 @@ class TransactionOperation(str, Enum): MINT = 'MINT' RAW = 'RAW' TYPED_MESSAGE = 'TYPED_MESSAGE' + APPROVE = 'APPROVE' @classmethod def from_json(cls, json_str: str) -> Self: diff --git a/test/test_contract_upload_request.py b/test/test_contract_upload_request.py index f7100208..5d0e5fa2 100644 --- a/test/test_contract_upload_request.py +++ b/test/test_contract_upload_request.py @@ -71,6 +71,7 @@ def make_instance(self, include_optional) -> ContractUploadRequest: name = 'My Contract', description = 'an ERC20 implementation', bytecode = '', + type = 'FUNGIBLE_TOKEN', abi = [{"inputs":[{"internalType":"address","name":"implementation","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"}],"stateMutability":"payable","type":"constructor"}], ) """ diff --git a/test/test_internal_wallets_api.py b/test/test_internal_wallets_api.py index 1688a349..572848d1 100644 --- a/test/test_internal_wallets_api.py +++ b/test/test_internal_wallets_api.py @@ -51,14 +51,14 @@ def test_delete_internal_wallet(self) -> None: def test_delete_internal_wallet_asset(self) -> None: """Test case for delete_internal_wallet_asset - Delete a whitelisted address from an internal wallet + Delete a whitelisted address """ pass def test_get_internal_wallet(self) -> None: """Test case for get_internal_wallet - Get assets for internal wallet + Get an asset from an internal wallet """ pass @@ -69,6 +69,13 @@ def test_get_internal_wallet_asset(self) -> None: """ pass + def test_get_internal_wallet_assets_paginated(self) -> None: + """Test case for get_internal_wallet_assets_paginated + + List assets in an internal wallet (Paginated) + """ + pass + def test_get_internal_wallets(self) -> None: """Test case for get_internal_wallets diff --git a/test/test_paginated_assets_response.py b/test/test_paginated_assets_response.py new file mode 100644 index 00000000..46611638 --- /dev/null +++ b/test/test_paginated_assets_response.py @@ -0,0 +1,83 @@ +# coding: utf-8 + +""" + Fireblocks API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 1.6.2 + Contact: support@fireblocks.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from fireblocks.models.paginated_assets_response import PaginatedAssetsResponse + + +class TestPaginatedAssetsResponse(unittest.TestCase): + """PaginatedAssetsResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PaginatedAssetsResponse: + """Test PaginatedAssetsResponse + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included""" + # uncomment below to create an instance of `PaginatedAssetsResponse` + """ + model = PaginatedAssetsResponse() + if include_optional: + return PaginatedAssetsResponse( + total = 1.337, + data = fireblocks.models.unmanaged_wallet.UnmanagedWallet( + id = '', + name = '', + customer_ref_id = '', + assets = [ + fireblocks.models.wallet_asset.WalletAsset( + id = '', + balance = '', + locked_amount = '', + status = 'WAITING_FOR_APPROVAL', + address = '', + tag = '', + activation_time = '', ) + ], ), + next = '' + ) + else: + return PaginatedAssetsResponse( + data = fireblocks.models.unmanaged_wallet.UnmanagedWallet( + id = '', + name = '', + customer_ref_id = '', + assets = [ + fireblocks.models.wallet_asset.WalletAsset( + id = '', + balance = '', + locked_amount = '', + status = 'WAITING_FOR_APPROVAL', + address = '', + tag = '', + activation_time = '', ) + ], ), + ) + """ + + def testPaginatedAssetsResponse(self): + """Test PaginatedAssetsResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == "__main__": + unittest.main()