import { GetTransactionReceiptArgs, Intent, OpenSessionArgs, SendContractCallArgs, SendERC1155Args, SendERC20Args, SendERC721Args, SendTransactionsArgs, SignedIntent, SignMessageArgs, SignTypedDataArgs } from "./intents/index.js"; import { Store } from "./store.js"; import { OpenSessionResponse } from "./intents/responses.js"; import { SimpleNetwork, WithSimpleNetwork } from "./networks.js"; import { IntentDataFederateAccount, IntentDataFeeOptions, IntentDataFinishValidateSession, IntentDataGetSession, IntentDataGetTransactionReceipt, IntentDataInitiateAuth, IntentDataListAccounts, IntentDataOpenSession, IntentDataSendTransaction, IntentDataSignMessage, IntentDataSignTypedData, IntentDataValidateSession } from "./clients/intent.gen.js"; import { SubtleCryptoBackend } from "./subtle-crypto.js"; import { SecureStoreBackend } from "./secure-store.js"; import { ChallengeIntentParams } from "./challenge.js"; export type SessionAuthProofArgs = { nonce?: string; }; export type ExtraArgs = { lifespan?: number; }; export type ExtraTransactionArgs = ExtraArgs & { identifier: string; }; export type SequenceBaseConfig = { network: SimpleNetwork; }; export type Observer = (value: T | null) => any; export declare class SequenceWaaSBase { readonly config: SequenceBaseConfig; private readonly store; private readonly cryptoBackend; private readonly secureStoreBackend; private readonly status; private readonly sessionId; private readonly wallet; private sessionObservers; constructor(config?: SequenceBaseConfig, store?: Store, cryptoBackend?: SubtleCryptoBackend | null, secureStoreBackend?: SecureStoreBackend | null); getAddress(): Promise; private getWalletAddress; private commonArgs; /** * Builds a payload that can be sent to the WaaS API to sign a transaction. * It automatically signs the payload, and attaches the current wallet address. * * @param packet The action already packed into a packet * @returns A payload that can be sent to the WaaS API */ private signIntent; signUsingSessionKey(message: string | Uint8Array): Promise; private gettingSessionIdPromise; /** * This method will return session id. * * @returns an id of the session */ getSessionId(): Promise; /** * This method will initiate a sign-in process with the waas API. It must be performed * when the user wants to sign in to the app, in parallel with the authentication of the * application's own authentication system. * * This method begins the sign-in process, but does not complete it. The returned payload * must be sent to the waas API to complete the sign-in. The waas API will return a receipt * that must be sent to the `completeSignIn` method to complete the sign-in. * * @param idToken Information about the user that can be used to prove their identity * @returns a session payload that **must** be sent to the waas API to complete the sign-in * @throws {Error} If the session is already signed in or there is a pending sign-in */ signInWithIdToken(idToken: string): Promise>; initiateGuestAuth(): Promise>; initiateEmailAuth(email: string): Promise>; initiateIdTokenAuth(idToken: string, exp?: number): Promise>; initiateStytchAuth(idToken: string, exp?: number): Promise>; initiatePlayFabAuth(titleId: string, sessionTicket: string): Promise>; initiateXAuth(accessToken: string): Promise>; completeAuth(params: ChallengeIntentParams, optParams: Partial): Promise>; onSessionStateChanged(callback: Observer): () => void; signOut({ lifespan, sessionId }?: { sessionId?: string; } & ExtraArgs): Promise>; signOutSession(sessionId: string): Promise>; listSessions(): Promise>; completeSignOut(): Promise; /** * This method will complete a sign-in process with the waas API. It must be performed * after the `signIn` method, when the waas API has returned a receipt. * * This method completes the sign-in process by validating the receipt's proof. * If the proof is invalid or there is no pending sign-in, it will throw an error. * * After this method is called, the wallet is ready to be used to sign transactions. * * @param receipt The receipt returned by the waas API after the `signIn` method * @returns The wallet address of the user that signed in * @throws {Error} If there is no pending sign-in or the receipt is invalid */ completeSignIn(receipt: OpenSessionResponse): Promise; isSignedIn(): Promise; sessionAuthProof(args: WithSimpleNetwork & ExtraArgs): Promise>; /** * This method can be used to sign message using waas API. It can only be used * after successfully signing in with the `signIn` and `completeSignIn` methods. * * The method does not sign the message. It only returns a payload * that must be sent to the waas API to complete the sign process. * * @param chainId The network on which the message will be signed * @param message The message that will be signed * @return a payload that must be sent to the waas API to complete sign process */ signMessage(args: WithSimpleNetwork & ExtraArgs): Promise>; /** * This method can be used to sign typed data using waas API. It can only be used * after successfully signing in with the `signIn` and `completeSignIn` methods. * * The method does not sign the typed data. It only returns a payload * that must be sent to the waas API to complete the sign process. * * @param chainId The network on which the typed data will be signed * @param typedData The typed data that will be signed * @return a payload that must be sent to the waas API to complete sign process */ signTypedData(args: WithSimpleNetwork & ExtraArgs): Promise>; /** * This method can be used to send transactions to the waas API. It can only be used * after successfully signing in with the `signIn` and `completeSignIn` methods. * * The method does not send the transactions to the network. It only returns a payload * that must be sent to the waas API to complete the transaction. * * @param transactions The transactions to be sent * @param chainId The network on which the transactions will be sent * @returns a payload that must be sent to the waas API to complete the transaction */ sendTransaction(args: WithSimpleNetwork & ExtraTransactionArgs): Promise>; getTransactionReceipt(args: WithSimpleNetwork & ExtraTransactionArgs): Promise>; sendERC20(args: WithSimpleNetwork & ExtraTransactionArgs): Promise>; sendERC721(args: WithSimpleNetwork & ExtraTransactionArgs): Promise>; sendERC1155(args: WithSimpleNetwork & ExtraTransactionArgs): Promise>; callContract(args: WithSimpleNetwork & ExtraTransactionArgs): Promise>; feeOptions(args: WithSimpleNetwork & ExtraTransactionArgs): Promise>; validateSession({ deviceMetadata }: { deviceMetadata: string; }): Promise>; getSession(): Promise>; finishValidateSession(salt: string, challenge: string): Promise>; listAccounts(): Promise>; linkAccount(params: ChallengeIntentParams): Promise>; removeAccount({ accountId }: { accountId: string; }): Promise>; getIdToken({ nonce }: { nonce?: string; }): Promise>; batch(intents: Intent[]): Promise>; private signalObservers; updateIntentTime(intent: SignedIntent, time: Date): Promise>; }