UNPKG

gill

Version:

a modern javascript/typescript client library for interacting with the Solana blockchain

88 lines (82 loc) 4.62 kB
import { KeyPairSigner } from '@solana/kit'; /** Default Solana tool suite local keypair path */ declare const DEFAULT_CLI_KEYPAIR_PATH = "~/.config/solana/id.json"; /** * Load a `CryptoKeyPair` from a filesystem wallet json file * (i.e. those generated by the `solana-keygen` command) * * @param filePath - file path to a json keypair file, default={@link DEFAULT_CLI_KEYPAIR_PATH} */ declare function loadKeypairFromFile(filePath?: string): Promise<CryptoKeyPair>; /** * Load a `KeyPairSigner` from a filesystem wallet json file * (i.e. those generated by the `solana-keygen` command) * * @param filePath - file path to a json keypair file, default={@link DEFAULT_CLI_KEYPAIR_PATH} */ declare function loadKeypairSignerFromFile(filePath?: string): Promise<KeyPairSigner>; /** * Load a `CryptoKeyPair` from an environment variable * (i.e. those generated by the `solana-keygen` command) * * Note: for base58 encoded keypairs in environment variables use {@link loadKeypairFromEnvironmentBase58} * * @param variableName - environment variable name accessible via `process.env[variableName]` */ declare function loadKeypairFromEnvironment<TName extends keyof NodeJS.ProcessEnv | string>(variableName: TName): Promise<CryptoKeyPair>; /** * Load a `KeyPairSigner` from a environment variable * (i.e. those generated by the `solana-keygen` command) * * Note: for base58 encoded keypairs in environment variables use {@link loadKeypairSignerFromEnvironmentBase58} * * @param variableName - environment variable name accessible via `process.env[variableName]` */ declare function loadKeypairSignerFromEnvironment<TName extends keyof NodeJS.ProcessEnv | string>(variableName: TName): Promise<KeyPairSigner>; /** * Load a `CryptoKeyPair` from an environment variable containing a base58 encoded keypair * * @param variableName - environment variable name accessible via `process.env[variableName]` */ declare function loadKeypairFromEnvironmentBase58<TName extends keyof NodeJS.ProcessEnv | string>(variableName: TName): Promise<CryptoKeyPair>; /** * Load a `KeyPairSigner` from an environment variable containing a base58 encoded keypair * * @param variableName - environment variable name accessible via `process.env[variableName]` */ declare function loadKeypairSignerFromEnvironmentBase58<TName extends keyof NodeJS.ProcessEnv | string>(variableName: TName): Promise<KeyPairSigner>; /** * Save an extractable `CryptoKeyPair` to a filesystem wallet json file * (i.e. same format as those generated by the `solana-keygen` command) * * @param keypair - an extractable `CryptoKeyPair` * @param filePath - path to file where the keypair will be saved */ declare function saveKeypairToFile(keypair: CryptoKeyPair, filePath: string): Promise<boolean>; /** * Save an extractable `KeyPairSigner` to a filesystem wallet json file * (i.e. same format as those generated by the `solana-keygen` command) * * @param keypairSigner - an extractable `KeyPairSigner` * @param filePath - path to file where the keypair will be saved */ declare function saveKeypairSignerToFile(keypairSigner: KeyPairSigner, filePath: string): Promise<boolean>; /** * Save an extractable `CryptoKeyPair` to a local environment file (e.g. `.env`) * (i.e. same format as those generated by the `solana-keygen` command) * * @param keypair - an extractable `CryptoKeyPair` * @param variableName - environment variable name accessible via `process.env[variableName]` after env file is loaded * @param envFilePath - environment variable file path, default = `.env` in the current working directory */ declare function saveKeypairToEnvFile(keypair: CryptoKeyPair, variableName: string, envFilePath?: string): Promise<void>; /** * Save an extractable `KeyPairSigner` to a filesystem wallet json file * (i.e. same format as those generated by the `solana-keygen` command) * * @param keypairSigner - an extractable `KeyPairSigner` * @param variableName - environment variable name accessible via `process.env[variableName]` after env file is loaded * @param envFilePath - environment variable file path, default = `.env` in the current working directory */ declare function saveKeypairSignerToEnvFile(keypairSigner: KeyPairSigner, variableName: string, envFilePath?: string): Promise<void>; export { DEFAULT_CLI_KEYPAIR_PATH, loadKeypairFromEnvironment, loadKeypairFromEnvironmentBase58, loadKeypairFromFile, loadKeypairSignerFromEnvironment, loadKeypairSignerFromEnvironmentBase58, loadKeypairSignerFromFile, saveKeypairSignerToEnvFile, saveKeypairSignerToFile, saveKeypairToEnvFile, saveKeypairToFile };