@blockrun/llm
Advanced tools
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| import { | ||
| Account, | ||
| AddressLookupTableAccount, | ||
| AddressLookupTableInstruction, | ||
| AddressLookupTableProgram, | ||
| Authorized, | ||
| BLOCKHASH_CACHE_TIMEOUT_MS, | ||
| BPF_LOADER_DEPRECATED_PROGRAM_ID, | ||
| BPF_LOADER_PROGRAM_ID, | ||
| BpfLoader, | ||
| COMPUTE_BUDGET_INSTRUCTION_LAYOUTS, | ||
| ComputeBudgetInstruction, | ||
| ComputeBudgetProgram, | ||
| Connection, | ||
| Ed25519Program, | ||
| Enum, | ||
| EpochSchedule, | ||
| FeeCalculatorLayout, | ||
| Keypair, | ||
| LAMPORTS_PER_SOL, | ||
| LOOKUP_TABLE_INSTRUCTION_LAYOUTS, | ||
| Loader, | ||
| Lockup, | ||
| MAX_SEED_LENGTH, | ||
| Message, | ||
| MessageAccountKeys, | ||
| MessageV0, | ||
| NONCE_ACCOUNT_LENGTH, | ||
| NonceAccount, | ||
| PACKET_DATA_SIZE, | ||
| PUBLIC_KEY_LENGTH, | ||
| PublicKey, | ||
| SIGNATURE_LENGTH_IN_BYTES, | ||
| SOLANA_SCHEMA, | ||
| STAKE_CONFIG_ID, | ||
| STAKE_INSTRUCTION_LAYOUTS, | ||
| SYSTEM_INSTRUCTION_LAYOUTS, | ||
| SYSVAR_CLOCK_PUBKEY, | ||
| SYSVAR_EPOCH_SCHEDULE_PUBKEY, | ||
| SYSVAR_INSTRUCTIONS_PUBKEY, | ||
| SYSVAR_RECENT_BLOCKHASHES_PUBKEY, | ||
| SYSVAR_RENT_PUBKEY, | ||
| SYSVAR_REWARDS_PUBKEY, | ||
| SYSVAR_SLOT_HASHES_PUBKEY, | ||
| SYSVAR_SLOT_HISTORY_PUBKEY, | ||
| SYSVAR_STAKE_HISTORY_PUBKEY, | ||
| Secp256k1Program, | ||
| SendTransactionError, | ||
| SolanaJSONRPCError, | ||
| SolanaJSONRPCErrorCode, | ||
| StakeAuthorizationLayout, | ||
| StakeInstruction, | ||
| StakeProgram, | ||
| Struct, | ||
| SystemInstruction, | ||
| SystemProgram, | ||
| Transaction, | ||
| TransactionExpiredBlockheightExceededError, | ||
| TransactionExpiredNonceInvalidError, | ||
| TransactionExpiredTimeoutError, | ||
| TransactionInstruction, | ||
| TransactionMessage, | ||
| TransactionStatus, | ||
| VALIDATOR_INFO_KEY, | ||
| VERSION_PREFIX_MASK, | ||
| VOTE_PROGRAM_ID, | ||
| ValidatorInfo, | ||
| VersionedMessage, | ||
| VersionedTransaction, | ||
| VoteAccount, | ||
| VoteAuthorizationLayout, | ||
| VoteInit, | ||
| VoteInstruction, | ||
| VoteProgram, | ||
| clusterApiUrl, | ||
| init_index_esm, | ||
| sendAndConfirmRawTransaction, | ||
| sendAndConfirmTransaction | ||
| } from "./chunk-KRDGCX7W.js"; | ||
| init_index_esm(); | ||
| export { | ||
| Account, | ||
| AddressLookupTableAccount, | ||
| AddressLookupTableInstruction, | ||
| AddressLookupTableProgram, | ||
| Authorized, | ||
| BLOCKHASH_CACHE_TIMEOUT_MS, | ||
| BPF_LOADER_DEPRECATED_PROGRAM_ID, | ||
| BPF_LOADER_PROGRAM_ID, | ||
| BpfLoader, | ||
| COMPUTE_BUDGET_INSTRUCTION_LAYOUTS, | ||
| ComputeBudgetInstruction, | ||
| ComputeBudgetProgram, | ||
| Connection, | ||
| Ed25519Program, | ||
| Enum, | ||
| EpochSchedule, | ||
| FeeCalculatorLayout, | ||
| Keypair, | ||
| LAMPORTS_PER_SOL, | ||
| LOOKUP_TABLE_INSTRUCTION_LAYOUTS, | ||
| Loader, | ||
| Lockup, | ||
| MAX_SEED_LENGTH, | ||
| Message, | ||
| MessageAccountKeys, | ||
| MessageV0, | ||
| NONCE_ACCOUNT_LENGTH, | ||
| NonceAccount, | ||
| PACKET_DATA_SIZE, | ||
| PUBLIC_KEY_LENGTH, | ||
| PublicKey, | ||
| SIGNATURE_LENGTH_IN_BYTES, | ||
| SOLANA_SCHEMA, | ||
| STAKE_CONFIG_ID, | ||
| STAKE_INSTRUCTION_LAYOUTS, | ||
| SYSTEM_INSTRUCTION_LAYOUTS, | ||
| SYSVAR_CLOCK_PUBKEY, | ||
| SYSVAR_EPOCH_SCHEDULE_PUBKEY, | ||
| SYSVAR_INSTRUCTIONS_PUBKEY, | ||
| SYSVAR_RECENT_BLOCKHASHES_PUBKEY, | ||
| SYSVAR_RENT_PUBKEY, | ||
| SYSVAR_REWARDS_PUBKEY, | ||
| SYSVAR_SLOT_HASHES_PUBKEY, | ||
| SYSVAR_SLOT_HISTORY_PUBKEY, | ||
| SYSVAR_STAKE_HISTORY_PUBKEY, | ||
| Secp256k1Program, | ||
| SendTransactionError, | ||
| SolanaJSONRPCError, | ||
| SolanaJSONRPCErrorCode, | ||
| StakeAuthorizationLayout, | ||
| StakeInstruction, | ||
| StakeProgram, | ||
| Struct, | ||
| SystemInstruction, | ||
| SystemProgram, | ||
| Transaction, | ||
| TransactionExpiredBlockheightExceededError, | ||
| TransactionExpiredNonceInvalidError, | ||
| TransactionExpiredTimeoutError, | ||
| TransactionInstruction, | ||
| TransactionMessage, | ||
| TransactionStatus, | ||
| VALIDATOR_INFO_KEY, | ||
| VERSION_PREFIX_MASK, | ||
| VOTE_PROGRAM_ID, | ||
| ValidatorInfo, | ||
| VersionedMessage, | ||
| VersionedTransaction, | ||
| VoteAccount, | ||
| VoteAuthorizationLayout, | ||
| VoteInit, | ||
| VoteInstruction, | ||
| VoteProgram, | ||
| clusterApiUrl, | ||
| sendAndConfirmRawTransaction, | ||
| sendAndConfirmTransaction | ||
| }; |
+112
-2
@@ -304,3 +304,3 @@ /** | ||
| * console.log(result.response); // '4' | ||
| * console.log(result.model); // 'google/gemini-2.5-flash' | ||
| * console.log(result.model); // 'google/gemini-2.5-flash-lite' | ||
| * console.log(result.routing.savings); // 0.78 (78% savings) | ||
@@ -506,2 +506,29 @@ * ``` | ||
| declare const USDC_BASE: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"; | ||
| declare const SOLANA_NETWORK = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"; | ||
| declare const USDC_SOLANA = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; | ||
| interface CreateSolanaPaymentOptions { | ||
| resourceUrl?: string; | ||
| resourceDescription?: string; | ||
| maxTimeoutSeconds?: number; | ||
| extra?: Record<string, unknown>; | ||
| extensions?: Record<string, unknown>; | ||
| rpcUrl?: string; | ||
| } | ||
| /** | ||
| * Create a signed Solana x402 v2 payment payload. | ||
| * | ||
| * This creates an SPL TransferChecked transaction for USDC payment | ||
| * that the CDP facilitator can verify and settle. | ||
| * | ||
| * Requires @solana/web3.js and @solana/spl-token dependencies. | ||
| * | ||
| * @param secretKey - Solana secret key (Uint8Array, 64 bytes) | ||
| * @param fromAddress - Sender wallet address (base58) | ||
| * @param recipient - Payment recipient address (base58) | ||
| * @param amount - Amount in micro USDC (6 decimals) | ||
| * @param feePayer - CDP facilitator fee payer address (base58) | ||
| * @param options - Additional options | ||
| * @returns Base64-encoded signed payment payload | ||
| */ | ||
| declare function createSolanaPaymentPayload(secretKey: Uint8Array, fromAddress: string, recipient: string, amount: string, feePayer: string, options?: CreateSolanaPaymentOptions): Promise<string>; | ||
@@ -608,2 +635,85 @@ /** | ||
| /** | ||
| * BlockRun Solana LLM Client. | ||
| * | ||
| * Usage: | ||
| * import { SolanaLLMClient } from '@blockrun/llm'; | ||
| * | ||
| * // SOLANA_WALLET_KEY env var (bs58-encoded Solana secret key) | ||
| * const client = new SolanaLLMClient(); | ||
| * | ||
| * // Or pass key directly | ||
| * const client = new SolanaLLMClient({ privateKey: 'your-bs58-key' }); | ||
| * | ||
| * const response = await client.chat('openai/gpt-4o', 'gm Solana'); | ||
| */ | ||
| interface SolanaLLMClientOptions { | ||
| /** bs58-encoded Solana secret key (64 bytes). Optional if SOLANA_WALLET_KEY env var is set. */ | ||
| privateKey?: string; | ||
| /** API endpoint URL (default: https://sol.blockrun.ai/api) */ | ||
| apiUrl?: string; | ||
| /** Solana RPC URL (default: https://api.mainnet-beta.solana.com) */ | ||
| rpcUrl?: string; | ||
| /** Request timeout in milliseconds (default: 60000) */ | ||
| timeout?: number; | ||
| } | ||
| declare class SolanaLLMClient { | ||
| static readonly SOLANA_API_URL = "https://sol.blockrun.ai/api"; | ||
| private privateKey; | ||
| private apiUrl; | ||
| private rpcUrl; | ||
| private timeout; | ||
| private sessionTotalUsd; | ||
| private sessionCalls; | ||
| private addressCache; | ||
| constructor(options?: SolanaLLMClientOptions); | ||
| /** Get Solana wallet address (public key in base58). */ | ||
| getWalletAddress(): Promise<string>; | ||
| /** Simple 1-line chat. */ | ||
| chat(model: string, prompt: string, options?: ChatOptions): Promise<string>; | ||
| /** Full chat completion (OpenAI-compatible). */ | ||
| chatCompletion(model: string, messages: ChatMessage[], options?: ChatCompletionOptions): Promise<ChatResponse>; | ||
| /** List available models. */ | ||
| listModels(): Promise<Model[]>; | ||
| /** Get session spending. */ | ||
| getSpending(): Spending; | ||
| /** True if using sol.blockrun.ai. */ | ||
| isSolana(): boolean; | ||
| private requestWithPayment; | ||
| private handlePaymentAndRetry; | ||
| private fetchWithTimeout; | ||
| } | ||
| /** | ||
| * Convenience function: create SolanaLLMClient for sol.blockrun.ai. | ||
| */ | ||
| declare function solanaClient(options?: SolanaLLMClientOptions): SolanaLLMClient; | ||
| declare const SOLANA_WALLET_FILE: string; | ||
| interface SolanaWalletInfo { | ||
| privateKey: string; | ||
| address: string; | ||
| isNew: boolean; | ||
| } | ||
| /** | ||
| * Create a new Solana wallet. | ||
| * Requires @solana/web3.js (optional dep). | ||
| */ | ||
| declare function createSolanaWallet(): { | ||
| address: string; | ||
| privateKey: string; | ||
| }; | ||
| /** | ||
| * Convert a bs58 private key string to Uint8Array (64 bytes). | ||
| * Accepts: bs58-encoded 64-byte key (standard Solana format). | ||
| */ | ||
| declare function solanaKeyToBytes(privateKey: string): Promise<Uint8Array>; | ||
| /** | ||
| * Get Solana public key (address) from bs58 private key. | ||
| */ | ||
| declare function solanaPublicKey(privateKey: string): Promise<string>; | ||
| declare function saveSolanaWallet(privateKey: string): string; | ||
| declare function loadSolanaWallet(): string | null; | ||
| declare function getOrCreateSolanaWallet(): Promise<SolanaWalletInfo>; | ||
| /** | ||
| * OpenAI-compatible API wrapper for BlockRun LLM SDK. | ||
@@ -747,2 +857,2 @@ * | ||
| export { APIError, BASE_CHAIN_ID, BlockrunError, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatUsage, type FunctionCall, type FunctionDefinition, ImageClient, type ImageClientOptions, type ImageData, type ImageGenerateOptions, type ImageModel, type ImageResponse, LLMClient, type LLMClientOptions, type Model, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PaymentError, type PaymentLinks, type RoutingDecision, type RoutingProfile, type RoutingTier, type RssSearchSource, type SearchParameters, type SearchSource, type SmartChatOptions, type SmartChatResponse, type Spending, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XSearchSource, createWallet, LLMClient as default, formatFundingMessageCompact, formatNeedsFundingMessage, formatWalletCreatedMessage, getEip681Uri, getOrCreateWallet, getPaymentLinks, getWalletAddress, loadWallet, saveWallet, testnetClient }; | ||
| export { APIError, BASE_CHAIN_ID, BlockrunError, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatUsage, type FunctionCall, type FunctionDefinition, ImageClient, type ImageClientOptions, type ImageData, type ImageGenerateOptions, type ImageModel, type ImageResponse, LLMClient, type LLMClientOptions, type Model, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PaymentError, type PaymentLinks, type RoutingDecision, type RoutingProfile, type RoutingTier, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, type SearchParameters, type SearchSource, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type Spending, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XSearchSource, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, formatFundingMessageCompact, formatNeedsFundingMessage, formatWalletCreatedMessage, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, loadSolanaWallet, loadWallet, saveSolanaWallet, saveWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, testnetClient }; |
+112
-2
@@ -304,3 +304,3 @@ /** | ||
| * console.log(result.response); // '4' | ||
| * console.log(result.model); // 'google/gemini-2.5-flash' | ||
| * console.log(result.model); // 'google/gemini-2.5-flash-lite' | ||
| * console.log(result.routing.savings); // 0.78 (78% savings) | ||
@@ -506,2 +506,29 @@ * ``` | ||
| declare const USDC_BASE: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"; | ||
| declare const SOLANA_NETWORK = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"; | ||
| declare const USDC_SOLANA = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; | ||
| interface CreateSolanaPaymentOptions { | ||
| resourceUrl?: string; | ||
| resourceDescription?: string; | ||
| maxTimeoutSeconds?: number; | ||
| extra?: Record<string, unknown>; | ||
| extensions?: Record<string, unknown>; | ||
| rpcUrl?: string; | ||
| } | ||
| /** | ||
| * Create a signed Solana x402 v2 payment payload. | ||
| * | ||
| * This creates an SPL TransferChecked transaction for USDC payment | ||
| * that the CDP facilitator can verify and settle. | ||
| * | ||
| * Requires @solana/web3.js and @solana/spl-token dependencies. | ||
| * | ||
| * @param secretKey - Solana secret key (Uint8Array, 64 bytes) | ||
| * @param fromAddress - Sender wallet address (base58) | ||
| * @param recipient - Payment recipient address (base58) | ||
| * @param amount - Amount in micro USDC (6 decimals) | ||
| * @param feePayer - CDP facilitator fee payer address (base58) | ||
| * @param options - Additional options | ||
| * @returns Base64-encoded signed payment payload | ||
| */ | ||
| declare function createSolanaPaymentPayload(secretKey: Uint8Array, fromAddress: string, recipient: string, amount: string, feePayer: string, options?: CreateSolanaPaymentOptions): Promise<string>; | ||
@@ -608,2 +635,85 @@ /** | ||
| /** | ||
| * BlockRun Solana LLM Client. | ||
| * | ||
| * Usage: | ||
| * import { SolanaLLMClient } from '@blockrun/llm'; | ||
| * | ||
| * // SOLANA_WALLET_KEY env var (bs58-encoded Solana secret key) | ||
| * const client = new SolanaLLMClient(); | ||
| * | ||
| * // Or pass key directly | ||
| * const client = new SolanaLLMClient({ privateKey: 'your-bs58-key' }); | ||
| * | ||
| * const response = await client.chat('openai/gpt-4o', 'gm Solana'); | ||
| */ | ||
| interface SolanaLLMClientOptions { | ||
| /** bs58-encoded Solana secret key (64 bytes). Optional if SOLANA_WALLET_KEY env var is set. */ | ||
| privateKey?: string; | ||
| /** API endpoint URL (default: https://sol.blockrun.ai/api) */ | ||
| apiUrl?: string; | ||
| /** Solana RPC URL (default: https://api.mainnet-beta.solana.com) */ | ||
| rpcUrl?: string; | ||
| /** Request timeout in milliseconds (default: 60000) */ | ||
| timeout?: number; | ||
| } | ||
| declare class SolanaLLMClient { | ||
| static readonly SOLANA_API_URL = "https://sol.blockrun.ai/api"; | ||
| private privateKey; | ||
| private apiUrl; | ||
| private rpcUrl; | ||
| private timeout; | ||
| private sessionTotalUsd; | ||
| private sessionCalls; | ||
| private addressCache; | ||
| constructor(options?: SolanaLLMClientOptions); | ||
| /** Get Solana wallet address (public key in base58). */ | ||
| getWalletAddress(): Promise<string>; | ||
| /** Simple 1-line chat. */ | ||
| chat(model: string, prompt: string, options?: ChatOptions): Promise<string>; | ||
| /** Full chat completion (OpenAI-compatible). */ | ||
| chatCompletion(model: string, messages: ChatMessage[], options?: ChatCompletionOptions): Promise<ChatResponse>; | ||
| /** List available models. */ | ||
| listModels(): Promise<Model[]>; | ||
| /** Get session spending. */ | ||
| getSpending(): Spending; | ||
| /** True if using sol.blockrun.ai. */ | ||
| isSolana(): boolean; | ||
| private requestWithPayment; | ||
| private handlePaymentAndRetry; | ||
| private fetchWithTimeout; | ||
| } | ||
| /** | ||
| * Convenience function: create SolanaLLMClient for sol.blockrun.ai. | ||
| */ | ||
| declare function solanaClient(options?: SolanaLLMClientOptions): SolanaLLMClient; | ||
| declare const SOLANA_WALLET_FILE: string; | ||
| interface SolanaWalletInfo { | ||
| privateKey: string; | ||
| address: string; | ||
| isNew: boolean; | ||
| } | ||
| /** | ||
| * Create a new Solana wallet. | ||
| * Requires @solana/web3.js (optional dep). | ||
| */ | ||
| declare function createSolanaWallet(): { | ||
| address: string; | ||
| privateKey: string; | ||
| }; | ||
| /** | ||
| * Convert a bs58 private key string to Uint8Array (64 bytes). | ||
| * Accepts: bs58-encoded 64-byte key (standard Solana format). | ||
| */ | ||
| declare function solanaKeyToBytes(privateKey: string): Promise<Uint8Array>; | ||
| /** | ||
| * Get Solana public key (address) from bs58 private key. | ||
| */ | ||
| declare function solanaPublicKey(privateKey: string): Promise<string>; | ||
| declare function saveSolanaWallet(privateKey: string): string; | ||
| declare function loadSolanaWallet(): string | null; | ||
| declare function getOrCreateSolanaWallet(): Promise<SolanaWalletInfo>; | ||
| /** | ||
| * OpenAI-compatible API wrapper for BlockRun LLM SDK. | ||
@@ -747,2 +857,2 @@ * | ||
| export { APIError, BASE_CHAIN_ID, BlockrunError, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatUsage, type FunctionCall, type FunctionDefinition, ImageClient, type ImageClientOptions, type ImageData, type ImageGenerateOptions, type ImageModel, type ImageResponse, LLMClient, type LLMClientOptions, type Model, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PaymentError, type PaymentLinks, type RoutingDecision, type RoutingProfile, type RoutingTier, type RssSearchSource, type SearchParameters, type SearchSource, type SmartChatOptions, type SmartChatResponse, type Spending, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XSearchSource, createWallet, LLMClient as default, formatFundingMessageCompact, formatNeedsFundingMessage, formatWalletCreatedMessage, getEip681Uri, getOrCreateWallet, getPaymentLinks, getWalletAddress, loadWallet, saveWallet, testnetClient }; | ||
| export { APIError, BASE_CHAIN_ID, BlockrunError, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatUsage, type FunctionCall, type FunctionDefinition, ImageClient, type ImageClientOptions, type ImageData, type ImageGenerateOptions, type ImageModel, type ImageResponse, LLMClient, type LLMClientOptions, type Model, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PaymentError, type PaymentLinks, type RoutingDecision, type RoutingProfile, type RoutingTier, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, type SearchParameters, type SearchSource, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type Spending, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XSearchSource, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, formatFundingMessageCompact, formatNeedsFundingMessage, formatWalletCreatedMessage, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, loadSolanaWallet, loadWallet, saveSolanaWallet, saveWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, testnetClient }; |
+332
-2
@@ -1,2 +0,7 @@ | ||
| import "./chunk-2ESYSVXG.js"; | ||
| import { | ||
| __require, | ||
| __toCommonJS, | ||
| index_esm_exports, | ||
| init_index_esm | ||
| } from "./chunk-KRDGCX7W.js"; | ||
@@ -37,2 +42,6 @@ // src/client.ts | ||
| var USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"; | ||
| var SOLANA_NETWORK = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"; | ||
| var USDC_SOLANA = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; | ||
| var DEFAULT_COMPUTE_UNIT_PRICE_MICROLAMPORTS = 1; | ||
| var DEFAULT_COMPUTE_UNIT_LIMIT = 8e3; | ||
| var USDC_DOMAIN = { | ||
@@ -110,2 +119,62 @@ name: "USD Coin", | ||
| } | ||
| async function createSolanaPaymentPayload(secretKey, fromAddress, recipient, amount, feePayer, options = {}) { | ||
| const { Connection, PublicKey, TransactionMessage, VersionedTransaction, ComputeBudgetProgram } = await import("./index.esm-SXKIFLA7.js"); | ||
| const { getAssociatedTokenAddress, createTransferCheckedInstruction, getMint } = await import("./esm-PTFDM6PE.js"); | ||
| const { Keypair } = await import("./index.esm-SXKIFLA7.js"); | ||
| const rpcUrl = options.rpcUrl || "https://api.mainnet-beta.solana.com"; | ||
| const connection = new Connection(rpcUrl); | ||
| const keypair = Keypair.fromSecretKey(secretKey); | ||
| const feePayerPubkey = new PublicKey(feePayer); | ||
| const ownerPubkey = keypair.publicKey; | ||
| const tokenMint = new PublicKey(USDC_SOLANA); | ||
| const payToPubkey = new PublicKey(recipient); | ||
| const mintInfo = await getMint(connection, tokenMint); | ||
| const sourceATA = await getAssociatedTokenAddress(tokenMint, ownerPubkey, false); | ||
| const destinationATA = await getAssociatedTokenAddress(tokenMint, payToPubkey, false); | ||
| const { blockhash } = await connection.getLatestBlockhash(); | ||
| const setComputeUnitPriceIx = ComputeBudgetProgram.setComputeUnitPrice({ | ||
| microLamports: DEFAULT_COMPUTE_UNIT_PRICE_MICROLAMPORTS | ||
| }); | ||
| const setComputeUnitLimitIx = ComputeBudgetProgram.setComputeUnitLimit({ | ||
| units: DEFAULT_COMPUTE_UNIT_LIMIT | ||
| }); | ||
| const transferIx = createTransferCheckedInstruction( | ||
| sourceATA, | ||
| tokenMint, | ||
| destinationATA, | ||
| ownerPubkey, | ||
| BigInt(amount), | ||
| mintInfo.decimals | ||
| ); | ||
| const messageV0 = new TransactionMessage({ | ||
| payerKey: feePayerPubkey, | ||
| recentBlockhash: blockhash, | ||
| instructions: [setComputeUnitLimitIx, setComputeUnitPriceIx, transferIx] | ||
| }).compileToV0Message(); | ||
| const transaction = new VersionedTransaction(messageV0); | ||
| transaction.sign([keypair]); | ||
| const serializedTx = Buffer.from(transaction.serialize()).toString("base64"); | ||
| const paymentData = { | ||
| x402Version: 2, | ||
| resource: { | ||
| url: options.resourceUrl || "https://blockrun.ai/api/v1/chat/completions", | ||
| description: options.resourceDescription || "BlockRun AI API call", | ||
| mimeType: "application/json" | ||
| }, | ||
| accepted: { | ||
| scheme: "exact", | ||
| network: SOLANA_NETWORK, | ||
| amount, | ||
| asset: USDC_SOLANA, | ||
| payTo: recipient, | ||
| maxTimeoutSeconds: options.maxTimeoutSeconds || 300, | ||
| extra: options.extra || { feePayer } | ||
| }, | ||
| payload: { | ||
| transaction: serializedTx | ||
| }, | ||
| extensions: options.extensions || {} | ||
| }; | ||
| return btoa(JSON.stringify(paymentData)); | ||
| } | ||
| function parsePaymentRequired(headerValue) { | ||
@@ -309,3 +378,3 @@ try { | ||
| * console.log(result.response); // '4' | ||
| * console.log(result.model); // 'google/gemini-2.5-flash' | ||
| * console.log(result.model); // 'google/gemini-2.5-flash-lite' | ||
| * console.log(result.routing.savings); // 0.78 (78% savings) | ||
@@ -953,2 +1022,251 @@ * ``` | ||
| // src/solana-wallet.ts | ||
| import * as fs2 from "fs"; | ||
| import * as path2 from "path"; | ||
| import * as os2 from "os"; | ||
| var WALLET_DIR2 = path2.join(os2.homedir(), ".blockrun"); | ||
| var SOLANA_WALLET_FILE = path2.join(WALLET_DIR2, ".solana-session"); | ||
| function createSolanaWallet() { | ||
| const { Keypair } = (init_index_esm(), __toCommonJS(index_esm_exports)); | ||
| const bs58 = __require("bs58"); | ||
| const keypair = Keypair.generate(); | ||
| return { | ||
| address: keypair.publicKey.toBase58(), | ||
| privateKey: bs58.default?.encode(keypair.secretKey) ?? bs58.encode(keypair.secretKey) | ||
| }; | ||
| } | ||
| async function solanaKeyToBytes(privateKey) { | ||
| try { | ||
| const bs58 = await import("bs58"); | ||
| const bytes = (bs58.default ?? bs58).decode(privateKey); | ||
| if (bytes.length !== 64) { | ||
| throw new Error(`Invalid Solana key length: expected 64 bytes, got ${bytes.length}`); | ||
| } | ||
| return bytes; | ||
| } catch (err) { | ||
| const msg = err instanceof Error ? err.message : String(err); | ||
| throw new Error(`Invalid Solana private key: ${msg}`); | ||
| } | ||
| } | ||
| async function solanaPublicKey(privateKey) { | ||
| const { Keypair } = await import("./index.esm-SXKIFLA7.js"); | ||
| const bytes = await solanaKeyToBytes(privateKey); | ||
| return Keypair.fromSecretKey(bytes).publicKey.toBase58(); | ||
| } | ||
| function saveSolanaWallet(privateKey) { | ||
| if (!fs2.existsSync(WALLET_DIR2)) fs2.mkdirSync(WALLET_DIR2, { recursive: true }); | ||
| fs2.writeFileSync(SOLANA_WALLET_FILE, privateKey, { mode: 384 }); | ||
| return SOLANA_WALLET_FILE; | ||
| } | ||
| function loadSolanaWallet() { | ||
| if (fs2.existsSync(SOLANA_WALLET_FILE)) { | ||
| const key = fs2.readFileSync(SOLANA_WALLET_FILE, "utf-8").trim(); | ||
| if (key) return key; | ||
| } | ||
| return null; | ||
| } | ||
| async function getOrCreateSolanaWallet() { | ||
| const envKey = typeof process !== "undefined" && process.env ? process.env.SOLANA_WALLET_KEY : void 0; | ||
| if (envKey) { | ||
| const address2 = await solanaPublicKey(envKey); | ||
| return { privateKey: envKey, address: address2, isNew: false }; | ||
| } | ||
| const fileKey = loadSolanaWallet(); | ||
| if (fileKey) { | ||
| const address2 = await solanaPublicKey(fileKey); | ||
| return { privateKey: fileKey, address: address2, isNew: false }; | ||
| } | ||
| const { address, privateKey } = createSolanaWallet(); | ||
| saveSolanaWallet(privateKey); | ||
| return { address, privateKey, isNew: true }; | ||
| } | ||
| // src/solana-client.ts | ||
| var SOLANA_API_URL = "https://sol.blockrun.ai/api"; | ||
| var DEFAULT_MAX_TOKENS2 = 1024; | ||
| var DEFAULT_TIMEOUT3 = 6e4; | ||
| var SDK_VERSION2 = "0.3.0"; | ||
| var USER_AGENT2 = `blockrun-ts/${SDK_VERSION2}`; | ||
| var SolanaLLMClient = class { | ||
| static SOLANA_API_URL = SOLANA_API_URL; | ||
| privateKey; | ||
| apiUrl; | ||
| rpcUrl; | ||
| timeout; | ||
| sessionTotalUsd = 0; | ||
| sessionCalls = 0; | ||
| addressCache = null; | ||
| constructor(options = {}) { | ||
| const envKey = typeof process !== "undefined" && process.env ? process.env.SOLANA_WALLET_KEY : void 0; | ||
| const privateKey = options.privateKey || envKey; | ||
| if (!privateKey) { | ||
| throw new Error( | ||
| "Private key required. Pass privateKey in options or set SOLANA_WALLET_KEY environment variable." | ||
| ); | ||
| } | ||
| this.privateKey = privateKey; | ||
| const apiUrl = options.apiUrl || SOLANA_API_URL; | ||
| validateApiUrl(apiUrl); | ||
| this.apiUrl = apiUrl.replace(/\/$/, ""); | ||
| this.rpcUrl = options.rpcUrl || "https://api.mainnet-beta.solana.com"; | ||
| this.timeout = options.timeout || DEFAULT_TIMEOUT3; | ||
| } | ||
| /** Get Solana wallet address (public key in base58). */ | ||
| async getWalletAddress() { | ||
| if (!this.addressCache) { | ||
| this.addressCache = await solanaPublicKey(this.privateKey); | ||
| } | ||
| return this.addressCache; | ||
| } | ||
| /** Simple 1-line chat. */ | ||
| async chat(model, prompt, options) { | ||
| const messages = []; | ||
| if (options?.system) messages.push({ role: "system", content: options.system }); | ||
| messages.push({ role: "user", content: prompt }); | ||
| const result = await this.chatCompletion(model, messages, { | ||
| maxTokens: options?.maxTokens, | ||
| temperature: options?.temperature, | ||
| topP: options?.topP, | ||
| search: options?.search, | ||
| searchParameters: options?.searchParameters | ||
| }); | ||
| return result.choices[0].message.content || ""; | ||
| } | ||
| /** Full chat completion (OpenAI-compatible). */ | ||
| async chatCompletion(model, messages, options) { | ||
| const body = { | ||
| model, | ||
| messages, | ||
| max_tokens: options?.maxTokens || DEFAULT_MAX_TOKENS2 | ||
| }; | ||
| if (options?.temperature !== void 0) body.temperature = options.temperature; | ||
| if (options?.topP !== void 0) body.top_p = options.topP; | ||
| if (options?.searchParameters !== void 0) body.search_parameters = options.searchParameters; | ||
| else if (options?.search === true) body.search_parameters = { mode: "on" }; | ||
| if (options?.tools !== void 0) body.tools = options.tools; | ||
| if (options?.toolChoice !== void 0) body.tool_choice = options.toolChoice; | ||
| return this.requestWithPayment("/v1/chat/completions", body); | ||
| } | ||
| /** List available models. */ | ||
| async listModels() { | ||
| const response = await this.fetchWithTimeout(`${this.apiUrl}/v1/models`, { method: "GET" }); | ||
| if (!response.ok) { | ||
| throw new APIError(`Failed to list models: ${response.status}`, response.status); | ||
| } | ||
| const data = await response.json(); | ||
| return data.data || []; | ||
| } | ||
| /** Get session spending. */ | ||
| getSpending() { | ||
| return { totalUsd: this.sessionTotalUsd, calls: this.sessionCalls }; | ||
| } | ||
| /** True if using sol.blockrun.ai. */ | ||
| isSolana() { | ||
| return this.apiUrl.includes("sol.blockrun.ai"); | ||
| } | ||
| async requestWithPayment(endpoint, body) { | ||
| const url = `${this.apiUrl}${endpoint}`; | ||
| const response = await this.fetchWithTimeout(url, { | ||
| method: "POST", | ||
| headers: { "Content-Type": "application/json", "User-Agent": USER_AGENT2 }, | ||
| body: JSON.stringify(body) | ||
| }); | ||
| if (response.status === 402) { | ||
| return this.handlePaymentAndRetry(url, body, response); | ||
| } | ||
| if (!response.ok) { | ||
| let errorBody; | ||
| try { | ||
| errorBody = await response.json(); | ||
| } catch { | ||
| errorBody = { error: "Request failed" }; | ||
| } | ||
| throw new APIError(`API error: ${response.status}`, response.status, sanitizeErrorResponse(errorBody)); | ||
| } | ||
| return response.json(); | ||
| } | ||
| async handlePaymentAndRetry(url, body, response) { | ||
| let paymentHeader = response.headers.get("payment-required"); | ||
| if (!paymentHeader) { | ||
| try { | ||
| const respBody = await response.json(); | ||
| if (respBody.accepts || respBody.x402Version) { | ||
| paymentHeader = btoa(JSON.stringify(respBody)); | ||
| } | ||
| } catch { | ||
| } | ||
| } | ||
| if (!paymentHeader) { | ||
| throw new PaymentError("402 response but no payment requirements found"); | ||
| } | ||
| const paymentRequired = parsePaymentRequired(paymentHeader); | ||
| const details = extractPaymentDetails(paymentRequired, SOLANA_NETWORK); | ||
| if (!details.network?.startsWith("solana:")) { | ||
| throw new PaymentError( | ||
| `Expected Solana payment network, got: ${details.network}. Use LLMClient for Base payments.` | ||
| ); | ||
| } | ||
| const feePayer = details.extra?.feePayer; | ||
| if (!feePayer) throw new PaymentError("Missing feePayer in 402 extra field"); | ||
| const fromAddress = await this.getWalletAddress(); | ||
| const secretKey = await solanaKeyToBytes(this.privateKey); | ||
| const extensions = paymentRequired.extensions; | ||
| const paymentPayload = await createSolanaPaymentPayload( | ||
| secretKey, | ||
| fromAddress, | ||
| details.recipient, | ||
| details.amount, | ||
| feePayer, | ||
| { | ||
| resourceUrl: validateResourceUrl( | ||
| details.resource?.url || `${this.apiUrl}/v1/chat/completions`, | ||
| this.apiUrl | ||
| ), | ||
| resourceDescription: details.resource?.description || "BlockRun Solana AI API call", | ||
| maxTimeoutSeconds: details.maxTimeoutSeconds || 300, | ||
| extra: details.extra, | ||
| extensions, | ||
| rpcUrl: this.rpcUrl | ||
| } | ||
| ); | ||
| const retryResponse = await this.fetchWithTimeout(url, { | ||
| method: "POST", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| "User-Agent": USER_AGENT2, | ||
| "PAYMENT-SIGNATURE": paymentPayload | ||
| }, | ||
| body: JSON.stringify(body) | ||
| }); | ||
| if (retryResponse.status === 402) { | ||
| throw new PaymentError("Payment was rejected. Check your Solana USDC balance."); | ||
| } | ||
| if (!retryResponse.ok) { | ||
| let errorBody; | ||
| try { | ||
| errorBody = await retryResponse.json(); | ||
| } catch { | ||
| errorBody = { error: "Request failed" }; | ||
| } | ||
| throw new APIError(`API error after payment: ${retryResponse.status}`, retryResponse.status, sanitizeErrorResponse(errorBody)); | ||
| } | ||
| const costUsd = parseFloat(details.amount) / 1e6; | ||
| this.sessionCalls += 1; | ||
| this.sessionTotalUsd += costUsd; | ||
| return retryResponse.json(); | ||
| } | ||
| async fetchWithTimeout(url, options) { | ||
| const controller = new AbortController(); | ||
| const timeoutId = setTimeout(() => controller.abort(), this.timeout); | ||
| try { | ||
| return await fetch(url, { ...options, signal: controller.signal }); | ||
| } finally { | ||
| clearTimeout(timeoutId); | ||
| } | ||
| } | ||
| }; | ||
| function solanaClient(options = {}) { | ||
| return new SolanaLLMClient({ ...options, apiUrl: SOLANA_API_URL }); | ||
| } | ||
| // src/openai-compat.ts | ||
@@ -1131,6 +1449,12 @@ var StreamingResponse = class { | ||
| PaymentError, | ||
| SOLANA_NETWORK, | ||
| SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, | ||
| SolanaLLMClient, | ||
| USDC_BASE, | ||
| USDC_BASE_CONTRACT, | ||
| USDC_SOLANA, | ||
| WALLET_DIR_PATH, | ||
| WALLET_FILE_PATH, | ||
| createSolanaPaymentPayload, | ||
| createSolanaWallet, | ||
| createWallet, | ||
@@ -1142,8 +1466,14 @@ client_default as default, | ||
| getEip681Uri, | ||
| getOrCreateSolanaWallet, | ||
| getOrCreateWallet, | ||
| getPaymentLinks, | ||
| getWalletAddress, | ||
| loadSolanaWallet, | ||
| loadWallet, | ||
| saveSolanaWallet, | ||
| saveWallet, | ||
| solanaClient, | ||
| solanaKeyToBytes, | ||
| solanaPublicKey, | ||
| testnetClient | ||
| }; |
+13
-13
| { | ||
| "name": "@blockrun/llm", | ||
| "version": "1.0.0", | ||
| "version": "1.1.0", | ||
| "type": "module", | ||
@@ -20,9 +20,2 @@ "description": "BlockRun LLM Gateway SDK - Pay-per-request AI via x402 on Base", | ||
| ], | ||
| "scripts": { | ||
| "build": "tsup src/index.ts --format cjs,esm --dts --clean", | ||
| "dev": "tsup src/index.ts --format cjs,esm --dts --watch", | ||
| "test": "vitest", | ||
| "lint": "eslint src/", | ||
| "typecheck": "tsc --noEmit" | ||
| }, | ||
| "keywords": [ | ||
@@ -52,8 +45,9 @@ "llm", | ||
| "dependencies": { | ||
| "@blockrun/clawrouter": "^0.9.3", | ||
| "@blockrun/clawrouter": "^0.10.18", | ||
| "bs58": "^6.0.0", | ||
| "viem": "^2.21.0" | ||
| }, | ||
| "optionalDependencies": { | ||
| "@solana/web3.js": "^1.98.0", | ||
| "@solana/spl-token": "^0.4.0" | ||
| "@solana/spl-token": "^0.4.0", | ||
| "@solana/web3.js": "^1.98.0" | ||
| }, | ||
@@ -72,3 +66,9 @@ "devDependencies": { | ||
| }, | ||
| "packageManager": "pnpm@9.15.4" | ||
| } | ||
| "scripts": { | ||
| "build": "tsup src/index.ts --format cjs,esm --dts --clean", | ||
| "dev": "tsup src/index.ts --format cjs,esm --dts --watch", | ||
| "test": "vitest", | ||
| "lint": "eslint src/", | ||
| "typecheck": "tsc --noEmit" | ||
| } | ||
| } |
+48
-11
| # @blockrun/llm | ||
| Pay-per-request access to GPT-4o, Claude 4, Gemini 2.5, and more via x402 micropayments on Base and Solana. | ||
| Pay-per-request access to GPT-4o, Claude 4, Gemini 3.1, and more via x402 micropayments on Base and Solana. | ||
@@ -38,10 +38,41 @@ **Networks:** | ||
| ```typescript | ||
| import { LLMClient } from '@blockrun/llm'; | ||
| import { SolanaLLMClient } from '@blockrun/llm'; | ||
| const client = new LLMClient({ network: 'solana' }); // Uses BLOCKRUN_SOLANA_KEY | ||
| const response = await client.chat('openai/gpt-4o', 'Hello!'); | ||
| // SOLANA_WALLET_KEY env var (bs58-encoded Solana secret key) | ||
| const client = new SolanaLLMClient(); | ||
| const response = await client.chat('openai/gpt-4o', 'gm Solana'); | ||
| console.log(response); | ||
| ``` | ||
| For Solana, set `BLOCKRUN_SOLANA_KEY` environment variable with your base58-encoded Solana secret key. | ||
| Set `SOLANA_WALLET_KEY` to your bs58-encoded Solana secret key. Payments are automatic via x402 — your key never leaves your machine. | ||
| ## Solana Support | ||
| Pay for AI calls with Solana USDC via [sol.blockrun.ai](https://sol.blockrun.ai): | ||
| ```typescript | ||
| import { SolanaLLMClient } from '@blockrun/llm'; | ||
| // SOLANA_WALLET_KEY env var (bs58-encoded Solana secret key) | ||
| const client = new SolanaLLMClient(); | ||
| // Or pass key directly | ||
| const client2 = new SolanaLLMClient({ privateKey: 'your-bs58-solana-key' }); | ||
| // Same API as LLMClient | ||
| const response = await client.chat('openai/gpt-4o', 'gm Solana'); | ||
| console.log(response); | ||
| // Live Search with Grok (Solana payment) | ||
| const tweet = await client.chat('xai/grok-3-mini', 'What is trending on X?', { search: true }); | ||
| ``` | ||
| **Setup:** | ||
| 1. Export your Solana wallet key: `export SOLANA_WALLET_KEY="your-bs58-key"` | ||
| 2. Fund with USDC on Solana mainnet | ||
| 3. That's it — payments are automatic via x402 | ||
| **Supported endpoint:** `https://sol.blockrun.ai/api` | ||
| **Payment:** Solana USDC (SPL, mainnet) | ||
| ## How It Works | ||
@@ -99,5 +130,7 @@ | ||
| |-------|-------------|--------------| | ||
| | `google/gemini-3-pro-preview` | $2.00/M | $12.00/M | | ||
| | `google/gemini-3.1-pro` | $2.00/M | $12.00/M | | ||
| | `google/gemini-3-flash-preview` | $0.50/M | $3.00/M | | ||
| | `google/gemini-2.5-pro` | $1.25/M | $10.00/M | | ||
| | `google/gemini-2.5-flash` | $0.30/M | $2.50/M | | ||
| | `google/gemini-2.5-flash-lite` | $0.10/M | $0.40/M | | ||
@@ -128,2 +161,7 @@ ### DeepSeek | ||
| ### MiniMax | ||
| | Model | Input Price | Output Price | | ||
| |-------|-------------|--------------| | ||
| | `minimax/minimax-m2.5` | $0.30/M | $1.20/M | | ||
| ### NVIDIA (Free & Hosted) | ||
@@ -329,5 +367,4 @@ | Model | Input Price | Output Price | Notes | | ||
| |----------|-------------| | ||
| | `BASE_CHAIN_WALLET_KEY` | Your Base chain wallet private key (for Base) | | ||
| | `BLOCKRUN_SOLANA_KEY` | Your Solana wallet secret key - base58 (for Solana) | | ||
| | `BLOCKRUN_NETWORK` | Default network: `base` or `solana` (optional, default: base) | | ||
| | `BASE_CHAIN_WALLET_KEY` | Your Base chain wallet private key (for Base / `LLMClient`) | | ||
| | `SOLANA_WALLET_KEY` | Your Solana wallet secret key - bs58 encoded (for `SolanaLLMClient`) | | ||
| | `BLOCKRUN_API_URL` | API endpoint (optional, default: https://blockrun.ai/api) | | ||
@@ -394,7 +431,7 @@ | ||
| 2. Get USDC on Solana for API payments | ||
| 3. Export your secret key and set as `BLOCKRUN_SOLANA_KEY` | ||
| 3. Export your secret key and set as `SOLANA_WALLET_KEY` | ||
| ```bash | ||
| # .env | ||
| BLOCKRUN_SOLANA_KEY=...your_base58_secret_key | ||
| SOLANA_WALLET_KEY=...your_bs58_secret_key | ||
| ``` | ||
@@ -401,0 +438,0 @@ |
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { | ||
| get: (a, b) => (typeof require !== "undefined" ? require : a)[b] | ||
| }) : x)(function(x) { | ||
| if (typeof require !== "undefined") return require.apply(this, arguments); | ||
| throw Error('Dynamic require of "' + x + '" is not supported'); | ||
| }); | ||
| var __esm = (fn, res) => function __init() { | ||
| return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; | ||
| }; | ||
| var __commonJS = (cb, mod) => function __require2() { | ||
| return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; | ||
| }; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| export { | ||
| __require, | ||
| __esm, | ||
| __commonJS, | ||
| __export, | ||
| __toESM, | ||
| __toCommonJS | ||
| }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| import { | ||
| Account, | ||
| AddressLookupTableAccount, | ||
| AddressLookupTableInstruction, | ||
| AddressLookupTableProgram, | ||
| Authorized, | ||
| BLOCKHASH_CACHE_TIMEOUT_MS, | ||
| BPF_LOADER_DEPRECATED_PROGRAM_ID, | ||
| BPF_LOADER_PROGRAM_ID, | ||
| BpfLoader, | ||
| COMPUTE_BUDGET_INSTRUCTION_LAYOUTS, | ||
| ComputeBudgetInstruction, | ||
| ComputeBudgetProgram, | ||
| Connection, | ||
| Ed25519Program, | ||
| Enum, | ||
| EpochSchedule, | ||
| FeeCalculatorLayout, | ||
| Keypair, | ||
| LAMPORTS_PER_SOL, | ||
| LOOKUP_TABLE_INSTRUCTION_LAYOUTS, | ||
| Loader, | ||
| Lockup, | ||
| MAX_SEED_LENGTH, | ||
| Message, | ||
| MessageAccountKeys, | ||
| MessageV0, | ||
| NONCE_ACCOUNT_LENGTH, | ||
| NonceAccount, | ||
| PACKET_DATA_SIZE, | ||
| PUBLIC_KEY_LENGTH, | ||
| PublicKey, | ||
| SIGNATURE_LENGTH_IN_BYTES, | ||
| SOLANA_SCHEMA, | ||
| STAKE_CONFIG_ID, | ||
| STAKE_INSTRUCTION_LAYOUTS, | ||
| SYSTEM_INSTRUCTION_LAYOUTS, | ||
| SYSVAR_CLOCK_PUBKEY, | ||
| SYSVAR_EPOCH_SCHEDULE_PUBKEY, | ||
| SYSVAR_INSTRUCTIONS_PUBKEY, | ||
| SYSVAR_RECENT_BLOCKHASHES_PUBKEY, | ||
| SYSVAR_RENT_PUBKEY, | ||
| SYSVAR_REWARDS_PUBKEY, | ||
| SYSVAR_SLOT_HASHES_PUBKEY, | ||
| SYSVAR_SLOT_HISTORY_PUBKEY, | ||
| SYSVAR_STAKE_HISTORY_PUBKEY, | ||
| Secp256k1Program, | ||
| SendTransactionError, | ||
| SolanaJSONRPCError, | ||
| SolanaJSONRPCErrorCode, | ||
| StakeAuthorizationLayout, | ||
| StakeInstruction, | ||
| StakeProgram, | ||
| Struct, | ||
| SystemInstruction, | ||
| SystemProgram, | ||
| Transaction, | ||
| TransactionExpiredBlockheightExceededError, | ||
| TransactionExpiredNonceInvalidError, | ||
| TransactionExpiredTimeoutError, | ||
| TransactionInstruction, | ||
| TransactionMessage, | ||
| TransactionStatus, | ||
| VALIDATOR_INFO_KEY, | ||
| VERSION_PREFIX_MASK, | ||
| VOTE_PROGRAM_ID, | ||
| ValidatorInfo, | ||
| VersionedMessage, | ||
| VersionedTransaction, | ||
| VoteAccount, | ||
| VoteAuthorizationLayout, | ||
| VoteInit, | ||
| VoteInstruction, | ||
| VoteProgram, | ||
| clusterApiUrl, | ||
| sendAndConfirmRawTransaction, | ||
| sendAndConfirmTransaction | ||
| } from "./chunk-S7BEMV6T.js"; | ||
| import "./chunk-2ESYSVXG.js"; | ||
| export { | ||
| Account, | ||
| AddressLookupTableAccount, | ||
| AddressLookupTableInstruction, | ||
| AddressLookupTableProgram, | ||
| Authorized, | ||
| BLOCKHASH_CACHE_TIMEOUT_MS, | ||
| BPF_LOADER_DEPRECATED_PROGRAM_ID, | ||
| BPF_LOADER_PROGRAM_ID, | ||
| BpfLoader, | ||
| COMPUTE_BUDGET_INSTRUCTION_LAYOUTS, | ||
| ComputeBudgetInstruction, | ||
| ComputeBudgetProgram, | ||
| Connection, | ||
| Ed25519Program, | ||
| Enum, | ||
| EpochSchedule, | ||
| FeeCalculatorLayout, | ||
| Keypair, | ||
| LAMPORTS_PER_SOL, | ||
| LOOKUP_TABLE_INSTRUCTION_LAYOUTS, | ||
| Loader, | ||
| Lockup, | ||
| MAX_SEED_LENGTH, | ||
| Message, | ||
| MessageAccountKeys, | ||
| MessageV0, | ||
| NONCE_ACCOUNT_LENGTH, | ||
| NonceAccount, | ||
| PACKET_DATA_SIZE, | ||
| PUBLIC_KEY_LENGTH, | ||
| PublicKey, | ||
| SIGNATURE_LENGTH_IN_BYTES, | ||
| SOLANA_SCHEMA, | ||
| STAKE_CONFIG_ID, | ||
| STAKE_INSTRUCTION_LAYOUTS, | ||
| SYSTEM_INSTRUCTION_LAYOUTS, | ||
| SYSVAR_CLOCK_PUBKEY, | ||
| SYSVAR_EPOCH_SCHEDULE_PUBKEY, | ||
| SYSVAR_INSTRUCTIONS_PUBKEY, | ||
| SYSVAR_RECENT_BLOCKHASHES_PUBKEY, | ||
| SYSVAR_RENT_PUBKEY, | ||
| SYSVAR_REWARDS_PUBKEY, | ||
| SYSVAR_SLOT_HASHES_PUBKEY, | ||
| SYSVAR_SLOT_HISTORY_PUBKEY, | ||
| SYSVAR_STAKE_HISTORY_PUBKEY, | ||
| Secp256k1Program, | ||
| SendTransactionError, | ||
| SolanaJSONRPCError, | ||
| SolanaJSONRPCErrorCode, | ||
| StakeAuthorizationLayout, | ||
| StakeInstruction, | ||
| StakeProgram, | ||
| Struct, | ||
| SystemInstruction, | ||
| SystemProgram, | ||
| Transaction, | ||
| TransactionExpiredBlockheightExceededError, | ||
| TransactionExpiredNonceInvalidError, | ||
| TransactionExpiredTimeoutError, | ||
| TransactionInstruction, | ||
| TransactionMessage, | ||
| TransactionStatus, | ||
| VALIDATOR_INFO_KEY, | ||
| VERSION_PREFIX_MASK, | ||
| VOTE_PROGRAM_ID, | ||
| ValidatorInfo, | ||
| VersionedMessage, | ||
| VersionedTransaction, | ||
| VoteAccount, | ||
| VoteAuthorizationLayout, | ||
| VoteInit, | ||
| VoteInstruction, | ||
| VoteProgram, | ||
| clusterApiUrl, | ||
| sendAndConfirmRawTransaction, | ||
| sendAndConfirmTransaction | ||
| }; |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 7 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 6 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
3580180
107.08%77619
98.26%506
7.89%34
-12.82%6
-14.29%5
25%10
-9.09%+ Added
+ Added
+ Added
+ Added
- Removed