@blockrun/llm 1.4.2 → 1.4.3
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 +9 -1
- package/dist/index.cjs +134 -36644
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +23 -12
- package/package.json +3 -3
- package/dist/chunk-KRDGCX7W.js +0 -27187
- package/dist/esm-PTFDM6PE.js +0 -8117
- package/dist/index.esm-SXKIFLA7.js +0 -158
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
7
|
|
|
8
8
|
// src/client.ts
|
|
9
9
|
import { privateKeyToAccount } from "viem/accounts";
|
|
@@ -116,9 +116,9 @@ async function createPaymentPayload(privateKey, fromAddress, recipient, amount,
|
|
|
116
116
|
return btoa(JSON.stringify(paymentData));
|
|
117
117
|
}
|
|
118
118
|
async function createSolanaPaymentPayload(secretKey, fromAddress, recipient, amount, feePayer, options = {}) {
|
|
119
|
-
const { Connection, PublicKey, TransactionMessage, VersionedTransaction, ComputeBudgetProgram } = await import("
|
|
120
|
-
const { getAssociatedTokenAddress, createTransferCheckedInstruction, getMint } = await import("
|
|
121
|
-
const { Keypair } = await import("
|
|
119
|
+
const { Connection, PublicKey, TransactionMessage, VersionedTransaction, ComputeBudgetProgram } = await import("@solana/web3.js");
|
|
120
|
+
const { getAssociatedTokenAddress, createTransferCheckedInstruction, getMint } = await import("@solana/spl-token");
|
|
121
|
+
const { Keypair } = await import("@solana/web3.js");
|
|
122
122
|
const rpcUrl = options.rpcUrl || "https://api.mainnet-beta.solana.com";
|
|
123
123
|
const connection = new Connection(rpcUrl);
|
|
124
124
|
const keypair = Keypair.fromSecretKey(secretKey);
|
|
@@ -804,7 +804,18 @@ var LLMClient = class {
|
|
|
804
804
|
);
|
|
805
805
|
}
|
|
806
806
|
const data = await response.json();
|
|
807
|
-
return data.data || []
|
|
807
|
+
return (data.data || []).map((m) => ({
|
|
808
|
+
id: m.id,
|
|
809
|
+
name: m.name || m.id,
|
|
810
|
+
provider: m.owned_by || "",
|
|
811
|
+
description: m.description || "",
|
|
812
|
+
inputPrice: m.pricing?.input ?? m.pricing?.flat ?? 0,
|
|
813
|
+
outputPrice: m.pricing?.output ?? 0,
|
|
814
|
+
contextWindow: m.context_window || 0,
|
|
815
|
+
maxOutput: m.max_output || 0,
|
|
816
|
+
categories: m.categories || [],
|
|
817
|
+
available: true
|
|
818
|
+
}));
|
|
808
819
|
}
|
|
809
820
|
/**
|
|
810
821
|
* List available image generation models with pricing.
|
|
@@ -1581,7 +1592,7 @@ import * as os2 from "os";
|
|
|
1581
1592
|
var WALLET_DIR2 = path2.join(os2.homedir(), ".blockrun");
|
|
1582
1593
|
var SOLANA_WALLET_FILE = path2.join(WALLET_DIR2, ".solana-session");
|
|
1583
1594
|
function createSolanaWallet() {
|
|
1584
|
-
const { Keypair } = (
|
|
1595
|
+
const { Keypair } = __require("@solana/web3.js");
|
|
1585
1596
|
const bs58 = __require("bs58");
|
|
1586
1597
|
const keypair = Keypair.generate();
|
|
1587
1598
|
return {
|
|
@@ -1603,7 +1614,7 @@ async function solanaKeyToBytes(privateKey) {
|
|
|
1603
1614
|
}
|
|
1604
1615
|
}
|
|
1605
1616
|
async function solanaPublicKey(privateKey) {
|
|
1606
|
-
const { Keypair } = await import("
|
|
1617
|
+
const { Keypair } = await import("@solana/web3.js");
|
|
1607
1618
|
const bytes = await solanaKeyToBytes(privateKey);
|
|
1608
1619
|
return Keypair.fromSecretKey(bytes).publicKey.toBase58();
|
|
1609
1620
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockrun/llm",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "BlockRun LLM Gateway SDK - Pay-per-request AI via x402 on Base and Solana",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"README.md"
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
|
-
"build": "tsup src/index.ts --format cjs,esm --dts --clean --external @anthropic-ai/sdk",
|
|
22
|
-
"dev": "tsup src/index.ts --format cjs,esm --dts --watch --external @anthropic-ai/sdk",
|
|
21
|
+
"build": "tsup src/index.ts --format cjs,esm --dts --clean --external @anthropic-ai/sdk --external @solana/web3.js --external @solana/spl-token --external bs58",
|
|
22
|
+
"dev": "tsup src/index.ts --format cjs,esm --dts --watch --external @anthropic-ai/sdk --external @solana/web3.js --external @solana/spl-token --external bs58",
|
|
23
23
|
"test": "vitest",
|
|
24
24
|
"lint": "eslint src/",
|
|
25
25
|
"typecheck": "tsc --noEmit"
|