import { IdentifierArray } from "@wallet-standard/core"; import { EmitterSubscription } from "react-native"; //#region src/mwaSessionEvents.d.ts /** * Mobile Wallet Adapter Session Events are notifications and events * about the underlying session between the wallet and the dApp. */ declare enum MWASessionEventType { SessionStartEvent = "SESSION_START", SessionReadyEvent = "SESSION_READY", SessionTerminatedEvent = "SESSION_TERMINATED", SessionServingClientsEvent = "SESSION_SERVING_CLIENTS", SessionServingCompleteEvent = "SESSION_SERVING_COMPLETE", SessionCompleteEvent = "SESSION_COMPLETE", SessionErrorEvent = "SESSION_ERROR", SessionTeardownCompleteEvent = "SESSION_TEARDOWN_COMPLETE", LowPowerNoConnectionEvent = "LOW_POWER_NO_CONNECTION" } interface IMWASessionEvent { __type: MWASessionEventType; sessionId: string; } type SessionStartEvent = Readonly<{ __type: MWASessionEventType.SessionStartEvent; }> & IMWASessionEvent; type SessionReadyEvent = Readonly<{ __type: MWASessionEventType.SessionReadyEvent; }> & IMWASessionEvent; type SessionTerminatedEvent = Readonly<{ __type: MWASessionEventType.SessionTerminatedEvent; }> & IMWASessionEvent; type SessionServingClientsEvent = Readonly<{ __type: MWASessionEventType.SessionServingClientsEvent; }> & IMWASessionEvent; type SessionServingCompleteEvent = Readonly<{ __type: MWASessionEventType.SessionServingCompleteEvent; }> & IMWASessionEvent; type SessionCompleteEvent = Readonly<{ __type: MWASessionEventType.SessionCompleteEvent; }> & IMWASessionEvent; type SessionErrorEvent = Readonly<{ __type: MWASessionEventType.SessionErrorEvent; }> & IMWASessionEvent; type SessionTeardownCompleteEvent = Readonly<{ __type: MWASessionEventType.SessionTeardownCompleteEvent; }> & IMWASessionEvent; type LowPowerNoConnectionEvent = Readonly<{ __type: MWASessionEventType.LowPowerNoConnectionEvent; }> & IMWASessionEvent; type MWASessionEvent = SessionStartEvent | SessionReadyEvent | SessionTerminatedEvent | SessionServingClientsEvent | SessionServingCompleteEvent | SessionCompleteEvent | SessionErrorEvent | SessionTeardownCompleteEvent | LowPowerNoConnectionEvent; //#endregion //#region src/resolve.d.ts type AppIdentity = Readonly<{ identityUri?: string; iconRelativeUri?: string; identityName?: string; }>; 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[]; }>; type Base64EncodedAddress = string; type Base64EncodedSignature = string; type Base64EncodedSignedMessage = string; /** * Mobile Wallet Adapter Requests are remote requests coming from * the dApp for authorization, signing, and sending services. */ type MWARequest = SignMessagesRequest | SignTransactionsRequest | SignAndSendTransactionsRequest | AuthorizeDappRequest | ReauthorizeDappRequest | DeauthorizeDappRequest; declare enum MWARequestType { AuthorizeDappRequest = "AUTHORIZE_DAPP", ReauthorizeDappRequest = "REAUTHORIZE_DAPP", DeauthorizeDappRequest = "DEAUTHORIZE_DAPP", SignMessagesRequest = "SIGN_MESSAGES", SignTransactionsRequest = "SIGN_TRANSACTIONS", SignAndSendTransactionsRequest = "SIGN_AND_SEND_TRANSACTIONS" } interface IMWARequest { __type: MWARequestType; requestId: string; sessionId: string; } interface IVerifiableIdentityRequest { chain: string; authorizationScope: Uint8Array; appIdentity?: AppIdentity; } type AuthorizeDappRequest = Readonly<{ __type: MWARequestType.AuthorizeDappRequest; chain: string; appIdentity?: AppIdentity; features?: IdentifierArray; addresses?: [string]; signInPayload?: SignInPayload; }> & IMWARequest; type ReauthorizeDappRequest = Readonly<{ __type: MWARequestType.ReauthorizeDappRequest; }> & IMWARequest & IVerifiableIdentityRequest; type DeauthorizeDappRequest = Readonly<{ __type: MWARequestType.DeauthorizeDappRequest; }> & IMWARequest & IVerifiableIdentityRequest; type SignMessagesRequest = Readonly<{ __type: MWARequestType.SignMessagesRequest; payloads: Uint8Array[]; }> & IMWARequest & IVerifiableIdentityRequest; type SignTransactionsRequest = Readonly<{ __type: MWARequestType.SignTransactionsRequest; payloads: Uint8Array[]; }> & IMWARequest & IVerifiableIdentityRequest; type SignAndSendTransactionsRequest = Readonly<{ __type: MWARequestType.SignAndSendTransactionsRequest; payloads: Uint8Array[]; minContextSlot?: number; commitment?: string; skipPreflight?: boolean; maxRetries?: number; waitForCommitmentToSendNextTransaction?: boolean; }> & IMWARequest & IVerifiableIdentityRequest; /** * MWA Request Responses */ type MWAResponse = AuthorizeDappResponse | ReauthorizeDappResponse | DeauthorizeDappResponse | SignMessagesResponse | SignTransactionsResponse | SignAndSendTransactionsResponse; declare enum MWARequestFailReason { UserDeclined = "USER_DECLINED", TooManyPayloads = "TOO_MANY_PAYLOADS", InvalidSignatures = "INVALID_SIGNATURES", AuthorizationNotValid = "AUTHORIZATION_NOT_VALID" } type UserDeclinedResponse = Readonly<{ failReason: MWARequestFailReason.UserDeclined; }>; type TooManyPayloadsResponse = Readonly<{ failReason: MWARequestFailReason.TooManyPayloads; }>; type AuthorizationNotValidResponse = Readonly<{ failReason: MWARequestFailReason.AuthorizationNotValid; }>; type InvalidSignaturesResponse = Readonly<{ failReason: MWARequestFailReason.InvalidSignatures; valid: boolean[]; }>; type AuthorizedAccount = Readonly<{ publicKey: Uint8Array; accountLabel?: string; icon?: string; chains?: IdentifierArray; features?: IdentifierArray; }>; type SignInResult = Readonly<{ address: Base64EncodedAddress; signed_message: Base64EncodedSignedMessage; signature: Base64EncodedSignature; signature_type?: string; }>; type AuthorizeDappCompleteResponse = Readonly<{ accounts: Array; walletUriBase?: string; authorizationScope?: Uint8Array; signInResult?: SignInResult; }>; type AuthorizeDappResponse = AuthorizeDappCompleteResponse | UserDeclinedResponse; type ReauthorizeDappCompleteResponse = Readonly<{ authorizationScope?: Uint8Array; }>; type ReauthorizeDappResponse = ReauthorizeDappCompleteResponse | AuthorizationNotValidResponse; type DeauthorizeDappCompleteResponse = Readonly>; type DeauthorizeDappResponse = DeauthorizeDappCompleteResponse | AuthorizationNotValidResponse; type SignPayloadsCompleteResponse = Readonly<{ signedPayloads: Uint8Array[]; }>; type SignPayloadsFailResponse = UserDeclinedResponse | TooManyPayloadsResponse | AuthorizationNotValidResponse | InvalidSignaturesResponse; type SignTransactionsResponse = SignPayloadsCompleteResponse | SignPayloadsFailResponse; type SignMessagesResponse = SignPayloadsCompleteResponse | SignPayloadsFailResponse; type SignAndSendTransactionsCompleteResponse = Readonly<{ signedTransactions: Uint8Array[]; }>; type SignAndSendTransactionsResponse = SignAndSendTransactionsCompleteResponse | UserDeclinedResponse | TooManyPayloadsResponse | AuthorizationNotValidResponse | InvalidSignaturesResponse; declare function resolve(request: AuthorizeDappRequest, response: AuthorizeDappResponse): void; declare function resolve(request: ReauthorizeDappRequest, response: ReauthorizeDappResponse): void; declare function resolve(request: DeauthorizeDappRequest, response: DeauthorizeDappResponse): void; declare function resolve(request: SignMessagesRequest, response: SignMessagesResponse): void; declare function resolve(request: SignTransactionsRequest, response: SignTransactionsResponse): void; declare function resolve(request: SignAndSendTransactionsRequest, response: SignAndSendTransactionsResponse): void; //#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/initializeMobileWalletAdapterSession.d.ts type MWASessionId = string; interface MobileWalletAdapterConfig { maxTransactionsPerSigningRequest: number; maxMessagesPerSigningRequest: number; supportedTransactionVersions: Array; noConnectionWarningTimeoutMs: number; optionalFeatures: IdentifierArray; } declare function initializeMobileWalletAdapterSession(walletName: string, config: MobileWalletAdapterConfig): Promise; //#endregion //#region src/useMobileWalletAdapterSession.d.ts declare function useMobileWalletAdapterSession(walletName: string, config: MobileWalletAdapterConfig, handleRequest: (request: MWARequest) => void, handleSessionEvent: (sessionEvent: MWASessionEvent) => void): void; //#endregion //#region src/initializeMWAEventListener.d.ts declare function initializeMWAEventListener(handleRequest: (request: MWARequest) => void, handleSessionEvent: (sessionEvent: MWASessionEvent) => void): EmitterSubscription; //#endregion //#region src/useDigitalAssetLinks.d.ts declare function getCallingPackage(): Promise; declare function verifyCallingPackage(clientIdentityUri: string): Promise; declare function getCallingPackageUid(): Promise; declare function getUidForPackage(packageName: string): Promise; //#endregion //#region src/errors.d.ts declare enum SolanaMWAWalletLibErrorCode { ERROR_INTENT_DATA_NOT_FOUND = "ERROR_INTENT_DATA_NOT_FOUND", ERROR_SESSION_ALREADY_CREATED = "ERROR_SESSION_ALREADY_CREATED", ERROR_UNSUPPORTED_ASSOCIATION_URI = "ERROR_UNSUPPORTED_ASSOCIATION_URI", ERROR_UNSUPPORTED_ASSOCIATION_TYPE = "ERROR_UNSUPPORTED_ASSOCIATION_TYPE" } declare class SolanaMWAWalletLibError extends Error { code: SolanaMWAWalletLibErrorCode; constructor(code: SolanaMWAWalletLibErrorCode, message: string); } //#endregion export { AuthorizationNotValidResponse, AuthorizeDappCompleteResponse, AuthorizeDappRequest, AuthorizeDappResponse, AuthorizedAccount, Base64EncodedAddress, Base64EncodedSignature, DeauthorizeDappCompleteResponse, DeauthorizeDappRequest, DeauthorizeDappResponse, IMWASessionEvent, InvalidSignaturesResponse, LowPowerNoConnectionEvent, MWARequest, MWARequestFailReason, MWARequestType, MWAResponse, MWASessionEvent, MWASessionEventType, MWASessionId, MobileWalletAdapterConfig, ReauthorizeDappCompleteResponse, ReauthorizeDappRequest, ReauthorizeDappResponse, SessionCompleteEvent, SessionErrorEvent, SessionReadyEvent, SessionServingClientsEvent, SessionServingCompleteEvent, SessionStartEvent, SessionTeardownCompleteEvent, SessionTerminatedEvent, SignAndSendTransactionsCompleteResponse, SignAndSendTransactionsRequest, SignAndSendTransactionsResponse, SignInPayload, SignInResult, SignMessagesRequest, SignMessagesResponse, SignPayloadsCompleteResponse, SignPayloadsFailResponse, SignTransactionsRequest, SignTransactionsResponse, SolanaMWAWalletLibError, SolanaMWAWalletLibErrorCode, TooManyPayloadsResponse, UserDeclinedResponse, getCallingPackage, getCallingPackageUid, getUidForPackage, initializeMWAEventListener, initializeMobileWalletAdapterSession, resolve, useMobileWalletAdapterSession, verifyCallingPackage }; //# sourceMappingURL=index.d.ts.map