UNPKG

@magiceden/magiceden-sdk

Version:

A TypeScript SDK for interacting with Magic Eden's API across multiple chains.

76 lines (75 loc) 2.36 kB
import { Connection, VersionedTransaction, RpcResponseAndContext, SignatureStatus, SignatureStatusConfig } from '@solana/web3.js'; import { WalletTxReceipt } from '../provider'; import { SolanaWalletProvider } from './solanaWalletProvider'; /** * Configuration for the Solana wallet adapter */ export type KeypairWalletConfig = { /** Secret key in either base58 string format or raw bytes */ secretKey: string | Uint8Array; /** RPC endpoint URL */ rpcEndpoint: string; }; /** * A Solana wallet implementation using a local keypair */ export declare class SolanaKeypairWalletProvider extends SolanaWalletProvider { private readonly connection; private readonly keypair; /** * Creates a new Solana wallet provider */ constructor(config: KeypairWalletConfig); /** * Gets the RPC connection */ getConnection(): Connection; /** * Gets the wallet's public address */ getAddress(): string; /** * Gets the wallet's SOL balance */ getBalance(): Promise<bigint>; /** * Sign a message * * @param message - The message to sign * @returns The base58 encoded signature */ signMessage(message: string | Uint8Array): Promise<string>; /** * Sign a transaction * * @param transaction - The transaction to sign * @returns The signed transaction */ signTransaction(transaction: VersionedTransaction): Promise<VersionedTransaction>; /** * Sign and send a transaction * * @param transaction - The transaction to sign and send * @returns The signature */ signAndSendTransaction(transaction: VersionedTransaction): Promise<string>; /** * Get the status of a transaction * * @param signature - The signature * @param options - The options for the status * @returns The status */ getSignatureStatus(signature: string, options?: SignatureStatusConfig): Promise<RpcResponseAndContext<SignatureStatus | null>>; /** * Wait for transaction confirmation * * @param signature - The signature * @returns The confirmation response */ waitForTransactionConfirmation(signature: string): Promise<WalletTxReceipt>; /** * Helper to create a keypair from different secret formats */ private createKeyFromSecret; }