@andrewkimjoseph/celina-sdk 0.7.13 → 0.8.0

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.
Files changed (67) hide show
  1. package/README.md +6 -39
  2. package/build/analytics/mcp-tool-events.js +0 -12
  3. package/build/analytics/mcp-tool-events.js.map +1 -1
  4. package/build/analytics/wallet-extract.js +0 -2
  5. package/build/analytics/wallet-extract.js.map +1 -1
  6. package/build/config/sdk-config.d.ts +0 -4
  7. package/build/config/sdk-config.js +0 -4
  8. package/build/config/sdk-config.js.map +1 -1
  9. package/build/index.d.ts +0 -10
  10. package/build/index.js +0 -7
  11. package/build/index.js.map +1 -1
  12. package/build/tools/domains/index.js +0 -2
  13. package/build/tools/domains/index.js.map +1 -1
  14. package/build/tools/filter.js +0 -8
  15. package/build/tools/filter.js.map +1 -1
  16. package/build/tools/index.d.ts +0 -1
  17. package/build/tools/index.js +0 -1
  18. package/build/tools/index.js.map +1 -1
  19. package/build/tools/schemas/common.d.ts +0 -10
  20. package/build/tools/schemas/common.js +0 -6
  21. package/build/tools/schemas/common.js.map +1 -1
  22. package/build/tools/schemas/wallet-params.d.ts +2 -0
  23. package/build/tools/schemas/wallet-params.js +27 -1
  24. package/build/tools/schemas/wallet-params.js.map +1 -1
  25. package/build/tools/types.d.ts +0 -26
  26. package/package.json +1 -2
  27. package/tests/catalog/operations.ts +2 -7
  28. package/build/clients/carbon-rest.d.ts +0 -17
  29. package/build/clients/carbon-rest.js +0 -59
  30. package/build/clients/carbon-rest.js.map +0 -1
  31. package/build/clients/carbon-sdk.d.ts +0 -31
  32. package/build/clients/carbon-sdk.js +0 -48
  33. package/build/clients/carbon-sdk.js.map +0 -1
  34. package/build/config/carbon.d.ts +0 -15
  35. package/build/config/carbon.js +0 -18
  36. package/build/config/carbon.js.map +0 -1
  37. package/build/services/carbon.service.d.ts +0 -73
  38. package/build/services/carbon.service.js +0 -204
  39. package/build/services/carbon.service.js.map +0 -1
  40. package/build/tools/domains/carbon.d.ts +0 -2
  41. package/build/tools/domains/carbon.js +0 -187
  42. package/build/tools/domains/carbon.js.map +0 -1
  43. package/build/tools/utils/carbon-prepare-handler.d.ts +0 -6
  44. package/build/tools/utils/carbon-prepare-handler.js +0 -17
  45. package/build/tools/utils/carbon-prepare-handler.js.map +0 -1
  46. package/build/types/carbon.d.ts +0 -31
  47. package/build/types/carbon.js +0 -2
  48. package/build/types/carbon.js.map +0 -1
  49. package/build/utils/carbon-execution.d.ts +0 -11
  50. package/build/utils/carbon-execution.js +0 -106
  51. package/build/utils/carbon-execution.js.map +0 -1
  52. package/build/utils/carbon-prepared-flow.d.ts +0 -11
  53. package/build/utils/carbon-prepared-flow.js +0 -28
  54. package/build/utils/carbon-prepared-flow.js.map +0 -1
  55. package/build/utils/carbon-rest-adapter.d.ts +0 -8
  56. package/build/utils/carbon-rest-adapter.js +0 -79
  57. package/build/utils/carbon-rest-adapter.js.map +0 -1
  58. package/build/utils/carbon-step-labels.d.ts +0 -12
  59. package/build/utils/carbon-step-labels.js +0 -180
  60. package/build/utils/carbon-step-labels.js.map +0 -1
  61. package/build/utils/carbon-token.d.ts +0 -10
  62. package/build/utils/carbon-token.js +0 -39
  63. package/build/utils/carbon-token.js.map +0 -1
  64. package/build/utils/finalize-carbon-prepare.d.ts +0 -10
  65. package/build/utils/finalize-carbon-prepare.js +0 -17
  66. package/build/utils/finalize-carbon-prepare.js.map +0 -1
  67. package/tests/catalog/domains/carbon.ts +0 -547
@@ -1,547 +0,0 @@
1
- import type { OperationSpec } from "../types.js";
2
- import { assertHasKeys } from "../../helpers/assert.js";
3
-
4
- const CARBON_WALLET = "0x0000000000000000000000000000000000000001" as const;
5
- const CELO = "0x471EcE3750Da237a93B120cEadFa0b8eA6E3E25";
6
- const USDC = "0xcebA9300f2b948710d2653dd7D87747AdA2aA3b";
7
-
8
- function carbonRead(
9
- id: string,
10
- tool: string,
11
- invoke: OperationSpec["sdk"]["invoke"],
12
- args: () => Record<string, unknown>,
13
- keys: string[],
14
- ): OperationSpec {
15
- return {
16
- id,
17
- domain: "carbon",
18
- layer: "read",
19
- sdk: { invoke },
20
- mcp: { tool, arguments: args },
21
- assert: (result) => assertHasKeys(result, keys),
22
- };
23
- }
24
-
25
- function carbonPrepare(
26
- id: string,
27
- tool: string,
28
- invoke: OperationSpec["sdk"]["invoke"],
29
- args: () => Record<string, unknown>,
30
- ): OperationSpec {
31
- return {
32
- id,
33
- domain: "carbon",
34
- layer: "prepare",
35
- sdk: { invoke },
36
- mcp: { tool, arguments: args },
37
- assert: (result) => assertHasKeys(result, ["status", "warnings"]),
38
- skip: () =>
39
- "Carbon prepare tools require valid strategy params; run manually with funded wallet",
40
- };
41
- }
42
-
43
- function carbonExecute(
44
- id: string,
45
- tool: string,
46
- args: () => Record<string, unknown>,
47
- ): OperationSpec {
48
- return {
49
- id,
50
- domain: "carbon",
51
- layer: "write",
52
- requiresEnv: ["CELO_PRIVATE_KEY"],
53
- requiresWrites: true,
54
- mcp: { tool, arguments: args },
55
- assert: (result) => assertHasKeys(result, ["hash", "from"]),
56
- skip: () => "Set CELINA_TEST_WRITES=1 to run on-chain Carbon execute tests",
57
- };
58
- }
59
-
60
- export const carbonOperations: OperationSpec[] = [
61
- carbonRead(
62
- "carbon.getStrategies",
63
- "get_carbon_strategies",
64
- (c) => c.carbon.getStrategies(CARBON_WALLET),
65
- () => ({ wallet_address: CARBON_WALLET }),
66
- ["status", "warnings"],
67
- ),
68
- {
69
- ...carbonRead(
70
- "carbon.getStrategy",
71
- "get_carbon_strategy",
72
- (c) => c.carbon.getStrategy("1"),
73
- () => ({ strategy_id: "1" }),
74
- ["status", "warnings"],
75
- ),
76
- skip: () =>
77
- "Requires an existing Carbon strategy id on Celo (set CELINA_CARBON_STRATEGY_ID)",
78
- },
79
- {
80
- ...carbonRead(
81
- "carbon.getTradeQuote",
82
- "get_carbon_trade_quote",
83
- (c) =>
84
- c.carbon.getTradeQuote({
85
- source_token: CELO,
86
- target_token: USDC,
87
- amount: 1,
88
- is_trade_by_target: false,
89
- }),
90
- () => ({
91
- source_token: CELO,
92
- target_token: USDC,
93
- amount: 1,
94
- is_trade_by_target: false,
95
- }),
96
- ["status", "warnings"],
97
- ),
98
- skip: () =>
99
- "Carbon get_trade_quote may fail when no maker liquidity exists for the pair",
100
- },
101
- carbonRead(
102
- "carbon.explorePair",
103
- "explore_carbon_pair",
104
- (c) => c.carbon.explorePair({ base_token: CELO, quote_token: USDC }),
105
- () => ({ base_token: CELO, quote_token: USDC }),
106
- ["status", "chain"],
107
- ),
108
- carbonRead(
109
- "carbon.resolveToken",
110
- "resolve_carbon_token",
111
- (c) => c.carbon.resolveToken("USDC"),
112
- () => ({ token: "USDC" }),
113
- ["status", "warnings"],
114
- ),
115
- carbonRead(
116
- "carbon.getActivity",
117
- "get_carbon_activity",
118
- (c) => c.carbon.getActivity({ wallet_address: CARBON_WALLET }),
119
- () => ({ wallet_address: CARBON_WALLET }),
120
- ["status", "warnings"],
121
- ),
122
- {
123
- ...carbonRead(
124
- "carbon.findOpportunities",
125
- "find_carbon_opportunities",
126
- (c) => c.carbon.findOpportunities({ base_token: CELO, quote_token: USDC }),
127
- () => ({ base_token: CELO, quote_token: USDC }),
128
- ["status", "warnings"],
129
- ),
130
- skip: () =>
131
- "Carbon find_opportunities may require market data on Celo; run manually when API returns opportunities",
132
- },
133
- carbonRead(
134
- "carbon.getProtocolStats",
135
- "get_carbon_protocol_stats",
136
- (c) => c.carbon.getProtocolStats({ period_days: 7 }),
137
- () => ({ period_days: 7 }),
138
- ["status", "chain"],
139
- ),
140
- {
141
- ...carbonRead(
142
- "carbon.getPriceHistory",
143
- "get_carbon_price_history",
144
- (c) =>
145
- c.carbon.getPriceHistory({
146
- base_token: CELO,
147
- quote_token: USDC,
148
- period_days: 7,
149
- }),
150
- () => ({ base_token: CELO, quote_token: USDC, period_days: 7 }),
151
- ["status", "warnings"],
152
- ),
153
- skip: () =>
154
- "Carbon get_price_history may return 400 for some Celo pairs; run manually when API is healthy",
155
- },
156
- {
157
- ...carbonRead(
158
- "carbon.simulateStrategy",
159
- "simulate_carbon_strategy",
160
- (c) =>
161
- c.carbon.simulateStrategy({
162
- base_token: CELO,
163
- quote_token: USDC,
164
- days: 7,
165
- buy_price_low: 0.1,
166
- buy_price_high: 0.2,
167
- buy_budget: 10,
168
- sell_price_low: 0.3,
169
- sell_price_high: 0.4,
170
- sell_budget: 5,
171
- }),
172
- () => ({
173
- base_token: CELO,
174
- quote_token: USDC,
175
- days: 7,
176
- buy_price_low: 0.1,
177
- buy_price_high: 0.2,
178
- buy_budget: 10,
179
- sell_price_low: 0.3,
180
- sell_price_high: 0.4,
181
- sell_budget: 5,
182
- }),
183
- ["status", "warnings"],
184
- ),
185
- skip: () =>
186
- "Carbon simulate_strategy may return 400 upstream on Celo; run manually when API is healthy",
187
- },
188
- carbonRead(
189
- "carbon.help",
190
- "carbon_help",
191
- (c) => c.carbon.help("create_limit_order"),
192
- () => ({ topic: "create_limit_order" }),
193
- ["status"],
194
- ),
195
- carbonRead(
196
- "carbon.learn",
197
- "carbon_learn",
198
- (c) => c.carbon.learn("recurring_strategy"),
199
- () => ({ topic: "recurring_strategy" }),
200
- ["status"],
201
- ),
202
- carbonPrepare(
203
- "carbon.prepareLimitOrder",
204
- "prepare_carbon_limit_order",
205
- (c) =>
206
- c.carbon.prepareLimitOrder({
207
- wallet_address: CARBON_WALLET,
208
- base_token: CELO,
209
- quote_token: USDC,
210
- direction: "buy",
211
- price: 0.5,
212
- budget: 10,
213
- }),
214
- () => ({
215
- wallet_address: CARBON_WALLET,
216
- base_token: CELO,
217
- quote_token: USDC,
218
- direction: "buy",
219
- price: 0.5,
220
- budget: 10,
221
- }),
222
- ),
223
- carbonPrepare(
224
- "carbon.prepareRangeOrder",
225
- "prepare_carbon_range_order",
226
- (c) =>
227
- c.carbon.prepareRangeOrder({
228
- wallet_address: CARBON_WALLET,
229
- base_token: CELO,
230
- quote_token: USDC,
231
- direction: "buy",
232
- price_low: 0.4,
233
- price_high: 0.6,
234
- budget: 10,
235
- }),
236
- () => ({
237
- wallet_address: CARBON_WALLET,
238
- base_token: CELO,
239
- quote_token: USDC,
240
- direction: "buy",
241
- price_low: 0.4,
242
- price_high: 0.6,
243
- budget: 10,
244
- }),
245
- ),
246
- carbonPrepare(
247
- "carbon.prepareRecurringStrategy",
248
- "prepare_carbon_recurring_strategy",
249
- (c) =>
250
- c.carbon.prepareRecurringStrategy({
251
- wallet_address: CARBON_WALLET,
252
- base_token: CELO,
253
- quote_token: USDC,
254
- buy_price_low: 0.4,
255
- buy_price_high: 0.5,
256
- buy_budget: 10,
257
- sell_price_low: 0.6,
258
- sell_price_high: 0.7,
259
- sell_budget: 5,
260
- }),
261
- () => ({
262
- wallet_address: CARBON_WALLET,
263
- base_token: CELO,
264
- quote_token: USDC,
265
- buy_price_low: 0.4,
266
- buy_price_high: 0.5,
267
- buy_budget: 10,
268
- sell_price_low: 0.6,
269
- sell_price_high: 0.7,
270
- sell_budget: 5,
271
- }),
272
- ),
273
- carbonPrepare(
274
- "carbon.prepareConcentratedStrategy",
275
- "prepare_carbon_concentrated_strategy",
276
- (c) =>
277
- c.carbon.prepareConcentratedStrategy({
278
- wallet_address: CARBON_WALLET,
279
- base_token: CELO,
280
- quote_token: USDC,
281
- spread_percentage: 1,
282
- buy_budget: 10,
283
- sell_budget: 5,
284
- }),
285
- () => ({
286
- wallet_address: CARBON_WALLET,
287
- base_token: CELO,
288
- quote_token: USDC,
289
- spread_percentage: 1,
290
- buy_budget: 10,
291
- sell_budget: 5,
292
- }),
293
- ),
294
- carbonPrepare(
295
- "carbon.prepareFullRangeStrategy",
296
- "prepare_carbon_full_range_strategy",
297
- (c) =>
298
- c.carbon.prepareFullRangeStrategy({
299
- wallet_address: CARBON_WALLET,
300
- base_token: CELO,
301
- quote_token: USDC,
302
- spread_percentage: 5,
303
- buy_budget: 10,
304
- sell_budget: 5,
305
- }),
306
- () => ({
307
- wallet_address: CARBON_WALLET,
308
- base_token: CELO,
309
- quote_token: USDC,
310
- spread_percentage: 5,
311
- buy_budget: 10,
312
- sell_budget: 5,
313
- }),
314
- ),
315
- carbonPrepare(
316
- "carbon.prepareRepriceStrategy",
317
- "prepare_carbon_reprice_strategy",
318
- (c) =>
319
- c.carbon.prepareRepriceStrategy({
320
- wallet_address: CARBON_WALLET,
321
- strategy_id: "1",
322
- buy_price_low: 0.4,
323
- buy_price_high: 0.5,
324
- }),
325
- () => ({
326
- wallet_address: CARBON_WALLET,
327
- strategy_id: "1",
328
- buy_price_low: 0.4,
329
- buy_price_high: 0.5,
330
- }),
331
- ),
332
- carbonPrepare(
333
- "carbon.prepareEditStrategy",
334
- "prepare_carbon_edit_strategy",
335
- (c) =>
336
- c.carbon.prepareEditStrategy({
337
- wallet_address: CARBON_WALLET,
338
- strategy_id: "1",
339
- buy_budget: 10,
340
- }),
341
- () => ({
342
- wallet_address: CARBON_WALLET,
343
- strategy_id: "1",
344
- buy_budget: 10,
345
- }),
346
- ),
347
- carbonPrepare(
348
- "carbon.prepareDepositBudget",
349
- "prepare_carbon_deposit_budget",
350
- (c) =>
351
- c.carbon.prepareDepositBudget({
352
- wallet_address: CARBON_WALLET,
353
- strategy_id: "1",
354
- buy_budget: 5,
355
- }),
356
- () => ({
357
- wallet_address: CARBON_WALLET,
358
- strategy_id: "1",
359
- buy_budget: 5,
360
- }),
361
- ),
362
- carbonPrepare(
363
- "carbon.prepareWithdrawBudget",
364
- "prepare_carbon_withdraw_budget",
365
- (c) =>
366
- c.carbon.prepareWithdrawBudget({
367
- wallet_address: CARBON_WALLET,
368
- strategy_id: "1",
369
- buy_budget: 1,
370
- }),
371
- () => ({
372
- wallet_address: CARBON_WALLET,
373
- strategy_id: "1",
374
- buy_budget: 1,
375
- }),
376
- ),
377
- carbonPrepare(
378
- "carbon.preparePauseStrategy",
379
- "prepare_carbon_pause_strategy",
380
- (c) =>
381
- c.carbon.preparePauseStrategy({
382
- wallet_address: CARBON_WALLET,
383
- strategy_id: "1",
384
- }),
385
- () => ({ wallet_address: CARBON_WALLET, strategy_id: "1" }),
386
- ),
387
- carbonPrepare(
388
- "carbon.prepareResumeStrategy",
389
- "prepare_carbon_resume_strategy",
390
- (c) =>
391
- c.carbon.prepareResumeStrategy({
392
- wallet_address: CARBON_WALLET,
393
- strategy_id: "1",
394
- }),
395
- () => ({ wallet_address: CARBON_WALLET, strategy_id: "1" }),
396
- ),
397
- carbonPrepare(
398
- "carbon.prepareDeleteStrategy",
399
- "prepare_carbon_delete_strategy",
400
- (c) =>
401
- c.carbon.prepareDeleteStrategy({
402
- wallet_address: CARBON_WALLET,
403
- strategy_id: "1",
404
- }),
405
- () => ({ wallet_address: CARBON_WALLET, strategy_id: "1" }),
406
- ),
407
- carbonPrepare(
408
- "carbon.prepareTrade",
409
- "prepare_carbon_trade",
410
- (c) =>
411
- c.carbon.prepareTrade({
412
- wallet_address: CARBON_WALLET,
413
- source_token: CELO,
414
- target_token: USDC,
415
- amount: "1",
416
- min_return: "0",
417
- }),
418
- () => ({
419
- wallet_address: CARBON_WALLET,
420
- source_token: CELO,
421
- target_token: USDC,
422
- amount: "1",
423
- min_return: "0",
424
- }),
425
- ),
426
- carbonExecute(
427
- "carbon.executeLimitOrder",
428
- "execute_carbon_limit_order",
429
- () => ({
430
- base_token: CELO,
431
- quote_token: USDC,
432
- direction: "buy",
433
- price: 0.5,
434
- budget: 1,
435
- }),
436
- ),
437
- carbonExecute(
438
- "carbon.executeRangeOrder",
439
- "execute_carbon_range_order",
440
- () => ({
441
- base_token: CELO,
442
- quote_token: USDC,
443
- direction: "buy",
444
- price: 0.5,
445
- budget: 1,
446
- }),
447
- ),
448
- carbonExecute(
449
- "carbon.executeRecurringStrategy",
450
- "execute_carbon_recurring_strategy",
451
- () => ({
452
- base_token: CELO,
453
- quote_token: USDC,
454
- direction: "buy",
455
- price: 0.5,
456
- budget: 1,
457
- }),
458
- ),
459
- carbonExecute(
460
- "carbon.executeConcentratedStrategy",
461
- "execute_carbon_concentrated_strategy",
462
- () => ({
463
- base_token: CELO,
464
- quote_token: USDC,
465
- budget: 1,
466
- }),
467
- ),
468
- carbonExecute(
469
- "carbon.executeFullRangeStrategy",
470
- "execute_carbon_full_range_strategy",
471
- () => ({
472
- base_token: CELO,
473
- quote_token: USDC,
474
- budget: 1,
475
- }),
476
- ),
477
- carbonExecute(
478
- "carbon.executeRepriceStrategy",
479
- "execute_carbon_reprice_strategy",
480
- () => ({
481
- wallet_address: CARBON_WALLET,
482
- strategy_id: "1",
483
- price: 0.5,
484
- }),
485
- ),
486
- carbonExecute(
487
- "carbon.executeEditStrategy",
488
- "execute_carbon_edit_strategy",
489
- () => ({
490
- wallet_address: CARBON_WALLET,
491
- strategy_id: "1",
492
- price: 0.5,
493
- }),
494
- ),
495
- carbonExecute(
496
- "carbon.executeDepositBudget",
497
- "execute_carbon_deposit_budget",
498
- () => ({
499
- wallet_address: CARBON_WALLET,
500
- strategy_id: "1",
501
- budget: 1,
502
- }),
503
- ),
504
- carbonExecute(
505
- "carbon.executeWithdrawBudget",
506
- "execute_carbon_withdraw_budget",
507
- () => ({
508
- wallet_address: CARBON_WALLET,
509
- strategy_id: "1",
510
- budget: 1,
511
- }),
512
- ),
513
- carbonExecute(
514
- "carbon.executePauseStrategy",
515
- "execute_carbon_pause_strategy",
516
- () => ({
517
- wallet_address: CARBON_WALLET,
518
- strategy_id: "1",
519
- }),
520
- ),
521
- carbonExecute(
522
- "carbon.executeResumeStrategy",
523
- "execute_carbon_resume_strategy",
524
- () => ({
525
- wallet_address: CARBON_WALLET,
526
- strategy_id: "1",
527
- }),
528
- ),
529
- carbonExecute(
530
- "carbon.executeDeleteStrategy",
531
- "execute_carbon_delete_strategy",
532
- () => ({
533
- wallet_address: CARBON_WALLET,
534
- strategy_id: "1",
535
- }),
536
- ),
537
- carbonExecute(
538
- "carbon.executeTrade",
539
- "execute_carbon_trade",
540
- () => ({
541
- source_token: CELO,
542
- target_token: USDC,
543
- amount: "1",
544
- min_return: "0",
545
- }),
546
- ),
547
- ];