@opentabs-dev/opentabs-plugin-coinbase 0.0.82 → 0.0.83
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.
|
@@ -1 +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;
|
|
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;AA6BxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;kBAmC7B,CAAC"}
|
|
@@ -2,11 +2,12 @@ import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { gql } from '../coinbase-api.js';
|
|
4
4
|
import { latestPriceSchema, mapLatestPrice } from './schemas.js';
|
|
5
|
-
const buildQuery = (uuids
|
|
5
|
+
const buildQuery = (uuids) => {
|
|
6
|
+
const varDefs = uuids.map((_, i) => `$uuid${i}: String!`).join(', ');
|
|
6
7
|
const fields = uuids
|
|
7
|
-
.map((
|
|
8
|
+
.map((_, i) => `a${i}: assetByUuid(uuid: $uuid${i}) { uuid name symbol latestPrice(quoteCurrency: $quoteCurrency) { price timestamp quoteCurrency } }`)
|
|
8
9
|
.join('\n ');
|
|
9
|
-
return `query CompareAssetPrices {\n ${fields}\n}`;
|
|
10
|
+
return `query CompareAssetPrices($quoteCurrency: String!, ${varDefs}) {\n ${fields}\n}`;
|
|
10
11
|
};
|
|
11
12
|
const priceComparisonSchema = z.object({
|
|
12
13
|
uuid: z.string().describe('Asset UUID'),
|
|
@@ -29,9 +30,12 @@ export const compareAssetPrices = defineTool({
|
|
|
29
30
|
assets: z.array(priceComparisonSchema).describe('Assets with their current prices'),
|
|
30
31
|
}),
|
|
31
32
|
handle: async (params) => {
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
33
|
+
const query = buildQuery(params.uuids);
|
|
34
|
+
const variables = { quoteCurrency: params.quote_currency ?? 'USD' };
|
|
35
|
+
for (const [i, uuid] of params.uuids.entries()) {
|
|
36
|
+
variables[`uuid${i}`] = uuid;
|
|
37
|
+
}
|
|
38
|
+
const data = await gql(query, variables);
|
|
35
39
|
const assets = params.uuids.map((_, i) => {
|
|
36
40
|
const a = data[`a${i}`] ?? {};
|
|
37
41
|
return {
|
|
@@ -1 +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,CAAC;AACzC,OAAO,EAAuB,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEtF,MAAM,UAAU,GAAG,CAAC,KAAe,EAAE,
|
|
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,CAAC;AACzC,OAAO,EAAuB,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEtF,MAAM,UAAU,GAAG,CAAC,KAAe,EAAU,EAAE;IAC7C,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC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,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,SAAS,GAA2B,EAAE,aAAa,EAAE,MAAM,CAAC,cAAc,IAAI,KAAK,EAAE,CAAC;QAC5F,KAAK,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YAC/C,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;QAC/B,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,GAAG,CAA8B,KAAK,EAAE,SAAS,CAAC,CAAC;QAEtE,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"}
|
package/dist/tools.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"sdkVersion": "0.0.
|
|
2
|
+
"sdkVersion": "0.0.82",
|
|
3
3
|
"iconSvg": "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm-1.243 16.846a5.082 5.082 0 01-3.532-1.332 4.993 4.993 0 01-1.474-3.49c-.013-1.327.5-2.605 1.427-3.556a5.07 5.07 0 013.532-1.487h.094c1.12.014 2.187.442 3.003 1.205l-1.59 1.69a2.574 2.574 0 00-1.46-.485 2.578 2.578 0 00-1.807.752 2.514 2.514 0 00-.726 1.847c.005.696.285 1.362.78 1.856a2.578 2.578 0 001.86.754c.586 0 1.146-.22 1.578-.619l1.537 1.727a5.098 5.098 0 01-3.222 1.138z\" fill=\"#0052FF\"/></svg>",
|
|
4
4
|
"iconInactiveSvg": "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm-1.243 16.846a5.082 5.082 0 01-3.532-1.332 4.993 4.993 0 01-1.474-3.49c-.013-1.327.5-2.605 1.427-3.556a5.07 5.07 0 013.532-1.487h.094c1.12.014 2.187.442 3.003 1.205l-1.59 1.69a2.574 2.574 0 00-1.46-.485 2.578 2.578 0 00-1.807.752 2.514 2.514 0 00-.726 1.847c.005.696.285 1.362.78 1.856a2.578 2.578 0 001.86.754c.586 0 1.146-.22 1.578-.619l1.537 1.727a5.098 5.098 0 01-3.222 1.138z\" fill=\"#999999\"/></svg>",
|
|
5
5
|
"iconDarkSvg": "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm-1.243 16.846a5.082 5.082 0 01-3.532-1.332 4.993 4.993 0 01-1.474-3.49c-.013-1.327.5-2.605 1.427-3.556a5.07 5.07 0 013.532-1.487h.094c1.12.014 2.187.442 3.003 1.205l-1.59 1.69a2.574 2.574 0 00-1.46-.485 2.578 2.578 0 00-1.807.752 2.514 2.514 0 00-.726 1.847c.005.696.285 1.362.78 1.856a2.578 2.578 0 001.86.754c.586 0 1.146-.22 1.578-.619l1.537 1.727a5.098 5.098 0 01-3.222 1.138z\" fill=\"#1a63ff\"/></svg>",
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.0.
|
|
7
|
+
"version": "0.0.83",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "dist/adapter.iife.js",
|
|
10
10
|
"keywords": [
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"zod": "^4.0.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@opentabs-dev/plugin-sdk": "^0.0.
|
|
51
|
+
"@opentabs-dev/plugin-sdk": "^0.0.82"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@opentabs-dev/plugin-tools": "^0.0.
|
|
54
|
+
"@opentabs-dev/plugin-tools": "^0.0.82",
|
|
55
55
|
"@biomejs/biome": "2.4.6",
|
|
56
56
|
"jiti": "^2.6.1",
|
|
57
57
|
"typescript": "^5.9.3",
|