@lit-protocol/e2e
Version:
Lit Protocol E2E testing package for running comprehensive integration tests
76 lines (75 loc) • 3.04 kB
TypeScript
import { AuthData, PKPData } from '@lit-protocol/schemas';
import { createEnvVars } from '../helper/createEnvVars';
import { createTestEnv } from '../helper/createTestEnv';
import type { AuthContext, ViemAccount } from '../types';
export declare const LITE_CORE_FUNCTIONS: readonly ["handshake", "pkpSign", "signSessionKey", "executeJs", "encryptDecrypt", "wrappedKeys"];
export declare const LITE_FUNCTIONS: readonly ["handshake", "pkpSign", "signSessionKey", "executeJs", "encryptDecrypt", "wrappedKeys", "paymentDelegation"];
export type LiteFunctionName = (typeof LITE_FUNCTIONS)[number];
export type LiteUptimeRunner = (name: LiteFunctionName, fn: () => Promise<void>) => Promise<void>;
export type LiteContext = {
envVars: ReturnType<typeof createEnvVars>;
testEnv: Awaited<ReturnType<typeof createTestEnv>>;
masterAccount: ViemAccount;
masterAuthData: AuthData;
masterEoaAuthContext: AuthContext;
masterPkp: PKPData;
};
/**
* Initialize shared lite mainnet context for e2e runs.
*
* Validates the network, builds the test environment, ensures the master
* account and PKP are ready, and configures wrapped keys actions.
*/
export declare const initLiteMainnetContext: () => Promise<LiteContext>;
/**
* Ensure the master EOA and its PKP have the minimum ledger balances.
*/
export declare const ensureMasterLedgerBalances: (ctx: LiteContext) => Promise<void>;
/**
* Test 1: Handshake
*
* Confirms a fresh client handshake returns server keys and meets threshold,
* while timing the client creation for latency tracking.
*/
export declare const runHandshakeTest: (ctx: LiteContext) => Promise<void>;
/**
* Test 2: PKP Sign
*
* Verifies the PKP signing endpoint works for the master PKP.
*/
export declare const runPkpSignTest: (ctx: LiteContext) => Promise<void>;
/**
* Test 3: Sign Session Key
*
* Creates a PKP auth context to exercise the signSessionKey endpoint.
*/
export declare const runSignSessionKeyTest: (ctx: LiteContext) => Promise<void>;
/**
* Test 4: Execute JS
*
* Executes a Lit Action that signs a payload to validate the runtime.
*/
export declare const runExecuteJsTest: (ctx: LiteContext) => Promise<void>;
/**
* Test 5: Encrypt/Decrypt
*
* Encrypts data with ACCs and decrypts it using the master auth context.
*/
export declare const runEncryptDecryptTest: (ctx: LiteContext) => Promise<void>;
/**
* Test 6: Wrapped Keys
*
* Imports and exports a private key via wrapped keys using PKP session sigs.
*/
export declare const runWrappedKeysTest: (ctx: LiteContext) => Promise<void>;
/**
* Test 7: Payment Delegation
*
* Ensures Alice can sponsor Bob's PKP execution and that removing sponsorship
* causes Bob's next request to fail while reducing Alice's ledger balance.
*/
export declare const runPaymentDelegationTest: (testEnv: Awaited<ReturnType<typeof createTestEnv>>) => Promise<void>;
/**
* Run the full lite mainnet suite once, including payment delegation.
*/
export declare const runLiteMainnetOnce: (runner: LiteUptimeRunner) => Promise<void>;