import { SolanaSignInInput } from "@solana/wallet-standard-features"; import { IdentifierArray, IdentifierString, WalletAccount, WalletIcon } from "@wallet-standard/core"; //#region src/errors.d.ts declare const SolanaMobileWalletAdapterErrorCode: { readonly ERROR_ASSOCIATION_PORT_OUT_OF_RANGE: "ERROR_ASSOCIATION_PORT_OUT_OF_RANGE"; readonly ERROR_REFLECTOR_ID_OUT_OF_RANGE: "ERROR_REFLECTOR_ID_OUT_OF_RANGE"; readonly ERROR_FORBIDDEN_WALLET_BASE_URL: "ERROR_FORBIDDEN_WALLET_BASE_URL"; readonly ERROR_SECURE_CONTEXT_REQUIRED: "ERROR_SECURE_CONTEXT_REQUIRED"; readonly ERROR_SESSION_CLOSED: "ERROR_SESSION_CLOSED"; readonly ERROR_SESSION_TIMEOUT: "ERROR_SESSION_TIMEOUT"; readonly ERROR_WALLET_NOT_FOUND: "ERROR_WALLET_NOT_FOUND"; readonly ERROR_INVALID_PROTOCOL_VERSION: "ERROR_INVALID_PROTOCOL_VERSION"; readonly ERROR_BROWSER_NOT_SUPPORTED: "ERROR_BROWSER_NOT_SUPPORTED"; readonly ERROR_LOOPBACK_ACCESS_BLOCKED: "ERROR_LOOPBACK_ACCESS_BLOCKED"; readonly ERROR_ASSOCIATION_CANCELLED: "ERROR_ASSOCIATION_CANCELLED"; readonly ERROR_ILLEGAL_TRANSPORT_STATE: "ERROR_ILLEGAL_TRANSPORT_STATE"; }; type SolanaMobileWalletAdapterErrorCodeEnum = (typeof SolanaMobileWalletAdapterErrorCode)[keyof typeof SolanaMobileWalletAdapterErrorCode]; type ErrorDataTypeMap = { [SolanaMobileWalletAdapterErrorCode.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE]: { port: number; }; [SolanaMobileWalletAdapterErrorCode.ERROR_REFLECTOR_ID_OUT_OF_RANGE]: { id: number; }; [SolanaMobileWalletAdapterErrorCode.ERROR_FORBIDDEN_WALLET_BASE_URL]: undefined; [SolanaMobileWalletAdapterErrorCode.ERROR_SECURE_CONTEXT_REQUIRED]: undefined; [SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_CLOSED]: { closeEvent: CloseEvent; }; [SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_TIMEOUT]: undefined; [SolanaMobileWalletAdapterErrorCode.ERROR_WALLET_NOT_FOUND]: undefined; [SolanaMobileWalletAdapterErrorCode.ERROR_INVALID_PROTOCOL_VERSION]: undefined; [SolanaMobileWalletAdapterErrorCode.ERROR_BROWSER_NOT_SUPPORTED]: undefined; [SolanaMobileWalletAdapterErrorCode.ERROR_LOOPBACK_ACCESS_BLOCKED]: undefined; [SolanaMobileWalletAdapterErrorCode.ERROR_ASSOCIATION_CANCELLED]: { event: Event | undefined; }; [SolanaMobileWalletAdapterErrorCode.ERROR_ILLEGAL_TRANSPORT_STATE]: undefined; }; declare class SolanaMobileWalletAdapterError extends Error { data: ErrorDataTypeMap[TErrorCode] | undefined; code: TErrorCode; constructor(...args: ErrorDataTypeMap[TErrorCode] extends Record ? [code: TErrorCode, message: string, data: ErrorDataTypeMap[TErrorCode]] : [code: TErrorCode, message: string]); } type JSONRPCErrorCode = number; declare const SolanaMobileWalletAdapterProtocolErrorCode: { readonly ERROR_AUTHORIZATION_FAILED: -1; readonly ERROR_INVALID_PAYLOADS: -2; readonly ERROR_NOT_SIGNED: -3; readonly ERROR_NOT_SUBMITTED: -4; readonly ERROR_TOO_MANY_PAYLOADS: -5; readonly ERROR_ATTEST_ORIGIN_ANDROID: -100; }; type SolanaMobileWalletAdapterProtocolErrorCodeEnum = (typeof SolanaMobileWalletAdapterProtocolErrorCode)[keyof typeof SolanaMobileWalletAdapterProtocolErrorCode]; type ProtocolErrorDataTypeMap = { [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_AUTHORIZATION_FAILED]: undefined; [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_INVALID_PAYLOADS]: undefined; [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SIGNED]: undefined; [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SUBMITTED]: undefined; [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_TOO_MANY_PAYLOADS]: undefined; [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_ATTEST_ORIGIN_ANDROID]: { attest_origin_uri: string; challenge: string; context: string; }; }; declare class SolanaMobileWalletAdapterProtocolError extends Error { data: ProtocolErrorDataTypeMap[TErrorCode] | undefined; code: TErrorCode | JSONRPCErrorCode; jsonRpcMessageId: number; constructor(...args: ProtocolErrorDataTypeMap[TErrorCode] extends Record ? [jsonRpcMessageId: number, code: TErrorCode | JSONRPCErrorCode, message: string, data: ProtocolErrorDataTypeMap[TErrorCode]] : [jsonRpcMessageId: number, code: TErrorCode | JSONRPCErrorCode, message: string]); } //#endregion //#region src/nostr.d.ts declare const NOSTR_EVENT_KIND_MWA = 20012; interface NostrEvent { id: string; pubkey: string; created_at: number; kind: number; tags: string[][]; content: string; sig: string; } declare function generateNostrKeypair(): { privateKey: Uint8Array; publicKey: string; }; declare function deriveSessionIdentifier(associationPublicKey: CryptoKey): Promise; declare function createNostrEvent(kind: number, content: string, tags: string[][], privateKey: Uint8Array): NostrEvent; declare function verifyNostrEvent(event: NostrEvent): boolean; //#endregion //#region ../../node_modules/.pnpm/@solana+web3.js@1.98.4_bufferutil@4.1.0_typescript@6.0.3_utf-8-validate@5.0.10/node_modules/@solana/web3.js/lib/index.d.ts type TransactionVersion = 'legacy' | 0; //#endregion //#region src/types.d.ts type Account = Readonly<{ address: Base64EncodedAddress; label?: string; icon?: WalletIcon; chains?: IdentifierArray; features?: IdentifierArray; }> | WalletAccount; /** * Properties that wallets may present to users when an app * asks for authorization to execute privileged methods (see * {@link PrivilegedMethods}). */ type AppIdentity = Readonly<{ uri?: string; icon?: string; name?: string; }>; /** * An ephemeral elliptic-curve keypair on the P-256 curve. * This public key is used to create the association token. * The private key is used during session establishment. */ type AssociationKeypair = CryptoKeyPair; type ProtocolVersion = 'v1' | 'legacy'; type SessionProperties = Readonly<{ protocol_version: ProtocolVersion; }>; /** * The context returned from a wallet after having authorized a given * account for use with a given application. You can cache this and * use it later to invoke privileged methods. */ type AuthorizationResult = Readonly<{ accounts: Account[]; auth_token: AuthToken; wallet_uri_base: string; sign_in_result?: SignInResult; }>; type AuthToken = string; type Base64EncodedAddress = string; type Base64EncodedSignature = string; type Base64EncodedMessage = string; type Base64EncodedSignedMessage = string; type Base64EncodedSignedTransaction = string; type Base64EncodedTransaction = string; /** * @deprecated Replaced by the 'chain' parameter, which adds multi-chain capability as per MWA 2.0 spec. */ type Cluster = 'devnet' | 'testnet' | 'mainnet-beta'; type Chain = IdentifierString | Cluster; type Finality = 'confirmed' | 'finalized' | 'processed'; type WalletAssociationConfig = Readonly<{ baseUri?: string; }>; type RemoteWalletAssociationConfig = WalletAssociationConfig & Readonly<{ remoteHostAuthority: string; }>; type NostrWalletAssociationConfig = WalletAssociationConfig & Readonly<{ connectionType: 'local' | 'remote'; relayDomain: string; }>; interface AuthorizeAPI { /** * @deprecated Replaced by updated authorize() method, which adds MWA 2.0 spec support. */ authorize(params: { cluster: Cluster; identity: AppIdentity; }): Promise; authorize(params: { identity: AppIdentity; chain?: Chain; features?: IdentifierArray; addresses?: string[]; auth_token?: AuthToken; sign_in_payload?: SignInPayload; }): Promise; } interface CloneAuthorizationAPI { cloneAuthorization(params: { auth_token: AuthToken; }): Promise>; } interface DeauthorizeAPI { deauthorize(params: { auth_token: AuthToken; }): Promise>>; } interface GetCapabilitiesAPI { getCapabilities(): Promise; features: IdentifierArray; /** * @deprecated Replaced by features array. */ supports_clone_authorization: boolean; /** * @deprecated Replaced by features array. */ supports_sign_and_send_transactions: boolean; }>>; } interface ReauthorizeAPI { reauthorize(params: { auth_token: AuthToken; identity: AppIdentity; }): Promise; } interface SignMessagesAPI { signMessages(params: { addresses: Base64EncodedAddress[]; payloads: Base64EncodedMessage[]; }): Promise>; } interface SignTransactionsAPI { signTransactions(params: { payloads: Base64EncodedTransaction[]; }): Promise>; } interface SignAndSendTransactionsAPI { signAndSendTransactions(params: { options?: Readonly<{ min_context_slot?: number; commitment?: string; skip_preflight?: boolean; max_retries?: number; wait_for_commitment_to_send_next_transaction?: boolean; }>; payloads: Base64EncodedTransaction[]; }): Promise>; } interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI {} interface TerminateSessionAPI { terminateSession(): void; } interface RemoteMobileWallet extends MobileWallet, TerminateSessionAPI {} declare const SolanaSignTransactions = "solana:signTransactions"; declare const SolanaCloneAuthorization = "solana:cloneAuthorization"; declare const SolanaSignInWithSolana = "solana:signInWithSolana"; type SignInPayload = Readonly<{ domain?: string; address?: string; statement?: string; uri?: string; version?: string; chainId?: string; nonce?: string; issuedAt?: string; expirationTime?: string; notBefore?: string; requestId?: string; resources?: readonly string[]; }> | SolanaSignInInput; type SignInPayloadWithRequiredFields = Partial & Required>; type SignInResult = Readonly<{ address: Base64EncodedAddress; signed_message: Base64EncodedSignedMessage; signature: Base64EncodedSignature; signature_type?: string; }>; type Scenario = Readonly<{ wallet: Promise; close: () => void; }>; type RemoteScenario = Scenario & Readonly<{ associationUrl: URL; }>; //#endregion //#region src/transact.d.ts declare function transact(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise; declare function startScenario(config?: WalletAssociationConfig): Promise; declare function startRemoteScenario(config: RemoteWalletAssociationConfig): Promise; declare function startNostrScenario(config: NostrWalletAssociationConfig): Promise; //#endregion export { Account, AppIdentity, AssociationKeypair, AuthToken, AuthorizationResult, AuthorizeAPI, Base64EncodedAddress, Base64EncodedTransaction, Chain, CloneAuthorizationAPI, Cluster, DeauthorizeAPI, Finality, GetCapabilitiesAPI, MobileWallet, NOSTR_EVENT_KIND_MWA, NostrEvent, NostrWalletAssociationConfig, ProtocolVersion, ReauthorizeAPI, RemoteMobileWallet, RemoteScenario, RemoteWalletAssociationConfig, Scenario, SessionProperties, SignAndSendTransactionsAPI, SignInPayload, SignInPayloadWithRequiredFields, SignInResult, SignMessagesAPI, SignTransactionsAPI, SolanaCloneAuthorization, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaSignInWithSolana, SolanaSignTransactions, TerminateSessionAPI, WalletAssociationConfig, createNostrEvent, deriveSessionIdentifier, generateNostrKeypair, startNostrScenario, startRemoteScenario, startScenario, transact, verifyNostrEvent }; //# sourceMappingURL=index.d.ts.map