@opentabs-dev/opentabs-plugin-coinbase 0.0.74
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 +159 -0
- package/dist/adapter.iife.js +15111 -0
- package/dist/adapter.iife.js.map +7 -0
- package/dist/coinbase-api.d.ts +14 -0
- package/dist/coinbase-api.d.ts.map +1 -0
- package/dist/coinbase-api.js +74 -0
- package/dist/coinbase-api.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +64 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/add-watchlist-item.d.ts +8 -0
- package/dist/tools/add-watchlist-item.d.ts.map +1 -0
- package/dist/tools/add-watchlist-item.js +33 -0
- package/dist/tools/add-watchlist-item.js.map +1 -0
- package/dist/tools/compare-asset-prices.d.ts +17 -0
- package/dist/tools/compare-asset-prices.d.ts.map +1 -0
- package/dist/tools/compare-asset-prices.js +47 -0
- package/dist/tools/compare-asset-prices.js.map +1 -0
- package/dist/tools/create-price-alert.d.ts +12 -0
- package/dist/tools/create-price-alert.d.ts.map +1 -0
- package/dist/tools/create-price-alert.js +37 -0
- package/dist/tools/create-price-alert.js.map +1 -0
- package/dist/tools/create-watchlist.d.ts +7 -0
- package/dist/tools/create-watchlist.d.ts.map +1 -0
- package/dist/tools/create-watchlist.js +27 -0
- package/dist/tools/create-watchlist.js.map +1 -0
- package/dist/tools/delete-price-alert.d.ts +7 -0
- package/dist/tools/delete-price-alert.d.ts.map +1 -0
- package/dist/tools/delete-price-alert.js +29 -0
- package/dist/tools/delete-price-alert.js.map +1 -0
- package/dist/tools/delete-watchlist.d.ts +7 -0
- package/dist/tools/delete-watchlist.d.ts.map +1 -0
- package/dist/tools/delete-watchlist.js +27 -0
- package/dist/tools/delete-watchlist.js.map +1 -0
- package/dist/tools/get-asset-by-slug.d.ts +27 -0
- package/dist/tools/get-asset-by-slug.d.ts.map +1 -0
- package/dist/tools/get-asset-by-slug.js +39 -0
- package/dist/tools/get-asset-by-slug.js.map +1 -0
- package/dist/tools/get-asset-by-symbol.d.ts +27 -0
- package/dist/tools/get-asset-by-symbol.d.ts.map +1 -0
- package/dist/tools/get-asset-by-symbol.js +39 -0
- package/dist/tools/get-asset-by-symbol.js.map +1 -0
- package/dist/tools/get-asset-by-uuid.d.ts +38 -0
- package/dist/tools/get-asset-by-uuid.d.ts.map +1 -0
- package/dist/tools/get-asset-by-uuid.js +45 -0
- package/dist/tools/get-asset-by-uuid.js.map +1 -0
- package/dist/tools/get-asset-categories.d.ts +12 -0
- package/dist/tools/get-asset-categories.d.ts.map +1 -0
- package/dist/tools/get-asset-categories.js +30 -0
- package/dist/tools/get-asset-categories.js.map +1 -0
- package/dist/tools/get-asset-networks.d.ts +13 -0
- package/dist/tools/get-asset-networks.d.ts.map +1 -0
- package/dist/tools/get-asset-networks.js +36 -0
- package/dist/tools/get-asset-networks.js.map +1 -0
- package/dist/tools/get-asset-price.d.ts +14 -0
- package/dist/tools/get-asset-price.d.ts.map +1 -0
- package/dist/tools/get-asset-price.js +40 -0
- package/dist/tools/get-asset-price.js.map +1 -0
- package/dist/tools/get-current-user.d.ts +14 -0
- package/dist/tools/get-current-user.d.ts.map +1 -0
- package/dist/tools/get-current-user.js +27 -0
- package/dist/tools/get-current-user.js.map +1 -0
- package/dist/tools/list-portfolios.d.ts +9 -0
- package/dist/tools/list-portfolios.d.ts.map +1 -0
- package/dist/tools/list-portfolios.js +26 -0
- package/dist/tools/list-portfolios.js.map +1 -0
- package/dist/tools/list-price-alerts.d.ts +14 -0
- package/dist/tools/list-price-alerts.d.ts.map +1 -0
- package/dist/tools/list-price-alerts.js +42 -0
- package/dist/tools/list-price-alerts.js.map +1 -0
- package/dist/tools/list-watchlists.d.ts +14 -0
- package/dist/tools/list-watchlists.d.ts.map +1 -0
- package/dist/tools/list-watchlists.js +34 -0
- package/dist/tools/list-watchlists.js.map +1 -0
- package/dist/tools/remove-watchlist-item.d.ts +8 -0
- package/dist/tools/remove-watchlist-item.d.ts.map +1 -0
- package/dist/tools/remove-watchlist-item.js +33 -0
- package/dist/tools/remove-watchlist-item.js.map +1 -0
- package/dist/tools/schemas.d.ts +220 -0
- package/dist/tools/schemas.d.ts.map +1 -0
- package/dist/tools/schemas.js +171 -0
- package/dist/tools/schemas.js.map +1 -0
- package/dist/tools.json +1272 -0
- package/package.json +55 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coinbase uses HttpOnly session cookies for authentication and a same-origin
|
|
3
|
+
* GraphQL endpoint at `/graphql/query`. Introspection is disabled but inline
|
|
4
|
+
* queries are accepted via POST. Auth detection relies on the `logged_in`
|
|
5
|
+
* non-HttpOnly cookie that Coinbase sets alongside the session.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isAuthenticated: () => boolean;
|
|
8
|
+
export declare const waitForAuth: () => Promise<boolean>;
|
|
9
|
+
/**
|
|
10
|
+
* Execute a GraphQL query or mutation against the Coinbase same-origin endpoint.
|
|
11
|
+
* Uses HttpOnly session cookies automatically via `credentials: 'include'`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const gql: <T>(query: string, variables?: Record<string, unknown>, operationName?: string) => Promise<T>;
|
|
14
|
+
//# sourceMappingURL=coinbase-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coinbase-api.d.ts","sourceRoot":"","sources":["../src/coinbase-api.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAMH,eAAO,MAAM,eAAe,QAAO,OAA4C,CAAC;AAEhF,eAAO,MAAM,WAAW,QAAa,OAAO,CAAC,OAAO,CAOnD,CAAC;AAqBF;;;GAGG;AACH,eAAO,MAAM,GAAG,GAAU,CAAC,EACzB,OAAO,MAAM,EACb,YAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACvC,gBAAgB,MAAM,KACrB,OAAO,CAAC,CAAC,CA2CX,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ToolError, fetchFromPage, getCookie, waitUntil } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Coinbase uses HttpOnly session cookies for authentication and a same-origin
|
|
4
|
+
* GraphQL endpoint at `/graphql/query`. Introspection is disabled but inline
|
|
5
|
+
* queries are accepted via POST. Auth detection relies on the `logged_in`
|
|
6
|
+
* non-HttpOnly cookie that Coinbase sets alongside the session.
|
|
7
|
+
*/
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// Auth detection
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
export const isAuthenticated = () => getCookie('logged_in') === 'true';
|
|
12
|
+
export const waitForAuth = async () => {
|
|
13
|
+
try {
|
|
14
|
+
await waitUntil(() => isAuthenticated(), { interval: 500, timeout: 5000 });
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// GraphQL caller
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
const GQL_ENDPOINT = '/graphql/query';
|
|
25
|
+
const HEADERS = {
|
|
26
|
+
'Content-Type': 'application/json',
|
|
27
|
+
'CB-CLIENT': 'CoinbaseWeb',
|
|
28
|
+
'cb-version': '2021-01-11',
|
|
29
|
+
'X-CB-Platform': 'web',
|
|
30
|
+
'X-CB-Project-Name': 'consumer',
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Execute a GraphQL query or mutation against the Coinbase same-origin endpoint.
|
|
34
|
+
* Uses HttpOnly session cookies automatically via `credentials: 'include'`.
|
|
35
|
+
*/
|
|
36
|
+
export const gql = async (query, variables = {}, operationName) => {
|
|
37
|
+
if (!isAuthenticated()) {
|
|
38
|
+
throw ToolError.auth('Not authenticated — please log in to Coinbase.');
|
|
39
|
+
}
|
|
40
|
+
const response = await fetchFromPage(GQL_ENDPOINT, {
|
|
41
|
+
method: 'POST',
|
|
42
|
+
headers: HEADERS,
|
|
43
|
+
body: JSON.stringify({ query, variables, operationName }),
|
|
44
|
+
});
|
|
45
|
+
const json = (await response.json());
|
|
46
|
+
const firstError = json.errors?.[0];
|
|
47
|
+
if (firstError) {
|
|
48
|
+
const first = firstError;
|
|
49
|
+
const code = first.extensions?.code ?? '';
|
|
50
|
+
const msg = first.message;
|
|
51
|
+
if (code === 'UNAUTHENTICATED' || code === 'FORBIDDEN') {
|
|
52
|
+
throw ToolError.auth(msg);
|
|
53
|
+
}
|
|
54
|
+
if (code === 'NOT_FOUND') {
|
|
55
|
+
throw ToolError.notFound(msg);
|
|
56
|
+
}
|
|
57
|
+
if (code === 'RATE_LIMITED') {
|
|
58
|
+
throw ToolError.rateLimited(msg);
|
|
59
|
+
}
|
|
60
|
+
if (code === 'VALIDATION_FAILED' || code === 'BAD_USER_INPUT') {
|
|
61
|
+
throw ToolError.validation(msg);
|
|
62
|
+
}
|
|
63
|
+
// If we got partial data alongside errors, return the data
|
|
64
|
+
if (json.data) {
|
|
65
|
+
return json.data;
|
|
66
|
+
}
|
|
67
|
+
throw ToolError.internal(`GraphQL error: ${msg}`);
|
|
68
|
+
}
|
|
69
|
+
if (!json.data) {
|
|
70
|
+
throw ToolError.internal('GraphQL response contained no data.');
|
|
71
|
+
}
|
|
72
|
+
return json.data;
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=coinbase-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coinbase-api.js","sourceRoot":"","sources":["../src/coinbase-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1F;;;;;GAKG;AAEH,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,eAAe,GAAG,GAAY,EAAE,CAAC,SAAS,CAAC,WAAW,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M,IAAI,GAAG,KAAK,CAAC,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC;QAC1C,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC;QAE1B,IAAI,IAAI,KAAK,iBAAiB,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;YACvD,MAAM,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC;QACD,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;YACzB,MAAM,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAChC,CAAC;QACD,IAAI,IAAI,KAAK,cAAc,EAAE,CAAC;YAC5B,MAAM,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACnC,CAAC;QACD,IAAI,IAAI,KAAK,mBAAmB,IAAI,IAAI,KAAK,gBAAgB,EAAE,CAAC;YAC9D,MAAM,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAClC,CAAC;QACD,2DAA2D;QAC3D,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;QACD,MAAM,SAAS,CAAC,QAAQ,CAAC,kBAAkB,GAAG,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACf,MAAM,SAAS,CAAC,QAAQ,CAAC,qCAAqC,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OpenTabsPlugin } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import type { ToolDefinition } from '@opentabs-dev/plugin-sdk';
|
|
3
|
+
declare class CoinbasePlugin extends OpenTabsPlugin {
|
|
4
|
+
readonly name = "coinbase";
|
|
5
|
+
readonly description = "OpenTabs plugin for Coinbase";
|
|
6
|
+
readonly displayName = "Coinbase";
|
|
7
|
+
readonly urlPatterns: string[];
|
|
8
|
+
readonly homepage = "https://www.coinbase.com/home";
|
|
9
|
+
readonly tools: ToolDefinition[];
|
|
10
|
+
isReady(): Promise<boolean>;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: CoinbasePlugin;
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAgC/D,cAAM,cAAe,SAAQ,cAAc;IACzC,QAAQ,CAAC,IAAI,cAAc;IAC3B,QAAQ,CAAC,WAAW,kCAAkC;IACtD,SAAkB,WAAW,cAAc;IAC3C,QAAQ,CAAC,WAAW,WAA4B;IAChD,SAAkB,QAAQ,mCAAmC;IAC7D,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,CA6B9B;IAEI,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;CAIlC;;AAED,wBAAoC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { OpenTabsPlugin } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { isAuthenticated, waitForAuth } from './coinbase-api.js';
|
|
3
|
+
// Account
|
|
4
|
+
import { getCurrentUser } from './tools/get-current-user.js';
|
|
5
|
+
// Portfolio
|
|
6
|
+
import { listPortfolios } from './tools/list-portfolios.js';
|
|
7
|
+
// Assets
|
|
8
|
+
import { getAssetByUuid } from './tools/get-asset-by-uuid.js';
|
|
9
|
+
import { getAssetBySlug } from './tools/get-asset-by-slug.js';
|
|
10
|
+
import { getAssetBySymbol } from './tools/get-asset-by-symbol.js';
|
|
11
|
+
import { getAssetCategories } from './tools/get-asset-categories.js';
|
|
12
|
+
import { getAssetNetworks } from './tools/get-asset-networks.js';
|
|
13
|
+
// Prices
|
|
14
|
+
import { getAssetPrice } from './tools/get-asset-price.js';
|
|
15
|
+
import { compareAssetPrices } from './tools/compare-asset-prices.js';
|
|
16
|
+
// Watchlists
|
|
17
|
+
import { listWatchlists } from './tools/list-watchlists.js';
|
|
18
|
+
import { createWatchlist } from './tools/create-watchlist.js';
|
|
19
|
+
import { deleteWatchlist } from './tools/delete-watchlist.js';
|
|
20
|
+
import { addWatchlistItem } from './tools/add-watchlist-item.js';
|
|
21
|
+
import { removeWatchlistItem } from './tools/remove-watchlist-item.js';
|
|
22
|
+
// Alerts
|
|
23
|
+
import { listPriceAlerts } from './tools/list-price-alerts.js';
|
|
24
|
+
import { createPriceAlert } from './tools/create-price-alert.js';
|
|
25
|
+
import { deletePriceAlert } from './tools/delete-price-alert.js';
|
|
26
|
+
class CoinbasePlugin extends OpenTabsPlugin {
|
|
27
|
+
name = 'coinbase';
|
|
28
|
+
description = 'OpenTabs plugin for Coinbase';
|
|
29
|
+
displayName = 'Coinbase';
|
|
30
|
+
urlPatterns = ['*://*.coinbase.com/*'];
|
|
31
|
+
homepage = 'https://www.coinbase.com/home';
|
|
32
|
+
tools = [
|
|
33
|
+
// Account
|
|
34
|
+
getCurrentUser,
|
|
35
|
+
// Portfolio
|
|
36
|
+
listPortfolios,
|
|
37
|
+
// Assets
|
|
38
|
+
getAssetByUuid,
|
|
39
|
+
getAssetBySlug,
|
|
40
|
+
getAssetBySymbol,
|
|
41
|
+
getAssetCategories,
|
|
42
|
+
getAssetNetworks,
|
|
43
|
+
// Prices
|
|
44
|
+
getAssetPrice,
|
|
45
|
+
compareAssetPrices,
|
|
46
|
+
// Watchlists
|
|
47
|
+
listWatchlists,
|
|
48
|
+
createWatchlist,
|
|
49
|
+
deleteWatchlist,
|
|
50
|
+
addWatchlistItem,
|
|
51
|
+
removeWatchlistItem,
|
|
52
|
+
// Alerts
|
|
53
|
+
listPriceAlerts,
|
|
54
|
+
createPriceAlert,
|
|
55
|
+
deletePriceAlert,
|
|
56
|
+
];
|
|
57
|
+
async isReady() {
|
|
58
|
+
if (isAuthenticated())
|
|
59
|
+
return true;
|
|
60
|
+
return waitForAuth();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export default new CoinbasePlugin();
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEjE,UAAU;AACV,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,YAAY;AACZ,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,SAAS;AACT,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,SAAS;AACT,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,aAAa;AACb,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,SAAS;AACT,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,cAAe,SAAQ,cAAc;IAChC,IAAI,GAAG,UAAU,CAAC;IAClB,WAAW,GAAG,8BAA8B,CAAC;IACpC,WAAW,GAAG,UAAU,CAAC;IAClC,WAAW,GAAG,CAAC,sBAAsB,CAAC,CAAC;IAC9B,QAAQ,GAAG,+BAA+B,CAAC;IACpD,KAAK,GAAqB;QACjC,UAAU;QACV,cAAc;QAEd,YAAY;QACZ,cAAc;QAEd,SAAS;QACT,cAAc;QACd,cAAc;QACd,gBAAgB;QAChB,kBAAkB;QAClB,gBAAgB;QAEhB,SAAS;QACT,aAAa;QACb,kBAAkB;QAElB,aAAa;QACb,cAAc;QACd,eAAe;QACf,eAAe;QACf,gBAAgB;QAChB,mBAAmB;QAEnB,SAAS;QACT,eAAe;QACf,gBAAgB;QAChB,gBAAgB;KACjB,CAAC;IAEF,KAAK,CAAC,OAAO;QACX,IAAI,eAAe,EAAE;YAAE,OAAO,IAAI,CAAC;QACnC,OAAO,WAAW,EAAE,CAAC;IACvB,CAAC;CACF;AAED,eAAe,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const addWatchlistItem: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
watchlist_uuid: z.ZodString;
|
|
4
|
+
asset_uuid: z.ZodString;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
success: z.ZodBoolean;
|
|
7
|
+
}, z.core.$strip>>;
|
|
8
|
+
//# sourceMappingURL=add-watchlist-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-watchlist-item.d.ts","sourceRoot":"","sources":["../../src/tools/add-watchlist-item.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,gBAAgB;;;;;kBAwB3B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { gql } from '../coinbase-api.js';
|
|
4
|
+
const MUTATION = `mutation AddWatchlistItem($input: AddWatchlistItemInput!) {
|
|
5
|
+
addWatchlistItem(input: $input) {
|
|
6
|
+
__typename
|
|
7
|
+
}
|
|
8
|
+
}`;
|
|
9
|
+
export const addWatchlistItem = defineTool({
|
|
10
|
+
name: 'add_watchlist_item',
|
|
11
|
+
displayName: 'Add Watchlist Item',
|
|
12
|
+
description: 'Add an asset to a watchlist by providing the watchlist UUID and the asset UUID. Use list_watchlists to find watchlist UUIDs and get_asset_by_symbol/slug to find asset UUIDs.',
|
|
13
|
+
summary: 'Add an asset to a watchlist',
|
|
14
|
+
icon: 'plus',
|
|
15
|
+
group: 'Watchlists',
|
|
16
|
+
input: z.object({
|
|
17
|
+
watchlist_uuid: z.string().describe('Watchlist UUID (from list_watchlists)'),
|
|
18
|
+
asset_uuid: z.string().describe('Asset UUID to add'),
|
|
19
|
+
}),
|
|
20
|
+
output: z.object({
|
|
21
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
22
|
+
}),
|
|
23
|
+
handle: async (params) => {
|
|
24
|
+
await gql(MUTATION, {
|
|
25
|
+
input: {
|
|
26
|
+
watchlistUuid: params.watchlist_uuid,
|
|
27
|
+
assetUuid: params.asset_uuid,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
return { success: true };
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=add-watchlist-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-watchlist-item.js","sourceRoot":"","sources":["../../src/tools/add-watchlist-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAEzC,MAAM,QAAQ,GAAG;;;;EAIf,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;IACzC,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EACT,+KAA+K;IACjL,OAAO,EAAE,6BAA6B;IACtC,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,YAAY;IACnB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;QAC5E,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;KACrD,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;KACjE,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,GAAG,CAAC,QAAQ,EAAE;YAClB,KAAK,EAAE;gBACL,aAAa,EAAE,MAAM,CAAC,cAAc;gBACpC,SAAS,EAAE,MAAM,CAAC,UAAU;aAC7B;SACF,CAAC,CAAC;QACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const compareAssetPrices: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
uuids: z.ZodArray<z.ZodString>;
|
|
4
|
+
quote_currency: z.ZodOptional<z.ZodString>;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
assets: z.ZodArray<z.ZodObject<{
|
|
7
|
+
uuid: z.ZodString;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
symbol: z.ZodString;
|
|
10
|
+
latest_price: z.ZodObject<{
|
|
11
|
+
price: z.ZodString;
|
|
12
|
+
timestamp: z.ZodString;
|
|
13
|
+
quote_currency: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
}, z.core.$strip>>;
|
|
17
|
+
//# sourceMappingURL=compare-asset-prices.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare-asset-prices.d.ts","sourceRoot":"","sources":["../../src/tools/compare-asset-prices.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4BxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;kBAgC7B,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { gql } from '../coinbase-api.js';
|
|
4
|
+
import { latestPriceSchema, mapLatestPrice } from './schemas.js';
|
|
5
|
+
const buildQuery = (uuids, quoteCurrency) => {
|
|
6
|
+
const fields = uuids
|
|
7
|
+
.map((uuid, i) => `a${i}: assetByUuid(uuid: "${uuid}") { uuid name symbol latestPrice(quoteCurrency: "${quoteCurrency}") { price timestamp quoteCurrency } }`)
|
|
8
|
+
.join('\n ');
|
|
9
|
+
return `query CompareAssetPrices {\n ${fields}\n}`;
|
|
10
|
+
};
|
|
11
|
+
const priceComparisonSchema = z.object({
|
|
12
|
+
uuid: z.string().describe('Asset UUID'),
|
|
13
|
+
name: z.string().describe('Asset name'),
|
|
14
|
+
symbol: z.string().describe('Ticker symbol'),
|
|
15
|
+
latest_price: latestPriceSchema,
|
|
16
|
+
});
|
|
17
|
+
export const compareAssetPrices = defineTool({
|
|
18
|
+
name: 'compare_asset_prices',
|
|
19
|
+
displayName: 'Compare Asset Prices',
|
|
20
|
+
description: 'Get current prices for multiple assets in a single request. Provide up to 10 asset UUIDs and receive all their latest prices at once. Useful for comparing prices across assets.',
|
|
21
|
+
summary: 'Compare prices of multiple assets',
|
|
22
|
+
icon: 'bar-chart-3',
|
|
23
|
+
group: 'Prices',
|
|
24
|
+
input: z.object({
|
|
25
|
+
uuids: z.array(z.string()).min(1).max(10).describe('Array of asset UUIDs to compare (1-10)'),
|
|
26
|
+
quote_currency: z.string().optional().describe('Quote currency for prices (default "USD")'),
|
|
27
|
+
}),
|
|
28
|
+
output: z.object({
|
|
29
|
+
assets: z.array(priceComparisonSchema).describe('Assets with their current prices'),
|
|
30
|
+
}),
|
|
31
|
+
handle: async (params) => {
|
|
32
|
+
const qc = params.quote_currency ?? 'USD';
|
|
33
|
+
const query = buildQuery(params.uuids, qc);
|
|
34
|
+
const data = await gql(query);
|
|
35
|
+
const assets = params.uuids.map((_, i) => {
|
|
36
|
+
const a = data[`a${i}`] ?? {};
|
|
37
|
+
return {
|
|
38
|
+
uuid: a.uuid ?? '',
|
|
39
|
+
name: a.name ?? '',
|
|
40
|
+
symbol: a.symbol ?? '',
|
|
41
|
+
latest_price: mapLatestPrice(a.latestPrice ?? {}),
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
return { assets };
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=compare-asset-prices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare-asset-prices.js","sourceRoot":"","sources":["../../src/tools/compare-asset-prices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAA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MAAM,CAAC;QACf,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,QAAQ,CAAC,kCAAkC,CAAC;KACpF,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,EAAE,GAAG,MAAM,CAAC,cAAc,IAAI,KAAK,CAAC;QAC1C,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC3C,MAAM,IAAI,GAAG,MAAM,GAAG,CAA8B,KAAK,CAAC,CAAC;QAE3D,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACvC,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;YAC9B,OAAO;gBACL,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE;gBAClB,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE;gBAClB,MAAM,EAAE,CAAC,CAAC,MAAM,IAAI,EAAE;gBACtB,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC,WAAW,IAAI,EAAE,CAAC;aAClD,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,CAAC;IACpB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createPriceAlert: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
asset_uuid: z.ZodString;
|
|
4
|
+
target_price: z.ZodString;
|
|
5
|
+
direction: z.ZodEnum<{
|
|
6
|
+
ABOVE: "ABOVE";
|
|
7
|
+
BELOW: "BELOW";
|
|
8
|
+
}>;
|
|
9
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
10
|
+
success: z.ZodBoolean;
|
|
11
|
+
}, z.core.$strip>>;
|
|
12
|
+
//# sourceMappingURL=create-price-alert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-price-alert.d.ts","sourceRoot":"","sources":["../../src/tools/create-price-alert.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,gBAAgB;;;;;;;;;kBA4B3B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { gql } from '../coinbase-api.js';
|
|
4
|
+
const MUTATION = `mutation CreatePriceAlert($input: CreatePriceAlertInput!) {
|
|
5
|
+
createPriceAlert(input: $input) {
|
|
6
|
+
__typename
|
|
7
|
+
}
|
|
8
|
+
}`;
|
|
9
|
+
export const createPriceAlert = defineTool({
|
|
10
|
+
name: 'create_price_alert',
|
|
11
|
+
displayName: 'Create Price Alert',
|
|
12
|
+
description: 'Create a price alert for a cryptocurrency asset. You will be notified when the asset price crosses the target price in the specified direction. Use get_asset_by_symbol to find the asset UUID.',
|
|
13
|
+
summary: 'Create a price alert for an asset',
|
|
14
|
+
icon: 'bell-plus',
|
|
15
|
+
group: 'Alerts',
|
|
16
|
+
input: z.object({
|
|
17
|
+
asset_uuid: z.string().describe('Asset UUID to set the alert for'),
|
|
18
|
+
target_price: z.string().describe('Target price as a decimal string (e.g. "75000.00")'),
|
|
19
|
+
direction: z
|
|
20
|
+
.enum(['ABOVE', 'BELOW'])
|
|
21
|
+
.describe('Alert direction — ABOVE to notify when price rises above target, BELOW when it drops below'),
|
|
22
|
+
}),
|
|
23
|
+
output: z.object({
|
|
24
|
+
success: z.boolean().describe('Whether the alert was created'),
|
|
25
|
+
}),
|
|
26
|
+
handle: async (params) => {
|
|
27
|
+
await gql(MUTATION, {
|
|
28
|
+
input: {
|
|
29
|
+
assetUuid: params.asset_uuid,
|
|
30
|
+
targetPrice: params.target_price,
|
|
31
|
+
direction: params.direction,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
return { success: true };
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=create-price-alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-price-alert.js","sourceRoot":"","sources":["../../src/tools/create-price-alert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAEzC,MAAM,QAAQ,GAAG;;;;EAIf,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;IACzC,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EACT,iMAAiM;IACnM,OAAO,EAAE,mCAAmC;IAC5C,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;QAClE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;QACvF,SAAS,EAAE,CAAC;aACT,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;aACxB,QAAQ,CAAC,4FAA4F,CAAC;KAC1G,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;KAC/D,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,GAAG,CAAC,QAAQ,EAAE;YAClB,KAAK,EAAE;gBACL,SAAS,EAAE,MAAM,CAAC,UAAU;gBAC5B,WAAW,EAAE,MAAM,CAAC,YAAY;gBAChC,SAAS,EAAE,MAAM,CAAC,SAAS;aAC5B;SACF,CAAC,CAAC;QACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createWatchlist: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
success: z.ZodBoolean;
|
|
6
|
+
}, z.core.$strip>>;
|
|
7
|
+
//# sourceMappingURL=create-watchlist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-watchlist.d.ts","sourceRoot":"","sources":["../../src/tools/create-watchlist.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,eAAe;;;;kBAiB1B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { gql } from '../coinbase-api.js';
|
|
4
|
+
const MUTATION = `mutation CreateWatchlist($input: CreateWatchlistInput!) {
|
|
5
|
+
createWatchlist(input: $input) {
|
|
6
|
+
__typename
|
|
7
|
+
}
|
|
8
|
+
}`;
|
|
9
|
+
export const createWatchlist = defineTool({
|
|
10
|
+
name: 'create_watchlist',
|
|
11
|
+
displayName: 'Create Watchlist',
|
|
12
|
+
description: 'Create a new empty watchlist with a given name. Use add_watchlist_item to add assets to it afterwards.',
|
|
13
|
+
summary: 'Create a new watchlist',
|
|
14
|
+
icon: 'list-plus',
|
|
15
|
+
group: 'Watchlists',
|
|
16
|
+
input: z.object({
|
|
17
|
+
name: z.string().describe('Name for the new watchlist'),
|
|
18
|
+
}),
|
|
19
|
+
output: z.object({
|
|
20
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
21
|
+
}),
|
|
22
|
+
handle: async (params) => {
|
|
23
|
+
await gql(MUTATION, { input: { name: params.name } });
|
|
24
|
+
return { success: true };
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=create-watchlist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-watchlist.js","sourceRoot":"","sources":["../../src/tools/create-watchlist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAEzC,MAAM,QAAQ,GAAG;;;;EAIf,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;IACxC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,wGAAwG;IACrH,OAAO,EAAE,wBAAwB;IACjC,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,YAAY;IACnB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;KACxD,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;KACjE,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,GAAG,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACtD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const deletePriceAlert: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
alert_uuid: z.ZodString;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
success: z.ZodBoolean;
|
|
6
|
+
}, z.core.$strip>>;
|
|
7
|
+
//# sourceMappingURL=delete-price-alert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-price-alert.d.ts","sourceRoot":"","sources":["../../src/tools/delete-price-alert.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,gBAAgB;;;;kBAmB3B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { gql } from '../coinbase-api.js';
|
|
4
|
+
const MUTATION = `mutation DeletePriceAlert($input: DeletePriceAlertInput!) {
|
|
5
|
+
deletePriceAlert(input: $input) {
|
|
6
|
+
__typename
|
|
7
|
+
}
|
|
8
|
+
}`;
|
|
9
|
+
export const deletePriceAlert = defineTool({
|
|
10
|
+
name: 'delete_price_alert',
|
|
11
|
+
displayName: 'Delete Price Alert',
|
|
12
|
+
description: 'Delete an existing price alert by its UUID. Use list_price_alerts to find alert UUIDs.',
|
|
13
|
+
summary: 'Delete a price alert',
|
|
14
|
+
icon: 'bell-minus',
|
|
15
|
+
group: 'Alerts',
|
|
16
|
+
input: z.object({
|
|
17
|
+
alert_uuid: z.string().describe('UUID of the price alert to delete'),
|
|
18
|
+
}),
|
|
19
|
+
output: z.object({
|
|
20
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
21
|
+
}),
|
|
22
|
+
handle: async (params) => {
|
|
23
|
+
await gql(MUTATION, {
|
|
24
|
+
input: { priceAlertUuid: params.alert_uuid },
|
|
25
|
+
});
|
|
26
|
+
return { success: true };
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=delete-price-alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-price-alert.js","sourceRoot":"","sources":["../../src/tools/delete-price-alert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAEzC,MAAM,QAAQ,GAAG;;;;EAIf,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;IACzC,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,wFAAwF;IACrG,OAAO,EAAE,sBAAsB;IAC/B,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;KACrE,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;KACjE,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,GAAG,CAAC,QAAQ,EAAE;YAClB,KAAK,EAAE,EAAE,cAAc,EAAE,MAAM,CAAC,UAAU,EAAE;SAC7C,CAAC,CAAC;QACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const deleteWatchlist: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
watchlist_uuid: z.ZodString;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
success: z.ZodBoolean;
|
|
6
|
+
}, z.core.$strip>>;
|
|
7
|
+
//# sourceMappingURL=delete-watchlist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-watchlist.d.ts","sourceRoot":"","sources":["../../src/tools/delete-watchlist.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,eAAe;;;;kBAiB1B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { gql } from '../coinbase-api.js';
|
|
4
|
+
const MUTATION = `mutation DeleteWatchlist($input: DeleteWatchlistInput!) {
|
|
5
|
+
deleteWatchlist(input: $input) {
|
|
6
|
+
__typename
|
|
7
|
+
}
|
|
8
|
+
}`;
|
|
9
|
+
export const deleteWatchlist = defineTool({
|
|
10
|
+
name: 'delete_watchlist',
|
|
11
|
+
displayName: 'Delete Watchlist',
|
|
12
|
+
description: 'Delete a watchlist by its UUID. Use list_watchlists to find watchlist UUIDs.',
|
|
13
|
+
summary: 'Delete a watchlist',
|
|
14
|
+
icon: 'trash-2',
|
|
15
|
+
group: 'Watchlists',
|
|
16
|
+
input: z.object({
|
|
17
|
+
watchlist_uuid: z.string().describe('UUID of the watchlist to delete'),
|
|
18
|
+
}),
|
|
19
|
+
output: z.object({
|
|
20
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
21
|
+
}),
|
|
22
|
+
handle: async (params) => {
|
|
23
|
+
await gql(MUTATION, { input: { watchlistUuid: params.watchlist_uuid } });
|
|
24
|
+
return { success: true };
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=delete-watchlist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-watchlist.js","sourceRoot":"","sources":["../../src/tools/delete-watchlist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAEzC,MAAM,QAAQ,GAAG;;;;EAIf,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;IACxC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,8EAA8E;IAC3F,OAAO,EAAE,oBAAoB;IAC7B,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,YAAY;IACnB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;KACvE,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;KACjE,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,GAAG,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QACzE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getAssetBySlug: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
slug: z.ZodString;
|
|
4
|
+
quote_currency: z.ZodOptional<z.ZodString>;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
asset: z.ZodObject<{
|
|
7
|
+
uuid: z.ZodString;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
symbol: z.ZodString;
|
|
10
|
+
slug: z.ZodString;
|
|
11
|
+
description: z.ZodString;
|
|
12
|
+
color: z.ZodString;
|
|
13
|
+
image_url: z.ZodString;
|
|
14
|
+
circulating_supply: z.ZodString;
|
|
15
|
+
max_supply: z.ZodString;
|
|
16
|
+
market_cap: z.ZodString;
|
|
17
|
+
volume_24h: z.ZodString;
|
|
18
|
+
all_time_high: z.ZodString;
|
|
19
|
+
unit_price_scale: z.ZodNumber;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
latest_price: z.ZodObject<{
|
|
22
|
+
price: z.ZodString;
|
|
23
|
+
timestamp: z.ZodString;
|
|
24
|
+
quote_currency: z.ZodString;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
//# sourceMappingURL=get-asset-by-slug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-asset-by-slug.d.ts","sourceRoot":"","sources":["../../src/tools/get-asset-by-slug.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuBxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;kBA2BzB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { gql } from '../coinbase-api.js';
|
|
4
|
+
import { assetSchema, latestPriceSchema, mapAsset, mapLatestPrice, } from './schemas.js';
|
|
5
|
+
const QUERY = `query GetAssetBySlug($slug: String!, $quoteCurrency: TickerSymbol!) {
|
|
6
|
+
assetBySlug(slug: $slug) {
|
|
7
|
+
uuid name symbol slug description color imageUrl
|
|
8
|
+
circulatingSupply maxSupply marketCap volume24h allTimeHigh unitPriceScale
|
|
9
|
+
latestPrice(quoteCurrency: $quoteCurrency) { price timestamp quoteCurrency }
|
|
10
|
+
}
|
|
11
|
+
}`;
|
|
12
|
+
export const getAssetBySlug = defineTool({
|
|
13
|
+
name: 'get_asset_by_slug',
|
|
14
|
+
displayName: 'Get Asset by Slug',
|
|
15
|
+
description: 'Get detailed information about a cryptocurrency asset by its URL slug (e.g. "bitcoin", "ethereum", "solana"). Returns market data and current price.',
|
|
16
|
+
summary: 'Get asset details by URL slug',
|
|
17
|
+
icon: 'circle-dollar-sign',
|
|
18
|
+
group: 'Assets',
|
|
19
|
+
input: z.object({
|
|
20
|
+
slug: z.string().describe('Asset URL slug (e.g. "bitcoin", "ethereum", "solana", "dogecoin")'),
|
|
21
|
+
quote_currency: z.string().optional().describe('Quote currency for price (default "USD")'),
|
|
22
|
+
}),
|
|
23
|
+
output: z.object({
|
|
24
|
+
asset: assetSchema,
|
|
25
|
+
latest_price: latestPriceSchema,
|
|
26
|
+
}),
|
|
27
|
+
handle: async (params) => {
|
|
28
|
+
const data = await gql(QUERY, {
|
|
29
|
+
slug: params.slug,
|
|
30
|
+
quoteCurrency: params.quote_currency ?? 'USD',
|
|
31
|
+
});
|
|
32
|
+
const a = data.assetBySlug;
|
|
33
|
+
return {
|
|
34
|
+
asset: mapAsset(a),
|
|
35
|
+
latest_price: mapLatestPrice(a.latestPrice ?? {}),
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=get-asset-by-slug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-asset-by-slug.js","sourceRoot":"","sources":["../../src/tools/get-asset-by-slug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAGL,WAAW,EAC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ptional<z.ZodString>;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
asset: z.ZodObject<{
|
|
7
|
+
uuid: z.ZodString;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
symbol: z.ZodString;
|
|
10
|
+
slug: z.ZodString;
|
|
11
|
+
description: z.ZodString;
|
|
12
|
+
color: z.ZodString;
|
|
13
|
+
image_url: z.ZodString;
|
|
14
|
+
circulating_supply: z.ZodString;
|
|
15
|
+
max_supply: z.ZodString;
|
|
16
|
+
market_cap: z.ZodString;
|
|
17
|
+
volume_24h: z.ZodString;
|
|
18
|
+
all_time_high: z.ZodString;
|
|
19
|
+
unit_price_scale: z.ZodNumber;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
latest_price: z.ZodObject<{
|
|
22
|
+
price: z.ZodString;
|
|
23
|
+
timestamp: z.ZodString;
|
|
24
|
+
quote_currency: z.ZodString;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
//# sourceMappingURL=get-asset-by-symbol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-asset-by-symbol.d.ts","sourceRoot":"","sources":["../../src/tools/get-asset-by-symbol.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuBxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;kBA2B3B,CAAC"}
|