DecentralChain (DCC)
Actions36
- Account Actions
- Matcher Actions
- Token/Asset Actions
- Transaction Actions
- Utility Actions
Overview
The "Upsert Asset Rate" operation in the Matcher resource allows users to add or update the exchange rate of a specific asset relative to the DecentralChain Coin (DCC). This operation is useful for maintaining up-to-date pricing information on the matcher service, which facilitates trading and order matching on the DecentralChain network.
Typical use cases include:
- Updating the price of an asset to reflect current market conditions.
- Adding a new asset's rate to enable its trading on the matcher.
- Automating asset rate management as part of a broader trading or asset management workflow.
For example, if you have a token issued on DecentralChain and want to set or update its price relative to DCC so that it can be traded on the matcher, you would use this operation.
Properties
| Name | Meaning |
|---|---|
| Base URL | Base URL to use for API requests if no credential is supplied. Default: https://nodes.decentralchain.io |
| Matcher Base URL | Base URL for the Matcher API, used if no matcher credential is supplied. Default: https://mainnet-matcher.decentralchain.io |
| Asset ID | The identifier of the asset for which the rate is being added or updated. |
| Rate | The price of 1 DCC expressed in the specified asset. |
Output
The node outputs a JSON object containing the response from the matcher API after attempting to upsert the asset rate. The output includes:
- The result of the PUT request to
/matcher/settings/rates/{assetId}, typically confirming the new or updated rate. - A
debugfield with metadata such as:- Operation name (
upsertAssetRate) - Endpoint URL used
- Asset ID and rate values submitted
- Matcher base URL
- Timestamp of the request
- Operation name (
Example output structure (simplified):
{
"rate": 12345,
"assetId": "some-asset-id",
"debug": {
"operation": "upsertAssetRate",
"endpoint": "/matcher/settings/rates/some-asset-id",
"assetId": "some-asset-id",
"rate": 12345,
"matcherBaseUrl": "https://mainnet-matcher.decentralchain.io",
"timestamp": "2024-06-01T12:00:00.000Z"
}
}
No binary data output is involved in this operation.
Dependencies
- Requires access to the Matcher API endpoint, which may require authentication via an API token credential.
- If credentials are not provided, the node uses the configured base URLs for the main node and matcher API.
- The node depends on standard HTTP request capabilities within n8n to communicate with the matcher service.
Troubleshooting
- Invalid Asset ID: If the asset ID is incorrect or does not exist on the matcher, the API may return an error. Verify the asset ID is correct and recognized by the matcher.
- Authentication Errors: If using credentials, ensure the API token is valid and has permissions to modify asset rates.
- Network Issues: Connection failures to the matcher base URL will cause errors. Confirm network connectivity and correct base URL configuration.
- API Response Errors: The matcher API might reject the rate if it is invalid (e.g., negative or zero). Ensure the rate is a positive number.
- JSON Parsing Errors: Although unlikely in this operation, malformed responses or unexpected data could cause issues; check debug output for details.
If the node throws an error related to HTTP requests, inspect the debug information included in the output for endpoint URLs, parameters, and timestamps to assist in diagnosis.
Links and References
- DecentralChain Matcher API Documentation (hypothetical link for reference)
- DecentralChain Official Website
- n8n Documentation on HTTP Request Node
This summary focuses exclusively on the "Matcher" resource's "Upsert Asset Rate" operation as requested.