@blockrun/llm 3.0.0 → 3.1.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.
package/README.md CHANGED
@@ -669,6 +669,37 @@ const symbols = await p.listSymbols('crypto', { query: 'sol', limit: 20 });
669
669
 
670
670
  Supported `StockMarket` values: `us, hk, jp, kr, gb, de, fr, nl, ie, lu, cn, ca`.
671
671
 
672
+ ### DeFi Data, DEX Swaps & Cloud Compute
673
+
674
+ Three passthrough families live directly on `LLMClient` / `SolanaLLMClient`:
675
+
676
+ ```ts
677
+ const client = new LLMClient();
678
+
679
+ // DefiLlama — protocols / TVL / yields / prices ($0.005/call, prices $0.001)
680
+ const protocols = await client.defiProtocols();
681
+ const aave = await client.defiProtocol('aave');
682
+ const prices = await client.defiPrices(['coingecko:bitcoin', 'base:0x833589...']);
683
+
684
+ // 0x DEX — swap + gasless quotes (FREE; BlockRun takes an on-chain affiliate
685
+ // fee on executed swaps instead of x402)
686
+ const quote = await client.dexQuote({
687
+ chainId: '8453', sellToken: '0x...', buyToken: '0x...',
688
+ sellAmount: '1000000', taker: '0xYourWallet',
689
+ });
690
+ const gq = await client.dexGaslessQuote({ /* ... */ });
691
+ const res = await client.dexGaslessSubmit({ trade: { /* signed eip712 */ } });
692
+ const status = await client.dexGaslessStatus(res.tradeHash as string);
693
+
694
+ // Modal — sandboxed compute ($0.01 create CPU / $0.05 GPU, $0.001 exec)
695
+ const sb = await client.modalSandboxCreate({ image: 'python:3.11' });
696
+ const out = await client.modalSandboxExec(sb.sandbox_id as string, ['python', '-c', 'print(42)']);
697
+ await client.modalSandboxTerminate(sb.sandbox_id as string);
698
+ ```
699
+
700
+ Generic escape hatches: `client.defi(path, params)`, `client.dex(path, params, body?)`,
701
+ `client.modal(path, body)`.
702
+
672
703
  ### Multi-chain RPC
673
704
 
674
705
  `RpcClient` wraps `POST /v1/rpc/{network}` — standard JSON-RPC 2.0 access to
package/dist/index.cjs CHANGED
@@ -1703,6 +1703,120 @@ var LLMClient = class _LLMClient {
1703
1703
  async pmWalletCluster(address) {
1704
1704
  return this.pm(`polymarket/wallet/${address}/cluster`);
1705
1705
  }
1706
+ // ============================================================
1707
+ // DefiLlama (DeFi protocols / TVL / yields / prices)
1708
+ // ============================================================
1709
+ /**
1710
+ * Query DefiLlama DeFi data (GET passthrough). Powered by DefiLlama.
1711
+ * $0.005/call for protocols / protocol/{slug} / chains / yields;
1712
+ * $0.001/call for prices/{coins}.
1713
+ *
1714
+ * @param path - e.g. "protocols", "protocol/aave", "chains", "yields",
1715
+ * "prices/coingecko:bitcoin,base:0x..."
1716
+ * @param params - Query parameters passed through to DefiLlama
1717
+ */
1718
+ async defi(path5, params) {
1719
+ return this.getWithPaymentRaw(`/v1/defillama/${path5}`, params);
1720
+ }
1721
+ /** All DeFi protocols with TVL ($0.005/call). */
1722
+ async defiProtocols() {
1723
+ return this.defi("protocols");
1724
+ }
1725
+ /** Single protocol details + historical TVL ($0.005/call). */
1726
+ async defiProtocol(slug) {
1727
+ return this.defi(`protocol/${slug}`);
1728
+ }
1729
+ /** Current TVL of every chain ($0.005/call). */
1730
+ async defiChains() {
1731
+ return this.defi("chains");
1732
+ }
1733
+ /** Yield pools with APY/TVL ($0.005/call). */
1734
+ async defiYields(params) {
1735
+ return this.defi("yields", params);
1736
+ }
1737
+ /** Token price lookup ($0.001/call). Coins like "coingecko:bitcoin" or "{chain}:{address}". */
1738
+ async defiPrices(coins) {
1739
+ const joined = Array.isArray(coins) ? coins.join(",") : coins;
1740
+ return this.defi(`prices/${joined}`);
1741
+ }
1742
+ // ============================================================
1743
+ // 0x DEX (swap quotes + gasless) — free passthrough
1744
+ // ============================================================
1745
+ /**
1746
+ * Query the 0x Swap / Gasless APIs (free — no x402 payment; BlockRun
1747
+ * takes an on-chain affiliate fee on executed swaps instead).
1748
+ *
1749
+ * @param path - "price", "quote", "gasless/price", "gasless/quote",
1750
+ * "gasless/submit" (POST), "gasless/status/{hash}",
1751
+ * "gasless/approval-tokens", "gasless/chains", "swap/chains"
1752
+ * @param params - Query params (chainId, sellToken, buyToken, sellAmount, taker, ...)
1753
+ * @param body - JSON body — pass to switch to POST (gasless/submit only)
1754
+ */
1755
+ async dex(path5, params, body) {
1756
+ if (body) return this.requestWithPaymentRaw(`/v1/zerox/${path5}`, body);
1757
+ return this.getWithPaymentRaw(`/v1/zerox/${path5}`, params);
1758
+ }
1759
+ /** Indicative Permit2 swap price — no commitment (free). */
1760
+ async dexPrice(params) {
1761
+ return this.dex("price", params);
1762
+ }
1763
+ /** Firm Permit2 swap quote with permit2.eip712 + tx data (free). */
1764
+ async dexQuote(params) {
1765
+ return this.dex("quote", params);
1766
+ }
1767
+ /** Gasless indicative price quote (free). */
1768
+ async dexGaslessPrice(params) {
1769
+ return this.dex("gasless/price", params);
1770
+ }
1771
+ /** Gasless firm quote — returns trade.eip712 to sign (free). */
1772
+ async dexGaslessQuote(params) {
1773
+ return this.dex("gasless/quote", params);
1774
+ }
1775
+ /** Submit a signed gasless trade; the 0x relayer pays gas (free). */
1776
+ async dexGaslessSubmit(body) {
1777
+ return this.dex("gasless/submit", void 0, body);
1778
+ }
1779
+ /** Poll a gasless trade's status by tradeHash (free). */
1780
+ async dexGaslessStatus(tradeHash) {
1781
+ return this.dex(`gasless/status/${tradeHash}`);
1782
+ }
1783
+ /** Chains where the Swap API is supported (free). */
1784
+ async dexChains() {
1785
+ return this.dex("swap/chains");
1786
+ }
1787
+ /** Chains where the Gasless API is supported (free). */
1788
+ async dexGaslessChains() {
1789
+ return this.dex("gasless/chains");
1790
+ }
1791
+ // ============================================================
1792
+ // Modal Sandbox (pay-per-call cloud compute)
1793
+ // ============================================================
1794
+ /**
1795
+ * Call the Modal sandbox compute API (POST passthrough).
1796
+ *
1797
+ * @param path - "sandbox/create" ($0.01 CPU / $0.05 GPU), "sandbox/exec",
1798
+ * "sandbox/status", "sandbox/terminate" ($0.001 each)
1799
+ * @param body - JSON body for the endpoint
1800
+ */
1801
+ async modal(path5, body) {
1802
+ return this.requestWithPaymentRaw(`/v1/modal/${path5}`, body ?? {});
1803
+ }
1804
+ /** Create a sandboxed compute environment ($0.01 CPU / $0.05 GPU). */
1805
+ async modalSandboxCreate(body) {
1806
+ return this.modal("sandbox/create", body);
1807
+ }
1808
+ /** Execute a command in a sandbox; returns stdout/stderr ($0.001). */
1809
+ async modalSandboxExec(sandboxId, command, extra) {
1810
+ return this.modal("sandbox/exec", { sandbox_id: sandboxId, command, ...extra });
1811
+ }
1812
+ /** Check a sandbox's status ($0.001). */
1813
+ async modalSandboxStatus(sandboxId) {
1814
+ return this.modal("sandbox/status", { sandbox_id: sandboxId });
1815
+ }
1816
+ /** Terminate a sandbox ($0.001). */
1817
+ async modalSandboxTerminate(sandboxId) {
1818
+ return this.modal("sandbox/terminate", { sandbox_id: sandboxId });
1819
+ }
1706
1820
  /**
1707
1821
  * Get current session spending.
1708
1822
  *
@@ -4806,6 +4920,120 @@ var SolanaLLMClient = class {
4806
4920
  async exaAnswer(query, options) {
4807
4921
  return this.requestWithPaymentRaw("/v1/exa/answer", { query, ...options });
4808
4922
  }
4923
+ // ============================================================
4924
+ // DefiLlama (DeFi protocols / TVL / yields / prices)
4925
+ // ============================================================
4926
+ /**
4927
+ * Query DefiLlama DeFi data (GET passthrough). Powered by DefiLlama.
4928
+ * $0.005/call for protocols / protocol/{slug} / chains / yields;
4929
+ * $0.001/call for prices/{coins}.
4930
+ *
4931
+ * @param path - e.g. "protocols", "protocol/aave", "chains", "yields",
4932
+ * "prices/coingecko:bitcoin,base:0x..."
4933
+ * @param params - Query parameters passed through to DefiLlama
4934
+ */
4935
+ async defi(path5, params) {
4936
+ return this.getWithPaymentRaw(`/v1/defillama/${path5}`, params);
4937
+ }
4938
+ /** All DeFi protocols with TVL ($0.005/call). */
4939
+ async defiProtocols() {
4940
+ return this.defi("protocols");
4941
+ }
4942
+ /** Single protocol details + historical TVL ($0.005/call). */
4943
+ async defiProtocol(slug) {
4944
+ return this.defi(`protocol/${slug}`);
4945
+ }
4946
+ /** Current TVL of every chain ($0.005/call). */
4947
+ async defiChains() {
4948
+ return this.defi("chains");
4949
+ }
4950
+ /** Yield pools with APY/TVL ($0.005/call). */
4951
+ async defiYields(params) {
4952
+ return this.defi("yields", params);
4953
+ }
4954
+ /** Token price lookup ($0.001/call). Coins like "coingecko:bitcoin" or "{chain}:{address}". */
4955
+ async defiPrices(coins) {
4956
+ const joined = Array.isArray(coins) ? coins.join(",") : coins;
4957
+ return this.defi(`prices/${joined}`);
4958
+ }
4959
+ // ============================================================
4960
+ // 0x DEX (swap quotes + gasless) — free passthrough
4961
+ // ============================================================
4962
+ /**
4963
+ * Query the 0x Swap / Gasless APIs (free — no x402 payment; BlockRun
4964
+ * takes an on-chain affiliate fee on executed swaps instead).
4965
+ *
4966
+ * @param path - "price", "quote", "gasless/price", "gasless/quote",
4967
+ * "gasless/submit" (POST), "gasless/status/{hash}",
4968
+ * "gasless/approval-tokens", "gasless/chains", "swap/chains"
4969
+ * @param params - Query params (chainId, sellToken, buyToken, sellAmount, taker, ...)
4970
+ * @param body - JSON body — pass to switch to POST (gasless/submit only)
4971
+ */
4972
+ async dex(path5, params, body) {
4973
+ if (body) return this.requestWithPaymentRaw(`/v1/zerox/${path5}`, body);
4974
+ return this.getWithPaymentRaw(`/v1/zerox/${path5}`, params);
4975
+ }
4976
+ /** Indicative Permit2 swap price — no commitment (free). */
4977
+ async dexPrice(params) {
4978
+ return this.dex("price", params);
4979
+ }
4980
+ /** Firm Permit2 swap quote with permit2.eip712 + tx data (free). */
4981
+ async dexQuote(params) {
4982
+ return this.dex("quote", params);
4983
+ }
4984
+ /** Gasless indicative price quote (free). */
4985
+ async dexGaslessPrice(params) {
4986
+ return this.dex("gasless/price", params);
4987
+ }
4988
+ /** Gasless firm quote — returns trade.eip712 to sign (free). */
4989
+ async dexGaslessQuote(params) {
4990
+ return this.dex("gasless/quote", params);
4991
+ }
4992
+ /** Submit a signed gasless trade; the 0x relayer pays gas (free). */
4993
+ async dexGaslessSubmit(body) {
4994
+ return this.dex("gasless/submit", void 0, body);
4995
+ }
4996
+ /** Poll a gasless trade's status by tradeHash (free). */
4997
+ async dexGaslessStatus(tradeHash) {
4998
+ return this.dex(`gasless/status/${tradeHash}`);
4999
+ }
5000
+ /** Chains where the Swap API is supported (free). */
5001
+ async dexChains() {
5002
+ return this.dex("swap/chains");
5003
+ }
5004
+ /** Chains where the Gasless API is supported (free). */
5005
+ async dexGaslessChains() {
5006
+ return this.dex("gasless/chains");
5007
+ }
5008
+ // ============================================================
5009
+ // Modal Sandbox (pay-per-call cloud compute)
5010
+ // ============================================================
5011
+ /**
5012
+ * Call the Modal sandbox compute API (POST passthrough).
5013
+ *
5014
+ * @param path - "sandbox/create" ($0.01 CPU / $0.05 GPU), "sandbox/exec",
5015
+ * "sandbox/status", "sandbox/terminate" ($0.001 each)
5016
+ * @param body - JSON body for the endpoint
5017
+ */
5018
+ async modal(path5, body) {
5019
+ return this.requestWithPaymentRaw(`/v1/modal/${path5}`, body ?? {});
5020
+ }
5021
+ /** Create a sandboxed compute environment ($0.01 CPU / $0.05 GPU). */
5022
+ async modalSandboxCreate(body) {
5023
+ return this.modal("sandbox/create", body);
5024
+ }
5025
+ /** Execute a command in a sandbox; returns stdout/stderr ($0.001). */
5026
+ async modalSandboxExec(sandboxId, command, extra) {
5027
+ return this.modal("sandbox/exec", { sandbox_id: sandboxId, command, ...extra });
5028
+ }
5029
+ /** Check a sandbox's status ($0.001). */
5030
+ async modalSandboxStatus(sandboxId) {
5031
+ return this.modal("sandbox/status", { sandbox_id: sandboxId });
5032
+ }
5033
+ /** Terminate a sandbox ($0.001). */
5034
+ async modalSandboxTerminate(sandboxId) {
5035
+ return this.modal("sandbox/terminate", { sandbox_id: sandboxId });
5036
+ }
4809
5037
  /** Get session spending. */
4810
5038
  getSpending() {
4811
5039
  return { totalUsd: this.sessionTotalUsd, calls: this.sessionCalls };
package/dist/index.d.cts CHANGED
@@ -1288,6 +1288,69 @@ declare class LLMClient {
1288
1288
  /** Discover wallets connected to a seed address via on-chain transfers and
1289
1289
  * identity proofs. Tier 2 ($0.005/call). */
1290
1290
  pmWalletCluster(address: string): Promise<Record<string, unknown>>;
1291
+ /**
1292
+ * Query DefiLlama DeFi data (GET passthrough). Powered by DefiLlama.
1293
+ * $0.005/call for protocols / protocol/{slug} / chains / yields;
1294
+ * $0.001/call for prices/{coins}.
1295
+ *
1296
+ * @param path - e.g. "protocols", "protocol/aave", "chains", "yields",
1297
+ * "prices/coingecko:bitcoin,base:0x..."
1298
+ * @param params - Query parameters passed through to DefiLlama
1299
+ */
1300
+ defi(path: string, params?: Record<string, string>): Promise<Record<string, unknown>>;
1301
+ /** All DeFi protocols with TVL ($0.005/call). */
1302
+ defiProtocols(): Promise<Record<string, unknown>>;
1303
+ /** Single protocol details + historical TVL ($0.005/call). */
1304
+ defiProtocol(slug: string): Promise<Record<string, unknown>>;
1305
+ /** Current TVL of every chain ($0.005/call). */
1306
+ defiChains(): Promise<Record<string, unknown>>;
1307
+ /** Yield pools with APY/TVL ($0.005/call). */
1308
+ defiYields(params?: Record<string, string>): Promise<Record<string, unknown>>;
1309
+ /** Token price lookup ($0.001/call). Coins like "coingecko:bitcoin" or "{chain}:{address}". */
1310
+ defiPrices(coins: string | string[]): Promise<Record<string, unknown>>;
1311
+ /**
1312
+ * Query the 0x Swap / Gasless APIs (free — no x402 payment; BlockRun
1313
+ * takes an on-chain affiliate fee on executed swaps instead).
1314
+ *
1315
+ * @param path - "price", "quote", "gasless/price", "gasless/quote",
1316
+ * "gasless/submit" (POST), "gasless/status/{hash}",
1317
+ * "gasless/approval-tokens", "gasless/chains", "swap/chains"
1318
+ * @param params - Query params (chainId, sellToken, buyToken, sellAmount, taker, ...)
1319
+ * @param body - JSON body — pass to switch to POST (gasless/submit only)
1320
+ */
1321
+ dex(path: string, params?: Record<string, string>, body?: Record<string, unknown>): Promise<Record<string, unknown>>;
1322
+ /** Indicative Permit2 swap price — no commitment (free). */
1323
+ dexPrice(params: Record<string, string>): Promise<Record<string, unknown>>;
1324
+ /** Firm Permit2 swap quote with permit2.eip712 + tx data (free). */
1325
+ dexQuote(params: Record<string, string>): Promise<Record<string, unknown>>;
1326
+ /** Gasless indicative price quote (free). */
1327
+ dexGaslessPrice(params: Record<string, string>): Promise<Record<string, unknown>>;
1328
+ /** Gasless firm quote — returns trade.eip712 to sign (free). */
1329
+ dexGaslessQuote(params: Record<string, string>): Promise<Record<string, unknown>>;
1330
+ /** Submit a signed gasless trade; the 0x relayer pays gas (free). */
1331
+ dexGaslessSubmit(body: Record<string, unknown>): Promise<Record<string, unknown>>;
1332
+ /** Poll a gasless trade's status by tradeHash (free). */
1333
+ dexGaslessStatus(tradeHash: string): Promise<Record<string, unknown>>;
1334
+ /** Chains where the Swap API is supported (free). */
1335
+ dexChains(): Promise<Record<string, unknown>>;
1336
+ /** Chains where the Gasless API is supported (free). */
1337
+ dexGaslessChains(): Promise<Record<string, unknown>>;
1338
+ /**
1339
+ * Call the Modal sandbox compute API (POST passthrough).
1340
+ *
1341
+ * @param path - "sandbox/create" ($0.01 CPU / $0.05 GPU), "sandbox/exec",
1342
+ * "sandbox/status", "sandbox/terminate" ($0.001 each)
1343
+ * @param body - JSON body for the endpoint
1344
+ */
1345
+ modal(path: string, body?: Record<string, unknown>): Promise<Record<string, unknown>>;
1346
+ /** Create a sandboxed compute environment ($0.01 CPU / $0.05 GPU). */
1347
+ modalSandboxCreate(body?: Record<string, unknown>): Promise<Record<string, unknown>>;
1348
+ /** Execute a command in a sandbox; returns stdout/stderr ($0.001). */
1349
+ modalSandboxExec(sandboxId: string, command: string[], extra?: Record<string, unknown>): Promise<Record<string, unknown>>;
1350
+ /** Check a sandbox's status ($0.001). */
1351
+ modalSandboxStatus(sandboxId: string): Promise<Record<string, unknown>>;
1352
+ /** Terminate a sandbox ($0.001). */
1353
+ modalSandboxTerminate(sandboxId: string): Promise<Record<string, unknown>>;
1291
1354
  /**
1292
1355
  * Get current session spending.
1293
1356
  *
@@ -2584,6 +2647,69 @@ declare class SolanaLLMClient {
2584
2647
  * const answer = await client.exaAnswer("What is the current state of AI safety research?");
2585
2648
  */
2586
2649
  exaAnswer(query: string, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
2650
+ /**
2651
+ * Query DefiLlama DeFi data (GET passthrough). Powered by DefiLlama.
2652
+ * $0.005/call for protocols / protocol/{slug} / chains / yields;
2653
+ * $0.001/call for prices/{coins}.
2654
+ *
2655
+ * @param path - e.g. "protocols", "protocol/aave", "chains", "yields",
2656
+ * "prices/coingecko:bitcoin,base:0x..."
2657
+ * @param params - Query parameters passed through to DefiLlama
2658
+ */
2659
+ defi(path: string, params?: Record<string, string>): Promise<Record<string, unknown>>;
2660
+ /** All DeFi protocols with TVL ($0.005/call). */
2661
+ defiProtocols(): Promise<Record<string, unknown>>;
2662
+ /** Single protocol details + historical TVL ($0.005/call). */
2663
+ defiProtocol(slug: string): Promise<Record<string, unknown>>;
2664
+ /** Current TVL of every chain ($0.005/call). */
2665
+ defiChains(): Promise<Record<string, unknown>>;
2666
+ /** Yield pools with APY/TVL ($0.005/call). */
2667
+ defiYields(params?: Record<string, string>): Promise<Record<string, unknown>>;
2668
+ /** Token price lookup ($0.001/call). Coins like "coingecko:bitcoin" or "{chain}:{address}". */
2669
+ defiPrices(coins: string | string[]): Promise<Record<string, unknown>>;
2670
+ /**
2671
+ * Query the 0x Swap / Gasless APIs (free — no x402 payment; BlockRun
2672
+ * takes an on-chain affiliate fee on executed swaps instead).
2673
+ *
2674
+ * @param path - "price", "quote", "gasless/price", "gasless/quote",
2675
+ * "gasless/submit" (POST), "gasless/status/{hash}",
2676
+ * "gasless/approval-tokens", "gasless/chains", "swap/chains"
2677
+ * @param params - Query params (chainId, sellToken, buyToken, sellAmount, taker, ...)
2678
+ * @param body - JSON body — pass to switch to POST (gasless/submit only)
2679
+ */
2680
+ dex(path: string, params?: Record<string, string>, body?: Record<string, unknown>): Promise<Record<string, unknown>>;
2681
+ /** Indicative Permit2 swap price — no commitment (free). */
2682
+ dexPrice(params: Record<string, string>): Promise<Record<string, unknown>>;
2683
+ /** Firm Permit2 swap quote with permit2.eip712 + tx data (free). */
2684
+ dexQuote(params: Record<string, string>): Promise<Record<string, unknown>>;
2685
+ /** Gasless indicative price quote (free). */
2686
+ dexGaslessPrice(params: Record<string, string>): Promise<Record<string, unknown>>;
2687
+ /** Gasless firm quote — returns trade.eip712 to sign (free). */
2688
+ dexGaslessQuote(params: Record<string, string>): Promise<Record<string, unknown>>;
2689
+ /** Submit a signed gasless trade; the 0x relayer pays gas (free). */
2690
+ dexGaslessSubmit(body: Record<string, unknown>): Promise<Record<string, unknown>>;
2691
+ /** Poll a gasless trade's status by tradeHash (free). */
2692
+ dexGaslessStatus(tradeHash: string): Promise<Record<string, unknown>>;
2693
+ /** Chains where the Swap API is supported (free). */
2694
+ dexChains(): Promise<Record<string, unknown>>;
2695
+ /** Chains where the Gasless API is supported (free). */
2696
+ dexGaslessChains(): Promise<Record<string, unknown>>;
2697
+ /**
2698
+ * Call the Modal sandbox compute API (POST passthrough).
2699
+ *
2700
+ * @param path - "sandbox/create" ($0.01 CPU / $0.05 GPU), "sandbox/exec",
2701
+ * "sandbox/status", "sandbox/terminate" ($0.001 each)
2702
+ * @param body - JSON body for the endpoint
2703
+ */
2704
+ modal(path: string, body?: Record<string, unknown>): Promise<Record<string, unknown>>;
2705
+ /** Create a sandboxed compute environment ($0.01 CPU / $0.05 GPU). */
2706
+ modalSandboxCreate(body?: Record<string, unknown>): Promise<Record<string, unknown>>;
2707
+ /** Execute a command in a sandbox; returns stdout/stderr ($0.001). */
2708
+ modalSandboxExec(sandboxId: string, command: string[], extra?: Record<string, unknown>): Promise<Record<string, unknown>>;
2709
+ /** Check a sandbox's status ($0.001). */
2710
+ modalSandboxStatus(sandboxId: string): Promise<Record<string, unknown>>;
2711
+ /** Terminate a sandbox ($0.001). */
2712
+ modalSandboxTerminate(sandboxId: string): Promise<Record<string, unknown>>;
2587
2713
  /** Get session spending. */
2588
2714
  getSpending(): Spending;
2589
2715
  /** True if using sol.blockrun.ai. */
package/dist/index.d.ts CHANGED
@@ -1288,6 +1288,69 @@ declare class LLMClient {
1288
1288
  /** Discover wallets connected to a seed address via on-chain transfers and
1289
1289
  * identity proofs. Tier 2 ($0.005/call). */
1290
1290
  pmWalletCluster(address: string): Promise<Record<string, unknown>>;
1291
+ /**
1292
+ * Query DefiLlama DeFi data (GET passthrough). Powered by DefiLlama.
1293
+ * $0.005/call for protocols / protocol/{slug} / chains / yields;
1294
+ * $0.001/call for prices/{coins}.
1295
+ *
1296
+ * @param path - e.g. "protocols", "protocol/aave", "chains", "yields",
1297
+ * "prices/coingecko:bitcoin,base:0x..."
1298
+ * @param params - Query parameters passed through to DefiLlama
1299
+ */
1300
+ defi(path: string, params?: Record<string, string>): Promise<Record<string, unknown>>;
1301
+ /** All DeFi protocols with TVL ($0.005/call). */
1302
+ defiProtocols(): Promise<Record<string, unknown>>;
1303
+ /** Single protocol details + historical TVL ($0.005/call). */
1304
+ defiProtocol(slug: string): Promise<Record<string, unknown>>;
1305
+ /** Current TVL of every chain ($0.005/call). */
1306
+ defiChains(): Promise<Record<string, unknown>>;
1307
+ /** Yield pools with APY/TVL ($0.005/call). */
1308
+ defiYields(params?: Record<string, string>): Promise<Record<string, unknown>>;
1309
+ /** Token price lookup ($0.001/call). Coins like "coingecko:bitcoin" or "{chain}:{address}". */
1310
+ defiPrices(coins: string | string[]): Promise<Record<string, unknown>>;
1311
+ /**
1312
+ * Query the 0x Swap / Gasless APIs (free — no x402 payment; BlockRun
1313
+ * takes an on-chain affiliate fee on executed swaps instead).
1314
+ *
1315
+ * @param path - "price", "quote", "gasless/price", "gasless/quote",
1316
+ * "gasless/submit" (POST), "gasless/status/{hash}",
1317
+ * "gasless/approval-tokens", "gasless/chains", "swap/chains"
1318
+ * @param params - Query params (chainId, sellToken, buyToken, sellAmount, taker, ...)
1319
+ * @param body - JSON body — pass to switch to POST (gasless/submit only)
1320
+ */
1321
+ dex(path: string, params?: Record<string, string>, body?: Record<string, unknown>): Promise<Record<string, unknown>>;
1322
+ /** Indicative Permit2 swap price — no commitment (free). */
1323
+ dexPrice(params: Record<string, string>): Promise<Record<string, unknown>>;
1324
+ /** Firm Permit2 swap quote with permit2.eip712 + tx data (free). */
1325
+ dexQuote(params: Record<string, string>): Promise<Record<string, unknown>>;
1326
+ /** Gasless indicative price quote (free). */
1327
+ dexGaslessPrice(params: Record<string, string>): Promise<Record<string, unknown>>;
1328
+ /** Gasless firm quote — returns trade.eip712 to sign (free). */
1329
+ dexGaslessQuote(params: Record<string, string>): Promise<Record<string, unknown>>;
1330
+ /** Submit a signed gasless trade; the 0x relayer pays gas (free). */
1331
+ dexGaslessSubmit(body: Record<string, unknown>): Promise<Record<string, unknown>>;
1332
+ /** Poll a gasless trade's status by tradeHash (free). */
1333
+ dexGaslessStatus(tradeHash: string): Promise<Record<string, unknown>>;
1334
+ /** Chains where the Swap API is supported (free). */
1335
+ dexChains(): Promise<Record<string, unknown>>;
1336
+ /** Chains where the Gasless API is supported (free). */
1337
+ dexGaslessChains(): Promise<Record<string, unknown>>;
1338
+ /**
1339
+ * Call the Modal sandbox compute API (POST passthrough).
1340
+ *
1341
+ * @param path - "sandbox/create" ($0.01 CPU / $0.05 GPU), "sandbox/exec",
1342
+ * "sandbox/status", "sandbox/terminate" ($0.001 each)
1343
+ * @param body - JSON body for the endpoint
1344
+ */
1345
+ modal(path: string, body?: Record<string, unknown>): Promise<Record<string, unknown>>;
1346
+ /** Create a sandboxed compute environment ($0.01 CPU / $0.05 GPU). */
1347
+ modalSandboxCreate(body?: Record<string, unknown>): Promise<Record<string, unknown>>;
1348
+ /** Execute a command in a sandbox; returns stdout/stderr ($0.001). */
1349
+ modalSandboxExec(sandboxId: string, command: string[], extra?: Record<string, unknown>): Promise<Record<string, unknown>>;
1350
+ /** Check a sandbox's status ($0.001). */
1351
+ modalSandboxStatus(sandboxId: string): Promise<Record<string, unknown>>;
1352
+ /** Terminate a sandbox ($0.001). */
1353
+ modalSandboxTerminate(sandboxId: string): Promise<Record<string, unknown>>;
1291
1354
  /**
1292
1355
  * Get current session spending.
1293
1356
  *
@@ -2584,6 +2647,69 @@ declare class SolanaLLMClient {
2584
2647
  * const answer = await client.exaAnswer("What is the current state of AI safety research?");
2585
2648
  */
2586
2649
  exaAnswer(query: string, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
2650
+ /**
2651
+ * Query DefiLlama DeFi data (GET passthrough). Powered by DefiLlama.
2652
+ * $0.005/call for protocols / protocol/{slug} / chains / yields;
2653
+ * $0.001/call for prices/{coins}.
2654
+ *
2655
+ * @param path - e.g. "protocols", "protocol/aave", "chains", "yields",
2656
+ * "prices/coingecko:bitcoin,base:0x..."
2657
+ * @param params - Query parameters passed through to DefiLlama
2658
+ */
2659
+ defi(path: string, params?: Record<string, string>): Promise<Record<string, unknown>>;
2660
+ /** All DeFi protocols with TVL ($0.005/call). */
2661
+ defiProtocols(): Promise<Record<string, unknown>>;
2662
+ /** Single protocol details + historical TVL ($0.005/call). */
2663
+ defiProtocol(slug: string): Promise<Record<string, unknown>>;
2664
+ /** Current TVL of every chain ($0.005/call). */
2665
+ defiChains(): Promise<Record<string, unknown>>;
2666
+ /** Yield pools with APY/TVL ($0.005/call). */
2667
+ defiYields(params?: Record<string, string>): Promise<Record<string, unknown>>;
2668
+ /** Token price lookup ($0.001/call). Coins like "coingecko:bitcoin" or "{chain}:{address}". */
2669
+ defiPrices(coins: string | string[]): Promise<Record<string, unknown>>;
2670
+ /**
2671
+ * Query the 0x Swap / Gasless APIs (free — no x402 payment; BlockRun
2672
+ * takes an on-chain affiliate fee on executed swaps instead).
2673
+ *
2674
+ * @param path - "price", "quote", "gasless/price", "gasless/quote",
2675
+ * "gasless/submit" (POST), "gasless/status/{hash}",
2676
+ * "gasless/approval-tokens", "gasless/chains", "swap/chains"
2677
+ * @param params - Query params (chainId, sellToken, buyToken, sellAmount, taker, ...)
2678
+ * @param body - JSON body — pass to switch to POST (gasless/submit only)
2679
+ */
2680
+ dex(path: string, params?: Record<string, string>, body?: Record<string, unknown>): Promise<Record<string, unknown>>;
2681
+ /** Indicative Permit2 swap price — no commitment (free). */
2682
+ dexPrice(params: Record<string, string>): Promise<Record<string, unknown>>;
2683
+ /** Firm Permit2 swap quote with permit2.eip712 + tx data (free). */
2684
+ dexQuote(params: Record<string, string>): Promise<Record<string, unknown>>;
2685
+ /** Gasless indicative price quote (free). */
2686
+ dexGaslessPrice(params: Record<string, string>): Promise<Record<string, unknown>>;
2687
+ /** Gasless firm quote — returns trade.eip712 to sign (free). */
2688
+ dexGaslessQuote(params: Record<string, string>): Promise<Record<string, unknown>>;
2689
+ /** Submit a signed gasless trade; the 0x relayer pays gas (free). */
2690
+ dexGaslessSubmit(body: Record<string, unknown>): Promise<Record<string, unknown>>;
2691
+ /** Poll a gasless trade's status by tradeHash (free). */
2692
+ dexGaslessStatus(tradeHash: string): Promise<Record<string, unknown>>;
2693
+ /** Chains where the Swap API is supported (free). */
2694
+ dexChains(): Promise<Record<string, unknown>>;
2695
+ /** Chains where the Gasless API is supported (free). */
2696
+ dexGaslessChains(): Promise<Record<string, unknown>>;
2697
+ /**
2698
+ * Call the Modal sandbox compute API (POST passthrough).
2699
+ *
2700
+ * @param path - "sandbox/create" ($0.01 CPU / $0.05 GPU), "sandbox/exec",
2701
+ * "sandbox/status", "sandbox/terminate" ($0.001 each)
2702
+ * @param body - JSON body for the endpoint
2703
+ */
2704
+ modal(path: string, body?: Record<string, unknown>): Promise<Record<string, unknown>>;
2705
+ /** Create a sandboxed compute environment ($0.01 CPU / $0.05 GPU). */
2706
+ modalSandboxCreate(body?: Record<string, unknown>): Promise<Record<string, unknown>>;
2707
+ /** Execute a command in a sandbox; returns stdout/stderr ($0.001). */
2708
+ modalSandboxExec(sandboxId: string, command: string[], extra?: Record<string, unknown>): Promise<Record<string, unknown>>;
2709
+ /** Check a sandbox's status ($0.001). */
2710
+ modalSandboxStatus(sandboxId: string): Promise<Record<string, unknown>>;
2711
+ /** Terminate a sandbox ($0.001). */
2712
+ modalSandboxTerminate(sandboxId: string): Promise<Record<string, unknown>>;
2587
2713
  /** Get session spending. */
2588
2714
  getSpending(): Spending;
2589
2715
  /** True if using sol.blockrun.ai. */
package/dist/index.js CHANGED
@@ -1596,6 +1596,120 @@ var LLMClient = class _LLMClient {
1596
1596
  async pmWalletCluster(address) {
1597
1597
  return this.pm(`polymarket/wallet/${address}/cluster`);
1598
1598
  }
1599
+ // ============================================================
1600
+ // DefiLlama (DeFi protocols / TVL / yields / prices)
1601
+ // ============================================================
1602
+ /**
1603
+ * Query DefiLlama DeFi data (GET passthrough). Powered by DefiLlama.
1604
+ * $0.005/call for protocols / protocol/{slug} / chains / yields;
1605
+ * $0.001/call for prices/{coins}.
1606
+ *
1607
+ * @param path - e.g. "protocols", "protocol/aave", "chains", "yields",
1608
+ * "prices/coingecko:bitcoin,base:0x..."
1609
+ * @param params - Query parameters passed through to DefiLlama
1610
+ */
1611
+ async defi(path5, params) {
1612
+ return this.getWithPaymentRaw(`/v1/defillama/${path5}`, params);
1613
+ }
1614
+ /** All DeFi protocols with TVL ($0.005/call). */
1615
+ async defiProtocols() {
1616
+ return this.defi("protocols");
1617
+ }
1618
+ /** Single protocol details + historical TVL ($0.005/call). */
1619
+ async defiProtocol(slug) {
1620
+ return this.defi(`protocol/${slug}`);
1621
+ }
1622
+ /** Current TVL of every chain ($0.005/call). */
1623
+ async defiChains() {
1624
+ return this.defi("chains");
1625
+ }
1626
+ /** Yield pools with APY/TVL ($0.005/call). */
1627
+ async defiYields(params) {
1628
+ return this.defi("yields", params);
1629
+ }
1630
+ /** Token price lookup ($0.001/call). Coins like "coingecko:bitcoin" or "{chain}:{address}". */
1631
+ async defiPrices(coins) {
1632
+ const joined = Array.isArray(coins) ? coins.join(",") : coins;
1633
+ return this.defi(`prices/${joined}`);
1634
+ }
1635
+ // ============================================================
1636
+ // 0x DEX (swap quotes + gasless) — free passthrough
1637
+ // ============================================================
1638
+ /**
1639
+ * Query the 0x Swap / Gasless APIs (free — no x402 payment; BlockRun
1640
+ * takes an on-chain affiliate fee on executed swaps instead).
1641
+ *
1642
+ * @param path - "price", "quote", "gasless/price", "gasless/quote",
1643
+ * "gasless/submit" (POST), "gasless/status/{hash}",
1644
+ * "gasless/approval-tokens", "gasless/chains", "swap/chains"
1645
+ * @param params - Query params (chainId, sellToken, buyToken, sellAmount, taker, ...)
1646
+ * @param body - JSON body — pass to switch to POST (gasless/submit only)
1647
+ */
1648
+ async dex(path5, params, body) {
1649
+ if (body) return this.requestWithPaymentRaw(`/v1/zerox/${path5}`, body);
1650
+ return this.getWithPaymentRaw(`/v1/zerox/${path5}`, params);
1651
+ }
1652
+ /** Indicative Permit2 swap price — no commitment (free). */
1653
+ async dexPrice(params) {
1654
+ return this.dex("price", params);
1655
+ }
1656
+ /** Firm Permit2 swap quote with permit2.eip712 + tx data (free). */
1657
+ async dexQuote(params) {
1658
+ return this.dex("quote", params);
1659
+ }
1660
+ /** Gasless indicative price quote (free). */
1661
+ async dexGaslessPrice(params) {
1662
+ return this.dex("gasless/price", params);
1663
+ }
1664
+ /** Gasless firm quote — returns trade.eip712 to sign (free). */
1665
+ async dexGaslessQuote(params) {
1666
+ return this.dex("gasless/quote", params);
1667
+ }
1668
+ /** Submit a signed gasless trade; the 0x relayer pays gas (free). */
1669
+ async dexGaslessSubmit(body) {
1670
+ return this.dex("gasless/submit", void 0, body);
1671
+ }
1672
+ /** Poll a gasless trade's status by tradeHash (free). */
1673
+ async dexGaslessStatus(tradeHash) {
1674
+ return this.dex(`gasless/status/${tradeHash}`);
1675
+ }
1676
+ /** Chains where the Swap API is supported (free). */
1677
+ async dexChains() {
1678
+ return this.dex("swap/chains");
1679
+ }
1680
+ /** Chains where the Gasless API is supported (free). */
1681
+ async dexGaslessChains() {
1682
+ return this.dex("gasless/chains");
1683
+ }
1684
+ // ============================================================
1685
+ // Modal Sandbox (pay-per-call cloud compute)
1686
+ // ============================================================
1687
+ /**
1688
+ * Call the Modal sandbox compute API (POST passthrough).
1689
+ *
1690
+ * @param path - "sandbox/create" ($0.01 CPU / $0.05 GPU), "sandbox/exec",
1691
+ * "sandbox/status", "sandbox/terminate" ($0.001 each)
1692
+ * @param body - JSON body for the endpoint
1693
+ */
1694
+ async modal(path5, body) {
1695
+ return this.requestWithPaymentRaw(`/v1/modal/${path5}`, body ?? {});
1696
+ }
1697
+ /** Create a sandboxed compute environment ($0.01 CPU / $0.05 GPU). */
1698
+ async modalSandboxCreate(body) {
1699
+ return this.modal("sandbox/create", body);
1700
+ }
1701
+ /** Execute a command in a sandbox; returns stdout/stderr ($0.001). */
1702
+ async modalSandboxExec(sandboxId, command, extra) {
1703
+ return this.modal("sandbox/exec", { sandbox_id: sandboxId, command, ...extra });
1704
+ }
1705
+ /** Check a sandbox's status ($0.001). */
1706
+ async modalSandboxStatus(sandboxId) {
1707
+ return this.modal("sandbox/status", { sandbox_id: sandboxId });
1708
+ }
1709
+ /** Terminate a sandbox ($0.001). */
1710
+ async modalSandboxTerminate(sandboxId) {
1711
+ return this.modal("sandbox/terminate", { sandbox_id: sandboxId });
1712
+ }
1599
1713
  /**
1600
1714
  * Get current session spending.
1601
1715
  *
@@ -4699,6 +4813,120 @@ var SolanaLLMClient = class {
4699
4813
  async exaAnswer(query, options) {
4700
4814
  return this.requestWithPaymentRaw("/v1/exa/answer", { query, ...options });
4701
4815
  }
4816
+ // ============================================================
4817
+ // DefiLlama (DeFi protocols / TVL / yields / prices)
4818
+ // ============================================================
4819
+ /**
4820
+ * Query DefiLlama DeFi data (GET passthrough). Powered by DefiLlama.
4821
+ * $0.005/call for protocols / protocol/{slug} / chains / yields;
4822
+ * $0.001/call for prices/{coins}.
4823
+ *
4824
+ * @param path - e.g. "protocols", "protocol/aave", "chains", "yields",
4825
+ * "prices/coingecko:bitcoin,base:0x..."
4826
+ * @param params - Query parameters passed through to DefiLlama
4827
+ */
4828
+ async defi(path5, params) {
4829
+ return this.getWithPaymentRaw(`/v1/defillama/${path5}`, params);
4830
+ }
4831
+ /** All DeFi protocols with TVL ($0.005/call). */
4832
+ async defiProtocols() {
4833
+ return this.defi("protocols");
4834
+ }
4835
+ /** Single protocol details + historical TVL ($0.005/call). */
4836
+ async defiProtocol(slug) {
4837
+ return this.defi(`protocol/${slug}`);
4838
+ }
4839
+ /** Current TVL of every chain ($0.005/call). */
4840
+ async defiChains() {
4841
+ return this.defi("chains");
4842
+ }
4843
+ /** Yield pools with APY/TVL ($0.005/call). */
4844
+ async defiYields(params) {
4845
+ return this.defi("yields", params);
4846
+ }
4847
+ /** Token price lookup ($0.001/call). Coins like "coingecko:bitcoin" or "{chain}:{address}". */
4848
+ async defiPrices(coins) {
4849
+ const joined = Array.isArray(coins) ? coins.join(",") : coins;
4850
+ return this.defi(`prices/${joined}`);
4851
+ }
4852
+ // ============================================================
4853
+ // 0x DEX (swap quotes + gasless) — free passthrough
4854
+ // ============================================================
4855
+ /**
4856
+ * Query the 0x Swap / Gasless APIs (free — no x402 payment; BlockRun
4857
+ * takes an on-chain affiliate fee on executed swaps instead).
4858
+ *
4859
+ * @param path - "price", "quote", "gasless/price", "gasless/quote",
4860
+ * "gasless/submit" (POST), "gasless/status/{hash}",
4861
+ * "gasless/approval-tokens", "gasless/chains", "swap/chains"
4862
+ * @param params - Query params (chainId, sellToken, buyToken, sellAmount, taker, ...)
4863
+ * @param body - JSON body — pass to switch to POST (gasless/submit only)
4864
+ */
4865
+ async dex(path5, params, body) {
4866
+ if (body) return this.requestWithPaymentRaw(`/v1/zerox/${path5}`, body);
4867
+ return this.getWithPaymentRaw(`/v1/zerox/${path5}`, params);
4868
+ }
4869
+ /** Indicative Permit2 swap price — no commitment (free). */
4870
+ async dexPrice(params) {
4871
+ return this.dex("price", params);
4872
+ }
4873
+ /** Firm Permit2 swap quote with permit2.eip712 + tx data (free). */
4874
+ async dexQuote(params) {
4875
+ return this.dex("quote", params);
4876
+ }
4877
+ /** Gasless indicative price quote (free). */
4878
+ async dexGaslessPrice(params) {
4879
+ return this.dex("gasless/price", params);
4880
+ }
4881
+ /** Gasless firm quote — returns trade.eip712 to sign (free). */
4882
+ async dexGaslessQuote(params) {
4883
+ return this.dex("gasless/quote", params);
4884
+ }
4885
+ /** Submit a signed gasless trade; the 0x relayer pays gas (free). */
4886
+ async dexGaslessSubmit(body) {
4887
+ return this.dex("gasless/submit", void 0, body);
4888
+ }
4889
+ /** Poll a gasless trade's status by tradeHash (free). */
4890
+ async dexGaslessStatus(tradeHash) {
4891
+ return this.dex(`gasless/status/${tradeHash}`);
4892
+ }
4893
+ /** Chains where the Swap API is supported (free). */
4894
+ async dexChains() {
4895
+ return this.dex("swap/chains");
4896
+ }
4897
+ /** Chains where the Gasless API is supported (free). */
4898
+ async dexGaslessChains() {
4899
+ return this.dex("gasless/chains");
4900
+ }
4901
+ // ============================================================
4902
+ // Modal Sandbox (pay-per-call cloud compute)
4903
+ // ============================================================
4904
+ /**
4905
+ * Call the Modal sandbox compute API (POST passthrough).
4906
+ *
4907
+ * @param path - "sandbox/create" ($0.01 CPU / $0.05 GPU), "sandbox/exec",
4908
+ * "sandbox/status", "sandbox/terminate" ($0.001 each)
4909
+ * @param body - JSON body for the endpoint
4910
+ */
4911
+ async modal(path5, body) {
4912
+ return this.requestWithPaymentRaw(`/v1/modal/${path5}`, body ?? {});
4913
+ }
4914
+ /** Create a sandboxed compute environment ($0.01 CPU / $0.05 GPU). */
4915
+ async modalSandboxCreate(body) {
4916
+ return this.modal("sandbox/create", body);
4917
+ }
4918
+ /** Execute a command in a sandbox; returns stdout/stderr ($0.001). */
4919
+ async modalSandboxExec(sandboxId, command, extra) {
4920
+ return this.modal("sandbox/exec", { sandbox_id: sandboxId, command, ...extra });
4921
+ }
4922
+ /** Check a sandbox's status ($0.001). */
4923
+ async modalSandboxStatus(sandboxId) {
4924
+ return this.modal("sandbox/status", { sandbox_id: sandboxId });
4925
+ }
4926
+ /** Terminate a sandbox ($0.001). */
4927
+ async modalSandboxTerminate(sandboxId) {
4928
+ return this.modal("sandbox/terminate", { sandbox_id: sandboxId });
4929
+ }
4702
4930
  /** Get session spending. */
4703
4931
  getSpending() {
4704
4932
  return { totalUsd: this.sessionTotalUsd, calls: this.sessionCalls };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/llm",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "type": "module",
5
5
  "description": "BlockRun SDK - Pay-per-request AI (LLM, Image, Video, Music, Voice) via x402 on Base and Solana",
6
6
  "main": "dist/index.cjs",