2020-10-03 02:50:57 -07:00
import {
INodeProperties ,
} from 'n8n-workflow' ;
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 : {
resource : [
'coin' ,
] ,
} ,
} ,
options : [
{
name : 'Candlestick' ,
value : 'candlestick' ,
description : 'Get a candlestick open-high-low-close chart for the selected currency' ,
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get current data for a coin' ,
} ,
{
name : 'Get All' ,
value : 'getAll' ,
description : 'Get all coins' ,
} ,
{
name : 'History' ,
value : 'history' ,
description : 'Get historical data (name, price, market, stats) at a given date for a coin' ,
} ,
{
name : 'Market' ,
value : 'market' ,
description : 'Get prices and market related data for all trading pairs that match the selected currency' ,
} ,
{
name : 'Market Chart' ,
value : 'marketChart' ,
description : 'Get historical market data include price, market cap, and 24h volume (granularity auto)' ,
} ,
{
name : 'Price' ,
value : 'price' ,
description : 'Get the current price of any cryptocurrencies in any other supported currencies that you need' ,
} ,
{
name : 'Ticker' ,
value : 'ticker' ,
description : 'Get coin tickers' ,
} ,
] ,
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 : {
operation : [
'get' ,
'marketChart' ,
'price' ,
] ,
resource : [
'coin' ,
] ,
} ,
} ,
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' ,
typeOptions : {
loadOptionsMethod : 'getCoins' ,
} ,
displayOptions : {
show : {
operation : [
'get' ,
] ,
resource : [
'coin' ,
] ,
} ,
} ,
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 : {
operation : [
'candlestick' ,
] ,
resource : [
'coin' ,
] ,
} ,
} ,
default : '' ,
2022-06-03 10:23:49 -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/nodes/expressions.html#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 : {
operation : [
'market' ,
] ,
resource : [
'coin' ,
] ,
} ,
} ,
default : '' ,
2022-06-03 10:23:49 -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/nodes/expressions.html#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' ,
typeOptions : {
loadOptionsMethod : 'getCoins' ,
} ,
displayOptions : {
show : {
operation : [
'ticker' ,
'history' ,
] ,
resource : [
'coin' ,
] ,
} ,
} ,
default : '' ,
placeholder : 'bitcoin' ,
} ,
{
2020-10-06 01:19:28 -07:00
displayName : 'Base Currencies' ,
name : 'baseCurrencies' ,
2020-10-03 02:50:57 -07:00
required : true ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getCoins' ,
} ,
displayOptions : {
show : {
operation : [
'price' ,
] ,
resource : [
'coin' ,
] ,
searchBy : [
2020-10-22 06:46:03 -07:00
'coinId' ,
2020-10-03 02:50:57 -07:00
] ,
} ,
} ,
default : [ ] ,
placeholder : 'bitcoin' ,
2020-10-06 01:19:28 -07:00
description : 'The first currency in the pair. For BTC:ETH this is BTC.' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Platform ID' ,
name : 'platformId' ,
required : true ,
displayOptions : {
show : {
operation : [
'get' ,
'marketChart' ,
'price' ,
] ,
resource : [
'coin' ,
] ,
searchBy : [
2020-10-22 06:46:03 -07:00
'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 : {
operation : [
'get' ,
'marketChart' ,
] ,
resource : [
'coin' ,
] ,
searchBy : [
2020-10-22 06:46:03 -07:00
'contractAddress' ,
2020-10-03 02:50:57 -07:00
] ,
} ,
} ,
2022-05-06 14:01:25 -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 : {
operation : [
'price' ,
] ,
resource : [
'coin' ,
] ,
searchBy : [
2020-10-22 06:46:03 -07:00
'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 : {
operation : [
'marketChart' ,
] ,
resource : [
'coin' ,
] ,
searchBy : [
2020-10-22 06:46:03 -07:00
'coinId' ,
2020-10-03 02:50:57 -07:00
] ,
} ,
hide : {
searchBy : [
'contractAddress' ,
] ,
} ,
} ,
default : '' ,
2022-06-03 10:23:49 -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/nodes/expressions.html#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 : {
operation : [
'candlestick' ,
2020-10-06 01:19:28 -07:00
'marketChart' ,
2020-10-03 02:50:57 -07:00
] ,
resource : [
'coin' ,
] ,
} ,
} ,
default : '' ,
2022-06-03 10:23:49 -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/nodes/expressions.html#expressions">expression</a>.' ,
2020-10-03 02:50:57 -07:00
} ,
{
2020-10-06 01:19:28 -07:00
displayName : 'Quote Currencies' ,
name : 'quoteCurrencies' ,
2020-10-03 02:50:57 -07:00
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getCurrencies' ,
} ,
required : true ,
displayOptions : {
show : {
operation : [
'price' ,
] ,
resource : [
'coin' ,
] ,
} ,
} ,
default : [ ] ,
2020-10-06 01:19:28 -07:00
description : 'The second currency in the pair. For BTC:ETH this is ETH.' ,
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 : {
operation : [
'marketChart' ,
'candlestick' ,
] ,
resource : [
'coin' ,
] ,
} ,
} ,
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 : {
operation : [
'history' ,
] ,
resource : [
'coin' ,
] ,
} ,
} ,
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 : {
operation : [
'getAll' ,
'market' ,
'ticker' ,
] ,
resource : [
'coin' ,
] ,
} ,
} ,
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 : {
operation : [
'getAll' ,
'market' ,
'ticker' ,
] ,
resource : [
'coin' ,
] ,
returnAll : [
false ,
] ,
} ,
} ,
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 : {
resource : [
'coin' ,
] ,
operation : [
'market' ,
] ,
} ,
} ,
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-05-06 14:01:25 -07:00
description : 'Include sparkline 7 days data' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Price Change Percentage' ,
name : 'price_change_percentage' ,
type : 'multiOptions' ,
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 : {
resource : [
'coin' ,
] ,
operation : [
'price' ,
] ,
} ,
} ,
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 : {
resource : [
'coin' ,
] ,
operation : [
'ticker' ,
] ,
} ,
} ,
options : [
{
displayName : 'Exchange IDs' ,
name : 'exchange_ids' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getExchanges' ,
} ,
default : [ ] ,
2022-05-06 14:01:25 -07:00
description : 'Filter results by exchange IDs' ,
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 : {
resource : [
'coin' ,
] ,
operation : [
'history' ,
] ,
} ,
} ,
options : [
{
displayName : 'Localization' ,
name : 'localization' ,
type : 'boolean' ,
default : true ,
2022-05-06 14:01:25 -07:00
description : 'Set to false 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 : {
operation : [
'get' ,
] ,
resource : [
'coin' ,
] ,
} ,
} ,
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-05-06 14:01:25 -07:00
description : '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-05-06 14:01:25 -07:00
description : 'Include developer data' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Localization' ,
name : 'localization' ,
type : 'boolean' ,
default : false ,
2022-05-06 14:01:25 -07:00
description : '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-05-06 14:01:25 -07:00
description : 'Include market data' ,
2020-10-03 02:50:57 -07:00
} ,
{
displayName : 'Sparkline' ,
name : 'sparkline' ,
type : 'boolean' ,
default : false ,
2020-10-22 06:46:03 -07:00
description : '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-05-06 14:01:25 -07:00
description : 'Include tickers data' ,
2020-10-03 02:50:57 -07:00
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;