import { Signature, Commitment, SendTransactionApi, TransactionMessage, TransactionMessageWithFeePayer, FullySignedTransaction, TransactionWithLifetime, BaseTransactionMessage, Rpc, GetEpochInfoApi, GetSignatureStatusesApi, GetLatestBlockhashApi, RpcSubscriptions, SignatureNotificationsApi, SlotNotificationsApi, Transaction, SimulateTransactionApi, DevnetUrl, MainnetUrl, TestnetUrl, createSolanaRpc, createSolanaRpcSubscriptions, RpcFromTransport, SolanaRpcApiFromTransport, RpcTransportFromClusterUrl, SolanaRpcSubscriptionsApi, Address, Base64EncodedWireTransaction, TransactionVersion, TransactionSigner, TransactionMessageWithFeePayerSigner, TransactionMessageWithBlockhashLifetime, GetSignaturesForAddressApi, SignatureBytes, KeyPairSigner, ReadonlyUint8Array } from '@solana/kit'; export * from '@solana/kit'; import { S as Simplify, C as CreateTransactionInput, F as FullTransaction } from './index-M7AUC0es.js'; import { waitForRecentTransactionConfirmation } from '@solana/transaction-confirmation'; interface SendAndConfirmTransactionWithBlockhashLifetimeConfig extends SendTransactionConfigWithoutEncoding { confirmRecentTransaction: (config: Omit[0], "getBlockHeightExceedencePromise" | "getRecentSignatureConfirmationPromise">) => Promise; abortSignal?: AbortSignal; commitment: Commitment; } type SendTransactionConfigWithoutEncoding = Omit[1]>, "encoding">; type SendableTransaction = (TransactionMessage & TransactionMessageWithFeePayer) | (FullySignedTransaction & TransactionWithLifetime) | (BaseTransactionMessage & TransactionMessageWithFeePayer); type SendAndConfirmTransactionWithSignersFunction = (transaction: SendableTransaction, config?: Omit) => Promise; type SendAndConfirmTransactionWithSignersFactoryConfig = { rpc: Rpc & { "~cluster"?: TCluster; }; rpcSubscriptions: RpcSubscriptions & { "~cluster"?: TCluster; }; }; declare function sendAndConfirmTransactionWithSignersFactory({ rpc, rpcSubscriptions, }: SendAndConfirmTransactionWithSignersFactoryConfig<"devnet">): SendAndConfirmTransactionWithSignersFunction; declare function sendAndConfirmTransactionWithSignersFactory({ rpc, rpcSubscriptions, }: SendAndConfirmTransactionWithSignersFactoryConfig<"testnet">): SendAndConfirmTransactionWithSignersFunction; declare function sendAndConfirmTransactionWithSignersFactory({ rpc, rpcSubscriptions, }: SendAndConfirmTransactionWithSignersFactoryConfig<"mainnet">): SendAndConfirmTransactionWithSignersFunction; declare function sendAndConfirmTransactionWithSignersFactory({ rpc, rpcSubscriptions, }: SendAndConfirmTransactionWithSignersFactoryConfig<"localnet">): SendAndConfirmTransactionWithSignersFunction; type SimulateTransactionFunction = (transaction: Transaction | (TransactionMessage & TransactionMessageWithFeePayer), config?: Simplify[1], "encoding" | "sigVerify">>) => Promise>; type SimulateTransactionFactoryConfig = { rpc: Rpc & { "~cluster"?: TCluster; }; }; declare function simulateTransactionFactory({ rpc, }: SimulateTransactionFactoryConfig<"devnet">): SimulateTransactionFunction; declare function simulateTransactionFactory({ rpc, }: SimulateTransactionFactoryConfig<"testnet">): SimulateTransactionFunction; declare function simulateTransactionFactory({ rpc, }: SimulateTransactionFactoryConfig<"mainnet">): SimulateTransactionFunction; declare function simulateTransactionFactory({ rpc, }: SimulateTransactionFactoryConfig<"localnet">): SimulateTransactionFunction; /** Solana cluster moniker */ type SolanaClusterMoniker = "devnet" | "localnet" | "mainnet" | "testnet"; type LocalnetUrl = string & { "~cluster": "localnet"; }; type GenericUrl = string & {}; type ModifiedClusterUrl = DevnetUrl | GenericUrl | LocalnetUrl | MainnetUrl | TestnetUrl; type SolanaClientUrlOrMoniker = ModifiedClusterUrl | SolanaClusterMoniker | URL; type CreateSolanaClientArgs = { /** Configuration used to create the `rpc` client */ rpcConfig?: Parameters[1] & { port?: number; }; /** Configuration used to create the `rpcSubscriptions` client */ rpcSubscriptionsConfig?: Parameters[1] & { port?: number; }; /** Full RPC URL (for a private RPC endpoint) or the Solana moniker (for a public RPC endpoint) */ urlOrMoniker: SolanaClientUrlOrMoniker | TClusterUrl; }; type SolanaClient = { /** Used to make RPC calls to your RPC provider */ rpc: RpcFromTransport>, RpcTransportFromClusterUrl>; /** Used to make RPC websocket calls to your RPC provider */ rpcSubscriptions: RpcSubscriptions & TClusterUrl; /** * Send and confirm a transaction to the network (including signing with available Signers). * * If the `transaction` does not already have a latest blockhash (and is not already signed), it will be automatically retrieved and applied. * * Default commitment level: `confirmed` */ sendAndConfirmTransaction: SendAndConfirmTransactionWithSignersFunction; /** * Simulate a transaction on the network */ simulateTransaction: SimulateTransactionFunction; /** Full RPC URL (for a private RPC endpoint) or the Solana moniker (for a public RPC endpoint) */ urlOrMoniker: SolanaClientUrlOrMoniker | TClusterUrl; }; type ExplorerLinkAccount = { address: string; }; type ExplorerLinkTransaction = { transaction: string; }; type ExplorerLinkBlock = { block: string; }; /** * @param cluster - Default: `mainnet` */ type GetExplorerLinkArgs = { cluster?: SolanaClusterMoniker | "mainnet-beta" | "localhost"; } & (ExplorerLinkAccount | ExplorerLinkTransaction | ExplorerLinkBlock | {}); /** * */ type LogLevel = "debug" | "info" | "warn" | "error"; declare global { /** * Whether or not to enable debug mode. When enabled, default log level of `info` */ var __GILL_DEBUG__: boolean | undefined; /** * Set the a desired level of logs to be output in the application * * - Default: `info` * - Options: `debug` | `info` | `warn` | `error` */ var __GILL_DEBUG_LEVEL__: LogLevel | undefined; } /** * Check if the `gill` debug logger is enabled or not */ declare const isDebugEnabled: () => boolean; /** * Log debug messages based on the desired application's logging level. * * @param message - the message contents to be logged * @param level - default: `info` (see: {@link GILL_LOG_LEVELS}) * @param prefix - default: `[GILL]` * * To enable gill's debug logger, set any of the following to `true`: * - `process.env.GILL_DEBUG` * - `global.__GILL_DEBUG__` * - `window.__GILL_DEBUG__` * * To set a desired level of logs to be output in the application, set the value of one of the following: * - `process.env.GILL_DEBUG_LEVEL` * - `global.__GILL_DEBUG_LEVEL__` * - `window.__GILL_DEBUG_LEVEL__` */ declare function debug(message: unknown, level?: LogLevel, prefix?: string): void; /** * Takes a base64 encoded string of a byte array, parses, then asserts it as an {@link Address} */ declare function base64BytesToAddress(base64Bytes: string): Address; /** * Takes a base64 encoded string of a byte array, parses, then asserts it as an {@link Signature} */ declare function base64BytesToSignature(base64Bytes: string): Signature; /** * Takes a base64 encoded string of a byte array, parses, then returns as a utf8 string */ declare function base64BytesToString(base64Bytes: string): string; /** * Convert a base64 encoded transaction string into compiled transaction * * Use {@link transactionToBase64} or {@link transactionToBase64WithSigners} to create the base64 encoded transaction string */ declare function transactionFromBase64(base64EncodedTransaction: string): Transaction; /** * Compile a transaction to a base64 string * * Note: This will NOT attempt to sign the transaction, * so it will be missing `signatures` from any of the attached Signers * * Use {@link transactionToBase64WithSignatures} sign and base64 encode */ declare function transactionToBase64(tx: (TransactionMessage & TransactionMessageWithFeePayer) | Transaction): Base64EncodedWireTransaction; /** * Compile a transaction to a base64 string and sign it with all attached Signers * * See also {@link partiallySignTransactionMessageWithSigners} */ declare function transactionToBase64WithSigners(tx: (TransactionMessage & TransactionMessageWithFeePayer) | Transaction): Promise; /** 1 billion lamports per SOL */ declare const LAMPORTS_PER_SOL = 1000000000; /** * Genesis hash for Solana network clusters */ declare const GENESIS_HASH: { mainnet: string; devnet: string; testnet: string; }; /** * Codama dependency map to utilize gill imports */ declare const GILL_EXTERNAL_MODULE_MAP: Record; /** * Create a Codama CLI configuration to generate a program client from an IDL. * Normally saved to `codama.js`. * * @example * ```ts * import { createCodamaConfig } from "gill"; * * export default createCodamaConfig({ * idl: "program/idl.json", * clientJs: "clients/js/src/generated", * // clientRust: "clients/rust/src/generated", * }); * ``` */ declare function createCodamaConfig({ idl, clientJs, clientRust, dependencyMap, }: { idl: string; clientJs: string; clientRust?: string; dependencyMap?: Record; }): { idl: string; scripts: { rust?: { from: string; args: (string | { crateFolder: string; formatCode: boolean; })[]; } | undefined; js: { args: (string | { dependencyMap: Record; })[]; from: string; }; }; }; /** * Create a Solana `rpc` and `rpcSubscriptions` client */ declare function createSolanaClient(props: Omit, "urlOrMoniker"> & { urlOrMoniker: "mainnet"; }): SolanaClient; declare function createSolanaClient(props: Omit, "urlOrMoniker"> & { urlOrMoniker: "devnet"; }): SolanaClient; declare function createSolanaClient(props: Omit, "urlOrMoniker"> & { urlOrMoniker: "testnet"; }): SolanaClient; declare function createSolanaClient(props: Omit, "urlOrMoniker"> & { urlOrMoniker: "localnet"; }): SolanaClient; declare function createSolanaClient(props: CreateSolanaClientArgs): SolanaClient; /** * Simple interface for creating a Solana transaction */ declare function createTransaction(props: CreateTransactionInput): FullTransaction; declare function createTransaction(props: CreateTransactionInput): FullTransaction; declare function createTransaction(props: CreateTransactionInput): Simplify>; declare function createTransaction(props: CreateTransactionInput): Simplify>; declare function createTransaction(props: CreateTransactionInput): Simplify>; /** * Craft a Solana Explorer link on any cluster */ declare function getExplorerLink(props?: GetExplorerLinkArgs): string; type GetOldestSignatureForAddressRpc = Rpc & { "~cluster"?: TCluster; }; type GetOldestSignatureForAddressConfig = Simplify[1]> & { abortSignal?: AbortSignal; }; /** * Get the oldest signature for the provided `address` */ declare function getOldestSignatureForAddress(rpc: GetOldestSignatureForAddressRpc, address: Address, config?: GetOldestSignatureForAddressConfig): Promise[0]>; /** * Converts signature bytes to a {@link Signature} string. * @param sigBytes - The signature bytes to convert * @returns The base58-encoded signature string */ declare function getSignatureFromBytes(sigBytes: SignatureBytes): Signature; /** * Insert a single of reference key {@link Address} into a transaction message * * Use {@link getOldestSignatureForAddress} to locate the oldest signature for a reference key's address * * Note: The `transaction` must have at least one non-memo instruction. */ declare function insertReferenceKeyToTransactionMessage(reference: Address, transaction: TTransaction): TTransaction; /** * Insert multiple reference key {@link Address | Addresses} into a transaction message * * Use {@link getOldestSignatureForAddress} to locate the oldest signature for a reference key's address * * Note: The `transaction` must have at least one non-memo instruction. */ declare function insertReferenceKeysToTransactionMessage(references: Address[], transaction: TTransaction): TTransaction; /** * Create a `CryptoKeyPair` from as base58 encoded secret key */ declare function createKeypairFromBase58(punitiveSecretKey: string): Promise; /** * Create a `KeyPairSigner` from as base58 encoded secret key */ declare function createKeypairSignerFromBase58(punitiveSecretKey: string): Promise; declare function assertKeyPairIsExtractable(keyPair: CryptoKeyPair): asserts keyPair is ExtractableCryptoKeyPair; type Extractable = { "~extractable": true; }; type ExtractableCryptoKeyPair = CryptoKeyPair & Extractable; type ExtractableKeyPairSigner = KeyPairSigner & Extractable; /** * Generates an extractable Ed25519 `CryptoKeyPair` capable of signing messages and transactions * */ declare function generateExtractableKeyPair(): Promise; /** * Generates an extractable signer capable of signing messages and transactions using a Crypto KeyPair. * */ declare function generateExtractableKeyPairSigner(): Promise; /** * Extracts the raw key material from an extractable Ed25519 CryptoKeyPair. * * @remarks * - Requires a keypair generated with extractable=true. See {@link generateExtractableKeyPair}. * - The extracted bytes can be used to reconstruct the `CryptoKeyPair` with {@link createKeyPairFromBytes}. * * @param keypair An extractable Ed25519 `CryptoKeyPair` * @returns Raw key bytes as `Uint8Array` */ declare function extractBytesFromKeyPair(keypair: ExtractableCryptoKeyPair | CryptoKeyPair): Promise; /** * Extracts the raw key material from an extractable Ed25519 KeyPairSigner. * * @remarks * - Requires a keypair generated with extractable=true. See {@link generateExtractableKeyPairSigner}. * - The extracted bytes can be used to reconstruct the `CryptoKeyPair` with {@link createKeyPairSignerFromBytes}. * * @param keypairSigner An extractable Ed25519 `KeyPairSigner` * @returns Raw key bytes as `Uint8Array` */ declare function extractBytesFromKeyPairSigner(keypairSigner: ExtractableKeyPairSigner | KeyPairSigner): Promise; type PrepareCompilableTransactionMessage = TransactionMessageWithFeePayer & TransactionMessage; type PrepareTransactionConfig = { /** * Transaction to prepare for sending to the blockchain */ transaction: TMessage; /** * RPC client capable of simulating transactions and getting the latest blockhash **/ rpc: Rpc; /** * Multiplier applied to the simulated compute unit value obtained from simulation * * Default: `1.1` **/ computeUnitLimitMultiplier?: number; /** * Whether or not you wish to force reset the compute unit limit value (if one is already set) * using the simulation response and `computeUnitLimitMultiplier` **/ computeUnitLimitReset?: boolean; /** * Whether or not you wish to force reset the latest blockhash (if one is already set) * * Default: `true` **/ blockhashReset?: boolean; }; /** * Prepare a Transaction to be signed and sent to the network. Including: * - setting a compute unit limit (if not already set) * - fetching the latest blockhash (if not already set) * - (optional) simulating and resetting the compute unit limit * - (optional) resetting latest blockhash to the most recent */ declare function prepareTransaction(config: PrepareTransactionConfig): Promise; /** * Calculate the total rent needed for to create an account, with or without extra data stored in it */ declare function getMinimumBalanceForRentExemption(space?: bigint | number): bigint; declare function localnet(putativeString: string): LocalnetUrl; /** * Get a public Solana RPC endpoint for a cluster based on its moniker * * Note: These RPC URLs are rate limited and not suitable for production applications. */ declare function getPublicSolanaRpcUrl(cluster: SolanaClusterMoniker | "mainnet-beta" | "localhost"): ModifiedClusterUrl; /** * Determine the Solana moniker from its genesis hash * * If the hash is NOT known, returns `unknown` */ declare function getMonikerFromGenesisHash(hash: string): SolanaClusterMoniker | "unknown"; declare function checkedAddress(input: Address | TransactionSigner): Address; declare function checkedTransactionSigner(input: Address | TransactionSigner): TransactionSigner; /** * Convert a lamport number to the human readable string of a SOL value * @param lamports - The amount in lamports * @param decimals - Number of decimal places to show (default: 9, max: 9) */ declare function lamportsToSol(lamports: bigint | number, decimals?: number): string; /** * Verifies a Solana Address had signed the given message. * * @param address - The Solana address expected to have signed the message * @param signature - The signature to verify * @param signedMessage - The original message that was signed * @returns Promise that resolves to `true` if the signature is valid, `false` otherwise * * @example * ```typescript * const isValid = await verifySignatureForAddress( * "GC5AFcYqshWUnNK23MbWTXPix3FUagZt4fjUAt88FT59" as Address, * "jrZaHRqiRojydQMxHqqe7FEkfeyw64KfPdF2ww1mm3hpVtGyxBvEU5NmHdZFoawYnYu62ujgqw3gcL2XHYbxd9K", * "Hello, Solana!!" * ); * console.log(isValid); // true or false * ``` */ declare function verifySignatureForAddress(address: Address, signature: string | Signature | SignatureBytes | Uint8Array | ReadonlyUint8Array, message: string | Uint8Array): Promise; export { type CreateSolanaClientArgs, CreateTransactionInput, FullTransaction, GENESIS_HASH, GILL_EXTERNAL_MODULE_MAP, type GenericUrl, type GetExplorerLinkArgs, LAMPORTS_PER_SOL, type LocalnetUrl, type ModifiedClusterUrl, type PrepareTransactionConfig, type SendAndConfirmTransactionWithSignersFunction, Simplify, type SimulateTransactionFunction, type SolanaClient, type SolanaClientUrlOrMoniker, type SolanaClusterMoniker, assertKeyPairIsExtractable, base64BytesToAddress, base64BytesToSignature, base64BytesToString, checkedAddress, checkedTransactionSigner, createCodamaConfig, createKeypairFromBase58, createKeypairSignerFromBase58, createSolanaClient, createTransaction, debug, extractBytesFromKeyPair, extractBytesFromKeyPairSigner, generateExtractableKeyPair, generateExtractableKeyPairSigner, getExplorerLink, getMinimumBalanceForRentExemption, getMonikerFromGenesisHash, getOldestSignatureForAddress, getPublicSolanaRpcUrl, getSignatureFromBytes, insertReferenceKeyToTransactionMessage, insertReferenceKeysToTransactionMessage, isDebugEnabled, lamportsToSol, localnet, prepareTransaction, sendAndConfirmTransactionWithSignersFactory, simulateTransactionFactory, transactionFromBase64, transactionToBase64, transactionToBase64WithSigners, verifySignatureForAddress };