@skillful-ai/piece-coinmarketcap 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/package.json +30 -0
- package/skillful-ai-piece-coinmarketcap-0.0.1.tgz +0 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +44 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/convert-price.d.ts +7 -0
- package/src/lib/actions/convert-price.js +93 -0
- package/src/lib/actions/convert-price.js.map +1 -0
- package/src/lib/actions/get-cryptocurrency-info.d.ts +5 -0
- package/src/lib/actions/get-cryptocurrency-info.js +72 -0
- package/src/lib/actions/get-cryptocurrency-info.js.map +1 -0
- package/src/lib/actions/get-cryptocurrency-listings-latest.d.ts +9 -0
- package/src/lib/actions/get-cryptocurrency-listings-latest.js +112 -0
- package/src/lib/actions/get-cryptocurrency-listings-latest.js.map +1 -0
- package/src/lib/actions/get-cryptocurrency-listings-new.d.ts +5 -0
- package/src/lib/actions/get-cryptocurrency-listings-new.js +73 -0
- package/src/lib/actions/get-cryptocurrency-listings-new.js.map +1 -0
- package/src/lib/actions/get-cryptocurrency-ohlcv-historical.d.ts +7 -0
- package/src/lib/actions/get-cryptocurrency-ohlcv-historical.js +90 -0
- package/src/lib/actions/get-cryptocurrency-ohlcv-historical.js.map +1 -0
- package/src/lib/actions/get-cryptocurrency-ohlcv-latest.d.ts +6 -0
- package/src/lib/actions/get-cryptocurrency-ohlcv-latest.js +81 -0
- package/src/lib/actions/get-cryptocurrency-ohlcv-latest.js.map +1 -0
- package/src/lib/actions/get-cryptocurrency-quotes-latest.d.ts +6 -0
- package/src/lib/actions/get-cryptocurrency-quotes-latest.js +81 -0
- package/src/lib/actions/get-cryptocurrency-quotes-latest.js.map +1 -0
- package/src/lib/actions/get-exchange-info.d.ts +5 -0
- package/src/lib/actions/get-exchange-info.js +73 -0
- package/src/lib/actions/get-exchange-info.js.map +1 -0
- package/src/lib/actions/get-fear-and-greed-historical.d.ts +4 -0
- package/src/lib/actions/get-fear-and-greed-historical.js +70 -0
- package/src/lib/actions/get-fear-and-greed-historical.js.map +1 -0
- package/src/lib/actions/get-fear-and-greed-latest.d.ts +1 -0
- package/src/lib/actions/get-fear-and-greed-latest.js +43 -0
- package/src/lib/actions/get-fear-and-greed-latest.js.map +1 -0
- package/src/lib/actions/get-global-metrics-quotes-historical.d.ts +6 -0
- package/src/lib/actions/get-global-metrics-quotes-historical.js +79 -0
- package/src/lib/actions/get-global-metrics-quotes-historical.js.map +1 -0
- package/src/lib/actions/get-global-metrics-quotes-latest.d.ts +3 -0
- package/src/lib/actions/get-global-metrics-quotes-latest.js +52 -0
- package/src/lib/actions/get-global-metrics-quotes-latest.js.map +1 -0
- package/src/lib/auth.d.ts +3 -0
- package/src/lib/auth.js +16 -0
- package/src/lib/auth.js.map +1 -0
- package/src/lib/common.d.ts +1 -0
- package/src/lib/common.js +37 -0
- package/src/lib/common.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@skillful-ai/piece-coinmarketcap",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@sinclair/typebox": "0.34.11",
|
|
9
|
+
"deepmerge-ts": "7.1.0",
|
|
10
|
+
"nanoid": "3.3.8",
|
|
11
|
+
"node-fetch": "2.7.0",
|
|
12
|
+
"semver": "7.6.0",
|
|
13
|
+
"tslib": "^2.3.0",
|
|
14
|
+
"@activepieces/pieces-framework": "0.20.1",
|
|
15
|
+
"@activepieces/shared": "0.22.0"
|
|
16
|
+
},
|
|
17
|
+
"overrides": {
|
|
18
|
+
"@tryfabric/martian": {
|
|
19
|
+
"@notionhq/client": "$@notionhq/client"
|
|
20
|
+
},
|
|
21
|
+
"vite": {
|
|
22
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
23
|
+
},
|
|
24
|
+
"undici": "6.19.8"
|
|
25
|
+
},
|
|
26
|
+
"resolutions": {
|
|
27
|
+
"rollup": "npm:@rollup/wasm-node",
|
|
28
|
+
"undici": "6.19.8"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
Binary file
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const coinmarketcap: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").PieceAuthProperty>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coinmarketcap = void 0;
|
|
4
|
+
const shared_1 = require("@activepieces/shared");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("./lib/auth");
|
|
7
|
+
// Import all actions
|
|
8
|
+
const convert_price_1 = require("./lib/actions/convert-price");
|
|
9
|
+
const get_cryptocurrency_info_1 = require("./lib/actions/get-cryptocurrency-info");
|
|
10
|
+
const get_cryptocurrency_listings_latest_1 = require("./lib/actions/get-cryptocurrency-listings-latest");
|
|
11
|
+
const get_cryptocurrency_listings_new_1 = require("./lib/actions/get-cryptocurrency-listings-new");
|
|
12
|
+
const get_cryptocurrency_ohlcv_historical_1 = require("./lib/actions/get-cryptocurrency-ohlcv-historical");
|
|
13
|
+
const get_cryptocurrency_ohlcv_latest_1 = require("./lib/actions/get-cryptocurrency-ohlcv-latest");
|
|
14
|
+
const get_cryptocurrency_quotes_latest_1 = require("./lib/actions/get-cryptocurrency-quotes-latest");
|
|
15
|
+
const get_exchange_info_1 = require("./lib/actions/get-exchange-info");
|
|
16
|
+
const get_fear_and_greed_historical_1 = require("./lib/actions/get-fear-and-greed-historical");
|
|
17
|
+
const get_fear_and_greed_latest_1 = require("./lib/actions/get-fear-and-greed-latest");
|
|
18
|
+
const get_global_metrics_quotes_historical_1 = require("./lib/actions/get-global-metrics-quotes-historical");
|
|
19
|
+
const get_global_metrics_quotes_latest_1 = require("./lib/actions/get-global-metrics-quotes-latest");
|
|
20
|
+
exports.coinmarketcap = (0, pieces_framework_1.createPiece)({
|
|
21
|
+
displayName: "Coinmarketcap",
|
|
22
|
+
description: "CoinMarketCap is a piece that allows you to interact with the CoinMarketCap API.",
|
|
23
|
+
auth: auth_1.coinmarketcapAuth,
|
|
24
|
+
minimumSupportedRelease: '0.36.1',
|
|
25
|
+
logoUrl: "https://app.skillfulai.io/icons/skills/coinmarketcap.svg",
|
|
26
|
+
authors: ['Inderdeep Singh Bassan'],
|
|
27
|
+
categories: [shared_1.PieceCategory.CORE],
|
|
28
|
+
actions: [
|
|
29
|
+
convert_price_1.coinMarketCapConvertPrice,
|
|
30
|
+
get_cryptocurrency_info_1.coinMarketCapGetCryptocurrencyInfo,
|
|
31
|
+
get_cryptocurrency_listings_latest_1.coinMarketCapGetCryptocurrencyListingsLatest,
|
|
32
|
+
get_cryptocurrency_listings_new_1.coinMarketCapGetCryptocurrencyListingsNew,
|
|
33
|
+
get_cryptocurrency_ohlcv_historical_1.coinMarketCapGetCryptocurrencyOhlcvHistorical,
|
|
34
|
+
get_cryptocurrency_ohlcv_latest_1.coinMarketCapGetCryptocurrencyOhlcvLatest,
|
|
35
|
+
get_cryptocurrency_quotes_latest_1.coinMarketCapGetCryptocurrencyQuotesLatest,
|
|
36
|
+
get_exchange_info_1.coinMarketCapGetExchangeInfo,
|
|
37
|
+
get_fear_and_greed_historical_1.coinMarketCapGetFearAndGreedHistorical,
|
|
38
|
+
get_fear_and_greed_latest_1.coinMarketCapGetFearAndGreedLatest,
|
|
39
|
+
get_global_metrics_quotes_historical_1.coinMarketCapGetGlobalMetricsQuotesHistorical,
|
|
40
|
+
get_global_metrics_quotes_latest_1.coinMarketCapGetGlobalMetricsQuotesLatest,
|
|
41
|
+
],
|
|
42
|
+
triggers: [],
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/custom/coinmarketcap/src/index.ts"],"names":[],"mappings":";;;AAAA,iDAAqD;AACrD,qEAA6D;AAC7D,qCAA+C;AAC/C,qBAAqB;AACrB,+DAAwE;AACxE,mFAA2F;AAC3F,yGAAgH;AAChH,mGAA0G;AAC1G,2GAAkH;AAClH,mGAA0G;AAC1G,qGAA4G;AAC5G,uEAA+E;AAC/E,+FAAqG;AACrG,uFAA6F;AAC7F,6GAAmH;AACnH,qGAA2G;AAE9F,QAAA,aAAa,GAAG,IAAA,8BAAW,EAAC;IACvC,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,kFAAkF;IAC/F,IAAI,EAAE,wBAAiB;IACvB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,0DAA0D;IACnE,OAAO,EAAE,CAAC,wBAAwB,CAAC;IACnC,UAAU,EAAE,CAAC,sBAAa,CAAC,IAAI,CAAC;IAChC,OAAO,EAAE;QACP,yCAAyB;QACzB,4DAAkC;QAClC,iFAA4C;QAC5C,2EAAyC;QACzC,mFAA6C;QAC7C,2EAAyC;QACzC,6EAA0C;QAC1C,gDAA4B;QAC5B,sEAAsC;QACtC,8DAAkC;QAClC,oFAA6C;QAC7C,4EAAyC;KAC1C;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const coinMarketCapConvertPrice: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
2
|
+
amount: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
3
|
+
id: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
4
|
+
symbol: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
convert: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
convert_id: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coinMarketCapConvertPrice = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.coinMarketCapConvertPrice = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'coinmarketcap_convert_price',
|
|
10
|
+
displayName: 'CoinMarketCap Convert Price',
|
|
11
|
+
description: 'Convert an amount of one currency into another using CoinMarketCap API.',
|
|
12
|
+
props: {
|
|
13
|
+
amount: pieces_framework_1.Property.Number({
|
|
14
|
+
displayName: 'Amount',
|
|
15
|
+
description: 'The amount to convert',
|
|
16
|
+
required: true,
|
|
17
|
+
}),
|
|
18
|
+
id: pieces_framework_1.Property.Number({
|
|
19
|
+
displayName: 'Source Currency ID',
|
|
20
|
+
description: 'The CoinMarketCap ID of the source currency',
|
|
21
|
+
required: false,
|
|
22
|
+
}),
|
|
23
|
+
symbol: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'Source Currency Symbol',
|
|
25
|
+
description: 'The symbol of the source currency (required if ID not provided)',
|
|
26
|
+
required: false,
|
|
27
|
+
}),
|
|
28
|
+
convert: pieces_framework_1.Property.ShortText({
|
|
29
|
+
displayName: 'Target Currency Code',
|
|
30
|
+
description: 'The target currency code to convert into (e.g. USD)',
|
|
31
|
+
required: false,
|
|
32
|
+
}),
|
|
33
|
+
convert_id: pieces_framework_1.Property.Number({
|
|
34
|
+
displayName: 'Target Currency ID',
|
|
35
|
+
description: 'The CoinMarketCap ID of the target currency',
|
|
36
|
+
required: false,
|
|
37
|
+
}),
|
|
38
|
+
},
|
|
39
|
+
run(context) {
|
|
40
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const { amount, id, symbol, convert, convert_id } = context.propsValue;
|
|
42
|
+
if (!id && !symbol) {
|
|
43
|
+
throw new Error('Either "id" or "symbol" must be provided.');
|
|
44
|
+
}
|
|
45
|
+
const url = new URL('https://pro-api.coinmarketcap.com/v1/tools/price-conversion');
|
|
46
|
+
const params = { amount: amount.toString() };
|
|
47
|
+
if (id)
|
|
48
|
+
params['id'] = id.toString();
|
|
49
|
+
if (symbol)
|
|
50
|
+
params['symbol'] = symbol;
|
|
51
|
+
if (convert)
|
|
52
|
+
params['convert'] = convert;
|
|
53
|
+
if (convert_id)
|
|
54
|
+
params['convert_id'] = convert_id.toString();
|
|
55
|
+
Object.entries(params).forEach(([key, value]) => url.searchParams.append(key, value));
|
|
56
|
+
const apiKey = yield (0, common_1.getCmcApiKey)(context);
|
|
57
|
+
if (!apiKey) {
|
|
58
|
+
return {
|
|
59
|
+
success: false,
|
|
60
|
+
errorType: 'MissingApiKey',
|
|
61
|
+
error: 'No CoinMarketCap API key available. Please configure a connection or contact support.'
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
const response = yield (0, node_fetch_1.default)(url.toString(), {
|
|
66
|
+
method: 'GET',
|
|
67
|
+
headers: {
|
|
68
|
+
Accept: 'application/json',
|
|
69
|
+
'X-CMC_PRO_API_KEY': apiKey,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
if (!response.ok) {
|
|
73
|
+
const errorText = yield response.text();
|
|
74
|
+
throw new Error(`CoinMarketCap API request failed: ${response.status} - ${errorText}`);
|
|
75
|
+
}
|
|
76
|
+
const data = yield response.json();
|
|
77
|
+
return {
|
|
78
|
+
success: true,
|
|
79
|
+
data,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
const error = err;
|
|
84
|
+
return {
|
|
85
|
+
success: false,
|
|
86
|
+
errorType: error.name || 'UnknownError',
|
|
87
|
+
error: error.message || 'An unknown error occurred',
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=convert-price.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-price.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/coinmarketcap/src/lib/actions/convert-price.ts"],"names":[],"mappings":";;;;AAAA,qEAAuE;AACvE,oEAA8B;AAC9B,sCAAwC;AAE3B,QAAA,yBAAyB,GAAG,IAAA,+BAAY,EAAC;IACpD,IAAI,EAAE,6BAA6B;IACnC,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE,yEAAyE;IACtF,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACtB,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,EAAE,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAClB,WAAW,EAAE,oBAAoB;YACjC,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,wBAAwB;YACrC,WAAW,EAAE,iEAAiE;YAC9E,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,sBAAsB;YACnC,WAAW,EAAE,qDAAqD;YAClE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC1B,WAAW,EAAE,oBAAoB;YACjC,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,MAAM,EAAE,EAAE,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AAmB,EAAE,MAAM;qBAC5B;iBACF,CAAC,CAAA;gBAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;oBACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;oBACvC,MAAM,IAAI,KAAK,CAAC,qCAAqC,QAAQ,CAAC,MAAM,MAAM,SAAS,EAAE,CAAC,CAAA;gBACxF,CAAC;gBAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;gBAElC,OAAO;oBACL,OAAO,EAAE,IAAI;oBACX,IAAI;iBACL,CAAA;YACH,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,KAAK,GAAG,GAAY,CAAA;gBAE1B,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,SAAS,EAAE,KAAK,CAAC,IAAI,IAAI,cAAc;oBACvC,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,2BAA2B;iBACpD,CAAA;YACH,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const coinMarketCapGetCryptocurrencyInfo: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
2
|
+
id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
3
|
+
slug: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
symbol: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coinMarketCapGetCryptocurrencyInfo = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.coinMarketCapGetCryptocurrencyInfo = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'coinmarketcap_get_cryptocurrency_info',
|
|
10
|
+
displayName: 'CoinMarketCap Get Cryptocurrency Info',
|
|
11
|
+
description: 'Get static metadata for cryptocurrencies from CoinMarketCap.',
|
|
12
|
+
props: {
|
|
13
|
+
id: pieces_framework_1.Property.ShortText({
|
|
14
|
+
displayName: 'Cryptocurrency ID',
|
|
15
|
+
description: 'The CoinMarketCap ID of the cryptocurrency.',
|
|
16
|
+
required: false,
|
|
17
|
+
}),
|
|
18
|
+
slug: pieces_framework_1.Property.ShortText({
|
|
19
|
+
displayName: 'Slug',
|
|
20
|
+
description: 'The URL-friendly identifier of the cryptocurrency (e.g. bitcoin).',
|
|
21
|
+
required: false,
|
|
22
|
+
}),
|
|
23
|
+
symbol: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'Symbol',
|
|
25
|
+
description: 'The ticker symbol of the cryptocurrency (e.g. BTC).',
|
|
26
|
+
required: false,
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
29
|
+
run(context) {
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const { id, slug, symbol } = context.propsValue;
|
|
32
|
+
// Validate input
|
|
33
|
+
if (!id && !slug && !symbol) {
|
|
34
|
+
throw new Error('One of "id", "slug", or "symbol" must be provided.');
|
|
35
|
+
}
|
|
36
|
+
const url = new URL('https://pro-api.coinmarketcap.com/v1/cryptocurrency/info');
|
|
37
|
+
// Build query parameters
|
|
38
|
+
if (id)
|
|
39
|
+
url.searchParams.append('id', id);
|
|
40
|
+
if (slug)
|
|
41
|
+
url.searchParams.append('slug', slug);
|
|
42
|
+
if (symbol)
|
|
43
|
+
url.searchParams.append('symbol', symbol);
|
|
44
|
+
const apiKey = yield (0, common_1.getCmcApiKey)(context);
|
|
45
|
+
if (!apiKey) {
|
|
46
|
+
return {
|
|
47
|
+
success: false,
|
|
48
|
+
errorType: 'MissingApiKey',
|
|
49
|
+
error: 'No CoinMarketCap API key available. Please configure a connection or contact support.'
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// Perform API request
|
|
53
|
+
const response = yield (0, node_fetch_1.default)(url.toString(), {
|
|
54
|
+
method: 'GET',
|
|
55
|
+
headers: {
|
|
56
|
+
Accept: 'application/json',
|
|
57
|
+
'X-CMC_PRO_API_KEY': apiKey,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
if (!response.ok) {
|
|
61
|
+
const errorText = yield response.text();
|
|
62
|
+
throw new Error(`CoinMarketCap API request failed: ${response.status} - ${errorText}`);
|
|
63
|
+
}
|
|
64
|
+
const data = yield response.json();
|
|
65
|
+
return {
|
|
66
|
+
success: true,
|
|
67
|
+
data,
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=get-cryptocurrency-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-cryptocurrency-info.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/coinmarketcap/src/lib/actions/get-cryptocurrency-info.ts"],"names":[],"mappings":";;;;AAAA,qEAAuE;AACvE,oEAA8B;AAC9B,sCAAwC;AAE3B,QAAA,kCAAkC,GAAG,IAAA,+BAAY,EAAC;IAC7D,IAAI,EAAE,uCAAuC;IAC7C,WAAW,EAAE,uCAAuC;IACpD,WAAW,EAAE,8DAA8D;IAC3E,KAAK,EAAE;QACL,EAAE,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,mBAAmB;YAChC,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,mEAAmE;YAChF,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,MAAM,EAAE,2BA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SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;gBACvC,MAAM,IAAI,KAAK,CAAC,qCAAqC,QAAQ,CAAC,MAAM,MAAM,SAAS,EAAE,CAAC,CAAA;YACxF,CAAC;YAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YAElC,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,IAAI;aACL,CAAA;QACH,CAAC;KAAA;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const coinMarketCapGetCryptocurrencyListingsLatest: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
2
|
+
start: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
3
|
+
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
4
|
+
convert: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
sort: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
sort_dir: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
7
|
+
cryptocurrency_type: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
tag: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coinMarketCapGetCryptocurrencyListingsLatest = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.coinMarketCapGetCryptocurrencyListingsLatest = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'coinmarketcap_get_cryptocurrency_listings_latest',
|
|
10
|
+
displayName: 'CoinMarketCap Get Cryptocurrency Listings Latest',
|
|
11
|
+
description: 'Fetch a list of cryptocurrencies with the latest market data from CoinMarketCap.',
|
|
12
|
+
props: {
|
|
13
|
+
start: pieces_framework_1.Property.Number({
|
|
14
|
+
displayName: 'Start',
|
|
15
|
+
description: 'Start index (default 1)',
|
|
16
|
+
required: false,
|
|
17
|
+
defaultValue: 1,
|
|
18
|
+
}),
|
|
19
|
+
limit: pieces_framework_1.Property.Number({
|
|
20
|
+
displayName: 'Limit',
|
|
21
|
+
description: 'Number of items to retrieve (default 20, max 10 enforced)',
|
|
22
|
+
required: false,
|
|
23
|
+
defaultValue: 20,
|
|
24
|
+
}),
|
|
25
|
+
convert: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Convert',
|
|
27
|
+
description: 'Currency code to convert prices into (default USD)',
|
|
28
|
+
required: false,
|
|
29
|
+
defaultValue: 'USD',
|
|
30
|
+
}),
|
|
31
|
+
sort: pieces_framework_1.Property.ShortText({
|
|
32
|
+
displayName: 'Sort',
|
|
33
|
+
description: 'Field to sort by (default market_cap)',
|
|
34
|
+
required: false,
|
|
35
|
+
defaultValue: 'market_cap',
|
|
36
|
+
}),
|
|
37
|
+
sort_dir: pieces_framework_1.Property.StaticDropdown({
|
|
38
|
+
displayName: 'Sort Direction',
|
|
39
|
+
description: 'Direction of sorting (asc or desc)',
|
|
40
|
+
required: false,
|
|
41
|
+
defaultValue: 'desc',
|
|
42
|
+
options: {
|
|
43
|
+
options: [
|
|
44
|
+
{ label: 'Ascending', value: 'asc' },
|
|
45
|
+
{ label: 'Descending', value: 'desc' },
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
49
|
+
cryptocurrency_type: pieces_framework_1.Property.ShortText({
|
|
50
|
+
displayName: 'Cryptocurrency Type',
|
|
51
|
+
description: 'Filter by cryptocurrency type (default all)',
|
|
52
|
+
required: false,
|
|
53
|
+
defaultValue: 'all',
|
|
54
|
+
}),
|
|
55
|
+
tag: pieces_framework_1.Property.ShortText({
|
|
56
|
+
displayName: 'Tag',
|
|
57
|
+
description: 'Filter by tag (default all)',
|
|
58
|
+
required: false,
|
|
59
|
+
defaultValue: 'all',
|
|
60
|
+
}),
|
|
61
|
+
},
|
|
62
|
+
run(context) {
|
|
63
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
var _a;
|
|
65
|
+
const { start, limit, convert, sort, sort_dir, cryptocurrency_type, tag, } = context.propsValue;
|
|
66
|
+
// Enforce maximum record limit of 10, like Python's `estimate_limit`
|
|
67
|
+
const enforcedLimit = limit && limit > 10 ? 10 : limit || 10;
|
|
68
|
+
const url = new URL('https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest');
|
|
69
|
+
const params = {
|
|
70
|
+
start: (start || 1).toString(),
|
|
71
|
+
limit: enforcedLimit.toString(),
|
|
72
|
+
};
|
|
73
|
+
if (convert)
|
|
74
|
+
params['convert'] = convert;
|
|
75
|
+
if (sort)
|
|
76
|
+
params['sort'] = sort;
|
|
77
|
+
if (sort_dir)
|
|
78
|
+
params['sort_dir'] = sort_dir;
|
|
79
|
+
if (cryptocurrency_type)
|
|
80
|
+
params['cryptocurrency_type'] = cryptocurrency_type;
|
|
81
|
+
if (tag)
|
|
82
|
+
params['tag'] = tag;
|
|
83
|
+
Object.entries(params).forEach(([key, value]) => url.searchParams.append(key, value));
|
|
84
|
+
const apiKey = yield (0, common_1.getCmcApiKey)(context);
|
|
85
|
+
if (!apiKey) {
|
|
86
|
+
return {
|
|
87
|
+
success: false,
|
|
88
|
+
errorType: 'MissingApiKey',
|
|
89
|
+
error: 'No CoinMarketCap API key available. Please configure a connection or contact support.'
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const response = yield (0, node_fetch_1.default)(url.toString(), {
|
|
93
|
+
method: 'GET',
|
|
94
|
+
headers: {
|
|
95
|
+
Accept: 'application/json',
|
|
96
|
+
'X-CMC_PRO_API_KEY': apiKey,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
if (!response.ok) {
|
|
100
|
+
const errorText = yield response.text();
|
|
101
|
+
throw new Error(`CoinMarketCap API request failed: ${response.status} - ${errorText}`);
|
|
102
|
+
}
|
|
103
|
+
const data = yield response.json();
|
|
104
|
+
return {
|
|
105
|
+
success: true,
|
|
106
|
+
totalReturned: ((_a = data.data) === null || _a === void 0 ? void 0 : _a.length) || 0,
|
|
107
|
+
data,
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
//# sourceMappingURL=get-cryptocurrency-listings-latest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-cryptocurrency-listings-latest.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/coinmarketcap/src/lib/actions/get-cryptocurrency-listings-latest.ts"],"names":[],"mappings":";;;;AAAA,qEAAuE;AACvE,oEAA8B;AAC9B,sCAAwC;AAE3B,QAAA,4CAA4C,GAAG,IAAA,+BAAY,EAAC;IACvE,IAAI,EAAE,kDAAkD;IACxD,WAAW,EAAE,kDAAkD;IAC/D,WAAW,EAAE,kFAAkF;IAC/F,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACrB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,yBAAyB;YACtC,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,CAAC;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACrB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,2DAA2D;YACxE,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,EAAE;SACjB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,oDAAoD;YACjE,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACpB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAA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MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YAElC,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,aAAa,EAAE,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,MAAM,KAAI,CAAC;gBACrC,IAAI;aACL,CAAA;QACH,CAAC;KAAA;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const coinMarketCapGetCryptocurrencyListingsNew: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
2
|
+
start: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
3
|
+
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
4
|
+
convert: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coinMarketCapGetCryptocurrencyListingsNew = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.coinMarketCapGetCryptocurrencyListingsNew = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'coinmarketcap_get_cryptocurrency_listings_new',
|
|
10
|
+
displayName: 'CoinMarketCap Get Cryptocurrency Listings New',
|
|
11
|
+
description: 'Get a list of new cryptocurrencies added to CoinMarketCap.',
|
|
12
|
+
props: {
|
|
13
|
+
start: pieces_framework_1.Property.Number({
|
|
14
|
+
displayName: 'Start',
|
|
15
|
+
description: 'Starting index of the listings (default 1)',
|
|
16
|
+
required: false,
|
|
17
|
+
defaultValue: 1,
|
|
18
|
+
}),
|
|
19
|
+
limit: pieces_framework_1.Property.Number({
|
|
20
|
+
displayName: 'Limit',
|
|
21
|
+
description: 'Number of cryptocurrencies to retrieve (default 10, max 10 enforced)',
|
|
22
|
+
required: false,
|
|
23
|
+
defaultValue: 10,
|
|
24
|
+
}),
|
|
25
|
+
convert: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Convert',
|
|
27
|
+
description: 'Currency code to convert prices into (default USD)',
|
|
28
|
+
required: false,
|
|
29
|
+
defaultValue: 'USD',
|
|
30
|
+
}),
|
|
31
|
+
},
|
|
32
|
+
run(context) {
|
|
33
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
var _a;
|
|
35
|
+
const { start, limit, convert } = context.propsValue;
|
|
36
|
+
// Enforce maximum limit = 10
|
|
37
|
+
const enforcedLimit = limit && limit > 10 ? 10 : limit || 10;
|
|
38
|
+
const url = new URL('https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/new');
|
|
39
|
+
const params = {
|
|
40
|
+
start: (start || 1).toString(),
|
|
41
|
+
limit: enforcedLimit.toString(),
|
|
42
|
+
convert: convert || 'USD',
|
|
43
|
+
};
|
|
44
|
+
Object.entries(params).forEach(([key, value]) => url.searchParams.append(key, value));
|
|
45
|
+
const apiKey = yield (0, common_1.getCmcApiKey)(context);
|
|
46
|
+
if (!apiKey) {
|
|
47
|
+
return {
|
|
48
|
+
success: false,
|
|
49
|
+
errorType: 'MissingApiKey',
|
|
50
|
+
error: 'No CoinMarketCap API key available. Please configure a connection or contact support.'
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const response = yield (0, node_fetch_1.default)(url.toString(), {
|
|
54
|
+
method: 'GET',
|
|
55
|
+
headers: {
|
|
56
|
+
Accept: 'application/json',
|
|
57
|
+
'X-CMC_PRO_API_KEY': apiKey,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
if (!response.ok) {
|
|
61
|
+
const errorText = yield response.text();
|
|
62
|
+
throw new Error(`CoinMarketCap API request failed: ${response.status} - ${errorText}`);
|
|
63
|
+
}
|
|
64
|
+
const data = yield response.json();
|
|
65
|
+
return {
|
|
66
|
+
success: true,
|
|
67
|
+
totalReturned: ((_a = data.data) === null || _a === void 0 ? void 0 : _a.length) || 0,
|
|
68
|
+
data,
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=get-cryptocurrency-listings-new.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-cryptocurrency-listings-new.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/coinmarketcap/src/lib/actions/get-cryptocurrency-listings-new.ts"],"names":[],"mappings":";;;;AAAA,qEAAuE;AACvE,oEAA8B;AAC9B,sCAAwC;AAE3B,QAAA,yCAAyC,GAAG,IAAA,+BAAY,EAAC;IACpE,IAAI,EAAE,+CAA+C;IACrD,WAAW,EAAE,+CAA+C;IAC5D,WAAW,EAAE,4DAA4D;IACzE,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACrB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,4CAA4C;YACzD,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,CAAC;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACrB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,sEAAsE;YACnF,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,EAAE;SACjB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,oDAAoD;YACjE,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACpB,CAAC;KAEH;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAA;YAEpD,6BAA6B;YAC7B,MAAM,aAAa,GAAG,KAAK,IAAI,KAAK,GAAG,EAAE,CAAC,CAAC,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ACb,aAAa,EAAE,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,MAAM,KAAI,CAAC;gBACrC,IAAI;aACL,CAAA;QACH,CAAC;KAAA;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const coinMarketCapGetCryptocurrencyOhlcvHistorical: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
2
|
+
id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
3
|
+
symbol: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
time_start: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
time_end: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
convert: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coinMarketCapGetCryptocurrencyOhlcvHistorical = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.coinMarketCapGetCryptocurrencyOhlcvHistorical = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'coinmarketcap_get_cryptocurrency_ohlcv_historical',
|
|
10
|
+
displayName: 'CoinMarketCap Get Cryptocurrency OHLCV Historical',
|
|
11
|
+
description: 'Retrieve historical OHLCV (Open, High, Low, Close, Volume) data for a cryptocurrency from CoinMarketCap within a maximum two-month timeframe.',
|
|
12
|
+
props: {
|
|
13
|
+
id: pieces_framework_1.Property.ShortText({
|
|
14
|
+
displayName: 'CoinMarketCap ID',
|
|
15
|
+
description: 'The CoinMarketCap ID of the cryptocurrency (required if symbol is not provided)',
|
|
16
|
+
required: false,
|
|
17
|
+
}),
|
|
18
|
+
symbol: pieces_framework_1.Property.ShortText({
|
|
19
|
+
displayName: 'Symbol',
|
|
20
|
+
description: 'The ticker symbol of the cryptocurrency (required if id is not provided)',
|
|
21
|
+
required: false,
|
|
22
|
+
}),
|
|
23
|
+
time_start: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'Start Time',
|
|
25
|
+
description: 'Start datetime for the historical data period in ISO 8601 format (e.g., "2023-10-01T00:00:00Z")',
|
|
26
|
+
required: false,
|
|
27
|
+
}),
|
|
28
|
+
time_end: pieces_framework_1.Property.ShortText({
|
|
29
|
+
displayName: 'End Time',
|
|
30
|
+
description: 'End datetime for the historical data period in ISO 8601 format (e.g., "2023-10-31T23:59:59Z")',
|
|
31
|
+
required: false,
|
|
32
|
+
}),
|
|
33
|
+
convert: pieces_framework_1.Property.ShortText({
|
|
34
|
+
displayName: 'Convert',
|
|
35
|
+
description: 'Currency code to convert prices into (default USD)',
|
|
36
|
+
required: false,
|
|
37
|
+
defaultValue: 'USD',
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
run(context) {
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const { id, symbol, time_start, time_end, convert } = context.propsValue;
|
|
43
|
+
if (!id && !symbol) {
|
|
44
|
+
throw new Error('One of id or symbol must be provided.');
|
|
45
|
+
}
|
|
46
|
+
const url = new URL('https://pro-api.coinmarketcap.com/v1/cryptocurrency/ohlcv/historical');
|
|
47
|
+
// Build query parameters
|
|
48
|
+
const params = {
|
|
49
|
+
convert: convert || 'USD',
|
|
50
|
+
interval: 'daily', // Default interval
|
|
51
|
+
};
|
|
52
|
+
if (id)
|
|
53
|
+
params['id'] = id;
|
|
54
|
+
if (symbol)
|
|
55
|
+
params['symbol'] = symbol;
|
|
56
|
+
if (time_start)
|
|
57
|
+
params['time_start'] = time_start;
|
|
58
|
+
if (time_end)
|
|
59
|
+
params['time_end'] = time_end;
|
|
60
|
+
Object.entries(params).forEach(([key, value]) => url.searchParams.append(key, value));
|
|
61
|
+
const apiKey = yield (0, common_1.getCmcApiKey)(context);
|
|
62
|
+
if (!apiKey) {
|
|
63
|
+
return {
|
|
64
|
+
success: false,
|
|
65
|
+
errorType: 'MissingApiKey',
|
|
66
|
+
error: 'No CoinMarketCap API key available. Please configure a connection or contact support.'
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const response = yield (0, node_fetch_1.default)(url.toString(), {
|
|
70
|
+
method: 'GET',
|
|
71
|
+
headers: {
|
|
72
|
+
Accept: 'application/json',
|
|
73
|
+
'X-CMC_PRO_API_KEY': apiKey,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
if (!response.ok) {
|
|
77
|
+
const errorText = yield response.text();
|
|
78
|
+
throw new Error(`CoinMarketCap API request failed: ${response.status} - ${errorText}`);
|
|
79
|
+
}
|
|
80
|
+
const data = yield response.json();
|
|
81
|
+
return {
|
|
82
|
+
success: true,
|
|
83
|
+
symbol: symbol || id,
|
|
84
|
+
totalReturned: data.data ? Object.keys(data.data).length : 0,
|
|
85
|
+
data,
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=get-cryptocurrency-ohlcv-historical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-cryptocurrency-ohlcv-historical.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/coinmarketcap/src/lib/actions/get-cryptocurrency-ohlcv-historical.ts"],"names":[],"mappings":";;;;AAAA,qEAAuE;AACvE,oEAA8B;AAC9B,sCAAwC;AAE3B,QAAA,6CAA6C,GAAG,IAAA,+BAAY,EAAC;IACxE,IAAI,EAAE,mDAAmD;IACzD,WAAW,EAAE,mDAAmD;IAChE,WAAW,EACT,+IAA+I;IACjJ,KAAK,EAAE;QACL,EAAE,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WA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L,CAAA;QACH,CAAC;KAAA;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const coinMarketCapGetCryptocurrencyOhlcvLatest: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
2
|
+
id: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
3
|
+
slug: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
symbol: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
convert: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
}>;
|