@blockrun/llm 3.0.0 → 3.2.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 +31 -0
- package/dist/index.cjs +260 -2
- package/dist/index.d.cts +151 -0
- package/dist/index.d.ts +151 -0
- package/dist/index.js +260 -2
- package/package.json +1 -1
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
|
*
|
|
@@ -2492,11 +2606,41 @@ var VideoClient = class {
|
|
|
2492
2606
|
const budgetMs = options?.budgetMs ?? DEFAULT_GENERATE_BUDGET_MS;
|
|
2493
2607
|
return this.submitAndPoll(body, budgetMs);
|
|
2494
2608
|
}
|
|
2609
|
+
/**
|
|
2610
|
+
* Generate a video from a standard Seedance `content[]` body.
|
|
2611
|
+
*
|
|
2612
|
+
* Targets the gateway's `POST /v1/videos` endpoint, which accepts the
|
|
2613
|
+
* mainstream multimodal `content` array (text + a single reference image)
|
|
2614
|
+
* used by other Seedance APIs — so callers already holding a
|
|
2615
|
+
* `content[]`-shaped request can submit it unchanged. The gateway validates
|
|
2616
|
+
* unsupported inputs *before* charging, then delegates to the same x402
|
|
2617
|
+
* submit+poll pipeline as {@link generate}.
|
|
2618
|
+
*
|
|
2619
|
+
* Most SDK users should prefer {@link generate} (structured options like
|
|
2620
|
+
* `imageUrl` / `lastFrameUrl`) — this exists for migrating existing
|
|
2621
|
+
* `content[]` payloads with no reshaping.
|
|
2622
|
+
*
|
|
2623
|
+
* @param content - The Seedance `content` array, e.g.
|
|
2624
|
+
* `[{ type: "text", text: "a red apple spinning" }]` or a text item plus
|
|
2625
|
+
* `{ type: "image_url", image_url: { url: "https://..." } }`.
|
|
2626
|
+
* @param options - `model`, `budgetMs`, and any extra top-level body fields
|
|
2627
|
+
* (`resolution`, `durationSeconds`/`duration_seconds`, `aspectRatio`, …)
|
|
2628
|
+
* forwarded verbatim.
|
|
2629
|
+
*/
|
|
2630
|
+
async generateFromContent(content, options) {
|
|
2631
|
+
if (!Array.isArray(content) || content.length === 0) {
|
|
2632
|
+
throw new Error("content must be a non-empty array of Seedance content items.");
|
|
2633
|
+
}
|
|
2634
|
+
const { model, budgetMs, ...extra } = options ?? {};
|
|
2635
|
+
const body = { content, ...extra };
|
|
2636
|
+
if (model !== void 0) body.model = model;
|
|
2637
|
+
return this.submitAndPoll(body, budgetMs ?? DEFAULT_GENERATE_BUDGET_MS, "/v1/videos");
|
|
2638
|
+
}
|
|
2495
2639
|
// --------------------------------------------------------------------
|
|
2496
2640
|
// Internal: async submit + poll
|
|
2497
2641
|
// --------------------------------------------------------------------
|
|
2498
|
-
async submitAndPoll(body, budgetMs) {
|
|
2499
|
-
const submitUrl = `${this.apiUrl}
|
|
2642
|
+
async submitAndPoll(body, budgetMs, submitPath = "/v1/videos/generations") {
|
|
2643
|
+
const submitUrl = `${this.apiUrl}${submitPath}`;
|
|
2500
2644
|
const resp402 = await this.fetchWithTimeout(submitUrl, {
|
|
2501
2645
|
method: "POST",
|
|
2502
2646
|
headers: { "Content-Type": "application/json" },
|
|
@@ -4806,6 +4950,120 @@ var SolanaLLMClient = class {
|
|
|
4806
4950
|
async exaAnswer(query, options) {
|
|
4807
4951
|
return this.requestWithPaymentRaw("/v1/exa/answer", { query, ...options });
|
|
4808
4952
|
}
|
|
4953
|
+
// ============================================================
|
|
4954
|
+
// DefiLlama (DeFi protocols / TVL / yields / prices)
|
|
4955
|
+
// ============================================================
|
|
4956
|
+
/**
|
|
4957
|
+
* Query DefiLlama DeFi data (GET passthrough). Powered by DefiLlama.
|
|
4958
|
+
* $0.005/call for protocols / protocol/{slug} / chains / yields;
|
|
4959
|
+
* $0.001/call for prices/{coins}.
|
|
4960
|
+
*
|
|
4961
|
+
* @param path - e.g. "protocols", "protocol/aave", "chains", "yields",
|
|
4962
|
+
* "prices/coingecko:bitcoin,base:0x..."
|
|
4963
|
+
* @param params - Query parameters passed through to DefiLlama
|
|
4964
|
+
*/
|
|
4965
|
+
async defi(path5, params) {
|
|
4966
|
+
return this.getWithPaymentRaw(`/v1/defillama/${path5}`, params);
|
|
4967
|
+
}
|
|
4968
|
+
/** All DeFi protocols with TVL ($0.005/call). */
|
|
4969
|
+
async defiProtocols() {
|
|
4970
|
+
return this.defi("protocols");
|
|
4971
|
+
}
|
|
4972
|
+
/** Single protocol details + historical TVL ($0.005/call). */
|
|
4973
|
+
async defiProtocol(slug) {
|
|
4974
|
+
return this.defi(`protocol/${slug}`);
|
|
4975
|
+
}
|
|
4976
|
+
/** Current TVL of every chain ($0.005/call). */
|
|
4977
|
+
async defiChains() {
|
|
4978
|
+
return this.defi("chains");
|
|
4979
|
+
}
|
|
4980
|
+
/** Yield pools with APY/TVL ($0.005/call). */
|
|
4981
|
+
async defiYields(params) {
|
|
4982
|
+
return this.defi("yields", params);
|
|
4983
|
+
}
|
|
4984
|
+
/** Token price lookup ($0.001/call). Coins like "coingecko:bitcoin" or "{chain}:{address}". */
|
|
4985
|
+
async defiPrices(coins) {
|
|
4986
|
+
const joined = Array.isArray(coins) ? coins.join(",") : coins;
|
|
4987
|
+
return this.defi(`prices/${joined}`);
|
|
4988
|
+
}
|
|
4989
|
+
// ============================================================
|
|
4990
|
+
// 0x DEX (swap quotes + gasless) — free passthrough
|
|
4991
|
+
// ============================================================
|
|
4992
|
+
/**
|
|
4993
|
+
* Query the 0x Swap / Gasless APIs (free — no x402 payment; BlockRun
|
|
4994
|
+
* takes an on-chain affiliate fee on executed swaps instead).
|
|
4995
|
+
*
|
|
4996
|
+
* @param path - "price", "quote", "gasless/price", "gasless/quote",
|
|
4997
|
+
* "gasless/submit" (POST), "gasless/status/{hash}",
|
|
4998
|
+
* "gasless/approval-tokens", "gasless/chains", "swap/chains"
|
|
4999
|
+
* @param params - Query params (chainId, sellToken, buyToken, sellAmount, taker, ...)
|
|
5000
|
+
* @param body - JSON body — pass to switch to POST (gasless/submit only)
|
|
5001
|
+
*/
|
|
5002
|
+
async dex(path5, params, body) {
|
|
5003
|
+
if (body) return this.requestWithPaymentRaw(`/v1/zerox/${path5}`, body);
|
|
5004
|
+
return this.getWithPaymentRaw(`/v1/zerox/${path5}`, params);
|
|
5005
|
+
}
|
|
5006
|
+
/** Indicative Permit2 swap price — no commitment (free). */
|
|
5007
|
+
async dexPrice(params) {
|
|
5008
|
+
return this.dex("price", params);
|
|
5009
|
+
}
|
|
5010
|
+
/** Firm Permit2 swap quote with permit2.eip712 + tx data (free). */
|
|
5011
|
+
async dexQuote(params) {
|
|
5012
|
+
return this.dex("quote", params);
|
|
5013
|
+
}
|
|
5014
|
+
/** Gasless indicative price quote (free). */
|
|
5015
|
+
async dexGaslessPrice(params) {
|
|
5016
|
+
return this.dex("gasless/price", params);
|
|
5017
|
+
}
|
|
5018
|
+
/** Gasless firm quote — returns trade.eip712 to sign (free). */
|
|
5019
|
+
async dexGaslessQuote(params) {
|
|
5020
|
+
return this.dex("gasless/quote", params);
|
|
5021
|
+
}
|
|
5022
|
+
/** Submit a signed gasless trade; the 0x relayer pays gas (free). */
|
|
5023
|
+
async dexGaslessSubmit(body) {
|
|
5024
|
+
return this.dex("gasless/submit", void 0, body);
|
|
5025
|
+
}
|
|
5026
|
+
/** Poll a gasless trade's status by tradeHash (free). */
|
|
5027
|
+
async dexGaslessStatus(tradeHash) {
|
|
5028
|
+
return this.dex(`gasless/status/${tradeHash}`);
|
|
5029
|
+
}
|
|
5030
|
+
/** Chains where the Swap API is supported (free). */
|
|
5031
|
+
async dexChains() {
|
|
5032
|
+
return this.dex("swap/chains");
|
|
5033
|
+
}
|
|
5034
|
+
/** Chains where the Gasless API is supported (free). */
|
|
5035
|
+
async dexGaslessChains() {
|
|
5036
|
+
return this.dex("gasless/chains");
|
|
5037
|
+
}
|
|
5038
|
+
// ============================================================
|
|
5039
|
+
// Modal Sandbox (pay-per-call cloud compute)
|
|
5040
|
+
// ============================================================
|
|
5041
|
+
/**
|
|
5042
|
+
* Call the Modal sandbox compute API (POST passthrough).
|
|
5043
|
+
*
|
|
5044
|
+
* @param path - "sandbox/create" ($0.01 CPU / $0.05 GPU), "sandbox/exec",
|
|
5045
|
+
* "sandbox/status", "sandbox/terminate" ($0.001 each)
|
|
5046
|
+
* @param body - JSON body for the endpoint
|
|
5047
|
+
*/
|
|
5048
|
+
async modal(path5, body) {
|
|
5049
|
+
return this.requestWithPaymentRaw(`/v1/modal/${path5}`, body ?? {});
|
|
5050
|
+
}
|
|
5051
|
+
/** Create a sandboxed compute environment ($0.01 CPU / $0.05 GPU). */
|
|
5052
|
+
async modalSandboxCreate(body) {
|
|
5053
|
+
return this.modal("sandbox/create", body);
|
|
5054
|
+
}
|
|
5055
|
+
/** Execute a command in a sandbox; returns stdout/stderr ($0.001). */
|
|
5056
|
+
async modalSandboxExec(sandboxId, command, extra) {
|
|
5057
|
+
return this.modal("sandbox/exec", { sandbox_id: sandboxId, command, ...extra });
|
|
5058
|
+
}
|
|
5059
|
+
/** Check a sandbox's status ($0.001). */
|
|
5060
|
+
async modalSandboxStatus(sandboxId) {
|
|
5061
|
+
return this.modal("sandbox/status", { sandbox_id: sandboxId });
|
|
5062
|
+
}
|
|
5063
|
+
/** Terminate a sandbox ($0.001). */
|
|
5064
|
+
async modalSandboxTerminate(sandboxId) {
|
|
5065
|
+
return this.modal("sandbox/terminate", { sandbox_id: sandboxId });
|
|
5066
|
+
}
|
|
4809
5067
|
/** Get session spending. */
|
|
4810
5068
|
getSpending() {
|
|
4811
5069
|
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
|
*
|
|
@@ -1635,6 +1698,31 @@ declare class VideoClient {
|
|
|
1635
1698
|
generate(prompt: string, options?: VideoGenerateOptions & {
|
|
1636
1699
|
budgetMs?: number;
|
|
1637
1700
|
}): Promise<VideoResponse>;
|
|
1701
|
+
/**
|
|
1702
|
+
* Generate a video from a standard Seedance `content[]` body.
|
|
1703
|
+
*
|
|
1704
|
+
* Targets the gateway's `POST /v1/videos` endpoint, which accepts the
|
|
1705
|
+
* mainstream multimodal `content` array (text + a single reference image)
|
|
1706
|
+
* used by other Seedance APIs — so callers already holding a
|
|
1707
|
+
* `content[]`-shaped request can submit it unchanged. The gateway validates
|
|
1708
|
+
* unsupported inputs *before* charging, then delegates to the same x402
|
|
1709
|
+
* submit+poll pipeline as {@link generate}.
|
|
1710
|
+
*
|
|
1711
|
+
* Most SDK users should prefer {@link generate} (structured options like
|
|
1712
|
+
* `imageUrl` / `lastFrameUrl`) — this exists for migrating existing
|
|
1713
|
+
* `content[]` payloads with no reshaping.
|
|
1714
|
+
*
|
|
1715
|
+
* @param content - The Seedance `content` array, e.g.
|
|
1716
|
+
* `[{ type: "text", text: "a red apple spinning" }]` or a text item plus
|
|
1717
|
+
* `{ type: "image_url", image_url: { url: "https://..." } }`.
|
|
1718
|
+
* @param options - `model`, `budgetMs`, and any extra top-level body fields
|
|
1719
|
+
* (`resolution`, `durationSeconds`/`duration_seconds`, `aspectRatio`, …)
|
|
1720
|
+
* forwarded verbatim.
|
|
1721
|
+
*/
|
|
1722
|
+
generateFromContent(content: Array<Record<string, unknown>>, options?: {
|
|
1723
|
+
model?: string;
|
|
1724
|
+
budgetMs?: number;
|
|
1725
|
+
} & Record<string, unknown>): Promise<VideoResponse>;
|
|
1638
1726
|
private submitAndPoll;
|
|
1639
1727
|
private absolute;
|
|
1640
1728
|
private extractPaymentRequired;
|
|
@@ -2584,6 +2672,69 @@ declare class SolanaLLMClient {
|
|
|
2584
2672
|
* const answer = await client.exaAnswer("What is the current state of AI safety research?");
|
|
2585
2673
|
*/
|
|
2586
2674
|
exaAnswer(query: string, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2675
|
+
/**
|
|
2676
|
+
* Query DefiLlama DeFi data (GET passthrough). Powered by DefiLlama.
|
|
2677
|
+
* $0.005/call for protocols / protocol/{slug} / chains / yields;
|
|
2678
|
+
* $0.001/call for prices/{coins}.
|
|
2679
|
+
*
|
|
2680
|
+
* @param path - e.g. "protocols", "protocol/aave", "chains", "yields",
|
|
2681
|
+
* "prices/coingecko:bitcoin,base:0x..."
|
|
2682
|
+
* @param params - Query parameters passed through to DefiLlama
|
|
2683
|
+
*/
|
|
2684
|
+
defi(path: string, params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
2685
|
+
/** All DeFi protocols with TVL ($0.005/call). */
|
|
2686
|
+
defiProtocols(): Promise<Record<string, unknown>>;
|
|
2687
|
+
/** Single protocol details + historical TVL ($0.005/call). */
|
|
2688
|
+
defiProtocol(slug: string): Promise<Record<string, unknown>>;
|
|
2689
|
+
/** Current TVL of every chain ($0.005/call). */
|
|
2690
|
+
defiChains(): Promise<Record<string, unknown>>;
|
|
2691
|
+
/** Yield pools with APY/TVL ($0.005/call). */
|
|
2692
|
+
defiYields(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
2693
|
+
/** Token price lookup ($0.001/call). Coins like "coingecko:bitcoin" or "{chain}:{address}". */
|
|
2694
|
+
defiPrices(coins: string | string[]): Promise<Record<string, unknown>>;
|
|
2695
|
+
/**
|
|
2696
|
+
* Query the 0x Swap / Gasless APIs (free — no x402 payment; BlockRun
|
|
2697
|
+
* takes an on-chain affiliate fee on executed swaps instead).
|
|
2698
|
+
*
|
|
2699
|
+
* @param path - "price", "quote", "gasless/price", "gasless/quote",
|
|
2700
|
+
* "gasless/submit" (POST), "gasless/status/{hash}",
|
|
2701
|
+
* "gasless/approval-tokens", "gasless/chains", "swap/chains"
|
|
2702
|
+
* @param params - Query params (chainId, sellToken, buyToken, sellAmount, taker, ...)
|
|
2703
|
+
* @param body - JSON body — pass to switch to POST (gasless/submit only)
|
|
2704
|
+
*/
|
|
2705
|
+
dex(path: string, params?: Record<string, string>, body?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2706
|
+
/** Indicative Permit2 swap price — no commitment (free). */
|
|
2707
|
+
dexPrice(params: Record<string, string>): Promise<Record<string, unknown>>;
|
|
2708
|
+
/** Firm Permit2 swap quote with permit2.eip712 + tx data (free). */
|
|
2709
|
+
dexQuote(params: Record<string, string>): Promise<Record<string, unknown>>;
|
|
2710
|
+
/** Gasless indicative price quote (free). */
|
|
2711
|
+
dexGaslessPrice(params: Record<string, string>): Promise<Record<string, unknown>>;
|
|
2712
|
+
/** Gasless firm quote — returns trade.eip712 to sign (free). */
|
|
2713
|
+
dexGaslessQuote(params: Record<string, string>): Promise<Record<string, unknown>>;
|
|
2714
|
+
/** Submit a signed gasless trade; the 0x relayer pays gas (free). */
|
|
2715
|
+
dexGaslessSubmit(body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2716
|
+
/** Poll a gasless trade's status by tradeHash (free). */
|
|
2717
|
+
dexGaslessStatus(tradeHash: string): Promise<Record<string, unknown>>;
|
|
2718
|
+
/** Chains where the Swap API is supported (free). */
|
|
2719
|
+
dexChains(): Promise<Record<string, unknown>>;
|
|
2720
|
+
/** Chains where the Gasless API is supported (free). */
|
|
2721
|
+
dexGaslessChains(): Promise<Record<string, unknown>>;
|
|
2722
|
+
/**
|
|
2723
|
+
* Call the Modal sandbox compute API (POST passthrough).
|
|
2724
|
+
*
|
|
2725
|
+
* @param path - "sandbox/create" ($0.01 CPU / $0.05 GPU), "sandbox/exec",
|
|
2726
|
+
* "sandbox/status", "sandbox/terminate" ($0.001 each)
|
|
2727
|
+
* @param body - JSON body for the endpoint
|
|
2728
|
+
*/
|
|
2729
|
+
modal(path: string, body?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2730
|
+
/** Create a sandboxed compute environment ($0.01 CPU / $0.05 GPU). */
|
|
2731
|
+
modalSandboxCreate(body?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2732
|
+
/** Execute a command in a sandbox; returns stdout/stderr ($0.001). */
|
|
2733
|
+
modalSandboxExec(sandboxId: string, command: string[], extra?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2734
|
+
/** Check a sandbox's status ($0.001). */
|
|
2735
|
+
modalSandboxStatus(sandboxId: string): Promise<Record<string, unknown>>;
|
|
2736
|
+
/** Terminate a sandbox ($0.001). */
|
|
2737
|
+
modalSandboxTerminate(sandboxId: string): Promise<Record<string, unknown>>;
|
|
2587
2738
|
/** Get session spending. */
|
|
2588
2739
|
getSpending(): Spending;
|
|
2589
2740
|
/** 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
|
*
|
|
@@ -1635,6 +1698,31 @@ declare class VideoClient {
|
|
|
1635
1698
|
generate(prompt: string, options?: VideoGenerateOptions & {
|
|
1636
1699
|
budgetMs?: number;
|
|
1637
1700
|
}): Promise<VideoResponse>;
|
|
1701
|
+
/**
|
|
1702
|
+
* Generate a video from a standard Seedance `content[]` body.
|
|
1703
|
+
*
|
|
1704
|
+
* Targets the gateway's `POST /v1/videos` endpoint, which accepts the
|
|
1705
|
+
* mainstream multimodal `content` array (text + a single reference image)
|
|
1706
|
+
* used by other Seedance APIs — so callers already holding a
|
|
1707
|
+
* `content[]`-shaped request can submit it unchanged. The gateway validates
|
|
1708
|
+
* unsupported inputs *before* charging, then delegates to the same x402
|
|
1709
|
+
* submit+poll pipeline as {@link generate}.
|
|
1710
|
+
*
|
|
1711
|
+
* Most SDK users should prefer {@link generate} (structured options like
|
|
1712
|
+
* `imageUrl` / `lastFrameUrl`) — this exists for migrating existing
|
|
1713
|
+
* `content[]` payloads with no reshaping.
|
|
1714
|
+
*
|
|
1715
|
+
* @param content - The Seedance `content` array, e.g.
|
|
1716
|
+
* `[{ type: "text", text: "a red apple spinning" }]` or a text item plus
|
|
1717
|
+
* `{ type: "image_url", image_url: { url: "https://..." } }`.
|
|
1718
|
+
* @param options - `model`, `budgetMs`, and any extra top-level body fields
|
|
1719
|
+
* (`resolution`, `durationSeconds`/`duration_seconds`, `aspectRatio`, …)
|
|
1720
|
+
* forwarded verbatim.
|
|
1721
|
+
*/
|
|
1722
|
+
generateFromContent(content: Array<Record<string, unknown>>, options?: {
|
|
1723
|
+
model?: string;
|
|
1724
|
+
budgetMs?: number;
|
|
1725
|
+
} & Record<string, unknown>): Promise<VideoResponse>;
|
|
1638
1726
|
private submitAndPoll;
|
|
1639
1727
|
private absolute;
|
|
1640
1728
|
private extractPaymentRequired;
|
|
@@ -2584,6 +2672,69 @@ declare class SolanaLLMClient {
|
|
|
2584
2672
|
* const answer = await client.exaAnswer("What is the current state of AI safety research?");
|
|
2585
2673
|
*/
|
|
2586
2674
|
exaAnswer(query: string, options?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2675
|
+
/**
|
|
2676
|
+
* Query DefiLlama DeFi data (GET passthrough). Powered by DefiLlama.
|
|
2677
|
+
* $0.005/call for protocols / protocol/{slug} / chains / yields;
|
|
2678
|
+
* $0.001/call for prices/{coins}.
|
|
2679
|
+
*
|
|
2680
|
+
* @param path - e.g. "protocols", "protocol/aave", "chains", "yields",
|
|
2681
|
+
* "prices/coingecko:bitcoin,base:0x..."
|
|
2682
|
+
* @param params - Query parameters passed through to DefiLlama
|
|
2683
|
+
*/
|
|
2684
|
+
defi(path: string, params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
2685
|
+
/** All DeFi protocols with TVL ($0.005/call). */
|
|
2686
|
+
defiProtocols(): Promise<Record<string, unknown>>;
|
|
2687
|
+
/** Single protocol details + historical TVL ($0.005/call). */
|
|
2688
|
+
defiProtocol(slug: string): Promise<Record<string, unknown>>;
|
|
2689
|
+
/** Current TVL of every chain ($0.005/call). */
|
|
2690
|
+
defiChains(): Promise<Record<string, unknown>>;
|
|
2691
|
+
/** Yield pools with APY/TVL ($0.005/call). */
|
|
2692
|
+
defiYields(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
2693
|
+
/** Token price lookup ($0.001/call). Coins like "coingecko:bitcoin" or "{chain}:{address}". */
|
|
2694
|
+
defiPrices(coins: string | string[]): Promise<Record<string, unknown>>;
|
|
2695
|
+
/**
|
|
2696
|
+
* Query the 0x Swap / Gasless APIs (free — no x402 payment; BlockRun
|
|
2697
|
+
* takes an on-chain affiliate fee on executed swaps instead).
|
|
2698
|
+
*
|
|
2699
|
+
* @param path - "price", "quote", "gasless/price", "gasless/quote",
|
|
2700
|
+
* "gasless/submit" (POST), "gasless/status/{hash}",
|
|
2701
|
+
* "gasless/approval-tokens", "gasless/chains", "swap/chains"
|
|
2702
|
+
* @param params - Query params (chainId, sellToken, buyToken, sellAmount, taker, ...)
|
|
2703
|
+
* @param body - JSON body — pass to switch to POST (gasless/submit only)
|
|
2704
|
+
*/
|
|
2705
|
+
dex(path: string, params?: Record<string, string>, body?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2706
|
+
/** Indicative Permit2 swap price — no commitment (free). */
|
|
2707
|
+
dexPrice(params: Record<string, string>): Promise<Record<string, unknown>>;
|
|
2708
|
+
/** Firm Permit2 swap quote with permit2.eip712 + tx data (free). */
|
|
2709
|
+
dexQuote(params: Record<string, string>): Promise<Record<string, unknown>>;
|
|
2710
|
+
/** Gasless indicative price quote (free). */
|
|
2711
|
+
dexGaslessPrice(params: Record<string, string>): Promise<Record<string, unknown>>;
|
|
2712
|
+
/** Gasless firm quote — returns trade.eip712 to sign (free). */
|
|
2713
|
+
dexGaslessQuote(params: Record<string, string>): Promise<Record<string, unknown>>;
|
|
2714
|
+
/** Submit a signed gasless trade; the 0x relayer pays gas (free). */
|
|
2715
|
+
dexGaslessSubmit(body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2716
|
+
/** Poll a gasless trade's status by tradeHash (free). */
|
|
2717
|
+
dexGaslessStatus(tradeHash: string): Promise<Record<string, unknown>>;
|
|
2718
|
+
/** Chains where the Swap API is supported (free). */
|
|
2719
|
+
dexChains(): Promise<Record<string, unknown>>;
|
|
2720
|
+
/** Chains where the Gasless API is supported (free). */
|
|
2721
|
+
dexGaslessChains(): Promise<Record<string, unknown>>;
|
|
2722
|
+
/**
|
|
2723
|
+
* Call the Modal sandbox compute API (POST passthrough).
|
|
2724
|
+
*
|
|
2725
|
+
* @param path - "sandbox/create" ($0.01 CPU / $0.05 GPU), "sandbox/exec",
|
|
2726
|
+
* "sandbox/status", "sandbox/terminate" ($0.001 each)
|
|
2727
|
+
* @param body - JSON body for the endpoint
|
|
2728
|
+
*/
|
|
2729
|
+
modal(path: string, body?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2730
|
+
/** Create a sandboxed compute environment ($0.01 CPU / $0.05 GPU). */
|
|
2731
|
+
modalSandboxCreate(body?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2732
|
+
/** Execute a command in a sandbox; returns stdout/stderr ($0.001). */
|
|
2733
|
+
modalSandboxExec(sandboxId: string, command: string[], extra?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2734
|
+
/** Check a sandbox's status ($0.001). */
|
|
2735
|
+
modalSandboxStatus(sandboxId: string): Promise<Record<string, unknown>>;
|
|
2736
|
+
/** Terminate a sandbox ($0.001). */
|
|
2737
|
+
modalSandboxTerminate(sandboxId: string): Promise<Record<string, unknown>>;
|
|
2587
2738
|
/** Get session spending. */
|
|
2588
2739
|
getSpending(): Spending;
|
|
2589
2740
|
/** 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
|
*
|
|
@@ -2385,11 +2499,41 @@ var VideoClient = class {
|
|
|
2385
2499
|
const budgetMs = options?.budgetMs ?? DEFAULT_GENERATE_BUDGET_MS;
|
|
2386
2500
|
return this.submitAndPoll(body, budgetMs);
|
|
2387
2501
|
}
|
|
2502
|
+
/**
|
|
2503
|
+
* Generate a video from a standard Seedance `content[]` body.
|
|
2504
|
+
*
|
|
2505
|
+
* Targets the gateway's `POST /v1/videos` endpoint, which accepts the
|
|
2506
|
+
* mainstream multimodal `content` array (text + a single reference image)
|
|
2507
|
+
* used by other Seedance APIs — so callers already holding a
|
|
2508
|
+
* `content[]`-shaped request can submit it unchanged. The gateway validates
|
|
2509
|
+
* unsupported inputs *before* charging, then delegates to the same x402
|
|
2510
|
+
* submit+poll pipeline as {@link generate}.
|
|
2511
|
+
*
|
|
2512
|
+
* Most SDK users should prefer {@link generate} (structured options like
|
|
2513
|
+
* `imageUrl` / `lastFrameUrl`) — this exists for migrating existing
|
|
2514
|
+
* `content[]` payloads with no reshaping.
|
|
2515
|
+
*
|
|
2516
|
+
* @param content - The Seedance `content` array, e.g.
|
|
2517
|
+
* `[{ type: "text", text: "a red apple spinning" }]` or a text item plus
|
|
2518
|
+
* `{ type: "image_url", image_url: { url: "https://..." } }`.
|
|
2519
|
+
* @param options - `model`, `budgetMs`, and any extra top-level body fields
|
|
2520
|
+
* (`resolution`, `durationSeconds`/`duration_seconds`, `aspectRatio`, …)
|
|
2521
|
+
* forwarded verbatim.
|
|
2522
|
+
*/
|
|
2523
|
+
async generateFromContent(content, options) {
|
|
2524
|
+
if (!Array.isArray(content) || content.length === 0) {
|
|
2525
|
+
throw new Error("content must be a non-empty array of Seedance content items.");
|
|
2526
|
+
}
|
|
2527
|
+
const { model, budgetMs, ...extra } = options ?? {};
|
|
2528
|
+
const body = { content, ...extra };
|
|
2529
|
+
if (model !== void 0) body.model = model;
|
|
2530
|
+
return this.submitAndPoll(body, budgetMs ?? DEFAULT_GENERATE_BUDGET_MS, "/v1/videos");
|
|
2531
|
+
}
|
|
2388
2532
|
// --------------------------------------------------------------------
|
|
2389
2533
|
// Internal: async submit + poll
|
|
2390
2534
|
// --------------------------------------------------------------------
|
|
2391
|
-
async submitAndPoll(body, budgetMs) {
|
|
2392
|
-
const submitUrl = `${this.apiUrl}
|
|
2535
|
+
async submitAndPoll(body, budgetMs, submitPath = "/v1/videos/generations") {
|
|
2536
|
+
const submitUrl = `${this.apiUrl}${submitPath}`;
|
|
2393
2537
|
const resp402 = await this.fetchWithTimeout(submitUrl, {
|
|
2394
2538
|
method: "POST",
|
|
2395
2539
|
headers: { "Content-Type": "application/json" },
|
|
@@ -4699,6 +4843,120 @@ var SolanaLLMClient = class {
|
|
|
4699
4843
|
async exaAnswer(query, options) {
|
|
4700
4844
|
return this.requestWithPaymentRaw("/v1/exa/answer", { query, ...options });
|
|
4701
4845
|
}
|
|
4846
|
+
// ============================================================
|
|
4847
|
+
// DefiLlama (DeFi protocols / TVL / yields / prices)
|
|
4848
|
+
// ============================================================
|
|
4849
|
+
/**
|
|
4850
|
+
* Query DefiLlama DeFi data (GET passthrough). Powered by DefiLlama.
|
|
4851
|
+
* $0.005/call for protocols / protocol/{slug} / chains / yields;
|
|
4852
|
+
* $0.001/call for prices/{coins}.
|
|
4853
|
+
*
|
|
4854
|
+
* @param path - e.g. "protocols", "protocol/aave", "chains", "yields",
|
|
4855
|
+
* "prices/coingecko:bitcoin,base:0x..."
|
|
4856
|
+
* @param params - Query parameters passed through to DefiLlama
|
|
4857
|
+
*/
|
|
4858
|
+
async defi(path5, params) {
|
|
4859
|
+
return this.getWithPaymentRaw(`/v1/defillama/${path5}`, params);
|
|
4860
|
+
}
|
|
4861
|
+
/** All DeFi protocols with TVL ($0.005/call). */
|
|
4862
|
+
async defiProtocols() {
|
|
4863
|
+
return this.defi("protocols");
|
|
4864
|
+
}
|
|
4865
|
+
/** Single protocol details + historical TVL ($0.005/call). */
|
|
4866
|
+
async defiProtocol(slug) {
|
|
4867
|
+
return this.defi(`protocol/${slug}`);
|
|
4868
|
+
}
|
|
4869
|
+
/** Current TVL of every chain ($0.005/call). */
|
|
4870
|
+
async defiChains() {
|
|
4871
|
+
return this.defi("chains");
|
|
4872
|
+
}
|
|
4873
|
+
/** Yield pools with APY/TVL ($0.005/call). */
|
|
4874
|
+
async defiYields(params) {
|
|
4875
|
+
return this.defi("yields", params);
|
|
4876
|
+
}
|
|
4877
|
+
/** Token price lookup ($0.001/call). Coins like "coingecko:bitcoin" or "{chain}:{address}". */
|
|
4878
|
+
async defiPrices(coins) {
|
|
4879
|
+
const joined = Array.isArray(coins) ? coins.join(",") : coins;
|
|
4880
|
+
return this.defi(`prices/${joined}`);
|
|
4881
|
+
}
|
|
4882
|
+
// ============================================================
|
|
4883
|
+
// 0x DEX (swap quotes + gasless) — free passthrough
|
|
4884
|
+
// ============================================================
|
|
4885
|
+
/**
|
|
4886
|
+
* Query the 0x Swap / Gasless APIs (free — no x402 payment; BlockRun
|
|
4887
|
+
* takes an on-chain affiliate fee on executed swaps instead).
|
|
4888
|
+
*
|
|
4889
|
+
* @param path - "price", "quote", "gasless/price", "gasless/quote",
|
|
4890
|
+
* "gasless/submit" (POST), "gasless/status/{hash}",
|
|
4891
|
+
* "gasless/approval-tokens", "gasless/chains", "swap/chains"
|
|
4892
|
+
* @param params - Query params (chainId, sellToken, buyToken, sellAmount, taker, ...)
|
|
4893
|
+
* @param body - JSON body — pass to switch to POST (gasless/submit only)
|
|
4894
|
+
*/
|
|
4895
|
+
async dex(path5, params, body) {
|
|
4896
|
+
if (body) return this.requestWithPaymentRaw(`/v1/zerox/${path5}`, body);
|
|
4897
|
+
return this.getWithPaymentRaw(`/v1/zerox/${path5}`, params);
|
|
4898
|
+
}
|
|
4899
|
+
/** Indicative Permit2 swap price — no commitment (free). */
|
|
4900
|
+
async dexPrice(params) {
|
|
4901
|
+
return this.dex("price", params);
|
|
4902
|
+
}
|
|
4903
|
+
/** Firm Permit2 swap quote with permit2.eip712 + tx data (free). */
|
|
4904
|
+
async dexQuote(params) {
|
|
4905
|
+
return this.dex("quote", params);
|
|
4906
|
+
}
|
|
4907
|
+
/** Gasless indicative price quote (free). */
|
|
4908
|
+
async dexGaslessPrice(params) {
|
|
4909
|
+
return this.dex("gasless/price", params);
|
|
4910
|
+
}
|
|
4911
|
+
/** Gasless firm quote — returns trade.eip712 to sign (free). */
|
|
4912
|
+
async dexGaslessQuote(params) {
|
|
4913
|
+
return this.dex("gasless/quote", params);
|
|
4914
|
+
}
|
|
4915
|
+
/** Submit a signed gasless trade; the 0x relayer pays gas (free). */
|
|
4916
|
+
async dexGaslessSubmit(body) {
|
|
4917
|
+
return this.dex("gasless/submit", void 0, body);
|
|
4918
|
+
}
|
|
4919
|
+
/** Poll a gasless trade's status by tradeHash (free). */
|
|
4920
|
+
async dexGaslessStatus(tradeHash) {
|
|
4921
|
+
return this.dex(`gasless/status/${tradeHash}`);
|
|
4922
|
+
}
|
|
4923
|
+
/** Chains where the Swap API is supported (free). */
|
|
4924
|
+
async dexChains() {
|
|
4925
|
+
return this.dex("swap/chains");
|
|
4926
|
+
}
|
|
4927
|
+
/** Chains where the Gasless API is supported (free). */
|
|
4928
|
+
async dexGaslessChains() {
|
|
4929
|
+
return this.dex("gasless/chains");
|
|
4930
|
+
}
|
|
4931
|
+
// ============================================================
|
|
4932
|
+
// Modal Sandbox (pay-per-call cloud compute)
|
|
4933
|
+
// ============================================================
|
|
4934
|
+
/**
|
|
4935
|
+
* Call the Modal sandbox compute API (POST passthrough).
|
|
4936
|
+
*
|
|
4937
|
+
* @param path - "sandbox/create" ($0.01 CPU / $0.05 GPU), "sandbox/exec",
|
|
4938
|
+
* "sandbox/status", "sandbox/terminate" ($0.001 each)
|
|
4939
|
+
* @param body - JSON body for the endpoint
|
|
4940
|
+
*/
|
|
4941
|
+
async modal(path5, body) {
|
|
4942
|
+
return this.requestWithPaymentRaw(`/v1/modal/${path5}`, body ?? {});
|
|
4943
|
+
}
|
|
4944
|
+
/** Create a sandboxed compute environment ($0.01 CPU / $0.05 GPU). */
|
|
4945
|
+
async modalSandboxCreate(body) {
|
|
4946
|
+
return this.modal("sandbox/create", body);
|
|
4947
|
+
}
|
|
4948
|
+
/** Execute a command in a sandbox; returns stdout/stderr ($0.001). */
|
|
4949
|
+
async modalSandboxExec(sandboxId, command, extra) {
|
|
4950
|
+
return this.modal("sandbox/exec", { sandbox_id: sandboxId, command, ...extra });
|
|
4951
|
+
}
|
|
4952
|
+
/** Check a sandbox's status ($0.001). */
|
|
4953
|
+
async modalSandboxStatus(sandboxId) {
|
|
4954
|
+
return this.modal("sandbox/status", { sandbox_id: sandboxId });
|
|
4955
|
+
}
|
|
4956
|
+
/** Terminate a sandbox ($0.001). */
|
|
4957
|
+
async modalSandboxTerminate(sandboxId) {
|
|
4958
|
+
return this.modal("sandbox/terminate", { sandbox_id: sandboxId });
|
|
4959
|
+
}
|
|
4702
4960
|
/** Get session spending. */
|
|
4703
4961
|
getSpending() {
|
|
4704
4962
|
return { totalUsd: this.sessionTotalUsd, calls: this.sessionCalls };
|