UNPKG

@argent/x-sessions

Version:

Manage sessions for Argent X wallets

44 lines (42 loc) 2.36 kB
import { Account, ArraySignatureType } from 'starknet'; import { Session, SessionKey } from './session.types'; import { GetAccountWithSessionSignerParams, GetSessionSignatureForTransactionParams } from './SessionAccount.types'; /** * Class representing a session account for managing transactions with session-based authorization. */ export declare class SessionAccount { session: Session; sessionKey: SessionKey; argentSessionServiceUrl: string; /** * Creates an instance of SessionAccount. * @param session - The session object containing session details. * @param sessionKey - The session key used for signing transactions. * @param argentSessionServiceUrl - The base URL for the Argent session service. */ constructor(session: Session, sessionKey: SessionKey, argentSessionServiceUrl?: string); /** * Retrieves an account with a session signer. * * @param {Object} params - The parameters for the function. * @param {Provider} params.provider - The provider to use for the account. * @param {Session} params.session - The session information. * @param {boolean} [params.cacheAuthorisation=false] - Whether to cache the authorisation signature. * @returns {Account} The account with the session signer. */ getAccountWithSessionSigner({ provider, session, cacheAuthorisation, }: GetAccountWithSessionSignerParams): Account; private signTransaction; /** * Generates a session signature for a transaction. * * @param sessionAuthorizationSignature - The authorization signature for the session. * @param session - The session object containing session details. * @param transactionHash - The hash of the transaction. * @param calls - An array of calls to be made. * @param accountAddress - The address of the account. * @param invocationSignerDetails - Details of the invocation signer. * @param cacheAuthorisation - A boolean indicating whether to cache the authorization. * @returns A promise that resolves to an array containing the session signature. */ getSessionSignatureForTransaction({ sessionAuthorizationSignature, session, transactionHash, calls, accountAddress, invocationSignerDetails, cacheAuthorisation, }: GetSessionSignatureForTransactionParams): Promise<ArraySignatureType>; }