2022-08-01 13:47:55 -07:00
import { INodeProperties } from 'n8n-workflow' ;
2020-10-03 02:50:57 -07:00
2021-12-03 00:44:16 -08:00
export const coinOperations : INodeProperties [ ] = [
2020-10-03 02:50:57 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-10-03 02:50:57 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'coin' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
options : [
{
name : 'Candlestick' ,
value : 'candlestick' ,
description : 'Get a candlestick open-high-low-close chart for the selected currency' ,
2022-07-10 13:50:51 -07:00
action : 'Get a candlestick for a coin' ,
2020-10-03 02:50:57 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get current data for a coin' ,
2022-07-10 13:50:51 -07:00
action : 'Get a coin' ,
2020-10-03 02:50:57 -07:00
} ,
{
name : 'Get All' ,
value : 'getAll' ,
description : 'Get all coins' ,
2022-07-10 13:50:51 -07:00
action : 'Get all coins' ,
2020-10-03 02:50:57 -07:00
} ,
{
name : 'History' ,
value : 'history' ,
description : 'Get historical data (name, price, market, stats) at a given date for a coin' ,
2022-07-10 13:50:51 -07:00
action : 'Get history for a coin' ,
2020-10-03 02:50:57 -07:00
} ,
{
name : 'Market' ,
value : 'market' ,
2022-08-01 13:47:55 -07:00
description :
'Get prices and market related data for all trading pairs that match the selected currency' ,
2022-07-10 13:50:51 -07:00
action : 'Get market prices for a coin' ,
2020-10-03 02:50:57 -07:00
} ,
{
name : 'Market Chart' ,
value : 'marketChart' ,
2022-08-01 13:47:55 -07:00
description :
'Get historical market data include price, market cap, and 24h volume (granularity auto)' ,
2022-07-10 13:50:51 -07:00
action : 'Get market chart for a coin' ,
2020-10-03 02:50:57 -07:00
} ,
{
name : 'Price' ,
value : 'price' ,
2022-08-01 13:47:55 -07:00
description :
'Get the current price of any cryptocurrencies in any other supported currencies that you need' ,
2022-07-10 13:50:51 -07:00
action : 'Get the price for a coin' ,
2020-10-03 02:50:57 -07:00
} ,
{
name : 'Ticker' ,
value : 'ticker' ,
description : 'Get coin tickers' ,
2022-07-10 13:50:51 -07:00
action : 'Get the ticker for a coin' ,
2020-10-03 02:50:57 -07:00
} ,
] ,
default : 'getAll' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-10-03 02:50:57 -07:00
2021-12-03 00:44:16 -08:00
export const coinFields : INodeProperties [ ] = [
2020-10-03 02:50:57 -07:00
{
displayName : 'Search By' ,
name : 'searchBy' ,
required : true ,
type : 'options' ,
options : [
{
name : 'Coin ID' ,
value : 'coinId' ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'Contract Address' ,
2020-10-03 02:50:57 -07:00
value : 'contractAddress' ,
} ,
] ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'get' , 'marketChart' , 'price' ] ,
resource : [ 'coin' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
default : 'coinId' ,
2022-05-06 14:01:25 -07:00
description : 'Search by coin ID or contract address' ,
2020-10-03 02:50:57 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Coin Name or ID' ,
2020-10-03 02:50:57 -07:00
name : 'coinId' ,
required : true ,
type : 'options' ,
2022-08-01 13:47:55 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-10-03 02:50:57 -07:00
typeOptions : {
loadOptionsMethod : 'getCoins' ,
} ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'get' ] ,
resource : [ 'coin' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
default : '' ,
placeholder : 'bitcoin' ,
} ,
2020-10-06 01:19:28 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Base Currency Name or ID' ,
2020-10-06 01:19:28 -07:00
name : 'baseCurrency' ,
required : true ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getCoins' ,
} ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'candlestick' ] ,
resource : [ 'coin' ] ,
2020-10-06 01:19:28 -07:00
} ,
} ,
default : '' ,
2022-08-01 13:47:55 -07:00
description :
'The first currency in the pair. For BTC:ETH this is BTC. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-10-06 01:19:28 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Base Currency Name or ID' ,
2020-10-06 01:19:28 -07:00
name : 'baseCurrency' ,
required : true ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getCurrencies' ,
} ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'market' ] ,
resource : [ 'coin' ] ,
2020-10-06 01:19:28 -07:00
} ,
} ,
default : '' ,
2022-08-01 13:47:55 -07:00
description :
'The first currency in the pair. For BTC:ETH this is BTC. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-10-06 01:19:28 -07:00
} ,
2020-10-03 02:50:57 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Coin Name or ID' ,
2020-10-03 02:50:57 -07:00
name : 'coinId' ,
required : true ,
type : 'options' ,
2022-08-01 13:47:55 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-10-03 02:50:57 -07:00
typeOptions : {
loadOptionsMethod : 'getCoins' ,
} ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'ticker' , 'history' ] ,
resource : [ 'coin' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
default : '' ,
placeholder : 'bitcoin' ,
} ,
{
2022-06-23 10:45:56 -07:00
displayName : 'Base Currency Names or IDs' ,
2020-10-06 01:19:28 -07:00
name : 'baseCurrencies' ,
2020-10-03 02:50:57 -07:00
required : true ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getCoins' ,
} ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'price' ] ,
resource : [ 'coin' ] ,
searchBy : [ 'coinId' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
default : [ ] ,
placeholder : 'bitcoin' ,
2022-08-01 13:47:55 -07:00
description :
'The first currency in the pair. For BTC:ETH this is BTC. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Platform ID' ,
name : 'platformId' ,
required : true ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'get' , 'marketChart' , 'price' ] ,
resource : [ 'coin' ] ,
searchBy : [ 'contractAddress' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
type : 'options' ,
options : [
{
name : 'Ethereum' ,
value : 'ethereum' ,
} ,
] ,
default : 'ethereum' ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the platform issuing tokens' ,
2020-10-03 02:50:57 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Contract Address' ,
2020-10-03 02:50:57 -07:00
name : 'contractAddress' ,
required : true ,
type : 'string' ,
2021-12-03 00:44:16 -08:00
default : '' ,
2020-10-03 02:50:57 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'get' , 'marketChart' ] ,
resource : [ 'coin' ] ,
searchBy : [ 'contractAddress' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
2022-08-01 13:47:55 -07:00
description : "Token's contract address" ,
2020-10-03 02:50:57 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Contract Addresses' ,
2020-10-03 02:50:57 -07:00
name : 'contractAddresses' ,
required : true ,
type : 'string' ,
2021-12-03 00:44:16 -08:00
default : '' ,
2020-10-03 02:50:57 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'price' ] ,
resource : [ 'coin' ] ,
searchBy : [ 'contractAddress' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The contract address of tokens, comma-separated' ,
2020-10-03 02:50:57 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Base Currency Name or ID' ,
2020-10-03 02:50:57 -07:00
name : 'baseCurrency' ,
required : true ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getCoins' ,
} ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'marketChart' ] ,
resource : [ 'coin' ] ,
searchBy : [ 'coinId' ] ,
2020-10-03 02:50:57 -07:00
} ,
hide : {
2022-08-01 13:47:55 -07:00
searchBy : [ 'contractAddress' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
default : '' ,
2022-08-01 13:47:55 -07:00
description :
'The first currency in the pair. For BTC:ETH this is BTC. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-10-03 02:50:57 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Quote Currency Name or ID' ,
2020-10-03 02:50:57 -07:00
name : 'quoteCurrency' ,
required : true ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getCurrencies' ,
} ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'candlestick' , 'marketChart' ] ,
resource : [ 'coin' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
default : '' ,
2022-08-01 13:47:55 -07:00
description :
'The second currency in the pair. For BTC:ETH this is ETH. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-10-03 02:50:57 -07:00
} ,
{
2022-06-23 10:45:56 -07:00
displayName : 'Quote Currency Names or IDs' ,
2020-10-06 01:19:28 -07:00
name : 'quoteCurrencies' ,
2020-10-03 02:50:57 -07:00
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getCurrencies' ,
} ,
required : true ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'price' ] ,
resource : [ 'coin' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
default : [ ] ,
2022-08-01 13:47:55 -07:00
description :
'The second currency in the pair. For BTC:ETH this is ETH. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-10-03 02:50:57 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Range (Days)' ,
2020-10-03 02:50:57 -07:00
name : 'days' ,
required : true ,
type : 'options' ,
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
2020-10-03 02:50:57 -07:00
options : [
{
name : '1' ,
value : '1' ,
} ,
{
name : '7' ,
value : '7' ,
} ,
{
name : '14' ,
value : '14' ,
} ,
{
name : '30' ,
value : '30' ,
} ,
{
name : '90' ,
value : '90' ,
} ,
{
name : '180' ,
value : '180' ,
} ,
{
name : '365' ,
value : '365' ,
} ,
{
name : 'Max' ,
value : 'max' ,
} ,
] ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'marketChart' , 'candlestick' ] ,
resource : [ 'coin' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Return data for this many days in the past from now' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Date' ,
name : 'date' ,
required : true ,
type : 'dateTime' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'history' ] ,
resource : [ 'coin' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The date of data snapshot' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'getAll' , 'market' , 'ticker' ] ,
resource : [ 'coin' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'getAll' , 'market' , 'ticker' ] ,
resource : [ 'coin' ] ,
returnAll : [ false ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 500 ,
} ,
default : 100 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'coin' ] ,
operation : [ 'market' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
options : [
{
displayName : 'Coin IDs' ,
name : 'ids' ,
type : 'string' ,
placeholder : 'bitcoin' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Filter results by comma-separated list of coin ID' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Category' ,
name : 'category' ,
type : 'options' ,
options : [
{
name : 'Decentralized Finance Defi' ,
value : 'decentralized_finance_defi' ,
} ,
] ,
default : 'decentralized_finance_defi' ,
2022-05-06 14:01:25 -07:00
description : 'Filter by coin category' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Order' ,
name : 'order' ,
type : 'options' ,
options : [
{
2022-06-03 10:23:49 -07:00
name : 'Gecko Asc' ,
value : 'gecko_asc' ,
2020-10-03 02:50:57 -07:00
} ,
{
name : 'Gecko Desc' ,
value : 'gecko_desc' ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'ID Asc' ,
value : 'id_asc' ,
} ,
{
name : 'ID Desc' ,
value : 'id_desc' ,
2020-10-03 02:50:57 -07:00
} ,
{
name : 'Market Cap Asc' ,
value : 'market_cap_asc' ,
} ,
2022-06-03 10:23:49 -07:00
{
name : 'Market Cap Desc' ,
value : 'market_cap_desc' ,
} ,
2020-10-03 02:50:57 -07:00
{
name : 'Volume Asc' ,
value : 'volume_asc' ,
} ,
{
name : 'Volume Desc' ,
value : 'volume_desc' ,
} ,
] ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Sort results by field' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Sparkline' ,
name : 'sparkline' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether to include sparkline 7 days data' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Price Change Percentage' ,
name : 'price_change_percentage' ,
type : 'multiOptions' ,
2022-06-20 07:54:01 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-multi-options-type-unsorted-items
2020-10-03 02:50:57 -07:00
options : [
{
name : '1h' ,
value : '1h' ,
} ,
{
name : '24h' ,
value : '24h' ,
} ,
{
name : '7d' ,
value : '7d' ,
} ,
{
name : '14d' ,
value : '14d' ,
} ,
{
name : '30d' ,
value : '30d' ,
} ,
{
name : '200d' ,
value : '200d' ,
} ,
{
name : '1y' ,
value : '1y' ,
} ,
] ,
default : [ ] ,
2022-05-06 14:01:25 -07:00
description : 'Include price change percentage for specified times' ,
2020-10-03 02:50:57 -07:00
} ,
] ,
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'coin' ] ,
operation : [ 'price' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
options : [
{
displayName : 'Include 24hr Change' ,
name : 'include_24hr_change' ,
type : 'boolean' ,
default : false ,
} ,
{
displayName : 'Include 24hr Vol' ,
name : 'include_24hr_vol' ,
type : 'boolean' ,
default : false ,
} ,
{
displayName : 'Include Last Updated At' ,
name : 'include_last_updated_at' ,
type : 'boolean' ,
default : false ,
} ,
{
displayName : 'Include Market Cap' ,
name : 'include_market_cap' ,
type : 'boolean' ,
default : false ,
} ,
] ,
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'coin' ] ,
operation : [ 'ticker' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
options : [
{
2022-06-20 07:54:01 -07:00
displayName : 'Exchange Names or IDs' ,
2020-10-03 02:50:57 -07:00
name : 'exchange_ids' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getExchanges' ,
} ,
default : [ ] ,
2022-08-01 13:47:55 -07:00
description :
'Filter results by exchange IDs. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Include Exchange Logo' ,
name : 'include_exchange_logo' ,
type : 'boolean' ,
default : false ,
} ,
{
displayName : 'Order' ,
name : 'order' ,
type : 'options' ,
options : [
{
name : 'Trust Score Desc' ,
value : 'trust_score_desc' ,
} ,
{
name : 'Trust Score Asc' ,
value : 'trust_score_asc' ,
} ,
{
name : 'Volume Desc' ,
value : 'volume_desc' ,
} ,
] ,
default : 'trust_score_desc' ,
2022-05-06 14:01:25 -07:00
description : 'Sorts results by the selected rule' ,
2020-10-03 02:50:57 -07:00
} ,
] ,
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'coin' ] ,
operation : [ 'history' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
options : [
{
displayName : 'Localization' ,
name : 'localization' ,
type : 'boolean' ,
default : true ,
2022-06-20 07:54:01 -07:00
description : 'Whether to exclude localized languages in response' ,
2020-10-03 02:50:57 -07:00
} ,
] ,
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'get' ] ,
resource : [ 'coin' ] ,
2020-10-03 02:50:57 -07:00
} ,
} ,
options : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Community Data' ,
2020-10-03 02:50:57 -07:00
name : 'community_data' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether to include community data' ,
2020-10-03 02:50:57 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Developer Data' ,
2020-10-03 02:50:57 -07:00
name : 'developer_data' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether to include developer data' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Localization' ,
name : 'localization' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether to include all localized languages in response' ,
2020-10-03 02:50:57 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Market Data' ,
2020-10-03 02:50:57 -07:00
name : 'market_data' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether to include market data' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Sparkline' ,
name : 'sparkline' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether to include sparkline 7 days data (eg. true, false).' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Tickers' ,
name : 'tickers' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether to include tickers data' ,
2020-10-03 02:50:57 -07:00
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;