UNPKG

@lit-protocol/e2e

Version:

Lit Protocol E2E testing package for running comprehensive integration tests

43 lines (42 loc) 1.57 kB
import { AuthData, PKPData } from '@lit-protocol/schemas'; import { privateKeyToAccount } from 'viem/accounts'; import { AuthContext } from '../types'; import { TestEnv } from './createTestEnv'; type CreateTestAccountOpts = { label: string; fundAccount: boolean; fundLedger: boolean; hasEoaAuthContext?: boolean; hasPKP: boolean; fundPKP: boolean; fundPKPLedger: boolean; hasPKPAuthContext?: boolean; sponsor?: { restrictions: { /** * This price will be divided by threshold to get per-request price * Make sure to keep your Ledger Balance high enough to cover this! */ totalMaxPriceInWei: string; requestsPerPeriod: string; periodSeconds: string; }; userAddresses: string[] | `0x${string}`[]; }; /** * Optional: Use a fixed private key instead of generating a new random one. * This allows reusing the same test account across multiple test runs. */ privateKey?: `0x${string}`; }; export type CreateTestAccountResult = { account: ReturnType<typeof privateKeyToAccount>; pkp?: PKPData; eoaAuthContext?: AuthContext; pkpAuthContext?: AuthContext; pkpViemAccount?: Awaited<ReturnType<TestEnv['litClient']['getPkpViemAccount']>>; paymentManager?: Awaited<ReturnType<TestEnv['litClient']['getPaymentManager']>>; authData?: AuthData; }; export declare function createTestAccount(testEnv: TestEnv, opts: CreateTestAccountOpts): Promise<CreateTestAccountResult>; export {};