diff --git a/.gitignore b/.gitignore index 37858e19f6..8deddf42d9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /out-tsc **/dist **/out-tsc +local-tests/**/*.js # dependencies node_modules diff --git a/local-tests/build.mjs b/local-tests/build.mjs index 79fd5883d7..ceffd8d8eb 100644 --- a/local-tests/build.mjs +++ b/local-tests/build.mjs @@ -1,65 +1,66 @@ import * as esbuild from 'esbuild'; import { nodeExternalsPlugin } from 'esbuild-node-externals'; -import fs from 'fs'; +import { fileURLToPath } from 'url'; -const TEST_DIR = 'local-tests'; +const ALLOW_LIST = [ + 'ethers', + '@lit-protocol/accs-schemas', + '@lit-protocol/contracts', + 'crypto', + 'secp256k1', +]; + +const getPath = (relativePath) => + fileURLToPath(new URL(relativePath, import.meta.url)); /** - * Builds the project using esbuild. - * @returns {Promise} A promise that resolves when the build is complete. + * Common esbuild configuration options. + * @param {string} entry - Entry file path. + * @param {string} outfile - Output file path. + * @param {string} [globalName] - Optional global name for the bundle. + * @returns {esbuild.BuildOptions} Esbuild configuration object. + */ +const createBuildConfig = (entry, outfile, globalName) => ({ + entryPoints: [getPath(entry)], + outfile: getPath(outfile), + bundle: true, + plugins: [ + nodeExternalsPlugin({ + allowList: ALLOW_LIST, + }), + ], + platform: 'node', + target: 'esnext', + format: 'esm', + inject: [getPath('./shim.mjs')], + mainFields: ['module', 'main'], + ...(globalName ? { globalName } : {}), +}); + +/** + * Builds the CLI-enabled version of Tinny. */ export const build = async () => { - await esbuild.build({ - entryPoints: [`${TEST_DIR}/test.ts`], - outfile: `./${TEST_DIR}/build/test.mjs`, - bundle: true, - plugins: [ - nodeExternalsPlugin({ - allowList: [ - 'ethers', - '@lit-protocol/accs-schemas', - '@lit-protocol/contracts', - 'crypto', - 'secp256k1', - ], - }), - ], - platform: 'node', - target: 'esnext', - format: 'esm', - inject: [`./${TEST_DIR}/shim.mjs`], - mainFields: ['module', 'main'], - }); + await esbuild.build(createBuildConfig('./test.ts', './build/test.mjs')); }; /** - * Inserts a polyfill at the beginning of a file. - * The polyfill ensures that the global `fetch` function is available. - * @returns {void} + * Bundles Tinny as a standalone package. */ -export const postBuildPolyfill = () => { - try { - const file = fs.readFileSync(`./${TEST_DIR}/build/test.mjs`, 'utf8'); - const content = `import fetch from 'node-fetch'; -try { - if (!globalThis.fetch) { - globalThis.fetch = fetch; - } -} catch (error) { - console.error('❌ Error in polyfill', error); -} -`; - const newFile = content + file; - fs.writeFileSync(`./${TEST_DIR}/build/test.mjs`, newFile); - } catch (e) { - throw new Error(`Error in postBuildPolyfill: ${e}`); - } +export const bundle = async () => { + await esbuild.build( + createBuildConfig('./index.ts', './index.js', 'tinnySdk') + ); }; // Go! (async () => { const start = Date.now(); - await build(); - postBuildPolyfill(); - console.log(`[build.mjs] 🚀 Build time: ${Date.now() - start}ms`); + try { + await build(); + await bundle(); + console.log(`[build.mjs] 🚀 Build time: ${Date.now() - start}ms`); + } catch (error) { + console.error(`[build.mjs] ❌ Build failed:`, error); + } })(); diff --git a/local-tests/index.ts b/local-tests/index.ts new file mode 100644 index 0000000000..15a02b54ac --- /dev/null +++ b/local-tests/index.ts @@ -0,0 +1,33 @@ +import { TinnyEnvironment } from './setup/tinny-environment'; +import { runInBand, runTestsParallel } from './setup/tinny-operations'; +import * as tinnyTests from './tests'; +import { getEoaSessionSigs } from './setup/session-sigs/get-eoa-session-sigs'; +import { getLitActionSessionSigs } from './setup/session-sigs/get-lit-action-session-sigs'; +import { getPkpSessionSigs } from './setup/session-sigs/get-pkp-session-sigs'; +import { AccessControlConditions } from './setup/accs/accs'; + +export { + TinnyEnvironment, + runInBand, + runTestsParallel, + tinnyTests, + getEoaSessionSigs, + getLitActionSessionSigs, + getPkpSessionSigs, + AccessControlConditions, +}; + +// Usage +// const devEnv = new TinnyEnvironment(); + +// await devEnv.init(); + +// const testConfig = { +// tests: { +// testEthAuthSigToEncryptDecryptString, +// }, +// devEnv, +// } + +// const res = await runTestsParallel(testConfig); +// console.log("res:", res); diff --git a/local-tests/package.json b/local-tests/package.json new file mode 100644 index 0000000000..6621828b72 --- /dev/null +++ b/local-tests/package.json @@ -0,0 +1,97 @@ +{ + "name": "@lit-protocol/tinny", + "version": "0.0.5", + "description": "A package to run the test script for Lit Protocol with custom commands", + "type": "module", + "main": "./index.js", + "typings": "./index.ts", + "license": "MIT", + "author": "Anson (https://github.com/ansonhkg)", + "publishConfig": { + "access": "public", + "directory": "./" + }, + "dependencies": { + "@cosmjs/amino": "0.30.1", + "@cosmjs/crypto": "0.30.1", + "@cosmjs/encoding": "0.30.1", + "@cosmjs/proto-signing": "0.30.1", + "@cosmjs/stargate": "0.30.1", + "@cypress/code-coverage": "^3.10.0", + "@cypress/react": "^6.2.0", + "@cypress/webpack-dev-server": "^2.3.0", + "@lit-protocol/accs-schemas": "0.0.7", + "@metamask/eth-sig-util": "5.0.2", + "@mysten/sui.js": "^0.37.1", + "@playwright/test": "^1.25.2", + "@simplewebauthn/browser": "^7.2.0", + "@simplewebauthn/typescript-types": "^7.0.0", + "@spruceid/siwe-parser": "2.0.0", + "@synthetixio/js": "^2.41.0", + "@testing-library/cypress": "^8.0.3", + "@testing-library/react": "^13.4.0", + "@types/testing-library__cypress": "^5.0.9", + "@walletconnect/core": "2.9.2", + "@walletconnect/ethereum-provider": "2.9.2", + "@walletconnect/jsonrpc-utils": "1.0.8", + "@walletconnect/modal": "2.6.1", + "@walletconnect/types": "2.9.2", + "@walletconnect/utils": "2.9.2", + "@walletconnect/web3wallet": "1.8.8", + "@websaam/nx-esbuild": "^0.0.1", + "ajv": "^8.12.0", + "axios": "^0.27.2", + "base64url": "^3.0.1", + "bitcoinjs-lib": "^6.1.0", + "blockstore-core": "^3.0.0", + "browserify-zlib": "^0.2.0", + "bs58": "^5.0.0", + "bytes32": "^0.0.3", + "cbor-web": "^9.0.1", + "commander": "^9.4.0", + "concurrently": "^7.4.0", + "core-js": "^3.6.5", + "cross-fetch": "3.1.4", + "crypto-browserify": "^3.12.0", + "cypress-wait-until": "^1.7.2", + "cypress-watch-and-reload": "^1.10.3", + "date-and-time": "^2.4.1", + "dotenv": "^16.0.2", + "dotenv-parse-variables": "^2.0.0", + "download": "^8.0.0", + "ethers": "^5.7.1", + "etherscan-api": "^10.2.0", + "find-config": "^1.0.0", + "g": "^2.0.1", + "https-browserify": "^1.0.0", + "jose": "^4.14.4", + "jszip": "^3.10.1", + "micromodal": "^0.4.10", + "multiformats": "^9.7.1", + "nanoid": "3.3.4", + "next": "13.3.0", + "react": "18.0.0", + "react-dom": "18.0.0", + "regenerator-runtime": "0.13.7", + "secp256k1": "^5.0.0", + "serve": "^14.0.1", + "siwe": "^2.0.5", + "siwe-recap": "0.0.2-alpha.0", + "stream-browserify": "^3.0.0", + "stream-http": "^3.2.0", + "synthetix-js": "^2.74.1", + "tslib": "^2.3.0", + "tweetnacl": "^1.0.3", + "tweetnacl-util": "^0.15.1", + "uint8arrays": "^4.0.3", + "@openagenda/verror": "^3.1.4", + "ipfs-unixfs-importer": "12.0.1", + "@solana/web3.js": "^1.95.3", + "bech32": "^2.0.0", + "pako": "^2.1.0", + "@lit-protocol/misc": "^7.0.0", + "@lit-protocol/lit-node-client": "^7.0.0", + "@lit-protocol/lit-auth-client": "^7.0.0", + "@lit-protocol/contracts": "^0.0.71" + } +} diff --git a/local-tests/setup/tinny-config.ts b/local-tests/setup/tinny-config.ts index 296e55dd9b..2fef9206b3 100644 --- a/local-tests/setup/tinny-config.ts +++ b/local-tests/setup/tinny-config.ts @@ -62,11 +62,6 @@ export interface ProcessEnvs { */ LIT_RPC_URL: string; - /** - * This is usually used when you're running tests locally depending how many nodes you are running. - */ - BOOTSTRAP_URLS: string[]; - /** * The list of private keys to use for testing. */ diff --git a/local-tests/setup/tinny-environment.ts b/local-tests/setup/tinny-environment.ts index 7163ca6d81..a7c4f39ebe 100644 --- a/local-tests/setup/tinny-environment.ts +++ b/local-tests/setup/tinny-environment.ts @@ -24,6 +24,7 @@ import { console.log('checking env', process.env['DEBUG']); export class TinnyEnvironment { public network: LIT_NETWORK_VALUES; + public customNetworkContext: any; /** * Environment variables used in the process. @@ -42,11 +43,6 @@ export class TinnyEnvironment { LIT_RPC_URL: process.env['LIT_RPC_URL'], WAIT_FOR_KEY_INTERVAL: parseInt(process.env['WAIT_FOR_KEY_INTERVAL']) || 3000, - BOOTSTRAP_URLS: process.env['BOOTSTRAP_URLS']?.split(',') || [ - 'http://127.0.0.1:7470', - 'http://127.0.0.1:7471', - 'http://127.0.0.1:7472', - ], TIME_TO_RELEASE_KEY: parseInt(process.env['TIME_TO_RELEASE_KEY']) || 10000, RUN_IN_BAND: process.env['RUN_IN_BAND'] === 'true', RUN_IN_BAND_INTERVAL: parseInt(process.env['RUN_IN_BAND_INTERVAL']) || 5000, @@ -105,15 +101,33 @@ export class TinnyEnvironment { private _shivaClient: ShivaClient = new ShivaClient(); private _contractContext: LitContractContext | LitContractResolverContext; - constructor(network?: LIT_NETWORK_VALUES) { + constructor( + override?: Partial & { customNetworkContext?: any } + ) { + this.customNetworkContext = override?.customNetworkContext; + + // Merge default processEnvs with custom overrides + this.processEnvs = { + ...this.processEnvs, + ...override, + }; + + // if there are only 1 private key, duplicate it to make it 10 cus we might not have enough + // for the setup process + if (this.processEnvs.PRIVATE_KEYS.length === 1) { + this.processEnvs.PRIVATE_KEYS = new Array(10).fill( + this.processEnvs.PRIVATE_KEYS[0] + ); + } + // -- setup network - this.network = network || this.processEnvs.NETWORK; + this.network = override?.NETWORK || this.processEnvs.NETWORK; if (Object.values(LIT_NETWORK).indexOf(this.network) === -1) { throw new Error( - `Invalid network environment. Please use one of ${Object.values( - LIT_NETWORK - )}` + `Invalid network environment ${ + this.network + }. Please use one of ${Object.values(LIT_NETWORK)}` ); } @@ -235,7 +249,8 @@ export class TinnyEnvironment { if (this.network === LIT_NETWORK.Custom || centralisation === 'unknown') { const networkContext = - this?.testnet?.ContractContext ?? this._contractContext; + this.customNetworkContext || + (this?.testnet?.ContractContext ?? this._contractContext); this.litNodeClient = new LitNodeClient({ litNetwork: LIT_NETWORK.Custom, rpcUrl: this.rpc, @@ -341,8 +356,8 @@ export class TinnyEnvironment { * Creates a random person. * @returns A promise that resolves to the created person. */ - async createRandomPerson() { - return await this.createNewPerson('Alice'); + async createRandomPerson(name?: string) { + return await this.createNewPerson(name || 'Alice'); } setUnavailable = (network: LIT_NETWORK_VALUES) => { @@ -373,7 +388,8 @@ export class TinnyEnvironment { await this.testnet.getTestnetConfig(); } else if (this.network === LIT_NETWORK.Custom) { - const context = await import('./networkContext.json'); + const context = + this.customNetworkContext || (await import('./networkContext.json')); this._contractContext = context; } diff --git a/local-tests/test.ts b/local-tests/test.ts index f4154aa420..6862ca9bf7 100644 --- a/local-tests/test.ts +++ b/local-tests/test.ts @@ -108,7 +108,6 @@ import { testBatchGeneratePrivateKeys } from './tests/wrapped-keys/testBatchGene import { testFailBatchGeneratePrivateKeysAtomic } from './tests/wrapped-keys/testFailStoreEncryptedKeyBatchIsAtomic'; import { setLitActionsCodeToLocal } from './tests/wrapped-keys/util'; -import { testUseEoaSessionSigsToRequestSingleResponse } from './tests/testUseEoaSessionSigsToRequestSingleResponse'; // Use the current LIT action code to test against setLitActionsCodeToLocal(); @@ -316,7 +315,9 @@ setLitActionsCodeToLocal(); }, devEnv, }; + let res; + if (devEnv.processEnvs.RUN_IN_BAND) { res = await runInBand(testConfig); } else { diff --git a/local-tests/tests.ts b/local-tests/tests.ts new file mode 100644 index 0000000000..8d42ceebbb --- /dev/null +++ b/local-tests/tests.ts @@ -0,0 +1,396 @@ +import { testUseEoaSessionSigsToExecuteJsSigning } from './tests/testUseEoaSessionSigsToExecuteJsSigning'; +import { testUseEoaSessionSigsToPkpSign } from './tests/testUseEoaSessionSigsToPkpSign'; +import { testUsePkpSessionSigsToExecuteJsSigning } from './tests/testUsePkpSessionSigsToExecuteJsSigning'; +import { testUsePkpSessionSigsToPkpSign } from './tests/testUsePkpSessionSigsToPkpSign'; +import { testUseValidLitActionCodeGeneratedSessionSigsToPkpSign } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning'; +import { testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning } from './tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning'; +import { testUseEoaSessionSigsToExecuteJsSigningInParallel } from './tests/testUseEoaSessionSigsToExecuteJsSigningInParallel'; +import { testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs } from './tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs'; +import { testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign } from './tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign'; +import { testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign'; +import { testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs'; +import { testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign'; +import { testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs'; +import { testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs } from './tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs'; +import { testUseEoaSessionSigsToExecuteJsClaimKeys } from './tests/testUseEoaSessionSigsToExecuteJsClaimKeys'; +import { testUseEoaSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys'; +import { testUseEoaSessionSigsToExecuteJsJsonResponse } from './tests/testUseEoaSessionSigsToExecuteJsJsonResponse'; +import { testUseEoaSessionSigsToExecuteJsConsoleLog } from './tests/testUseEoaSessionSigsToExecuteJsConsoleLog'; +import { testUseEoaSessionSigsToEncryptDecryptString } from './tests/testUseEoaSessionSigsToEncryptDecryptString'; +import { testUseEoaSessionSigsToEncryptDecryptUint8Array } from './tests/testUseEoaSessionSigsToEncryptDecryptUint8Array'; +import { testUsePkpSessionSigsToEncryptDecryptString } from './tests/testUsePkpSessionSigsToEncryptDecryptString'; +import { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString'; +import { testUseInvalidLitActionCodeToGenerateSessionSigs } from './tests/testUseInvalidLitActionCodeToGenerateSessionSigs'; +import { testUseEoaSessionSigsToEncryptDecryptFile } from './tests/testUseEoaSessionSigsToEncryptDecryptFile'; +import { testUsePkpSessionSigsToExecuteJsSigningInParallel } from './tests/testUsePkpSessionSigsToExecuteJsSigningInParallel'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel'; +import { testUsePkpSessionSigsToExecuteJsClaimKeys } from './tests/testUsePkpSessionSigsToExecuteJsClaimKeys'; +import { testUsePkpSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys'; +import { testUsePkpSessionSigsToExecuteJsJsonResponse } from './tests/testUsePkpSessionSigsToExecuteJsJsonResponse'; +import { testUsePkpSessionSigsToExecuteJsConsoleLog } from './tests/testUsePkpSessionSigsToExecuteJsConsoleLog'; +import { testUsePkpSessionSigsToEncryptDecryptFile } from './tests/testUsePkpSessionSigsToEncryptDecryptFile'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog'; +import { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile'; +import { testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign } from './tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign'; +import { testUseInvalidLitActionIpfsCodeToGenerateSessionSigs } from './tests/testUseInvalidLitActionIpfsCodeToGenerateSessionSigs'; +import { testSolAuthSigToEncryptDecryptString } from './tests/testSolAuthSigToEncryptDecryptString'; +import { testEthAuthSigToEncryptDecryptString } from './tests/testEthAuthSigToEncryptDecryptString'; +import { testCosmosAuthSigToEncryptDecryptString } from './tests/testCosmosAuthSigToEncryptDecryptString'; +import { testPkpEthersWithEoaSessionSigsToSignMessage } from './tests/testPkpEthersWithEoaSessionSigsToSignMessage'; +import { testPkpEthersWithEoaSessionSigsToSignWithAuthContext } from './tests/testPkpEthersWithEoaSessionSigsToSignWithAuthContext'; +import { testPkpEthersWithEoaSessionSigsToEthSign } from './tests/testPkpEthersWithEoaSessionSigsToEthSign'; +import { testPkpEthersWithEoaSessionSigsToPersonalSign } from './tests/testPkpEthersWithEoaSessionSigsToPersonalSign'; +import { testPkpEthersWithEoaSessionSigsToSendTx } from './tests/testPkpEthersWithEoaSessionSigsToSendTx'; +import { testPkpEthersWithPkpSessionSigsToSignMessage } from './tests/testPkpEthersWithPkpSessionSigsToSignMessage'; +import { testPkpEthersWithPkpSessionSigsToEthSign } from './tests/testPkpEthersWithPkpSessionSigsToEthSign'; +import { testPkpEthersWithPkpSessionSigsToPersonalSign } from './tests/testPkpEthersWithPkpSessionSigsToPersonalSign'; +import { testPkpEthersWithPkpSessionSigsToSendTx } from './tests/testPkpEthersWithPkpSessionSigsToSendTx'; +import { testPkpEthersWithEoaSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTransaction'; + +import { testPkpEthersWithPkpSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTransaction'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTransaction'; +import { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1'; +import { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1'; +import { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3'; +import { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4'; +import { testPkpEthersWithEoaSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedData'; +import { testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil'; +import { testPkpEthersWithLitActionSessionSigsToSignMessage } from './tests/testPkpEthersWithLitActionSessionSigsToSignMessage'; +import { testPkpEthersWithLitActionSessionSigsToEthSign } from './tests/testPkpEthersWithLitActionSessionSigsToEthSign'; +import { testPkpEthersWithLitActionSessionSigsToPersonalSign } from './tests/testPkpEthersWithLitActionSessionSigsToPersonalSign'; +import { testPkpEthersWithLitActionSessionSigsToSendTx } from './tests/testPkpEthersWithLitActionSessionSigsToSendTx'; +import { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3'; +import { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4'; +import { testPkpEthersWithPkpSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedData'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedData'; +import { testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil'; +import { testUseCustomAuthSessionSigsToPkpSignExecuteJs } from './tests/testUseCustomAuthSessionSigsToPkpSignExecuteJs'; +import { testExecuteJsSignAndCombineEcdsa } from './tests/testExecuteJsSignAndCombineEcdsa'; +import { testExecutJsDecryptAndCombine } from './tests/testExecuteJsDecryptAndCombine'; +import { testExecuteJsBroadcastAndCollect } from './tests/testExecuteJsBroadcastAndCollect'; +import { testRelayer } from './tests/testRelayer'; + +import { testEthereumSignMessageGeneratedKey } from './tests/wrapped-keys/testEthereumSignMessageGeneratedKey'; +import { testEthereumBroadcastTransactionGeneratedKey } from './tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey'; +import { testEthereumSignMessageWrappedKey } from './tests/wrapped-keys/testEthereumSignMessageWrappedKey'; +import { testFailEthereumSignTransactionWrappedKeyInvalidDecryption } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyInvalidDecryption'; +import { testEthereumSignTransactionWrappedKey } from './tests/wrapped-keys/testEthereumSignTransactionWrappedKey'; +import { testFailEthereumSignTransactionWrappedKeyWithInvalidParam } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithInvalidParam'; +import { testFailEthereumSignTransactionWrappedKeyWithMissingParam } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithMissingParam'; +import { testEthereumBroadcastTransactionWrappedKey } from './tests/wrapped-keys/testEthereumBroadcastTransactionWrappedKey'; +import { testEthereumBroadcastWrappedKeyWithFetchGasParams } from './tests/wrapped-keys/testEthereumBroadcastWrappedKeyWithFetchGasParams'; +import { testImportWrappedKey } from './tests/wrapped-keys/testImportWrappedKey'; +import { testGenerateEthereumWrappedKey } from './tests/wrapped-keys/testGenerateEthereumWrappedKey'; +import { testGenerateSolanaWrappedKey } from './tests/wrapped-keys/testGenerateSolanaWrappedKey'; +import { testFailImportWrappedKeysWithSamePrivateKey } from './tests/wrapped-keys/testFailImportWrappedKeysWithSamePrivateKey'; +import { testFailImportWrappedKeysWithEoaSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithEoaSessionSig'; +import { testFailImportWrappedKeysWithMaxExpirySessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithMaxExpirySessionSig'; +import { testFailImportWrappedKeysWithInvalidSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithInvalidSessionSig'; +import { testFailImportWrappedKeysWithExpiredSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithExpiredSessionSig'; +import { testExportWrappedKey } from './tests/wrapped-keys/testExportWrappedKey'; +import { testSignMessageWithSolanaEncryptedKey } from './tests/wrapped-keys/testSignMessageWithSolanaEncryptedKey'; +import { testSignTransactionWithSolanaEncryptedKey } from './tests/wrapped-keys/testSignTransactionWithSolanaEncryptedKey'; +import { testBatchGeneratePrivateKeys } from './tests/wrapped-keys/testBatchGeneratePrivateKeys'; +import { testFailBatchGeneratePrivateKeysAtomic } from './tests/wrapped-keys/testFailStoreEncryptedKeyBatchIsAtomic'; +import { testUseEoaSessionSigsToRequestSingleResponse } from './tests/testUseEoaSessionSigsToRequestSingleResponse'; + +export { testUseEoaSessionSigsToExecuteJsSigning } from './tests/testUseEoaSessionSigsToExecuteJsSigning'; +export { testUseEoaSessionSigsToPkpSign } from './tests/testUseEoaSessionSigsToPkpSign'; +export { testUsePkpSessionSigsToExecuteJsSigning } from './tests/testUsePkpSessionSigsToExecuteJsSigning'; +export { testUsePkpSessionSigsToPkpSign } from './tests/testUsePkpSessionSigsToPkpSign'; +export { testUseValidLitActionCodeGeneratedSessionSigsToPkpSign } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning'; +export { testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning } from './tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning'; +export { testUseEoaSessionSigsToExecuteJsSigningInParallel } from './tests/testUseEoaSessionSigsToExecuteJsSigningInParallel'; +export { testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs } from './tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs'; +export { testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign } from './tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign'; +export { testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign'; +export { testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs'; +export { testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign'; +export { testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs'; +export { testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs } from './tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs'; +export { testUseEoaSessionSigsToExecuteJsClaimKeys } from './tests/testUseEoaSessionSigsToExecuteJsClaimKeys'; +export { testUseEoaSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys'; +export { testUseEoaSessionSigsToExecuteJsJsonResponse } from './tests/testUseEoaSessionSigsToExecuteJsJsonResponse'; +export { testUseEoaSessionSigsToExecuteJsConsoleLog } from './tests/testUseEoaSessionSigsToExecuteJsConsoleLog'; +export { testUseEoaSessionSigsToEncryptDecryptString } from './tests/testUseEoaSessionSigsToEncryptDecryptString'; +export { testUseEoaSessionSigsToEncryptDecryptUint8Array } from './tests/testUseEoaSessionSigsToEncryptDecryptUint8Array'; +export { testUsePkpSessionSigsToEncryptDecryptString } from './tests/testUsePkpSessionSigsToEncryptDecryptString'; +export { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString'; +export { testUseInvalidLitActionCodeToGenerateSessionSigs } from './tests/testUseInvalidLitActionCodeToGenerateSessionSigs'; +export { testUseEoaSessionSigsToEncryptDecryptFile } from './tests/testUseEoaSessionSigsToEncryptDecryptFile'; +export { testUsePkpSessionSigsToExecuteJsSigningInParallel } from './tests/testUsePkpSessionSigsToExecuteJsSigningInParallel'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel'; +export { testUsePkpSessionSigsToExecuteJsClaimKeys } from './tests/testUsePkpSessionSigsToExecuteJsClaimKeys'; +export { testUsePkpSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys'; +export { testUsePkpSessionSigsToExecuteJsJsonResponse } from './tests/testUsePkpSessionSigsToExecuteJsJsonResponse'; +export { testUsePkpSessionSigsToExecuteJsConsoleLog } from './tests/testUsePkpSessionSigsToExecuteJsConsoleLog'; +export { testUsePkpSessionSigsToEncryptDecryptFile } from './tests/testUsePkpSessionSigsToEncryptDecryptFile'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog'; +export { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile'; +export { testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign } from './tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign'; +export { testUseInvalidLitActionIpfsCodeToGenerateSessionSigs } from './tests/testUseInvalidLitActionIpfsCodeToGenerateSessionSigs'; +export { testSolAuthSigToEncryptDecryptString } from './tests/testSolAuthSigToEncryptDecryptString'; +export { testEthAuthSigToEncryptDecryptString } from './tests/testEthAuthSigToEncryptDecryptString'; +export { testCosmosAuthSigToEncryptDecryptString } from './tests/testCosmosAuthSigToEncryptDecryptString'; +export { testPkpEthersWithEoaSessionSigsToSignMessage } from './tests/testPkpEthersWithEoaSessionSigsToSignMessage'; +export { testPkpEthersWithEoaSessionSigsToSignWithAuthContext } from './tests/testPkpEthersWithEoaSessionSigsToSignWithAuthContext'; +export { testPkpEthersWithEoaSessionSigsToEthSign } from './tests/testPkpEthersWithEoaSessionSigsToEthSign'; +export { testPkpEthersWithEoaSessionSigsToPersonalSign } from './tests/testPkpEthersWithEoaSessionSigsToPersonalSign'; +export { testPkpEthersWithEoaSessionSigsToSendTx } from './tests/testPkpEthersWithEoaSessionSigsToSendTx'; +export { testPkpEthersWithPkpSessionSigsToSignMessage } from './tests/testPkpEthersWithPkpSessionSigsToSignMessage'; +export { testPkpEthersWithPkpSessionSigsToEthSign } from './tests/testPkpEthersWithPkpSessionSigsToEthSign'; +export { testPkpEthersWithPkpSessionSigsToPersonalSign } from './tests/testPkpEthersWithPkpSessionSigsToPersonalSign'; +export { testPkpEthersWithPkpSessionSigsToSendTx } from './tests/testPkpEthersWithPkpSessionSigsToSendTx'; +export { testPkpEthersWithEoaSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTransaction'; + +export { testPkpEthersWithPkpSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTransaction'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTransaction'; +export { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1'; +export { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1'; +export { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3'; +export { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4'; +export { testPkpEthersWithEoaSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedData'; +export { testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil'; +export { testPkpEthersWithLitActionSessionSigsToSignMessage } from './tests/testPkpEthersWithLitActionSessionSigsToSignMessage'; +export { testPkpEthersWithLitActionSessionSigsToEthSign } from './tests/testPkpEthersWithLitActionSessionSigsToEthSign'; +export { testPkpEthersWithLitActionSessionSigsToPersonalSign } from './tests/testPkpEthersWithLitActionSessionSigsToPersonalSign'; +export { testPkpEthersWithLitActionSessionSigsToSendTx } from './tests/testPkpEthersWithLitActionSessionSigsToSendTx'; +export { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3'; +export { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4'; +export { testPkpEthersWithPkpSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedData'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedData'; +export { testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil'; +export { testUseCustomAuthSessionSigsToPkpSignExecuteJs } from './tests/testUseCustomAuthSessionSigsToPkpSignExecuteJs'; +export { testExecuteJsSignAndCombineEcdsa } from './tests/testExecuteJsSignAndCombineEcdsa'; +export { testExecutJsDecryptAndCombine } from './tests/testExecuteJsDecryptAndCombine'; +export { testExecuteJsBroadcastAndCollect } from './tests/testExecuteJsBroadcastAndCollect'; +export { testRelayer } from './tests/testRelayer'; + +export { testEthereumSignMessageGeneratedKey } from './tests/wrapped-keys/testEthereumSignMessageGeneratedKey'; +export { testEthereumBroadcastTransactionGeneratedKey } from './tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey'; +export { testEthereumSignMessageWrappedKey } from './tests/wrapped-keys/testEthereumSignMessageWrappedKey'; +export { testFailEthereumSignTransactionWrappedKeyInvalidDecryption } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyInvalidDecryption'; +export { testEthereumSignTransactionWrappedKey } from './tests/wrapped-keys/testEthereumSignTransactionWrappedKey'; +export { testFailEthereumSignTransactionWrappedKeyWithInvalidParam } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithInvalidParam'; +export { testFailEthereumSignTransactionWrappedKeyWithMissingParam } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithMissingParam'; +export { testEthereumBroadcastTransactionWrappedKey } from './tests/wrapped-keys/testEthereumBroadcastTransactionWrappedKey'; +export { testEthereumBroadcastWrappedKeyWithFetchGasParams } from './tests/wrapped-keys/testEthereumBroadcastWrappedKeyWithFetchGasParams'; +export { testImportWrappedKey } from './tests/wrapped-keys/testImportWrappedKey'; +export { testGenerateEthereumWrappedKey } from './tests/wrapped-keys/testGenerateEthereumWrappedKey'; +export { testGenerateSolanaWrappedKey } from './tests/wrapped-keys/testGenerateSolanaWrappedKey'; +export { testFailImportWrappedKeysWithSamePrivateKey } from './tests/wrapped-keys/testFailImportWrappedKeysWithSamePrivateKey'; +export { testFailImportWrappedKeysWithEoaSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithEoaSessionSig'; +export { testFailImportWrappedKeysWithMaxExpirySessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithMaxExpirySessionSig'; +export { testFailImportWrappedKeysWithInvalidSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithInvalidSessionSig'; +export { testFailImportWrappedKeysWithExpiredSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithExpiredSessionSig'; +export { testExportWrappedKey } from './tests/wrapped-keys/testExportWrappedKey'; +export { testSignMessageWithSolanaEncryptedKey } from './tests/wrapped-keys/testSignMessageWithSolanaEncryptedKey'; +export { testSignTransactionWithSolanaEncryptedKey } from './tests/wrapped-keys/testSignTransactionWithSolanaEncryptedKey'; +export { testBatchGeneratePrivateKeys } from './tests/wrapped-keys/testBatchGeneratePrivateKeys'; +export { testFailBatchGeneratePrivateKeysAtomic } from './tests/wrapped-keys/testFailStoreEncryptedKeyBatchIsAtomic'; +export { testUseEoaSessionSigsToRequestSingleResponse } from './tests/testUseEoaSessionSigsToRequestSingleResponse'; + +const relayerTests = { + testRelayer, +}; + +// --filter=WrappedKey +const wrappedKeysTests = { + // -- valid cases + testBatchGeneratePrivateKeys, + testEthereumSignMessageGeneratedKey, + testEthereumBroadcastTransactionGeneratedKey, + testEthereumSignMessageWrappedKey, + testEthereumSignTransactionWrappedKey, + testEthereumBroadcastTransactionWrappedKey, + testEthereumBroadcastWrappedKeyWithFetchGasParams, + + // -- generate wrapped keys + testGenerateEthereumWrappedKey, + testGenerateSolanaWrappedKey, + + // -- import wrapped keys + testImportWrappedKey, + + // -- export wrapped keys + testExportWrappedKey, + + // -- solana wrapped keys + testSignMessageWithSolanaEncryptedKey, + testSignTransactionWithSolanaEncryptedKey, + + // -- invalid cases + testFailEthereumSignTransactionWrappedKeyWithMissingParam, + testFailEthereumSignTransactionWrappedKeyWithInvalidParam, + testFailEthereumSignTransactionWrappedKeyInvalidDecryption, + testFailBatchGeneratePrivateKeysAtomic, + + // -- import wrapped keys + testFailImportWrappedKeysWithSamePrivateKey, + testFailImportWrappedKeysWithEoaSessionSig, + testFailImportWrappedKeysWithMaxExpirySessionSig, + testFailImportWrappedKeysWithInvalidSessionSig, + testFailImportWrappedKeysWithExpiredSessionSig, +}; + +const eoaSessionSigsTests = { + testUseEoaSessionSigsToExecuteJsSigning, + testUseEoaSessionSigsToPkpSign, + testUseEoaSessionSigsToExecuteJsSigningInParallel, + testUseEoaSessionSigsToExecuteJsClaimKeys, + testUseEoaSessionSigsToExecuteJsClaimMultipleKeys, + testUseEoaSessionSigsToExecuteJsJsonResponse, + testUseEoaSessionSigsToExecuteJsConsoleLog, + testUseEoaSessionSigsToEncryptDecryptString, + testUseEoaSessionSigsToEncryptDecryptUint8Array, + testUseEoaSessionSigsToEncryptDecryptFile, +}; + +const pkpSessionSigsTests = { + testUsePkpSessionSigsToExecuteJsSigning, + testUsePkpSessionSigsToPkpSign, + testUsePkpSessionSigsToExecuteJsSigningInParallel, + testUsePkpSessionSigsToExecuteJsClaimKeys, + testUsePkpSessionSigsToExecuteJsClaimMultipleKeys, + testUsePkpSessionSigsToExecuteJsJsonResponse, + testUsePkpSessionSigsToExecuteJsConsoleLog, + testUsePkpSessionSigsToEncryptDecryptString, + testUsePkpSessionSigsToEncryptDecryptFile, +}; + +const litActionSessionSigsTests = { + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning, + testUseValidLitActionCodeGeneratedSessionSigsToPkpSign, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog, + testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString, + testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile, + + // -- invalid cases + testUseInvalidLitActionIpfsCodeToGenerateSessionSigs, + + // -- custom auth methods + testUseCustomAuthSessionSigsToPkpSignExecuteJs, +}; + +const litActionIpfsIdSessionSigsTests = { + testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign, + testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning, + + // -- invalid cases + testUseInvalidLitActionCodeToGenerateSessionSigs, +}; + +const capacityDelegationTests = { + testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs, + testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign, + testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign, + testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign, +}; + +const bareAuthSigTests = { + // -- eth auth sig + testEthAuthSigToEncryptDecryptString, + + // -- solana auth sig + testSolAuthSigToEncryptDecryptString, + + // -- cosmos auth sig + testCosmosAuthSigToEncryptDecryptString, +}; + +const pkpEthersTest = { + eoaSessionSigs: { + testPkpEthersWithEoaSessionSigsToSignWithAuthContext, + testPkpEthersWithEoaSessionSigsToSignMessage, + testPkpEthersWithEoaSessionSigsToEthSign, + testPkpEthersWithEoaSessionSigsToPersonalSign, + testPkpEthersWithEoaSessionSigsToSendTx, + testPkpEthersWithEoaSessionSigsToEthSignTransaction, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4, + testPkpEthersWithEoaSessionSigsToEthSignTypedData, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil, + }, + pkpSessionSigs: { + testPkpEthersWithPkpSessionSigsToSignMessage, + testPkpEthersWithPkpSessionSigsToEthSign, + testPkpEthersWithPkpSessionSigsToPersonalSign, + testPkpEthersWithPkpSessionSigsToSendTx, + testPkpEthersWithPkpSessionSigsToEthSignTransaction, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4, + testPkpEthersWithPkpSessionSigsToEthSignTypedData, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil, + }, + litActionSessionSigs: { + testPkpEthersWithLitActionSessionSigsToSignMessage, + testPkpEthersWithLitActionSessionSigsToEthSign, + testPkpEthersWithLitActionSessionSigsToPersonalSign, + testPkpEthersWithLitActionSessionSigsToSendTx, + testPkpEthersWithLitActionSessionSigsToEthSignTransaction, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4, + testPkpEthersWithLitActionSessionSigsToEthSignTypedData, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil, + }, +}; + +const litActionCombiningTests = { + ecdsaSignAndCombine: { + testExecuteJsSignAndCombineEcdsa, + }, + decryptAndCombine: { + testExecutJsDecryptAndCombine, + }, + broadcastAndCombine: { + testExecuteJsBroadcastAndCollect, + }, +}; + +export const tinnyTests = { + // testExample, + // testBundleSpeed, + ...eoaSessionSigsTests, + ...pkpSessionSigsTests, + ...litActionSessionSigsTests, + ...litActionIpfsIdSessionSigsTests, + ...capacityDelegationTests, + ...bareAuthSigTests, + + ...pkpEthersTest.eoaSessionSigs, + ...pkpEthersTest.pkpSessionSigs, + ...pkpEthersTest.litActionSessionSigs, + + ...litActionCombiningTests.broadcastAndCombine, + ...litActionCombiningTests.decryptAndCombine, + ...litActionCombiningTests.ecdsaSignAndCombine, + + ...relayerTests, + ...wrappedKeysTests, +}; diff --git a/package.json b/package.json index 0449ee2489..836a93e1b6 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,8 @@ "publish:packages": "yarn node ./tools/scripts/pub.mjs --prod", "publish:beta": "yarn node ./tools/scripts/pub.mjs --tag beta", "publish:staging": "yarn node ./tools/scripts/pub.mjs --tag staging", + "build:tinny": "node ./local-tests/build.mjs", + "publish:tinny": "cd ./local-tests && npm publish", "gen:docs": "node ./tools/scripts/gen-doc.mjs", "gen:readme": "yarn node ./tools/scripts/gen-readme.mjs", "update:contracts-sdk": "yarn node ./packages/contracts-sdk/tools.mjs",