SDKs overview
Cryptonator offers Software Development Kits (SDKs) and libraries to facilitate integration with its cryptocurrency wallet and exchange API. These tools abstract the underlying HTTP requests and response parsing, allowing developers to focus on application logic rather than low-level API communication. The official SDKs support common programming languages, providing a structured way to access Cryptonator's features, including real-time exchange rates, currency conversions, and transaction management.
The Cryptonator API is designed for applications requiring simple multi-currency storage, basic crypto exchange functionalities, and the integration of crypto payments. It focuses on straightforward interactions, offering endpoints for retrieving current exchange rates, performing conversions, and managing wallet balances. The provided SDKs aim to simplify these common operations, offering language-specific wrappers around the API's RESTful interface.
Developers utilizing Cryptonator's SDKs can integrate various cryptocurrency functionalities into their applications, such as displaying up-to-date currency values, initiating exchanges between supported cryptocurrencies, and handling deposits or withdrawals. The SDKs are particularly useful for backend services and web applications that need to interact programmatically with cryptocurrency markets without implementing custom API clients.
Official SDKs by language
Cryptonator provides official SDKs for several popular programming languages, aiming to offer direct support and ensure compatibility with its API. These SDKs are maintained to reflect the latest API versions and best practices. The primary focus of these libraries is to simplify access to exchange rates, perform currency conversions, and manage wallet interactions.
| Language | Package/Library | Installation Command | Maturity |
|---|---|---|---|
| PHP | cryptonator/php-sdk |
composer require cryptonator/php-sdk |
Stable |
| Python | cryptonator-api |
pip install cryptonator-api |
Stable |
| Node.js | cryptonator-api-client |
npm install cryptonator-api-client |
Stable |
Each SDK is built around the Cryptonator API's core functionalities, offering methods to interact with endpoints such as /api/ticker for exchange rates, /api/full for detailed currency information, and /api/currency for supported currency lists. The official Cryptonator API documentation provides comprehensive details on each endpoint and its parameters, which are mirrored in the SDK implementations.
Installation
Installing Cryptonator's official SDKs typically involves using the respective language's package manager. This ensures that all necessary dependencies are resolved and the library is correctly integrated into your project. The following sections provide specific instructions for PHP, Python, and Node.js.
PHP SDK Installation
For PHP projects, the Cryptonator SDK is distributed via Composer, the dependency manager for PHP. To install, ensure you have Composer installed and then run the following command in your project's root directory:
composer require cryptonator/php-sdk
This command adds the cryptonator/php-sdk package to your composer.json file and installs it into your vendor/ directory. You can then include the Composer autoloader at the beginning of your PHP scripts: require 'vendor/autoload.php';
Python SDK Installation
The Python SDK for Cryptonator is available through pip, the Python package installer. To install it, open your terminal or command prompt and execute:
pip install cryptonator-api
It is generally recommended to install Python packages within a virtual environment to avoid conflicts with system-wide packages. Further details on virtual environments are available in the Microsoft Python documentation.
Node.js SDK Installation
For Node.js applications, the Cryptonator API client is installed using npm, the Node.js package manager. Navigate to your project directory in the terminal and run:
npm install cryptonator-api-client
This command adds cryptonator-api-client to your package.json dependencies and downloads the package to your node_modules/ directory, making it available for import in your JavaScript or TypeScript files.
Quickstart example
This section provides basic code examples for interacting with the Cryptonator API using the official SDKs. These snippets demonstrate how to retrieve exchange rate data, a common first step when integrating cryptocurrency services.
PHP Quickstart: Get Ticker Data
This PHP example shows how to fetch the ticker data for BTC-USD using the official SDK.
<?php
require 'vendor/autoload.php';
use Cryptonator\SDK\Client;
$client = new Client();
try {
$ticker = $client->getTicker('btc-usd');
if ($ticker && $ticker->success) {
echo "Base: " . $ticker->ticker->base . "\n";
echo "Target: " . $ticker->ticker->target . "\n";
echo "Price: " . $ticker->ticker->price . "\n";
echo "Volume: " . $ticker->ticker->volume . "\n";
echo "Change: " . $ticker->ticker->change . "\n";
} else {
echo "Error fetching ticker: " . ($ticker->error ?? 'Unknown error') . "\n";
}
} catch (Exception $e) {
echo "An error occurred: " . $e->getMessage() . "\n";
}
?>
Python Quickstart: Get Ticker Data
This Python example retrieves the current BTC-USD exchange rate using the cryptonator-api library.
import cryptonator
try:
ticker_data = cryptonator.get_ticker('btc-usd')
if ticker_data and ticker_data.get('success'):
ticker = ticker_data['ticker']
print(f"Base: {ticker['base']}")
print(f"Target: {ticker['target']}")
print(f"Price: {ticker['price']}")
print(f"Volume: {ticker['volume']}")
print(f"Change: {ticker['change']}")
else:
print(f"Error fetching ticker: {ticker_data.get('error', 'Unknown error')}")
except Exception as e:
print(f"An error occurred: {e}")
Node.js Quickstart: Get Ticker Data
This Node.js example demonstrates how to fetch BTC-USD ticker information asynchronously.
const CryptonatorClient = require('cryptonator-api-client');
const client = new CryptonatorClient();
async function getTickerData() {
try {
const tickerData = await client.getTicker('btc-usd');
if (tickerData && tickerData.success) {
const ticker = tickerData.ticker;
console.log(`Base: ${ticker.base}`);
console.log(`Target: ${ticker.target}`);
console.log(`Price: ${ticker.price}`);
console.log(`Volume: ${ticker.volume}`);
console.log(`Change: ${ticker.change}`);
} else {
console.error(`Error fetching ticker: ${tickerData.error || 'Unknown error'}`);
}
} catch (error) {
console.error(`An error occurred: ${error.message}`);
}
}
getTickerData();
These examples illustrate the basic usage of the SDKs for retrieving public data. For operations requiring user authentication or specific account actions, refer to the Cryptonator API documentation for details on API key management and authenticated requests, which often involve signing requests with private keys.
Community libraries
While Cryptonator provides official SDKs, the broader developer community may also contribute unofficial libraries or wrappers for additional languages or specific use cases. These community-maintained resources can offer flexibility, but their support, maintenance, and security should be evaluated independently by developers. Community contributions often emerge for languages not officially supported or to add specialized features not present in the official SDKs.
Developers seeking libraries beyond the official PHP, Python, and Node.js offerings are encouraged to search public code repositories like GitHub or language-specific package indexes (e.g., RubyGems for Ruby, Maven Central for Java). When considering a community library, it is important to review its documentation, recent activity, open issues, and the reputation of its maintainers. Verifying that the library correctly implements API authentication and handles data securely is critical for any application processing financial information. The MDN Web Docs on HTTP authentication provide general guidance on secure API interaction patterns.
Currently, the primary community focus aligns with the officially supported languages, with most development activity centered around these SDKs. For niche requirements, developers might need to implement a custom API client based on the Cryptonator API specification, ensuring direct control over security and functionality.