# Crypto.com Python Client for Developer Platform
The Crypto.com Python Client for Developer Platform is a Python library designed to facilitate easy and efficient interactions with the Crypto.com [Developer Platform Service](https://github.com/crypto-com/developer-platform-service). This client library provides methods to interact with various blockchain networks, manage wallets, tokens, and contracts seamlessly.
![PyPI](https://pypi.org/project/developer-platform-client-py)
## Features
- Simple and intuitive API for interacting with the Crypto.com Developer Platform Service.
- Configurable client instances tailored to your specific endpoint and security needs.
- **Currently in beta**: Expect frequent updates and potential changes in future releases.
## Installation
To install the package, run the following command:
```bash
pip install developer_platform_client_py
```
## Usage
Here’s how you can use the Crypto.com Python Client for Developer Platform in your project:
### Configuring the Client
```py
from developer_platform_client_py import Block, Client
from developer_platform_client_py.interfaces.chain_interfaces import CronosZkEvm
Client.init(api_key="EXPLORER_API_KEY",
chain_id=CronosZkEvm.TESTNET,provider="YOUR_PROVIDER")
block = Block.get_by_tag("latest")
```
## API Methods
### Block
- `get_by_tag(tag, tx_detail)`
- `tag`: Integer of a block number in hex, or the string "earliest", "latest" or "pending", as in https://ethereum.org/en/developers/docs/apis/json-rpc/#default-block
- `tx_detail`: If true it returns the full transaction objects, if false only the hashes of the transactions.
### Contract
- `get_contract_abi(contract_address)`
- `contract_address`: The address of the smart contract.
### Token
- `get_native_balance(address)`
- `address`: The address to get the balance for.
- `get_erc20_balance(address, contract_address, block_height)`
- `address`: The address to get the balance for.
- `contract_address`: The contract address to get the balance for.
- `block_height`: The block height to get the balance for. Optional, default to "latest".
- `transfer_token(to, amount)`
- `to`: The address to transfer the token to.
- `amount`: The amount of token to transfer.
- `wrap_token(from_contract_address, to_contract_address, to, amount)`
- `from_contract_address`: The address to wrap the token from.
- `to_contract_address`: The address to wrap the token to.
- `to`: The address to send the wrapped token to
- `amount`: The amount of token to wrap.
- `swap_token(from_contract_address, to_contract_address, to, amount)`
- `from_contract_address`: The token to swap from.
- `to_contract_address`: The token to swap to.
- `to`: The address to send the swapped token to
- `amount`: The amount of token to swap.
### Transaction
- `get_transactions_by_address(address, session, limit)`
- `address`: The address to get the transactions for.
- `session`: The session to get the transactions for. Optional, default to "".
- `limit`: The limit of the transactions to get. Optional, default to "20".
- `get_transaction_by_hash(hash)`
- `hash`: The hash of the transaction.
- `get_transaction_status(hash)`
- `hash`: The hash of the transaction to get the status for.
### Wallet
- `create_wallet()`
- `get_balance(address)`
- `address`: The address to get the balance for.
## Licensing
The code in this project is licensed under the MIT license.
## Contact
If you have any questions or comments about the library, please feel free to open an issue or a pull request on our GitHub repository.
Raw data
{
"_id": null,
"home_page": "https://github.com/crypto-com/developer-platform-client-py",
"name": "developer-platform-client-py",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0.0,>=3.8.1",
"maintainer_email": null,
"keywords": "agent, blockchain, crypto.com, AI, CDC",
"author": "Ric Arcifa",
"author_email": "ricardo.arcifa@crypto.com",
"download_url": null,
"platform": null,
"description": "# Crypto.com Python Client for Developer Platform\n\nThe Crypto.com Python Client for Developer Platform is a Python library designed to facilitate easy and efficient interactions with the Crypto.com [Developer Platform Service](https://github.com/crypto-com/developer-platform-service). This client library provides methods to interact with various blockchain networks, manage wallets, tokens, and contracts seamlessly.\n\n![PyPI](https://pypi.org/project/developer-platform-client-py)\n\n## Features\n\n- Simple and intuitive API for interacting with the Crypto.com Developer Platform Service.\n- Configurable client instances tailored to your specific endpoint and security needs.\n- **Currently in beta**: Expect frequent updates and potential changes in future releases.\n\n## Installation\n\nTo install the package, run the following command:\n\n```bash\npip install developer_platform_client_py\n```\n\n## Usage\n\nHere\u2019s how you can use the Crypto.com Python Client for Developer Platform in your project:\n\n### Configuring the Client\n\n```py\nfrom developer_platform_client_py import Block, Client\nfrom developer_platform_client_py.interfaces.chain_interfaces import CronosZkEvm\n\n\nClient.init(api_key=\"EXPLORER_API_KEY\",\n chain_id=CronosZkEvm.TESTNET,provider=\"YOUR_PROVIDER\")\n\nblock = Block.get_by_tag(\"latest\")\n```\n\n## API Methods\n\n### Block\n\n- `get_by_tag(tag, tx_detail)`\n - `tag`: Integer of a block number in hex, or the string \"earliest\", \"latest\" or \"pending\", as in https://ethereum.org/en/developers/docs/apis/json-rpc/#default-block\n - `tx_detail`: If true it returns the full transaction objects, if false only the hashes of the transactions.\n\n### Contract\n\n- `get_contract_abi(contract_address)`\n - `contract_address`: The address of the smart contract.\n\n### Token\n\n- `get_native_balance(address)`\n - `address`: The address to get the balance for.\n- `get_erc20_balance(address, contract_address, block_height)`\n - `address`: The address to get the balance for.\n - `contract_address`: The contract address to get the balance for.\n - `block_height`: The block height to get the balance for. Optional, default to \"latest\".\n- `transfer_token(to, amount)`\n - `to`: The address to transfer the token to.\n - `amount`: The amount of token to transfer.\n- `wrap_token(from_contract_address, to_contract_address, to, amount)`\n - `from_contract_address`: The address to wrap the token from.\n - `to_contract_address`: The address to wrap the token to.\n - `to`: The address to send the wrapped token to\n - `amount`: The amount of token to wrap.\n- `swap_token(from_contract_address, to_contract_address, to, amount)`\n - `from_contract_address`: The token to swap from.\n - `to_contract_address`: The token to swap to.\n - `to`: The address to send the swapped token to\n - `amount`: The amount of token to swap.\n\n### Transaction\n\n- `get_transactions_by_address(address, session, limit)`\n - `address`: The address to get the transactions for.\n - `session`: The session to get the transactions for. Optional, default to \"\".\n - `limit`: The limit of the transactions to get. Optional, default to \"20\".\n- `get_transaction_by_hash(hash)`\n - `hash`: The hash of the transaction.\n- `get_transaction_status(hash)`\n - `hash`: The hash of the transaction to get the status for.\n\n### Wallet\n\n- `create_wallet()`\n- `get_balance(address)`\n - `address`: The address to get the balance for.\n\n## Licensing\n\nThe code in this project is licensed under the MIT license.\n\n## Contact\n\nIf you have any questions or comments about the library, please feel free to open an issue or a pull request on our GitHub repository.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A python client to interact with @cryptocom/developer-platform-service",
"version": "1.0.1",
"project_urls": {
"Documentation": "https://github.com/crypto-com/developer-platform-client-py",
"Homepage": "https://github.com/crypto-com/developer-platform-client-py",
"Repository": "https://github.com/crypto-com/developer-platform-client-py"
},
"split_keywords": [
"agent",
" blockchain",
" crypto.com",
" ai",
" cdc"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "82a5b566f773da03ed2102466529a90037f79c21fba847f9e2180520bee5d4a9",
"md5": "d1caa129586cfc4c6fe9ae34bed406ee",
"sha256": "a458413e0f49f98f09477e38db3d90374bb41495b92205a95d4085a88491fe95"
},
"downloads": -1,
"filename": "developer_platform_client_py-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d1caa129586cfc4c6fe9ae34bed406ee",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0.0,>=3.8.1",
"size": 13014,
"upload_time": "2024-10-22T10:21:56",
"upload_time_iso_8601": "2024-10-22T10:21:56.664606Z",
"url": "https://files.pythonhosted.org/packages/82/a5/b566f773da03ed2102466529a90037f79c21fba847f9e2180520bee5d4a9/developer_platform_client_py-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-22 10:21:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "crypto-com",
"github_project": "developer-platform-client-py",
"github_not_found": true,
"lcname": "developer-platform-client-py"
}