forked from TONresistor/teleton-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
767 lines (681 loc) · 23.3 KB
/
index.js
File metadata and controls
767 lines (681 loc) · 23.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
/**
* StonFi plugin -- DEX on TON
*
* Search tokens, check prices, browse pools/farms, get swap quotes,
* and execute swaps on StonFi DEX. Uses @ston-fi/api (StonApiClient)
* for all API calls. Agent wallet at ~/.teleton/wallet.json signs swaps.
*/
import { createRequire } from "node:module";
import { readFileSync, realpathSync } from "node:fs";
import { join } from "node:path";
import { homedir } from "node:os";
// ---------------------------------------------------------------------------
// CJS dependencies
// ---------------------------------------------------------------------------
const _require = createRequire(realpathSync(process.argv[1])); // core: @ton/core, @ton/ton, @ton/crypto
const _pluginRequire = createRequire(import.meta.url); // local: plugin-specific deps
const { Address, SendMode } = _require("@ton/core");
const { WalletContractV5R1, TonClient, internal } = _require("@ton/ton");
const { mnemonicToPrivateKey } = _require("@ton/crypto");
// StonFi API client (from plugin's local node_modules)
const { StonApiClient } = _pluginRequire("@ston-fi/api");
const stonApi = new StonApiClient();
// StonFi SDK (for swap execution)
let dexFactory;
try {
const stonfi = _pluginRequire("@ston-fi/sdk");
dexFactory = stonfi.dexFactory ?? stonfi.DEX;
} catch {
// SDK not available -- swap execution will fail with clear error
}
// ---------------------------------------------------------------------------
// Constants
// ---------------------------------------------------------------------------
const TON_ADDRESS = "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c";
const WALLET_FILE = join(homedir(), ".teleton", "wallet.json");
// ---------------------------------------------------------------------------
// Asset cache (5-minute TTL via sdk.storage)
// queryAssets text search doesn't work, so we cache getAssets() and filter.
// ---------------------------------------------------------------------------
let _sdk = null;
async function getCachedAssets() {
const cached = _sdk?.storage?.get("stonfi_assets");
if (cached) return cached;
const data = await stonApi.getAssets();
_sdk?.storage?.set("stonfi_assets", data, { ttl: 5 * 60 * 1000 });
return data;
}
// ---------------------------------------------------------------------------
// Amount conversion helpers
// ---------------------------------------------------------------------------
function toUnits(amount, decimals) {
return BigInt(Math.round(Number(amount) * 10 ** decimals)).toString();
}
function fromUnits(units, decimals) {
return (Number(units) / 10 ** decimals).toString();
}
// Format an asset from StonApiClient (camelCase) to plugin output
function fmtAsset(a) {
return {
address: a.contractAddress,
name: a.displayName ?? null,
symbol: a.symbol ?? null,
decimals: a.decimals ?? null,
kind: a.kind ?? null,
price_usd: a.dexPriceUsd ?? null,
tags: a.tags ?? [],
};
}
// ---------------------------------------------------------------------------
// Wallet helper
// ---------------------------------------------------------------------------
async function getWalletAndClient() {
let walletData;
try {
walletData = JSON.parse(readFileSync(WALLET_FILE, "utf-8"));
} catch {
throw new Error("Agent wallet not found at " + WALLET_FILE);
}
if (!walletData.mnemonic || !Array.isArray(walletData.mnemonic)) {
throw new Error("Invalid wallet file: missing mnemonic array");
}
const keyPair = await mnemonicToPrivateKey(walletData.mnemonic);
const wallet = WalletContractV5R1.create({
workchain: 0,
publicKey: keyPair.publicKey,
});
let endpoint;
try {
const { getHttpEndpoint } = _pluginRequire("@orbs-network/ton-access");
endpoint = await getHttpEndpoint({ network: "mainnet" });
} catch {
endpoint = "https://toncenter.com/api/v2/jsonRPC";
}
const client = new TonClient({ endpoint });
const contract = client.open(wallet);
return { wallet, keyPair, client, contract };
}
// ---------------------------------------------------------------------------
// Tool 1: stonfi_search
// ---------------------------------------------------------------------------
const stonfiSearch = {
name: "stonfi_search",
description:
"Search tokens on StonFi DEX by name, symbol, or contract address. Returns matching tokens with price and metadata.",
category: "data-bearing",
parameters: {
type: "object",
properties: {
search: {
type: "string",
description:
'Token name, symbol, or address to search (e.g. "USDT", "NOT", "EQCxE6...")',
},
limit: {
type: "integer",
description: "Max results to return (default 5)",
minimum: 1,
maximum: 50,
},
},
required: ["search"],
},
execute: async (params) => {
try {
const limit = params.limit ?? 5;
const search = params.search.trim();
const isAddress =
search.startsWith("EQ") ||
search.startsWith("UQ") ||
search.startsWith("0:") ||
search.length > 40;
if (isAddress) {
const a = await stonApi.getAsset(search);
return { success: true, data: [fmtAsset(a)] };
}
// Text search -- filter cached asset list
const assets = await getCachedAssets();
const q = search.toLowerCase();
const matches = assets.filter(
(a) =>
(a.symbol && a.symbol.toLowerCase().includes(q)) ||
(a.displayName && a.displayName.toLowerCase().includes(q))
);
matches.sort(
(a, b) => (b.popularityIndex ?? 0) - (a.popularityIndex ?? 0)
);
return { success: true, data: matches.slice(0, limit).map(fmtAsset) };
} catch (err) {
return {
success: false,
error: String(err.message || err).slice(0, 500),
};
}
},
};
// ---------------------------------------------------------------------------
// Tool 2: stonfi_price
// ---------------------------------------------------------------------------
const stonfiPrice = {
name: "stonfi_price",
description:
"Get the current USD price for a token on StonFi. Use the TON address EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c for native TON.",
category: "data-bearing",
parameters: {
type: "object",
properties: {
address: {
type: "string",
description: "Token contract address",
},
},
required: ["address"],
},
execute: async (params) => {
try {
const a = await stonApi.getAsset(params.address);
return {
success: true,
data: {
address: a.contractAddress ?? params.address,
name: a.displayName ?? null,
symbol: a.symbol ?? null,
decimals: a.decimals ?? null,
dex_price_usd: a.dexPriceUsd ?? null,
third_party_price_usd: a.thirdPartyPriceUsd ?? null,
tags: a.tags ?? [],
},
};
} catch (err) {
return {
success: false,
error: String(err.message || err).slice(0, 500),
};
}
},
};
// ---------------------------------------------------------------------------
// Tool 3: stonfi_pools
// ---------------------------------------------------------------------------
const stonfiPools = {
name: "stonfi_pools",
description:
"Search and list liquidity pools on StonFi. Returns pool addresses, token pairs, reserves, APY, and volume.",
category: "data-bearing",
parameters: {
type: "object",
properties: {
search: {
type: "string",
description:
"Search by token name, symbol, or address (optional)",
},
limit: {
type: "integer",
description: "Max results (default 10)",
minimum: 1,
maximum: 50,
},
sort_by: {
type: "string",
enum: ["popularityIndex:desc", "volume24hUsd:desc"],
description: 'Sort order (default "popularityIndex:desc")',
},
},
},
execute: async (params) => {
try {
const limit = params.limit ?? 10;
const sortBy = params.sort_by ?? "popularityIndex:desc";
const search = (params.search ?? "").trim().toLowerCase();
// getPools returns all pools (camelCase fields)
let pools = (await stonApi.getPools()).slice();
// Filter by token address or symbol
if (search) {
const assets = await getCachedAssets();
const addrToMeta = new Map();
for (const a of assets) {
if (a.contractAddress) {
addrToMeta.set(a.contractAddress, {
symbol: a.symbol ?? "",
name: a.displayName ?? "",
});
}
}
pools = pools.filter((p) => {
const t0 = p.token0Address ?? "";
const t1 = p.token1Address ?? "";
if (t0.toLowerCase().includes(search) || t1.toLowerCase().includes(search)) {
return true;
}
const m0 = addrToMeta.get(t0);
const m1 = addrToMeta.get(t1);
return (
(m0 && (m0.symbol.toLowerCase().includes(search) || m0.name.toLowerCase().includes(search))) ||
(m1 && (m1.symbol.toLowerCase().includes(search) || m1.name.toLowerCase().includes(search)))
);
});
}
// Sort
const [field, dir] = sortBy.split(":");
pools.sort((a, b) => {
const va = parseFloat(a[field] ?? "0") || 0;
const vb = parseFloat(b[field] ?? "0") || 0;
return dir === "asc" ? va - vb : vb - va;
});
const result = pools.slice(0, limit).map((p) => ({
address: p.address,
router_address: p.routerAddress ?? null,
token0_address: p.token0Address ?? null,
token1_address: p.token1Address ?? null,
reserve0: p.reserve0 ?? null,
reserve1: p.reserve1 ?? null,
lp_total_supply_usd: p.lpTotalSupplyUsd ?? null,
lp_fee: p.lpFee ?? null,
apy_1d: p.apy1D ?? null,
apy_7d: p.apy7D ?? null,
apy_30d: p.apy30D ?? null,
volume_24h_usd: p.volume24hUsd ?? null,
tags: p.tags ?? [],
}));
return { success: true, data: result };
} catch (err) {
return {
success: false,
error: String(err.message || err).slice(0, 500),
};
}
},
};
// ---------------------------------------------------------------------------
// Tool 4: stonfi_pool_info
// ---------------------------------------------------------------------------
const stonfiPoolInfo = {
name: "stonfi_pool_info",
description:
"Get detailed info for a specific StonFi liquidity pool including reserves, fees, APY, and volume.",
category: "data-bearing",
parameters: {
type: "object",
properties: {
pool_address: {
type: "string",
description: "Pool contract address",
},
},
required: ["pool_address"],
},
execute: async (params) => {
try {
const p = await stonApi.getPool(params.pool_address);
return {
success: true,
data: {
address: p.address,
router_address: p.routerAddress ?? null,
token0_address: p.token0Address ?? null,
token1_address: p.token1Address ?? null,
reserve0: p.reserve0 ?? null,
reserve1: p.reserve1 ?? null,
lp_total_supply: p.lpTotalSupply ?? null,
lp_total_supply_usd: p.lpTotalSupplyUsd ?? null,
lp_fee: p.lpFee ?? null,
protocol_fee: p.protocolFee ?? null,
lp_price_usd: p.lpPriceUsd ?? null,
apy_1d: p.apy1D ?? null,
apy_7d: p.apy7D ?? null,
apy_30d: p.apy30D ?? null,
volume_24h_usd: p.volume24hUsd ?? null,
deprecated: p.deprecated ?? false,
tags: p.tags ?? [],
},
};
} catch (err) {
return {
success: false,
error: String(err.message || err).slice(0, 500),
};
}
},
};
// ---------------------------------------------------------------------------
// Tool 5: stonfi_farms
// ---------------------------------------------------------------------------
const stonfiFarms = {
name: "stonfi_farms",
description:
"List active farming opportunities on StonFi. Optionally filter by pool address.",
category: "data-bearing",
parameters: {
type: "object",
properties: {
pool_address: {
type: "string",
description: "Filter farms by pool address (optional)",
},
},
},
execute: async (params) => {
try {
let rawFarms;
if (params.pool_address) {
rawFarms = await stonApi.getFarmsByPool(params.pool_address);
} else {
rawFarms = await stonApi.getFarms();
}
const farms = rawFarms.map((f) => ({
minter_address: f.minterAddress ?? null,
pool_address: f.poolAddress ?? null,
version: f.version ?? null,
status: f.status ?? null,
apy: f.apy ?? null,
locked_total_lp: f.lockedTotalLp ?? null,
locked_total_lp_usd: f.lockedTotalLpUsd ?? null,
min_stake_duration_s: f.minStakeDurationS ?? null,
rewards: (f.rewards ?? []).map((r) => ({
address: r.address ?? null,
status: r.status ?? null,
reward_rate_24h: r.rewardRate24h ?? null,
})),
}));
return { success: true, data: farms };
} catch (err) {
return {
success: false,
error: String(err.message || err).slice(0, 500),
};
}
},
};
// ---------------------------------------------------------------------------
// Tool 6: stonfi_dex_stats
// ---------------------------------------------------------------------------
const stonfiDexStats = {
name: "stonfi_dex_stats",
description:
"Get overall StonFi DEX statistics including TVL, total volume, unique wallets, and trade count.",
category: "data-bearing",
parameters: {
type: "object",
properties: {},
},
execute: async () => {
try {
// No StonApiClient method for stats -- use raw fetch
const res = await fetch("https://api.ston.fi/v1/stats/dex", {
signal: AbortSignal.timeout(15000),
});
if (!res.ok) throw new Error(`StonFi API error: ${res.status}`);
const data = await res.json();
return {
success: true,
data: {
since: data.since ?? null,
until: data.until ?? null,
tvl: data.stats?.tvl ?? null,
volume_usd: data.stats?.volume_usd ?? null,
unique_wallets: data.stats?.unique_wallets ?? null,
trades: data.stats?.trades ?? null,
},
};
} catch (err) {
return {
success: false,
error: String(err.message || err).slice(0, 500),
};
}
},
};
// ---------------------------------------------------------------------------
// Tool 7: stonfi_swap_quote
// ---------------------------------------------------------------------------
const stonfiSwapQuote = {
name: "stonfi_swap_quote",
description:
"Get a swap quote on StonFi -- simulates a swap between two tokens and returns expected output, price impact, fees, and gas estimate. Use TON address EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c for native TON.",
category: "data-bearing",
parameters: {
type: "object",
properties: {
offer_address: {
type: "string",
description: "Source token contract address",
},
ask_address: {
type: "string",
description: "Destination token contract address",
},
amount: {
type: "string",
description:
'Amount to swap in human-readable units (e.g. "10" for 10 TON)',
},
slippage: {
type: "number",
description: "Slippage tolerance (0.01 = 1%, default 0.01)",
minimum: 0.001,
maximum: 0.5,
},
},
required: ["offer_address", "ask_address", "amount"],
},
execute: async (params) => {
try {
const slippage = params.slippage ?? 0.01;
const inputAmount = Number(params.amount);
if (isNaN(inputAmount) || inputAmount <= 0) {
throw new Error("amount must be a positive number");
}
// Look up both asset decimals in parallel
const [offerAsset, askAsset] = await Promise.all([
stonApi.getAsset(params.offer_address),
stonApi.getAsset(params.ask_address),
]);
const offerDecimals = offerAsset.decimals ?? 9;
const askDecimals = askAsset.decimals ?? 9;
_sdk?.log?.info(`Swap quote: ${params.amount} ${offerAsset.symbol} -> ${askAsset.symbol}`);
// Convert to smallest units
const units = toUnits(params.amount, offerDecimals);
// Simulate via StonApiClient
const sim = await stonApi.simulateSwap({
offerAddress: params.offer_address,
askAddress: params.ask_address,
offerUnits: units,
slippageTolerance: String(slippage),
});
return {
success: true,
data: {
offer_address: sim.offerAddress,
ask_address: sim.askAddress,
offer_amount: params.amount,
offer_units: sim.offerUnits,
ask_units: sim.askUnits,
ask_amount: fromUnits(sim.askUnits, askDecimals),
min_ask_units: sim.minAskUnits,
min_ask_amount: fromUnits(sim.minAskUnits, askDecimals),
swap_rate: sim.swapRate ?? null,
price_impact: sim.priceImpact ?? null,
fee_percent: sim.feePercent ?? null,
fee_units: sim.feeUnits ?? null,
slippage_tolerance: sim.slippageTolerance,
forward_gas: sim.gasParams?.forwardGas ?? null,
estimated_gas: sim.gasParams?.estimatedGasConsumption ?? null,
router_address: sim.routerAddress ?? null,
pool_address: sim.poolAddress ?? null,
offer_symbol: offerAsset.symbol ?? null,
ask_symbol: askAsset.symbol ?? null,
},
};
} catch (err) {
_sdk?.log?.error(`Swap quote failed: ${err.message}`);
return {
success: false,
error: String(err.message || err).slice(0, 500),
};
}
},
};
// ---------------------------------------------------------------------------
// Tool 8: stonfi_swap
// ---------------------------------------------------------------------------
const stonfiSwap = {
name: "stonfi_swap",
description:
"Execute a token swap on StonFi DEX. Simulates the swap via @ston-fi/api, builds the transaction via @ston-fi/sdk, and signs with the agent wallet. Call stonfi_swap_quote first to preview.",
category: "action",
parameters: {
type: "object",
properties: {
offer_address: {
type: "string",
description: "Source token contract address",
},
ask_address: {
type: "string",
description: "Destination token contract address",
},
amount: {
type: "string",
description:
'Amount to swap in human-readable units (e.g. "10" for 10 TON)',
},
slippage: {
type: "number",
description: "Slippage tolerance (0.01 = 1%, default 0.01)",
minimum: 0.001,
maximum: 0.5,
},
},
required: ["offer_address", "ask_address", "amount"],
},
execute: async (params) => {
try {
if (!dexFactory) {
throw new Error(
"@ston-fi/sdk is not installed. Install it to execute swaps."
);
}
const slippage = params.slippage ?? 0.01;
const inputAmount = Number(params.amount);
if (isNaN(inputAmount) || inputAmount <= 0) {
throw new Error("amount must be a positive number");
}
// Step 1: Look up offer + ask asset decimals in parallel
const [offerAsset, askAsset] = await Promise.all([
stonApi.getAsset(params.offer_address),
stonApi.getAsset(params.ask_address),
]);
const offerDecimals = offerAsset.decimals ?? 9;
const askDecimals = askAsset.decimals ?? 9;
_sdk?.log?.info(`Executing swap: ${params.amount} ${offerAsset.symbol} -> ${askAsset.symbol} (slippage: ${slippage})`);
// Step 2: Simulate swap via StonApiClient
const units = toUnits(params.amount, offerDecimals);
const sim = await stonApi.simulateSwap({
offerAddress: params.offer_address,
askAddress: params.ask_address,
offerUnits: units,
slippageTolerance: String(slippage),
});
if (!sim.router) {
throw new Error("Swap simulation did not return router info");
}
// Step 3: Get wallet
const { wallet, keyPair, client, contract } =
await getWalletAndClient();
const walletAddr = wallet.address.toString();
// Step 4: Build transaction via SDK (dexFactory auto-detects version)
const dexContracts = dexFactory(sim.router);
const router = client.open(
dexContracts.Router.create(sim.router.address)
);
const proxyTon = dexContracts.pTON.create(
sim.router.ptonMasterAddress
);
const offerIsTon = params.offer_address === TON_ADDRESS;
const askIsTon = params.ask_address === TON_ADDRESS;
let txParams;
if (offerIsTon) {
txParams = await router.getSwapTonToJettonTxParams({
userWalletAddress: walletAddr,
offerAmount: sim.offerUnits,
minAskAmount: sim.minAskUnits,
askJettonAddress: params.ask_address,
proxyTon,
});
} else if (askIsTon) {
txParams = await router.getSwapJettonToTonTxParams({
userWalletAddress: walletAddr,
offerJettonAddress: params.offer_address,
offerAmount: sim.offerUnits,
minAskAmount: sim.minAskUnits,
proxyTon,
});
} else {
txParams = await router.getSwapJettonToJettonTxParams({
userWalletAddress: walletAddr,
offerJettonAddress: params.offer_address,
askJettonAddress: params.ask_address,
offerAmount: sim.offerUnits,
minAskAmount: sim.minAskUnits,
});
}
// Step 5: Send transaction
const seqno = await contract.getSeqno();
await contract.sendTransfer({
seqno,
secretKey: keyPair.secretKey,
sendMode: SendMode.PAY_GAS_SEPARATELY | SendMode.IGNORE_ERRORS,
messages: [
internal({
to: txParams.to,
value: txParams.value,
body: txParams.body,
bounce: true,
}),
],
});
return {
success: true,
data: {
offer_amount: params.amount,
offer_symbol: offerAsset.symbol ?? null,
expected_output: fromUnits(sim.askUnits, askDecimals),
min_output: fromUnits(sim.minAskUnits, askDecimals),
ask_symbol: askAsset.symbol ?? null,
swap_rate: sim.swapRate ?? null,
price_impact: sim.priceImpact ?? null,
slippage,
seqno,
wallet_address: walletAddr,
router_address: sim.routerAddress ?? null,
pool_address: sim.poolAddress ?? null,
message:
"Swap transaction sent. Confirmation typically takes ~30 seconds on TON.",
},
};
} catch (err) {
_sdk?.log?.error(`Swap execution failed: ${err.message}`);
return {
success: false,
error: String(err.message || err).slice(0, 500),
};
}
},
};
// ---------------------------------------------------------------------------
// Export
// ---------------------------------------------------------------------------
export const tools = (sdk) => {
_sdk = sdk;
return [
stonfiSearch,
stonfiPrice,
stonfiPools,
stonfiPoolInfo,
stonfiFarms,
stonfiDexStats,
stonfiSwapQuote,
stonfiSwap,
];
};