import type { Address } from 'sats-connect'; import type { BitcoinProvider as BitcoinProvider_2 } from 'sats-connect'; import type { GetAddressResponse } from 'sats-connect'; import { PublicKey } from '@solana/web3.js'; import type { SendOptions } from '@solana/web3.js'; import type { SignTransactionResponse } from 'sats-connect'; import type { Transaction } from '@solana/web3.js'; import type { TransactionSignature } from '@solana/web3.js'; import type { TransactionVersion } from '@solana/web3.js'; import { UniversalProvider } from '@passkeys/web3-universal'; import type { VersionedTransaction } from '@solana/web3.js'; import { z } from 'zod'; declare abstract class BaseProvider extends EventEmitter { #private; constructor({ transport }: Deps); protected _callRpcMethod(method: string, params: Params): Promise; defineFlag(flagName: string): void; emitAndIgnoreErrors>(event: T, ...args: EventEmitter.EventArgs): void; } declare abstract class BaseProvider_2 extends EventEmitter { #private; constructor({ transport }: Deps_4); protected _callRpcMethod(method: string, params: Params): Promise; defineFlag(flagName: string): void; emitAndIgnoreErrors>(event: T, ...args: EventEmitter.EventArgs): void; } declare type BitcoinAccount = Omit; declare class BitcoinProvider extends BaseProvider implements BitcoinProvider_2 { #private; constructor({ transport, accountsObservable }: Deps_2); get accounts(): BitcoinAccount[]; call(request: string): Promise>; isConnected(): Promise; connect(request: string): Promise; sendBtcTransaction(request: string): Promise; signMessage(request: string): Promise; signTransaction(request: string): Promise; } declare interface BitcoinProviderEvents { accountsChanged(accounts: BitcoinAccount[]): void; connect(): void; disconnect(): void; } /** * A readonly byte array. */ declare type Bytes = Readonly; declare type ChainId = string; declare type ConnectOptions = { onlyIfTrusted?: boolean; silent?: boolean; }; export declare const createWallet: (options: CreateWalletOptions) => Wallet; declare type CreateWalletOptions = Input; declare type Deps = { transport: Transport; }; declare type Deps_2 = Deps & { accountsObservable: Observable; }; declare type Deps_3 = Deps & { accountsObservable: Observable; storage: Storage_2; storageKeyPrefix?: string; supportedChainIds?: ChainId[]; getDefaultChainId?: () => Promise; }; declare type Deps_4 = { transport: Transport; }; declare type Deps_5 = Deps_4 & { accountsObservable: Observable; }; declare class EthereumProvider extends BaseProvider { #private; constructor({ accountsObservable, transport, storage, storageKeyPrefix, supportedChainIds, getDefaultChainId, }: Deps_3); protected _callRpcMethod(method: string, params: Params): Promise; isConnected(): boolean; request: (args: RequestArguments) => Promise; /** * Experimental API */ _metamask: { /** * Determines if MetaMask is unlocked by the user. * * @returns Promise resolving to true if MetaMask is currently unlocked. */ isUnlocked: () => Promise; /** * Make a batch RPC request. * * @param requests - The RPC requests to make. */ requestBatch: (requests: RequestArguments[]) => Promise; }; get chainId(): ChainId | null; get selectedAddress(): string | null; enable: () => Promise; send: (methodOrPayload: string | JsonRpcRequest, paramsOrCallback: unknown[] | JsonRpcCallback) => Promise; sendAsync: (payload: JsonRpcRequest, callback: JsonRpcCallback) => void; } declare interface EthereumProviderEvents { accountsChanged(accounts: string[]): void; chainChanged(chainId: ChainId): void; connect(providerConnectInfo: ProviderConnectInfo): void; disconnect(): void; message(): void; } /** * Minimal `EventEmitter` interface that is molded against the Node.js * `EventEmitter` interface. */ declare class EventEmitter< EventTypes extends EventEmitter.ValidEventTypes = string | symbol, Context extends any = any > { static prefixed: string | boolean; /** * Return an array listing the events for which the emitter has registered * listeners. */ eventNames(): Array>; /** * Return the listeners registered for a given event. */ listeners>( event: T ): Array>; /** * Return the number of listeners listening to a given event. */ listenerCount(event: EventEmitter.EventNames): number; /** * Calls each of the listeners registered for a given event. */ emit>( event: T, ...args: EventEmitter.EventArgs ): boolean; /** * Add a listener for a given event. */ on>( event: T, fn: EventEmitter.EventListener, context?: Context ): this; addListener>( event: T, fn: EventEmitter.EventListener, context?: Context ): this; /** * Add a one-time listener for a given event. */ once>( event: T, fn: EventEmitter.EventListener, context?: Context ): this; /** * Remove the listeners of a given event. */ removeListener>( event: T, fn?: EventEmitter.EventListener, context?: Context, once?: boolean ): this; off>( event: T, fn?: EventEmitter.EventListener, context?: Context, once?: boolean ): this; /** * Remove all listeners, or those of the specified event. */ removeAllListeners(event?: EventEmitter.EventNames): this; } declare namespace EventEmitter { interface ListenerFn { (...args: Args): void; } interface EventEmitterStatic { new < EventTypes extends ValidEventTypes = string | symbol, Context = any >(): EventEmitter; } /** * `object` should be in either of the following forms: * ``` * interface EventTypes { * 'event-with-parameters': any[] * 'event-with-example-handler': (...args: any[]) => void * } * ``` */ type ValidEventTypes = string | symbol | object; type EventNames = T extends string | symbol ? T : keyof T; type ArgumentMap = { [K in keyof T]: T[K] extends (...args: any[]) => void ? Parameters : T[K] extends any[] ? T[K] : any[]; }; type EventListener< T extends ValidEventTypes, K extends EventNames > = T extends string | symbol ? (...args: any[]) => void : ( ...args: ArgumentMap>[Extract] ) => void; type EventArgs< T extends ValidEventTypes, K extends EventNames > = Parameters>; const EventEmitter: EventEmitterStatic; } export declare type ExpandOptions = { path?: string; }; /** * A read-only array of namespaced identifiers in the format `${namespace}:${reference}`. * * Used by {@link Wallet.chains | Wallet::chains}, {@link WalletAccount.chains | WalletAccount::chains}, and * {@link WalletAccount.features | WalletAccount::features}. * * @group Identifier */ declare type IdentifierArray = readonly IdentifierString[]; /** * A namespaced identifier in the format `${namespace}:${reference}`. * * Used by {@link IdentifierArray} and {@link IdentifierRecord}. * * @group Identifier */ declare type IdentifierString = `${string}:${string}`; declare type Input = z.input; declare type JsonRpcCallback = (error: Error | null, result?: JsonRpcResult) => unknown; declare type JsonRpcFailure = { id: JsonRpcId; jsonrpc: '2.0'; error: Error; }; declare type JsonRpcId = string | undefined; declare interface JsonRpcRequest { id: JsonRpcId; jsonrpc: '2.0'; method: string; params?: unknown[]; } declare type JsonRpcResult = JsonRpcSuccess | JsonRpcFailure; declare type JsonRpcSuccess = { id: JsonRpcId; jsonrpc: '2.0'; result: unknown; }; declare type LegacyOrVersionedTransaction = Transaction | VersionedTransaction; declare type NonEmptyArray = [T, ...T[]]; /** * An observable. */ declare interface Observable { observe: (value: any) => () => void; } declare interface ProviderConnectInfo { chainId: ChainId; } export declare type Providers = { bitcoin?: BitcoinProvider; ethereum?: EthereumProvider; solana?: SolanaProvider; universal?: UniversalProvider; }; declare interface ReadonlyUint8Array extends Omit { readonly [n: number]: number; } declare interface RequestArguments { method: string; params?: unknown[] | Record; } declare const schema: z.ZodDefault; providers: z.ZodDefault>; walletStandard: z.ZodDefault>; }, "strip", z.ZodTypeAny, { dangerouslyInjectWindow: boolean; walletStandard: boolean; }, { dangerouslyInjectWindow?: boolean | undefined; walletStandard?: boolean | undefined; }>]>>, false | { dangerouslyInjectWindow: boolean; walletStandard: boolean; }, boolean | { dangerouslyInjectWindow?: boolean | undefined; walletStandard?: boolean | undefined; } | undefined>; ethereum: z.ZodEffects>; eip6963: z.ZodDefault>; }, "strip", z.ZodTypeAny, { dangerouslyInjectWindow: boolean; eip6963: boolean; }, { dangerouslyInjectWindow?: boolean | undefined; eip6963?: boolean | undefined; }>]>>, false | { dangerouslyInjectWindow: boolean; eip6963: boolean; }, boolean | { dangerouslyInjectWindow?: boolean | undefined; eip6963?: boolean | undefined; } | undefined>; solana: z.ZodEffects>; walletStandard: z.ZodDefault>; }, "strip", z.ZodTypeAny, { dangerouslyInjectWindow: boolean; walletStandard: boolean; }, { dangerouslyInjectWindow?: boolean | undefined; walletStandard?: boolean | undefined; }>]>>, false | { dangerouslyInjectWindow: boolean; walletStandard: boolean; }, boolean | { dangerouslyInjectWindow?: boolean | undefined; walletStandard?: boolean | undefined; } | undefined>; universal: z.ZodDefault; }, "strip", z.ZodTypeAny, { bitcoin: false | { dangerouslyInjectWindow: boolean; walletStandard: boolean; }; ethereum: false | { dangerouslyInjectWindow: boolean; eip6963: boolean; }; solana: false | { dangerouslyInjectWindow: boolean; walletStandard: boolean; }; universal: boolean; }, { bitcoin?: boolean | { dangerouslyInjectWindow?: boolean | undefined; walletStandard?: boolean | undefined; } | undefined; ethereum?: boolean | { dangerouslyInjectWindow?: boolean | undefined; eip6963?: boolean | undefined; } | undefined; solana?: boolean | { dangerouslyInjectWindow?: boolean | undefined; walletStandard?: boolean | undefined; } | undefined; universal?: boolean | undefined; }>>>; /** @deprecated Use `providers` instead. */ networks: z.ZodOptional>; walletStandard: z.ZodDefault>; }, "strip", z.ZodTypeAny, { dangerouslyInjectWindow: boolean; walletStandard: boolean; }, { dangerouslyInjectWindow?: boolean | undefined; walletStandard?: boolean | undefined; }>]>>, false | { dangerouslyInjectWindow: boolean; walletStandard: boolean; }, boolean | { dangerouslyInjectWindow?: boolean | undefined; walletStandard?: boolean | undefined; } | undefined>; ethereum: z.ZodEffects>; eip6963: z.ZodDefault>; }, "strip", z.ZodTypeAny, { dangerouslyInjectWindow: boolean; eip6963: boolean; }, { dangerouslyInjectWindow?: boolean | undefined; eip6963?: boolean | undefined; }>]>>, false | { dangerouslyInjectWindow: boolean; eip6963: boolean; }, boolean | { dangerouslyInjectWindow?: boolean | undefined; eip6963?: boolean | undefined; } | undefined>; solana: z.ZodEffects>; walletStandard: z.ZodDefault>; }, "strip", z.ZodTypeAny, { dangerouslyInjectWindow: boolean; walletStandard: boolean; }, { dangerouslyInjectWindow?: boolean | undefined; walletStandard?: boolean | undefined; }>]>>, false | { dangerouslyInjectWindow: boolean; walletStandard: boolean; }, boolean | { dangerouslyInjectWindow?: boolean | undefined; walletStandard?: boolean | undefined; } | undefined>; universal: z.ZodDefault; }, "strip", z.ZodTypeAny, { bitcoin: false | { dangerouslyInjectWindow: boolean; walletStandard: boolean; }; ethereum: false | { dangerouslyInjectWindow: boolean; eip6963: boolean; }; solana: false | { dangerouslyInjectWindow: boolean; walletStandard: boolean; }; universal: boolean; }, { bitcoin?: boolean | { dangerouslyInjectWindow?: boolean | undefined; walletStandard?: boolean | undefined; } | undefined; ethereum?: boolean | { dangerouslyInjectWindow?: boolean | undefined; eip6963?: boolean | undefined; } | undefined; solana?: boolean | { dangerouslyInjectWindow?: boolean | undefined; walletStandard?: boolean | undefined; } | undefined; universal?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { providers: { bitcoin: false | { dangerouslyInjectWindow: boolean; walletStandard: boolean; }; ethereum: false | { dangerouslyInjectWindow: boolean; eip6963: boolean; }; solana: false | { dangerouslyInjectWindow: boolean; walletStandard: boolean; }; universal: boolean; }; appId?: string | undefined; networks?: { bitcoin: false | { dangerouslyInjectWindow: boolean; walletStandard: boolean; }; ethereum: false | { dangerouslyInjectWindow: boolean; eip6963: boolean; }; solana: false | { dangerouslyInjectWindow: boolean; walletStandard: boolean; }; universal: boolean; } | undefined; }, { appId?: string | undefined; providers?: { bitcoin?: boolean | { dangerouslyInjectWindow?: boolean | undefined; walletStandard?: boolean | undefined; } | undefined; ethereum?: boolean | { dangerouslyInjectWindow?: boolean | undefined; eip6963?: boolean | undefined; } | undefined; solana?: boolean | { dangerouslyInjectWindow?: boolean | undefined; walletStandard?: boolean | undefined; } | undefined; universal?: boolean | undefined; } | undefined; networks?: { bitcoin?: boolean | { dangerouslyInjectWindow?: boolean | undefined; walletStandard?: boolean | undefined; } | undefined; ethereum?: boolean | { dangerouslyInjectWindow?: boolean | undefined; eip6963?: boolean | undefined; } | undefined; solana?: boolean | { dangerouslyInjectWindow?: boolean | undefined; walletStandard?: boolean | undefined; } | undefined; universal?: boolean | undefined; } | undefined; }>>; declare type SendAllOptions = SendOptions & { parallel?: boolean; atomic?: boolean; }; declare type SignAndSendAllReturnValue = { signatures: true extends O['atomic'] ? Bytes[] | string[] : PromiseSettledResult[]; }; declare type SignAndSendAllTransactionsInput = TransactionWithSendOptions | TransactionOrRawTransaction; declare type SignMessageOptions = SolDisplayEncoding | { display?: SolDisplayEncoding; publicKey?: PublicKey; }; declare class SolanaProvider extends BaseProvider_2 { #private; constructor({ transport, accountsObservable }: Deps_5); get supportedTransactionVersions(): ReadonlySet; get publicKey(): PublicKey | null; get publicKeys(): PublicKey[]; get isConnected(): boolean; connect: ({ onlyIfTrusted, silent, }?: ConnectOptions) => Promise<{ publicKey: PublicKey; publicKeys: NonEmptyArray; }>; disconnect: () => void; signIn: (input?: SolanaSignInInput) => Promise; signTransaction: (transactionOrBytes: T) => Promise>; signAllTransactions: (transactionsOrBytes: TransactionOrRawTransaction[]) => Promise[]>; signAndSendAllTransactions: (inputs: SignAndSendAllTransactionsInput[], { parallel, atomic, ...sendOptions }?: O) => Promise>; signAndSendTransaction: (transactionOrBytes: LegacyOrVersionedTransaction | Bytes, options?: SendOptions) => Promise<{ signature: TransactionSignature | Bytes; }>; signMessage: (encodedMessage: Bytes, options?: SignMessageOptions) => Promise<{ signature: Bytes; publicKey: PublicKey; }>; postMessage: () => never; request: (args: { method: "connect" | "isConnected" | "disconnect" | "signIn" | "signTransaction" | "signAllTransactions" | "signAndSendTransaction" | "signMessage" | "postMessage"; params: unknown[]; }) => Promise; } declare interface SolanaProviderEvents { accountChanged(publicKey: PublicKey | undefined): void; connect(publicKey: PublicKey): void; disconnect(): void; } /** Input for signing in. */ declare interface SolanaSignInInput { /** * Optional EIP-4361 Domain. * If not provided, the wallet must determine the Domain to include in the message. */ readonly domain?: string; /** * Optional EIP-4361 Address. * If not provided, the wallet must determine the Address to include in the message. */ readonly address?: string; /** * Optional EIP-4361 Statement. * If not provided, the wallet must not include Statement in the message. */ readonly statement?: string; /** * Optional EIP-4361 URI. * If not provided, the wallet must not include URI in the message. */ readonly uri?: string; /** * Optional EIP-4361 Version. * If not provided, the wallet must not include Version in the message. */ readonly version?: string; /** * Optional EIP-4361 Chain ID. * If not provided, the wallet must not include Chain ID in the message. */ readonly chainId?: string; /** * Optional EIP-4361 Nonce. * If not provided, the wallet must not include Nonce in the message. */ readonly nonce?: string; /** * Optional EIP-4361 Issued At. * If not provided, the wallet must not include Issued At in the message. */ readonly issuedAt?: string; /** * Optional EIP-4361 Expiration Time. * If not provided, the wallet must not include Expiration Time in the message. */ readonly expirationTime?: string; /** * Optional EIP-4361 Not Before. * If not provided, the wallet must not include Not Before in the message. */ readonly notBefore?: string; /** * Optional EIP-4361 Request ID. * If not provided, the wallet must not include Request ID in the message. */ readonly requestId?: string; /** * Optional EIP-4361 Resources. * If not provided, the wallet must not include Resources in the message. */ readonly resources?: readonly string[]; } /** Output of signing in. */ declare interface SolanaSignInOutput { /** * Account that was signed in. * The address of the account may be different from the provided input Address. */ readonly account: WalletAccount; /** * Message bytes that were signed. * The wallet may prefix or otherwise modify the message before signing it. */ readonly signedMessage: Uint8Array; /** * Message signature produced. * If the signature type is provided, the signature must be Ed25519. */ readonly signature: Uint8Array; /** * Optional type of the message signature produced. * If not provided, the signature must be Ed25519. */ readonly signatureType?: 'ed25519'; } declare type SolDisplayEncoding = 'utf8' | 'hex'; /** * A storage. */ declare interface Storage_2 { getItem: (key: string) => Promise; setItem: (key: string, value: string) => Promise; removeItem: (key: string) => Promise; clear: () => Promise; } declare type TransactionOrRawTransaction = LegacyOrVersionedTransaction | Bytes; declare type TransactionReturnValue = Bytes extends T ? Uint8Array : LegacyOrVersionedTransaction; declare type TransactionWithSendOptions = { transaction: TransactionOrRawTransaction; options: SendOptions; }; /** * A JSON-RPC transport. */ declare interface Transport extends EventEmitter { write: (data: string) => void; } declare type TypedArrayMutableProperties = 'copyWithin' | 'fill' | 'reverse' | 'set' | 'sort'; export declare type Wallet = { getProvider: (chain: Chain) => Promise; renderWidget: (parent: HTMLElement | null) => void; setWidgetConfig: (config: unknown) => void; disconnect: () => void; experimental_expand: (options: ExpandOptions) => void; experimental_destroyWidget: () => void; }; /** * Interface of a **WalletAccount**, also referred to as an **Account**. * * An account is a _read-only data object_ that is provided from the Wallet to the app, authorizing the app to use it. * * The app can use an account to display and query information from a chain. * * The app can also act using an account by passing it to {@link Wallet.features | features} of the Wallet. * * Wallets may use or extend {@link "@wallet-standard/wallet".ReadonlyWalletAccount} which implements this interface. * * @group Wallet */ declare interface WalletAccount { /** Address of the account, corresponding with a public key. */ readonly address: string; /** Public key of the account, corresponding with a secret key to use. */ readonly publicKey: ReadonlyUint8Array; /** * Chains supported by the account. * * This must be a subset of the {@link Wallet.chains | chains} of the Wallet. */ readonly chains: IdentifierArray; /** * Feature names supported by the account. * * This must be a subset of the names of {@link Wallet.features | features} of the Wallet. */ readonly features: IdentifierArray; /** Optional user-friendly descriptive label or name for the account. This may be displayed by the app. */ readonly label?: string; /** Optional user-friendly icon for the account. This may be displayed by the app. */ readonly icon?: WalletIcon; } /** * A data URI containing a base64-encoded SVG, WebP, PNG, or GIF image. * * Used by {@link Wallet.icon | Wallet::icon} and {@link WalletAccount.icon | WalletAccount::icon}. * * @group Wallet */ declare type WalletIcon = `data:image/${'svg+xml' | 'webp' | 'png' | 'gif'};base64,${string}`; export { }